mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-27 08:19:47 -05:00
Indicate read-only state in window title.
This commit is contained in:
parent
5201001f3a
commit
8aefb1ed82
@ -387,6 +387,15 @@ void DatabaseTabWidget::toggleSearch()
|
||||
currentDatabaseWidget()->toggleSearch();
|
||||
}
|
||||
|
||||
bool DatabaseTabWidget::readOnly(int index)
|
||||
{
|
||||
if (index == -1) {
|
||||
index = currentIndex();
|
||||
}
|
||||
|
||||
return indexDatabaseManagerStruct(index).readOnly;
|
||||
}
|
||||
|
||||
void DatabaseTabWidget::updateTabName(Database* db)
|
||||
{
|
||||
int index = databaseIndex(db);
|
||||
@ -451,6 +460,21 @@ Database* DatabaseTabWidget::indexDatabase(int index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
DatabaseManagerStruct DatabaseTabWidget::indexDatabaseManagerStruct(int index)
|
||||
{
|
||||
QWidget* dbWidget = widget(index);
|
||||
|
||||
QHashIterator<Database*, DatabaseManagerStruct> i(m_dbList);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
if (i.value().dbWidget == dbWidget) {
|
||||
return i.value();
|
||||
}
|
||||
}
|
||||
|
||||
return DatabaseManagerStruct();
|
||||
}
|
||||
|
||||
Database* DatabaseTabWidget::databaseFromDatabaseWidget(DatabaseWidget* dbWidget)
|
||||
{
|
||||
QHashIterator<Database*, DatabaseManagerStruct> i(m_dbList);
|
||||
|
@ -74,6 +74,7 @@ public Q_SLOTS:
|
||||
void editGroup();
|
||||
void deleteGroup();
|
||||
void toggleSearch();
|
||||
bool readOnly(int index = -1);
|
||||
|
||||
Q_SIGNALS:
|
||||
void entrySelectionChanged(bool singleEntrySelected);
|
||||
@ -96,6 +97,8 @@ private:
|
||||
bool closeDatabase(Database* db);
|
||||
int databaseIndex(Database* db);
|
||||
Database* indexDatabase(int index);
|
||||
DatabaseManagerStruct indexDatabaseManagerStruct(int index);
|
||||
|
||||
Database* databaseFromDatabaseWidget(DatabaseWidget* dbWidget);
|
||||
void insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct);
|
||||
void updateLastDatabases(const QString& filename);
|
||||
|
@ -225,7 +225,11 @@ void MainWindow::updateWindowTitle()
|
||||
setWindowTitle(BaseWindowTitle);
|
||||
}
|
||||
else {
|
||||
setWindowTitle(m_ui->tabWidget->tabText(index).append(" - ").append(BaseWindowTitle));
|
||||
QString windowTitle = m_ui->tabWidget->tabText(index);
|
||||
if (m_ui->tabWidget->readOnly(index)) {
|
||||
windowTitle.append(" [").append(tr("read-only")).append("]");
|
||||
}
|
||||
setWindowTitle(windowTitle.append(" - ").append(BaseWindowTitle));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user