diff options
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 26 | ||||
-rw-r--r-- | mobile-widgets/qmlprefs.cpp | 17 |
2 files changed, 12 insertions, 31 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(); } diff --git a/mobile-widgets/qmlprefs.cpp b/mobile-widgets/qmlprefs.cpp index defd28025..145ddf91f 100644 --- a/mobile-widgets/qmlprefs.cpp +++ b/mobile-widgets/qmlprefs.cpp @@ -143,16 +143,12 @@ void QMLPrefs::setTimeThreshold(int time) const QString QMLPrefs::theme() const { - QSettings s; - s.beginGroup("Theme"); - return s.value("currentTheme", "Blue").toString(); + return qPrefDisplay::theme(); } void QMLPrefs::setTheme(QString theme) { - QSettings s; - s.beginGroup("Theme"); - s.setValue("currentTheme", theme); + qPrefDisplay::set_theme(theme); emit themeChanged(); } @@ -175,14 +171,11 @@ void QMLPrefs::cancelCredentialsPinSetup() * Notice that this function is also used to switch to a different * cloud account, so the name is not perfect. */ - QSettings s; setCredentialStatus(qPref::CS_UNKNOWN); - s.beginGroup("CloudStorage"); - s.setValue("email", m_cloudUserName); - s.setValue("password", m_cloudPassword); - s.setValue("cloud_verification_status", m_credentialStatus); - s.sync(); + qPrefCloudStorage::set_cloud_storage_email(m_cloudUserName); + qPrefCloudStorage::set_cloud_storage_password(m_cloudPassword); + qPrefCloudStorage::set_cloud_verification_status(m_credentialStatus); QMLManager::instance()->setStartPageText(tr("Starting...")); setShowPin(false); |