Fix crash when canceling save of new database (#2601)

* Fix crash when canceling save of new database
* Standardize use of DatabaseWidget::save() function
* Close new database tabs that are "discarded"
* Fixes #2604. autoSaveOnExit setting
* Re-implement autosave functionality
This commit is contained in:
Jonathan White 2019-01-25 07:20:39 -05:00 committed by GitHub
parent d66299260c
commit c74664097b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 18 deletions

View file

@ -79,9 +79,9 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
connect(this, SIGNAL(rejected()), SLOT(reject()));
// clang-format off
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)), SLOT(enableAutoSaveOnExit(bool)));
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)), this, SLOT(enableSystray(bool)));
connect(m_generalUi->toolbarHideCheckBox, SIGNAL(toggled(bool)), this, SLOT(enableToolbarSettings(bool)));
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)), SLOT(autoSaveToggled(bool)));
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)), SLOT(systrayToggled(bool)));
connect(m_generalUi->toolbarHideCheckBox, SIGNAL(toggled(bool)), SLOT(enableToolbarSettings(bool)));
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
@ -308,12 +308,16 @@ void ApplicationSettingsWidget::reject()
}
}
void ApplicationSettingsWidget::enableAutoSaveOnExit(bool checked)
void ApplicationSettingsWidget::autoSaveToggled(bool checked)
{
// Explicitly enable auto-save on exit if it wasn't already
if (checked && !m_generalUi->autoSaveOnExitCheckBox->isChecked()) {
m_generalUi->autoSaveOnExitCheckBox->setChecked(true);
}
m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked);
}
void ApplicationSettingsWidget::enableSystray(bool checked)
void ApplicationSettingsWidget::systrayToggled(bool checked)
{
m_generalUi->systrayDarkIconCheckBox->setEnabled(checked);
m_generalUi->systrayMinimizeToTrayCheckBox->setEnabled(checked);