Save settings immediately to disk when applied

* See https://github.com/Martchus/syncthingtray/issues/59
* QCoreApplication::aboutToQuit() does not work reliably but terminating
  only at the end of the session is a common use-case for the tray
  application. So workaround the problem by saving the settings
  immediately.
* The plasmoid already does this anyways.
This commit is contained in:
Martchus 2019-10-06 17:55:41 +02:00
parent d50e78be29
commit 1a1b907f15
2 changed files with 7 additions and 1 deletions

View File

@ -10,7 +10,7 @@ set(META_APP_CATEGORIES "Network;FileTransfer")
set(META_GUI_OPTIONAL false)
set(META_VERSION_MAJOR 0)
set(META_VERSION_MINOR 10)
set(META_VERSION_PATCH 1)
set(META_VERSION_PATCH 2)
set(META_VERSION_EXACT_SONAME ON)
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)

View File

@ -212,6 +212,12 @@ void TrayWidget::showSettingsDialog()
if (!s_settingsDlg) {
s_settingsDlg = new SettingsDialog(&m_connection, m_dialogParent.get());
connect(s_settingsDlg, &SettingsDialog::applied, &TrayWidget::applySettingsOnAllInstances);
// save settings to disk when applied
// note: QCoreApplication::aboutToQuit() does not work reliably but terminating only at the
// end of the session is a common use-case for the tray application. So workaround this
// by simply saving the settings immediately.
connect(s_settingsDlg, &SettingsDialog::applied, &Settings::save);
}
centerWidget(s_settingsDlg);
showDialog(s_settingsDlg);