aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/CloudCredentials.qml4
-rw-r--r--mobile-widgets/qml/Settings.qml3
-rw-r--r--mobile-widgets/qmlmanager.cpp17
-rw-r--r--mobile-widgets/qmlprefs.cpp6
-rw-r--r--mobile-widgets/qmlprefs.h6
5 files changed, 11 insertions, 25 deletions
diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml
index 12f8a53d1..6bed7b1f7 100644
--- a/mobile-widgets/qml/CloudCredentials.qml
+++ b/mobile-widgets/qml/CloudCredentials.qml
@@ -110,7 +110,6 @@ Item {
text: qsTr("Cancel")
onClicked: {
PrefCloudStorage.cloud_verification_status = CloudStatus.CS_UNKNOWN
- prefs.cloudCredentials = CloudStatus.CS_UNKNOWN
manager.startPageText = qsTr("Check credentials...");
prefs.showPin = false;
}
@@ -140,7 +139,8 @@ Item {
onClicked: {
manager.setGitLocalOnly(true)
PrefCloudStorage.cloud_auto_sync = false
- prefs.credentialStatus = CloudStatus.CS_NOCLOUD
+ prefs.oldStatus = PrefCloudStorage.cloud_verification_status
+ PrefCloudStorage.cloud_verification_status = CloudStatus.CS_NOCLOUD
manager.saveCloudCredentials("", "", "")
manager.openNoCloudRepo()
}
diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml
index ae5f95751..03ffa13a9 100644
--- a/mobile-widgets/qml/Settings.qml
+++ b/mobile-widgets/qml/Settings.qml
@@ -55,7 +55,6 @@ Kirigami.ScrollablePage {
text: qsTr("Change")
onClicked: {
PrefCloudStorage.cloud_verification_status = CloudStatus.CS_UNKNOWN
- prefs.credentialStatus = CloudStatus.CS_UNKNOWN
manager.startPageText = qsTr("Starting...");
prefs.showPin = false;
}
@@ -68,7 +67,7 @@ Kirigami.ScrollablePage {
color: subsurfaceTheme.textColor
}
Controls.Label {
- text: describe[prefs.credentialStatus]
+ text: describe[PrefCloudStorage.cloud_verification_status]
font.pointSize: subsurfaceTheme.regularPointSize
Layout.preferredWidth: gridWidth * 0.60
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index fe884ceca..0eda38547 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -312,7 +312,7 @@ void QMLManager::openLocalThenRemote(QString url)
* care about this, as the very first commit of dive data to the
* no cloud repo solves this.
*/
- auto credStatus = QMLPrefs::instance()->credentialStatus();
+ 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);
@@ -321,7 +321,7 @@ void QMLManager::openLocalThenRemote(QString url)
// 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 (QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_UNKNOWN)
+ if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_UNKNOWN)
QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_VERIFIED);
if (git_prefs.unit_system == IMPERIAL)
qPrefUnits::set_unit_system("imperial");
@@ -339,11 +339,11 @@ void QMLManager::openLocalThenRemote(QString url)
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr));
setNotificationText(tr("%1 dives loaded from local dive data file").arg(dive_table.nr));
}
- if (QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NEED_TO_VERIFY) {
+ if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_NEED_TO_VERIFY) {
appendTextToLog(QStringLiteral("have cloud credentials, but still needs PIN"));
QMLPrefs::instance()->setShowPin(true);
}
- if (QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_INCORRECT_USER_PASSWD) {
+ if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_INCORRECT_USER_PASSWD) {
appendTextToLog(QStringLiteral("incorrect password for cloud credentials"));
setNotificationText(tr("Incorrect cloud credentials"));
}
@@ -455,7 +455,7 @@ void QMLManager::finishSetup()
alreadySaving = true;
openLocalThenRemote(url);
} else if (!empty_string(existing_filename) &&
- QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_UNKNOWN) {
+ qPrefCloudStorage::cloud_verification_status() != qPrefCloudStorage::CS_UNKNOWN) {
QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NOCLOUD);
saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password(), qPrefCloudStorage::cloud_storage_pin());
appendTextToLog(tr("working in no-cloud mode"));
@@ -496,7 +496,7 @@ QMLManager *QMLManager::instance()
void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &newPassword, const QString &pin)
{
bool cloudCredentialsChanged = false;
- bool noCloud = QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD;
+ bool noCloud = qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_NOCLOUD;
// make sure we only have letters, numbers, and +-_. in password and email address
QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$");
@@ -523,7 +523,7 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
cloudCredentialsChanged = true;
}
- if (QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_NOCLOUD &&
+ if (qPrefCloudStorage::cloud_verification_status() != qPrefCloudStorage::CS_NOCLOUD &&
!cloudCredentialsChanged) {
// just go back to the dive list
QMLPrefs::instance()->setCredentialStatus(QMLPrefs::instance()->oldStatus());
@@ -535,7 +535,6 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
qPrefCloudStorage::set_cloud_storage_email(newEmail);
qPrefCloudStorage::set_cloud_storage_password(newPassword);
- qPrefCloudStorage::set_cloud_verification_status(QMLPrefs::instance()->credentialStatus());
if (noCloud && cloudCredentialsChanged && dive_table.nr) {
// we came from NOCLOUD and are connecting to a cloud account;
@@ -1306,7 +1305,7 @@ void QMLManager::openNoCloudRepo()
void QMLManager::saveChangesLocal()
{
if (unsaved_changes()) {
- if (QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD) {
+ if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_NOCLOUD) {
if (empty_string(existing_filename)) {
char *filename = NOCLOUD_LOCALSTORAGE;
git_create_local_repo(filename);
diff --git a/mobile-widgets/qmlprefs.cpp b/mobile-widgets/qmlprefs.cpp
index c48327faa..59bd9767b 100644
--- a/mobile-widgets/qmlprefs.cpp
+++ b/mobile-widgets/qmlprefs.cpp
@@ -33,11 +33,6 @@ QMLPrefs *QMLPrefs::instance()
/*** public functions ***/
-qPrefCloudStorage::cloud_status QMLPrefs::credentialStatus() const
-{
- return (qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status();
-}
-
void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
{
if ((qPrefCloudStorage::cloud_status)qPrefCloudStorage::cloud_verification_status() != value) {
@@ -53,7 +48,6 @@ void QMLPrefs::setCredentialStatus(const qPrefCloudStorage::cloud_status value)
prefs.units = SI_units;
}
qPrefCloudStorage::set_cloud_verification_status(value);
- emit credentialStatusChanged();
}
}
diff --git a/mobile-widgets/qmlprefs.h b/mobile-widgets/qmlprefs.h
index 9f5673329..3ff394c67 100644
--- a/mobile-widgets/qmlprefs.h
+++ b/mobile-widgets/qmlprefs.h
@@ -9,10 +9,6 @@
class QMLPrefs : public QObject {
Q_OBJECT
- Q_PROPERTY(qPrefCloudStorage::cloud_status credentialStatus
- READ credentialStatus
- WRITE setCredentialStatus
- NOTIFY credentialStatusChanged)
Q_PROPERTY(bool showPin
MEMBER m_showPin
WRITE setShowPin
@@ -27,7 +23,6 @@ public:
static QMLPrefs *instance();
- qPrefCloudStorage::cloud_status credentialStatus() const;
void setCredentialStatus(const qPrefCloudStorage::cloud_status value);
qPrefCloudStorage::cloud_status oldStatus() const;
@@ -42,7 +37,6 @@ private:
bool m_showPin;
signals:
- void credentialStatusChanged();
void oldStatusChanged();
void showPinChanged();
};