summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.h
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-29 12:29:05 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-29 12:20:19 -0800
commit3d6d71aa9f6318497ba5f26ea628b3596b4c3552 (patch)
tree3757a45c758da51aaa471499ca65657960e8585a /mobile-widgets/qmlmanager.h
parent25e17443f9b8986dd2106975d7d2d307e506e447 (diff)
downloadsubsurface-3d6d71aa9f6318497ba5f26ea628b3596b4c3552.tar.gz
mobile-widgets: add oldStatus variable to qmlmanager
oldStatus() is kept in qmlPrefs during the login process to allow for a couple of special cases: - if a user have added dives in NO_CLOUD mode and changes to use the cloud these dives are copied to the Cloud, instead of being lost. - if a user does a bailout from the login process (this should not happen anymore) the old status is restored. The pure solution would be to have oldStatus at the top level (e.g. a property in qml) and only change it when actually being in the login process, however due to way the qmlmanager is written it proved very difficult and not worth the effort. In order to be able to remove qmlPrefs, oldStatus are moved to qmlManager. This commit only contain the creation of the variable and the supporting code. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.h')
-rw-r--r--mobile-widgets/qmlmanager.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 281d20778..a3fce0576 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -16,6 +16,7 @@
#include "qt-models/divelistmodel.h"
#include "qt-models/completionmodels.h"
#include "qt-models/divelocationmodel.h"
+#include "core/settings/qPrefCloudStorage.h"
#define NOCLOUD_LOCALSTORAGE format_string("%s/cloudstorage/localrepo[master]", system_default_directory())
@@ -49,6 +50,8 @@ class QMLManager : public QObject {
Q_PROPERTY(int DC_deviceId READ DC_deviceId WRITE DC_setDeviceId)
Q_PROPERTY(QString pluggedInDeviceName MEMBER m_pluggedInDeviceName NOTIFY pluggedInDeviceNameChanged)
Q_PROPERTY(bool showNonDiveComputers MEMBER m_showNonDiveComputers WRITE setShowNonDiveComputers NOTIFY showNonDiveComputersChanged)
+ Q_PROPERTY(qPrefCloudStorage::cloud_status oldStatus MEMBER m_oldStatus WRITE setOldStatus NOTIFY oldStatusChanged)
+
public:
QMLManager();
~QMLManager();
@@ -163,6 +166,8 @@ public:
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
void writeToAppLogFile(QString logText);
#endif
+ qPrefCloudStorage::cloud_status oldStatus() const;
+ void setOldStatus(const qPrefCloudStorage::cloud_status value);
public slots:
void appInitialized();
@@ -273,6 +278,7 @@ private:
QFile appLogFile;
bool appLogFileOpen;
#endif
+ qPrefCloudStorage::cloud_status m_oldStatus;
signals:
void locationServiceEnabledChanged();
@@ -295,11 +301,13 @@ signals:
void pluggedInDeviceNameChanged();
void showNonDiveComputersChanged();
void DC_ForceDownloadChanged();
+ void oldStatusChanged();
// From upload process
void uploadFinish(bool success, const QString &text);
void uploadProgress(qreal percentage);
+
private slots:
void uploadFinishSlot(bool success, const QString &text, const QByteArray &html);
};