mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
3d6d71aa9f
commit
e268af0d9f
2 changed files with 6 additions and 7 deletions
|
@ -138,7 +138,7 @@ Item {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.setGitLocalOnly(true)
|
manager.setGitLocalOnly(true)
|
||||||
PrefCloudStorage.cloud_auto_sync = false
|
PrefCloudStorage.cloud_auto_sync = false
|
||||||
prefs.oldStatus = PrefCloudStorage.cloud_verification_status
|
manager.oldStatus = PrefCloudStorage.cloud_verification_status
|
||||||
PrefCloudStorage.cloud_verification_status = CloudStatus.CS_NOCLOUD
|
PrefCloudStorage.cloud_verification_status = CloudStatus.CS_NOCLOUD
|
||||||
manager.saveCloudCredentials("", "", "")
|
manager.saveCloudCredentials("", "", "")
|
||||||
manager.openNoCloudRepo()
|
manager.openNoCloudRepo()
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
#include "qmlmanager.h"
|
#include "qmlmanager.h"
|
||||||
#include "qmlprefs.h"
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -347,7 +346,7 @@ void QMLManager::openLocalThenRemote(QString url)
|
||||||
appendTextToLog(QStringLiteral("incorrect password for cloud credentials"));
|
appendTextToLog(QStringLiteral("incorrect password for cloud credentials"));
|
||||||
setNotificationText(tr("Incorrect 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
|
// if we switch to credentials from CS_NOCLOUD, we take things online temporarily
|
||||||
git_local_only = false;
|
git_local_only = false;
|
||||||
appendTextToLog(QStringLiteral("taking things online to be able to switch to cloud account"));
|
appendTextToLog(QStringLiteral("taking things online to be able to switch to cloud account"));
|
||||||
|
@ -456,7 +455,7 @@ void QMLManager::finishSetup()
|
||||||
openLocalThenRemote(url);
|
openLocalThenRemote(url);
|
||||||
} else if (!empty_string(existing_filename) &&
|
} else if (!empty_string(existing_filename) &&
|
||||||
qPrefCloudStorage::cloud_verification_status() != qPrefCloudStorage::CS_UNKNOWN) {
|
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);
|
set_filename(NOCLOUD_LOCALSTORAGE);
|
||||||
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
||||||
saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password(), qPrefCloudStorage::cloud_storage_pin());
|
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 &&
|
if (qPrefCloudStorage::cloud_verification_status() != qPrefCloudStorage::CS_NOCLOUD &&
|
||||||
!cloudCredentialsChanged) {
|
!cloudCredentialsChanged) {
|
||||||
// just go back to the dive list
|
// just go back to the dive list
|
||||||
qPrefCloudStorage::set_cloud_verification_status(QMLPrefs::instance()->oldStatus());
|
qPrefCloudStorage::set_cloud_verification_status(m_oldStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noCloud &&
|
if (!noCloud &&
|
||||||
|
@ -799,7 +798,7 @@ void QMLManager::revertToNoCloudIfNeeded()
|
||||||
currentGitLocalOnly = false;
|
currentGitLocalOnly = false;
|
||||||
git_local_only = true;
|
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,
|
// 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
|
// but connecting to the cloud account (and subsequently merging the local
|
||||||
// and cloud data) failed - so let's delete the cloud credentials and go
|
// 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;
|
prefs.cloud_storage_password = NULL;
|
||||||
qPrefCloudStorage::set_cloud_storage_email("");
|
qPrefCloudStorage::set_cloud_storage_email("");
|
||||||
qPrefCloudStorage::set_cloud_storage_password("");
|
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);
|
qPrefCloudStorage::set_cloud_verification_status(qPrefCloudStorage::CS_NOCLOUD);
|
||||||
set_filename(NOCLOUD_LOCALSTORAGE);
|
set_filename(NOCLOUD_LOCALSTORAGE);
|
||||||
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
|
setStartPageText(RED_FONT + tr("Failed to connect to cloud server, reverting to no cloud status") + END_FONT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue