Fixup saving non-data changes on database lock

* Fix #5107 
* Change setting for non-data changes to Auto save on database lock (or not) instead of marking modified.
* When enabled, database will be auto-saved if there are only non-data changes, but will not prompt the user if saving has failed.
* When disabled, database will not auto-save if there are only non-data changes (same behavior as 2.5 and below) and will not mark the database dirty.
This commit is contained in:
Jonathan White 2020-08-01 18:00:47 -04:00
parent fd7daf4c89
commit c538f0b907
10 changed files with 66 additions and 74 deletions

View file

@ -184,6 +184,7 @@ void ApplicationSettingsWidget::loadSettings()
config()->get(Config::OpenPreviousDatabasesOnStartup).toBool());
m_generalUi->autoSaveAfterEveryChangeCheckBox->setChecked(config()->get(Config::AutoSaveAfterEveryChange).toBool());
m_generalUi->autoSaveOnExitCheckBox->setChecked(config()->get(Config::AutoSaveOnExit).toBool());
m_generalUi->autoSaveNonDataChangesCheckBox->setChecked(config()->get(Config::AutoSaveNonDataChanges).toBool());
m_generalUi->backupBeforeSaveCheckBox->setChecked(config()->get(Config::BackupBeforeSave).toBool());
m_generalUi->useAtomicSavesCheckBox->setChecked(config()->get(Config::UseAtomicSaves).toBool());
m_generalUi->autoReloadOnChangeCheckBox->setChecked(config()->get(Config::AutoReloadOnChange).toBool());
@ -197,7 +198,6 @@ void ApplicationSettingsWidget::loadSettings()
config()->get(Config::UseGroupIconOnEntryCreation).toBool());
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryTitleMatch).toBool());
m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryURLMatch).toBool());
m_generalUi->trackNonDataChangesCheckBox->setChecked(config()->get(Config::TrackNonDataChanges).toBool());
m_generalUi->faviconTimeoutSpinBox->setValue(config()->get(Config::FaviconDownloadTimeout).toInt());
m_generalUi->languageComboBox->clear();
@ -312,6 +312,7 @@ void ApplicationSettingsWidget::saveSettings()
m_generalUi->openPreviousDatabasesOnStartupCheckBox->isChecked());
config()->set(Config::AutoSaveAfterEveryChange, m_generalUi->autoSaveAfterEveryChangeCheckBox->isChecked());
config()->set(Config::AutoSaveOnExit, m_generalUi->autoSaveOnExitCheckBox->isChecked());
config()->set(Config::AutoSaveNonDataChanges, m_generalUi->autoSaveNonDataChangesCheckBox->isChecked());
config()->set(Config::BackupBeforeSave, m_generalUi->backupBeforeSaveCheckBox->isChecked());
config()->set(Config::UseAtomicSaves, m_generalUi->useAtomicSavesCheckBox->isChecked());
config()->set(Config::AutoReloadOnChange, m_generalUi->autoReloadOnChangeCheckBox->isChecked());
@ -321,7 +322,6 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked());
config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked());
config()->set(Config::UseGroupIconOnEntryCreation, m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
config()->set(Config::TrackNonDataChanges, m_generalUi->trackNonDataChangesCheckBox->isChecked());
config()->set(Config::AutoTypeEntryTitleMatch, m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
config()->set(Config::AutoTypeEntryURLMatch, m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked());
config()->set(Config::FaviconDownloadTimeout, m_generalUi->faviconTimeoutSpinBox->value());
@ -451,11 +451,13 @@ void ApplicationSettingsWidget::reject()
void ApplicationSettingsWidget::autoSaveToggled(bool checked)
{
// Explicitly enable auto-save on exit if it wasn't already
if (checked && !m_generalUi->autoSaveOnExitCheckBox->isChecked()) {
// Explicitly enable other auto-save options
if (checked) {
m_generalUi->autoSaveOnExitCheckBox->setChecked(true);
m_generalUi->autoSaveNonDataChangesCheckBox->setChecked(true);
}
m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked);
m_generalUi->autoSaveNonDataChangesCheckBox->setEnabled(!checked);
}
void ApplicationSettingsWidget::hideWindowOnCopyCheckBoxToggled(bool checked)