diff options
author | jan Iversen <jani@apache.org> | 2018-07-24 21:33:11 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-25 08:35:04 -0700 |
commit | 19871a6ab2c7a3022e0f7981154d4d6cd59715a9 (patch) | |
tree | 9b0c67820d1aae70d5ec9b12d6d33064cf863a70 /core | |
parent | daf8921d6f5152b835ab44ed97f535d47f3526b1 (diff) | |
download | subsurface-19871a6ab2c7a3022e0f7981154d4d6cd59715a9.tar.gz |
core: qPrefCloudStorage save userid to new location
userid was saved outside all groups, even though it belongs to cloudStorage
Add code to save in new location and read from new/old location
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/settings/qPrefCloudStorage.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp index 0eccb616c..3455aaf2d 100644 --- a/core/settings/qPrefCloudStorage.cpp +++ b/core/settings/qPrefCloudStorage.cpp @@ -108,10 +108,16 @@ HANDLE_PREFERENCE_BOOL(CloudStorage, "/save_userid_local", save_userid_local); SET_PREFERENCE_TXT(CloudStorage, userid); void qPrefCloudStorage::disk_userid(bool doSync) { - //WARNING: UserId is stored outside of any group, but it belongs to Cloud Storage. - const QString group = QStringLiteral(""); - if (doSync) + if (doSync) { + // always save in new position (part of cloud storage group) qPrefPrivate::instance()->setting.setValue(group + "subsurface_webservice_uid", prefs.userid); - else - prefs.userid = copy_qstring(qPrefPrivate::instance()->setting.value(group + "subsurface_webservice_uid", default_prefs.userid).toString()); + } else { + //WARNING: UserId was stored outside of any group. + // try to read from new location, if it fails read from old location + prefs.userid = copy_qstring(qPrefPrivate::instance()->setting.value(group + "subsurface_webservice_uid", "NoUserIdHere").toString()); + if (QString(prefs.userid) == "NoUserIdHere") { + const QString group = QStringLiteral(""); + prefs.userid = copy_qstring(qPrefPrivate::instance()->setting.value(group + "subsurface_webservice_uid", default_prefs.userid).toString()); + } + } } |