summaryrefslogtreecommitdiffstats
path: root/core/settings/qPrefCloudStorage.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-07 09:06:00 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-07 14:37:18 -0700
commit2ecbea3d24529b9776acb620c82af04a076b817f (patch)
tree0b0fc4eec864ff79db095d775341085cb1315895 /core/settings/qPrefCloudStorage.cpp
parentdb57a633d587444a7196c8d4274b8f327e77ceba (diff)
downloadsubsurface-2ecbea3d24529b9776acb620c82af04a076b817f.tar.gz
qPref: use helper function to ensure key/name grouping
We had a couple of instances of names being incorrectly merged with their group, this should handle that better. It's a bit of a big hammer to use, but it seems to work (and it makes it easy to then git grep for cases that don't use the new helper function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/settings/qPrefCloudStorage.cpp')
-rw-r--r--core/settings/qPrefCloudStorage.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp
index 37ab1a7cb..dfb9c435b 100644
--- a/core/settings/qPrefCloudStorage.cpp
+++ b/core/settings/qPrefCloudStorage.cpp
@@ -46,16 +46,16 @@ void qPrefCloudStorage::set_cloud_base_url(const QString &value)
void qPrefCloudStorage::disk_cloud_base_url(bool doSync)
{
if (doSync) {
- qPrefPrivate::propSetValue(group + "/cloud_base_url", prefs.cloud_base_url, default_prefs.cloud_base_url);
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "cloud_base_url"), prefs.cloud_base_url, default_prefs.cloud_base_url);
} else {
- prefs.cloud_base_url = copy_qstring(qPrefPrivate::propValue(group + "/cloud_base_url", default_prefs.cloud_base_url).toString());
+ prefs.cloud_base_url = copy_qstring(qPrefPrivate::propValue(keyFromGroupAndName(group, "cloud_base_url"), default_prefs.cloud_base_url).toString());
qPrefPrivate::copy_txt(&prefs.cloud_git_url, QString(prefs.cloud_base_url) + "/git");
}
}
-HANDLE_PREFERENCE_TXT(CloudStorage, "/email", cloud_storage_email);
+HANDLE_PREFERENCE_TXT(CloudStorage, "email", cloud_storage_email);
-HANDLE_PREFERENCE_TXT(CloudStorage, "/email_encoded", cloud_storage_email_encoded);
+HANDLE_PREFERENCE_TXT(CloudStorage, "email_encoded", cloud_storage_email_encoded);
void qPrefCloudStorage::set_cloud_storage_newpassword(const QString &value)
{
@@ -80,37 +80,37 @@ void qPrefCloudStorage::disk_cloud_storage_password(bool doSync)
{
if (doSync) {
if (prefs.save_password_local)
- qPrefPrivate::propSetValue(group + "/password", prefs.cloud_storage_password, default_prefs.cloud_storage_password);
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "password"), prefs.cloud_storage_password, default_prefs.cloud_storage_password);
} else {
- prefs.cloud_storage_password = copy_qstring(qPrefPrivate::propValue(group + "/password", default_prefs.cloud_storage_password).toString());
+ prefs.cloud_storage_password = copy_qstring(qPrefPrivate::propValue(keyFromGroupAndName(group, "password"), default_prefs.cloud_storage_password).toString());
}
}
-HANDLE_PREFERENCE_TXT(CloudStorage, "/pin", cloud_storage_pin);
+HANDLE_PREFERENCE_TXT(CloudStorage, "pin", cloud_storage_pin);
-HANDLE_PREFERENCE_INT(CloudStorage, "/timeout", cloud_timeout);
+HANDLE_PREFERENCE_INT(CloudStorage, "timeout", cloud_timeout);
-HANDLE_PREFERENCE_INT(CloudStorage, "/cloud_verification_status", cloud_verification_status);
+HANDLE_PREFERENCE_INT(CloudStorage, "cloud_verification_status", cloud_verification_status);
-HANDLE_PREFERENCE_BOOL(CloudStorage, "/git_local_only", git_local_only);
+HANDLE_PREFERENCE_BOOL(CloudStorage, "git_local_only", git_local_only);
-HANDLE_PREFERENCE_BOOL(CloudStorage, "/save_password_local", save_password_local);
+HANDLE_PREFERENCE_BOOL(CloudStorage, "save_password_local", save_password_local);
-HANDLE_PREFERENCE_BOOL(CloudStorage, "/save_userid_local", save_userid_local);
+HANDLE_PREFERENCE_BOOL(CloudStorage, "save_userid_local", save_userid_local);
SET_PREFERENCE_TXT(CloudStorage, userid);
void qPrefCloudStorage::disk_userid(bool doSync)
{
if (doSync) {
// always save in new position (part of cloud storage group)
- qPrefPrivate::propSetValue(group + "/subsurface_webservice_uid", prefs.userid, default_prefs.userid);
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "subsurface_webservice_uid"), prefs.userid, default_prefs.userid);
} 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::propValue(group + "/subsurface_webservice_uid", "NoUserIdHere").toString());
+ prefs.userid = copy_qstring(qPrefPrivate::propValue(keyFromGroupAndName(group, "subsurface_webservice_uid"), "NoUserIdHere").toString());
if (QString(prefs.userid) == "NoUserIdHere") {
const QString group = QStringLiteral("");
- prefs.userid = copy_qstring(qPrefPrivate::propValue(group + "/subsurface_webservice_uid", default_prefs.userid).toString());
+ prefs.userid = copy_qstring(qPrefPrivate::propValue(keyFromGroupAndName(group,"subsurface_webservice_uid"), default_prefs.userid).toString());
}
}
}