Get modified status directly from database object instead of using window title

This commit is contained in:
Weslly 2017-03-20 23:29:36 -03:00
parent a87fab8d18
commit 18b5b76a80
3 changed files with 16 additions and 5 deletions

View File

@ -526,6 +526,15 @@ bool DatabaseTabWidget::readOnly(int index)
return indexDatabaseManagerStruct(index).readOnly;
}
bool DatabaseTabWidget::isModified(int index)
{
if (index == -1) {
index = currentIndex();
}
return indexDatabaseManagerStruct(index).modified;
}
void DatabaseTabWidget::updateTabName(Database* db)
{
int index = databaseIndex(db);

View File

@ -77,6 +77,7 @@ public slots:
void changeMasterKey();
void changeDatabaseSettings();
bool readOnly(int index = -1);
bool isModified(int index = -1);
void performGlobalAutoType();
void lockDatabases();

View File

@ -519,12 +519,13 @@ void MainWindow::updateWindowTitle()
windowTitle = BaseWindowTitle;
} else {
windowTitle = QString("%1 - %2").arg(customWindowTitlePart, BaseWindowTitle);
if (customWindowTitlePart.right(1) == "*") {
}
if (m_ui->tabWidget->isModified(tabWidgetIndex)) {
setWindowModified(true);
} else {
setWindowModified(false);
}
}
setWindowTitle(windowTitle);
}