mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-15 09:17:28 -05:00
Display current tab name in window title.
This commit is contained in:
parent
e7d0dfbd26
commit
9726046e24
@ -351,6 +351,7 @@ void DatabaseTabWidget::updateTabName(Database* db)
|
|||||||
tabName.append("*");
|
tabName.append("*");
|
||||||
}
|
}
|
||||||
setTabText(index, tabName);
|
setTabText(index, tabName);
|
||||||
|
Q_EMIT tabNameChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DatabaseTabWidget::databaseIndex(Database* db)
|
int DatabaseTabWidget::databaseIndex(Database* db)
|
||||||
|
@ -71,6 +71,7 @@ public Q_SLOTS:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void entrySelectionChanged(bool singleEntrySelected);
|
void entrySelectionChanged(bool singleEntrySelected);
|
||||||
void currentWidgetIndexChanged(int index);
|
void currentWidgetIndexChanged(int index);
|
||||||
|
void tabNameChanged();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateTabName(Database* db);
|
void updateTabName(Database* db);
|
||||||
|
@ -35,6 +35,8 @@ MainWindow::MainWindow()
|
|||||||
|
|
||||||
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), SLOT(setMenuActionState()));
|
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)), SLOT(setMenuActionState()));
|
||||||
connect(m_ui->tabWidget, SIGNAL(currentWidgetIndexChanged(int)), SLOT(setMenuActionState(int)));
|
connect(m_ui->tabWidget, SIGNAL(currentWidgetIndexChanged(int)), SLOT(setMenuActionState(int)));
|
||||||
|
connect(m_ui->tabWidget, SIGNAL(tabNameChanged()), SLOT(updateWindowTitle()));
|
||||||
|
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(updateWindowTitle()));
|
||||||
|
|
||||||
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget, SLOT(newDatabase()));
|
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_ui->tabWidget, SLOT(newDatabase()));
|
||||||
connect(m_ui->actionDatabaseOpen, SIGNAL(triggered()), m_ui->tabWidget, SLOT(openDatabase()));
|
connect(m_ui->actionDatabaseOpen, SIGNAL(triggered()), m_ui->tabWidget, SLOT(openDatabase()));
|
||||||
@ -56,6 +58,8 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString MainWindow::m_baseWindowTitle = "KeePassX";
|
||||||
|
|
||||||
void MainWindow::setMenuActionState(int index)
|
void MainWindow::setMenuActionState(int index)
|
||||||
{
|
{
|
||||||
if (m_ui->tabWidget->currentIndex() != -1) {
|
if (m_ui->tabWidget->currentIndex() != -1) {
|
||||||
@ -128,6 +132,17 @@ void MainWindow::setMenuActionState(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateWindowTitle()
|
||||||
|
{
|
||||||
|
int index = m_ui->tabWidget->currentIndex();
|
||||||
|
if (index == -1) {
|
||||||
|
setWindowTitle(m_baseWindowTitle);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setWindowTitle(m_ui->tabWidget->tabText(index).append(" - ").append(m_baseWindowTitle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
if (!m_ui->tabWidget->closeAllDatabases()) {
|
if (!m_ui->tabWidget->closeAllDatabases()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
@ -136,6 +151,3 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,10 +37,12 @@ protected:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setMenuActionState(int index = -1);
|
void setMenuActionState(int index = -1);
|
||||||
|
void updateWindowTitle();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::MainWindow> m_ui;
|
QScopedPointer<Ui::MainWindow> m_ui;
|
||||||
|
static const QString m_baseWindowTitle;
|
||||||
|
|
||||||
Q_DISABLE_COPY(MainWindow)
|
Q_DISABLE_COPY(MainWindow)
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user