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>
This commit is contained in:
jan Iversen 2019-12-29 12:33:30 +01:00 committed by Dirk Hohndel
parent 3d6d71aa9f
commit e268af0d9f
2 changed files with 6 additions and 7 deletions

View file

@ -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()

View file

@ -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);