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; return indexDatabaseManagerStruct(index).readOnly;
} }
bool DatabaseTabWidget::isModified(int index)
{
if (index == -1) {
index = currentIndex();
}
return indexDatabaseManagerStruct(index).modified;
}
void DatabaseTabWidget::updateTabName(Database* db) void DatabaseTabWidget::updateTabName(Database* db)
{ {
int index = databaseIndex(db); int index = databaseIndex(db);

View File

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

View File

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