diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-12 07:02:51 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-12 11:28:20 -0700 |
commit | 3a0ffb70a0549b5c717e256cf602aadf2ea782a8 (patch) | |
tree | ad85b999424d9b0a959dc4c683244f1c3209897a /qt-ui/preferences.cpp | |
parent | a9c2a3f009a282ef080190ff9edfbbeae874cf73 (diff) | |
download | subsurface-3a0ffb70a0549b5c717e256cf602aadf2ea782a8.tar.gz |
Cloud storage: don't clear out password by mistake
If the user didn't enable saving the password to the preferences, then the
password was cleared out as the preferences got synced.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r-- | qt-ui/preferences.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index e3872ee4d..c6e1e2bd5 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -396,10 +396,13 @@ void PreferencesDialog::syncSettings() } SAVE_OR_REMOVE("email", default_prefs.cloud_storage_email, email); SAVE_OR_REMOVE("save_password_local", default_prefs.save_password_local, ui.save_password_local->isChecked()); - if (ui.save_password_local->isChecked()) + if (ui.save_password_local->isChecked()) { SAVE_OR_REMOVE("password", default_prefs.cloud_storage_password, password); - else + } else { s.remove("password"); + free(prefs.cloud_storage_password); + prefs.cloud_storage_password = strdup(qPrintable(password)); + } SAVE_OR_REMOVE("show_cloud_pin", default_prefs.show_cloud_pin, prefs.show_cloud_pin); s.endGroup(); loadSettings(); @@ -514,9 +517,11 @@ void PreferencesDialog::loadSettings() s.endGroup(); s.beginGroup("CloudStorage"); - GET_TXT("password", cloud_storage_password); GET_TXT("email", cloud_storage_email); GET_BOOL("save_password_local", save_password_local); + if (prefs.save_password_local) { // GET_TEXT macro is not a single statement + GET_TXT("password", cloud_storage_password); + } GET_BOOL("show_cloud_pin", show_cloud_pin); s.endGroup(); } |