diff options
author | jan Iversen <jani@apache.org> | 2018-08-19 00:31:46 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-08-25 11:49:47 -0700 |
commit | da6e8a4cd5d80a4288129bf44b1efad69de1704f (patch) | |
tree | 5a69037fd50242d21a37203d79f2fb69ab9eb58d /mobile-widgets/qmlmanager.cpp | |
parent | b7a1bb670ce11b22e52361f4152b4853b97e13f5 (diff) | |
download | subsurface-da6e8a4cd5d80a4288129bf44b1efad69de1704f.tar.gz |
mobile-widgets: remove QSettings
update qmlprefs and qmlmanager to use qPref
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index eb29061f5..91beb3c84 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -2,7 +2,6 @@ #include "qmlmanager.h" #include "qmlprefs.h" #include <QUrl> -#include <QSettings> #include <QDebug> #include <QNetworkAccessManager> #include <QAuthenticator> @@ -433,7 +432,6 @@ void QMLManager::savePreferences() void QMLManager::saveCloudCredentials() { - QSettings s; bool cloudCredentialsChanged = false; // make sure we only have letters, numbers, and +-_. in password and email address QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$"); @@ -452,11 +450,9 @@ void QMLManager::saveCloudCredentials() return; } } - s.beginGroup("CloudStorage"); - s.setValue("email", QMLPrefs::instance()->cloudUserName()); - s.setValue("password", QMLPrefs::instance()->cloudPassword()); - s.setValue("cloud_verification_status", QMLPrefs::instance()->credentialStatus()); - s.sync(); + qPrefCloudStorage::set_cloud_storage_email(QMLPrefs::instance()->cloudUserName()); + qPrefCloudStorage::set_cloud_storage_password(QMLPrefs::instance()->cloudPassword()); + qPrefCloudStorage::set_cloud_verification_status(QMLPrefs::instance()->credentialStatus()); if (!same_string(prefs.cloud_storage_email, qPrintable(QMLPrefs::instance()->cloudUserName()))) { free((void *)prefs.cloud_storage_email); @@ -637,9 +633,7 @@ void QMLManager::retrieveUserid() // overwrite the existing userid free((void *)prefs.userid); prefs.userid = copy_qstring(userid); - QSettings s; - s.setValue("subsurface_webservice_uid", prefs.userid); - s.sync(); + qPrefCloudStorage::set_userid(prefs.userid); } QMLPrefs::instance()->setCredentialStatus(qPref::CS_VERIFIED); setStartPageText(tr("Cloud credentials valid, loading dives...")); @@ -1465,16 +1459,12 @@ void QMLManager::setVerboseEnabled(bool verboseMode) void QMLManager::syncLoadFromCloud() { - QSettings s; - QString cloudMarker = QLatin1Literal("loadFromCloud") + QString(prefs.cloud_storage_email); - m_loadFromCloud = s.contains(cloudMarker) && s.value(cloudMarker).toBool(); + m_loadFromCloud = qPrefCloudStorage::loadFromCloud(prefs.cloud_storage_email); } void QMLManager::setLoadFromCloud(bool done) { - QSettings s; - QString cloudMarker = QLatin1Literal("loadFromCloud") + QString(prefs.cloud_storage_email); - s.setValue(cloudMarker, done); + qPrefCloudStorage::set_loadFromCloud(prefs.cloud_storage_email, done); m_loadFromCloud = done; emit loadFromCloudChanged(); } @@ -1536,9 +1526,7 @@ void QMLManager::setSyncToCloud(bool status) { m_syncToCloud = status; prefs.git_local_only = !status; - QSettings s; - s.beginGroup("CloudStorage"); - s.setValue("git_local_only", prefs.git_local_only); + qPrefCloudStorage::set_git_local_only(prefs.git_local_only); emit syncToCloudChanged(); } |