From 1a1b907f15c1101a41ecbfa3014b35fd2bb2d800 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 6 Oct 2019 17:55:41 +0200 Subject: [PATCH] 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. --- CMakeLists.txt | 2 +- tray/gui/traywidget.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a82e458..d6e4b26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/tray/gui/traywidget.cpp b/tray/gui/traywidget.cpp index 8571e3d..125a3b7 100644 --- a/tray/gui/traywidget.cpp +++ b/tray/gui/traywidget.cpp @@ -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);