diff options
author | jan Iversen <jan@casacondor.com> | 2019-12-29 12:33:30 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-29 12:20:19 -0800 |
commit | e268af0d9f40553faf1f8fe6205e3b4106eed6e3 (patch) | |
tree | 7c3785c3e2630d655f33dd215ea2d2fcdac39d1a | |
parent | 3d6d71aa9f6318497ba5f26ea628b3596b4c3552 (diff) | |
download | subsurface-e268af0d9f40553faf1f8fe6205e3b4106eed6e3.tar.gz |
mobile-widgets: use oldStatus in qmlmanager
Switch oldStatus from qmlprefs to qmlmanager
This is the last use of QMLPrefs, which can later be safely removed.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/CloudCredentials.qml | 2 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml index 1b999f4a5..405531258 100644 --- a/mobile-widgets/qml/CloudCredentials.qml +++ b/mobile-widgets/qml/CloudCredentials.qml @@ -138,7 +138,7 @@ Item { onClicked: { manager.setGitLocalOnly(true) PrefCloudStorage.cloud_auto_sync = false - prefs.oldStatus = PrefCloudStorage.cloud_verification_status + manager.oldStatus = PrefCloudStorage.cloud_verification_status PrefCloudStorage.cloud_verification_status = CloudStatus.CS_NOCLOUD manager.saveCloudCredentials("", "", "") manager.openNoCloudRepo() diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 01d9c0196..54eb9490b 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 #include "qmlmanager.h" -#include "qmlprefs.h" #include <QUrl> #include <QSettings> #include <QDebug> @@ -347,7 +346,7 @@ void QMLManager::openLocalThenRemote(QString url) appendTextToLog(QStringLiteral("incorrect password for cloud credentials")); setNotificationText(tr("Incorrect cloud credentials")); } - if (QMLPrefs::instance()->oldStatus() == qPrefCloudStorage::CS_NOCLOUD) { + if (m_oldStatus == qPrefCloudStorage::CS_NOCLOUD) { // if we switch to credentials from CS_NOCLOUD, we take things online temporarily git_local_only = false; appendTextToLog(QStringLiteral("taking things online to be able to switch to cloud account")); @@ -456,7 +455,7 @@ void QMLManager::finishSetup() openLocalThenRemote(url); } else if (!empty_string(existing_filename) && qPrefCloudStorage::cloud_verification_status() != qPrefCloudStorage::CS_UNKNOWN) { - QMLPrefs::instance()->setOldStatus((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status()); + setOldStatus((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status()); set_filename(NOCLOUD_LOCALSTORAGE); qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD); saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password(), qPrefCloudStorage::cloud_storage_pin()); @@ -528,7 +527,7 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne if (qPrefCloudStorage::cloud_verification_status() != qPrefCloudStorage::CS_NOCLOUD && !cloudCredentialsChanged) { // just go back to the dive list - qPrefCloudStorage::set_cloud_verification_status(QMLPrefs::instance()->oldStatus()); + qPrefCloudStorage::set_cloud_verification_status(m_oldStatus); } if (!noCloud && @@ -799,7 +798,7 @@ void QMLManager::revertToNoCloudIfNeeded() currentGitLocalOnly = false; git_local_only = true; } - if (QMLPrefs::instance()->oldStatus() == qPrefCloudStorage::CS_NOCLOUD) { + if (m_oldStatus == qPrefCloudStorage::CS_NOCLOUD) { // we tried to switch to a cloud account and had previously used local data, // but connecting to the cloud account (and subsequently merging the local // and cloud data) failed - so let's delete the cloud credentials and go @@ -815,7 +814,7 @@ void QMLManager::revertToNoCloudIfNeeded() prefs.cloud_storage_password = NULL; qPrefCloudStorage::set_cloud_storage_email(""); qPrefCloudStorage::set_cloud_storage_password(""); - QMLPrefs::instance()->setOldStatus((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status()); + setOldStatus((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status()); qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD); set_filename(NOCLOUD_LOCALSTORAGE); setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT); |