From 3c1415e4ed54fbc6af2b25cc9ca6e128f3036df8 Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Tue, 15 Mar 2016 09:32:41 +0100 Subject: [PATCH] Fixed saving of settings --- src/core/UBSettings.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/UBSettings.cpp b/src/core/UBSettings.cpp index 9e249b0d..1fcd8ef7 100644 --- a/src/core/UBSettings.cpp +++ b/src/core/UBSettings.cpp @@ -478,9 +478,22 @@ void UBSettings::save() QHash::const_iterator it = mSettingsQueue.constBegin(); while (it != mSettingsQueue.constEnd()) { - // We only save user settings that are different from the app settings - if (sAppSettings->value(it.key()) != it.value()) + /* + * We save the setting to the user settings if + * a) it is different from the (non-null) value stored in the user settings, or + * b) it doesn't currently exist in the user settings AND has changed from the app settings + */ + if (mUserSettings->contains(it.key()) + && it.value() != mUserSettings->value(it.key())) + { + mUserSettings->setValue(it.key(), it.value()); + } + + else if (!mUserSettings->contains(it.key()) + && it.value() != mAppSettings->value(it.key())) + { mUserSettings->setValue(it.key(), it.value()); + } ++it; }