summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qmlmanager.cpp13
-rw-r--r--mobile-widgets/qmlmanager.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index be4dc4ec3..6e5357cdc 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -733,6 +733,7 @@ void QMLManager::loadDivesWithValidCredentials()
appendTextToLog(QStringLiteral("%1 dives loaded after importing nocloud local storage").arg(dive_table.nr));
noCloudToCloud = false;
mark_divelist_changed(true);
+ emit syncStateChanged();
saveChangesLocal();
if (git_local_only == false) {
appendTextToLog(QStringLiteral("taking things back offline now that storage is synced"));
@@ -1292,6 +1293,7 @@ void QMLManager::changesNeedSaving()
// on iOS
// on all other platforms we just save the changes and be done with it
mark_divelist_changed(true);
+ emit syncStateChanged();
#if defined(Q_OS_IOS)
saveChangesLocal();
#else
@@ -2251,4 +2253,15 @@ QStringList QMLManager::cloudCacheList() const
void QMLManager::updateHaveLocalChanges(bool status)
{
localChanges = status;
+ emit syncStateChanged();
+}
+
+// show the state of the dive list
+QString QMLManager::getSyncState() const
+{
+ if (unsavedChanges())
+ return tr("(unsaved changes in memory)");
+ if (localChanges)
+ return tr("(changes synced locally)");
+ return tr("(synced with cloud)");
}
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index a40a9da3c..250493e79 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -60,6 +60,7 @@ class QMLManager : public QObject {
Q_PROPERTY(QString redoText READ getRedoText NOTIFY redoTextChanged) // this is a read-only property
Q_PROPERTY(bool diveListProcessing MEMBER m_diveListProcessing WRITE setDiveListProcessing NOTIFY diveListProcessingChanged)
Q_PROPERTY(bool initialized MEMBER m_initialized NOTIFY initializedChanged)
+ Q_PROPERTY(QString syncState READ getSyncState NOTIFY syncStateChanged)
public:
QMLManager();
@@ -175,6 +176,8 @@ public:
void setOldStatus(const qPrefCloudStorage::cloud_status value);
void rememberOldStatus();
+ QString getSyncState() const;
+
public slots:
void appInitialized();
void applicationStateChanged(Qt::ApplicationState state);
@@ -317,6 +320,7 @@ signals:
void undoTextChanged();
void redoTextChanged();
void restartDownloadSignal();
+ void syncStateChanged();
// From upload process
void uploadFinish(bool success, const QString &text);