Enable Save button on non-data changes without marking database modified

This commit is contained in:
xboxones1 2026-02-12 11:54:27 +00:00
parent 330e78a3fc
commit b05c73a708
2 changed files with 12 additions and 3 deletions

View file

@ -1902,7 +1902,7 @@ void DatabaseWidget::onDatabaseNonDataChanged()
{
// Force mark the database modified if we are not auto-saving non-data changes
if (!config()->get(Config::AutoSaveNonDataChanges).toBool()) {
m_db->markAsModified();
emit databaseNonDataChanged();
}
}

View file

@ -1041,7 +1041,11 @@ void MainWindow::updateMenuActionState()
m_ui->actionGroupDownloadFavicons->setEnabled(groupSelected && groupHasEntries && !inRecycleBin);
// Database Menu
m_ui->actionDatabaseSave->setEnabled(databaseUnlocked && m_ui->tabWidget->canSave());
bool enableSave = databaseUnlocked
&& (m_ui->tabWidget->canSave()
|| (dbWidget && dbWidget->database() && dbWidget->database()->hasNonDataChanges()
&& !config()->get(Config::AutoSaveNonDataChanges).toBool()));
m_ui->actionDatabaseSave->setEnabled(enableSave);
m_ui->actionDatabaseSaveAs->setEnabled(databaseUnlocked);
m_ui->actionDatabaseSaveBackup->setEnabled(databaseUnlocked);
m_ui->actionDatabaseClose->setEnabled(dbWidget);
@ -1094,7 +1098,12 @@ void MainWindow::updateWindowTitle()
if (isModified && customWindowTitlePart.endsWith("*")) {
customWindowTitlePart.remove(customWindowTitlePart.size() - 1, 1);
}
m_ui->actionDatabaseSave->setEnabled(m_ui->tabWidget->canSave(tabWidgetIndex));
auto dbWidget = m_ui->tabWidget->databaseWidgetFromIndex(tabWidgetIndex);
bool enableSave = (dbWidget && !dbWidget->isLocked())
&& (m_ui->tabWidget->canSave(tabWidgetIndex)
|| (dbWidget->database() && dbWidget->database()->hasNonDataChanges()
&& !config()->get(Config::AutoSaveNonDataChanges).toBool()));
m_ui->actionDatabaseSave->setEnabled(enableSave);
} else if (stackedWidgetIndex == StackedWidgetIndex::SettingsScreen) {
customWindowTitlePart = tr("Settings");
} else if (stackedWidgetIndex == StackedWidgetIndex::PasswordGeneratorScreen) {