From df7818a9b8495285b4d9812e5d6d50d6f9c08813 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 2 Nov 2015 12:50:17 -0800 Subject: Preferences: make apply work We didn't respond at all to that button. Also, the language settings didn't propagate without this explicit call. Signed-off-by: Dirk Hohndel --- desktop-widgets/preferences/preferences_language.cpp | 2 ++ desktop-widgets/preferences/preferencesdialog.cpp | 12 +++++++----- desktop-widgets/preferences/preferencesdialog.h | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp index 1b5ee19a8..31bbd1c20 100644 --- a/desktop-widgets/preferences/preferences_language.cpp +++ b/desktop-widgets/preferences/preferences_language.cpp @@ -1,5 +1,6 @@ #include "preferences_language.h" #include "ui_prefs_language.h" +#include "subsurface-core/helpers.h" #include #include @@ -67,4 +68,5 @@ void PreferencesLanguage::syncSettings() s.setValue("date_format_short", ui->shortDateFormatEntry->text()); } s.endGroup(); + uiLanguage(NULL); } diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index a7934a96d..d8798879a 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -74,9 +74,10 @@ void PreferencesDialog::buttonClicked(QAbstractButton* btn) { QDialogButtonBox::ButtonRole role = buttonBox->buttonRole(btn); switch(role) { - case QDialogButtonBox::AcceptRole : applyRequested(); return; - case QDialogButtonBox::RejectRole : cancelRequested(); return; - case QDialogButtonBox::ResetRole : defaultsRequested(); return; + case QDialogButtonBox::ApplyRole : applyRequested(false); return; + case QDialogButtonBox::AcceptRole : applyRequested(true); return; + case QDialogButtonBox::RejectRole : cancelRequested(); return; + case QDialogButtonBox::ResetRole : defaultsRequested(); return; } } @@ -110,13 +111,14 @@ void PreferencesDialog::refreshPages() } } -void PreferencesDialog::applyRequested() +void PreferencesDialog::applyRequested(bool closeIt) { Q_FOREACH(AbstractPreferencesWidget *page, pages) { page->syncSettings(); } emit settingsChanged(); - accept(); + if (closeIt) + accept(); } void PreferencesDialog::cancelRequested() diff --git a/desktop-widgets/preferences/preferencesdialog.h b/desktop-widgets/preferences/preferencesdialog.h index 611bd5fac..5f7f5f979 100644 --- a/desktop-widgets/preferences/preferencesdialog.h +++ b/desktop-widgets/preferences/preferencesdialog.h @@ -23,7 +23,7 @@ signals: private: PreferencesDialog(); void cancelRequested(); - void applyRequested(); + void applyRequested(bool closeIt); void defaultsRequested(); void buttonClicked(QAbstractButton *btn); QList pages; @@ -32,4 +32,4 @@ private: QDialogButtonBox *buttonBox; }; -#endif \ No newline at end of file +#endif -- cgit v1.2.3-70-g09d2