summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-28 18:18:06 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-29 12:20:19 -0800
commitdc98b0a2acb039dc812ba2b3a18b0ea5d2188a15 (patch)
treee2e75e46998609dfb979d24df434bbf6877ac835
parent783332561a433e8ff8be8b0bceb25a051967d3cf (diff)
downloadsubsurface-dc98b0a2acb039dc812ba2b3a18b0ea5d2188a15.tar.gz
mobile-widgets: replace simple setCredentialStatus
qmlprefs::setCredentialStatus() basically only does something when called with CS_NOCLOUD. A number of setCredentialStatus() calls happen where status cannot be CS_NOCLOUD, and therefore setCredentialStatus() can be safely replaced with set_cloud_verification_status() This limits the use of qmlprefs::setCredentialStatus(), but there are still a couple of more complicated calls. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qmlmanager.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 0eda38547..1378a1ee1 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -315,14 +315,14 @@ void QMLManager::openLocalThenRemote(QString url)
auto credStatus = qPrefCloudStorage::cloud_verification_status();
if (credStatus != qPrefCloudStorage::CS_NOCLOUD &&
credStatus != qPrefCloudStorage::CS_INCORRECT_USER_PASSWD)
- QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NEED_TO_VERIFY);
+ qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NEED_TO_VERIFY);
} else {
// if we can load from the cache, we know that we have a valid cloud account
// and we know that there was at least one successful sync with the cloud when
// that local cache was created - so there is a common ancestor
setLoadFromCloud(true);
if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_UNKNOWN)
- QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_VERIFIED);
+ qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_VERIFIED);
if (git_prefs.unit_system == IMPERIAL)
qPrefUnits::set_unit_system("imperial");
else if (git_prefs.unit_system == METRIC)
@@ -470,7 +470,7 @@ void QMLManager::finishSetup()
appendTextToLog(QString("working in no-cloud mode, finished loading %1 dives from %2").arg(dive_table.nr).arg(existing_filename));
}
} else {
- QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_UNKNOWN);
+ qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_UNKNOWN);
appendTextToLog(tr("no cloud credentials"));
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
}
@@ -673,7 +673,7 @@ void QMLManager::provideAuth(QNetworkReply *reply, QAuthenticator *auth)
// OK, credentials have been tried and didn't work, so they are invalid
appendTextToLog("Cloud credentials are invalid");
setStartPageText(RED_FONT + tr("Cloud credentials are invalid") + END_FONT);
- QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_INCORRECT_USER_PASSWD);
+ qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_INCORRECT_USER_PASSWD);
reply->disconnect();
reply->abort();
reply->deleteLater();
@@ -717,7 +717,7 @@ void QMLManager::retrieveUserid()
revertToNoCloudIfNeeded();
return;
}
- QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_VERIFIED);
+ qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_VERIFIED);
setStartPageText(tr("Cloud credentials valid, loading dives..."));
// this only gets called with "alreadySaving" already locked
loadDivesWithValidCredentials();