summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-mobile/qmlmanager.cpp16
-rw-r--r--qt-mobile/qmlmanager.h6
2 files changed, 22 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index ffd0a4e8c..d5a3c51ad 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -129,6 +129,7 @@ void QMLManager::loadDives()
DiveListModel::instance()->addDive(d);
}
appendTextToLog(QString("%1 dives loaded").arg(i));
+ setLoadFromCloud(true);
}
void QMLManager::commitChanges(QString diveId, QString suit, QString buddy, QString diveMaster, QString notes)
@@ -162,6 +163,10 @@ void QMLManager::commitChanges(QString diveId, QString suit, QString buddy, QStr
void QMLManager::saveChanges()
{
+ if (!loadFromCloud()) {
+ qmlUiShowMessage("Don't save dives without loading from the cloud, first.");
+ return;
+ }
qmlUiShowMessage("Saving dives.");
QString fileName;
if (getCloudURL(fileName)) {
@@ -287,3 +292,14 @@ void QMLManager::setTimeThreshold(int time)
m_timeThreshold = time;
emit timeThresholdChanged();
}
+
+bool QMLManager::loadFromCloud() const
+{
+ return m_loadFromCloud;
+}
+
+void QMLManager::setLoadFromCloud(bool done)
+{
+ m_loadFromCloud = done;
+ emit loadFromCloudChanged();
+}
diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h
index 07a7b9f60..c76fce975 100644
--- a/qt-mobile/qmlmanager.h
+++ b/qt-mobile/qmlmanager.h
@@ -18,6 +18,7 @@ class QMLManager : public QObject
Q_PROPERTY(bool locationServiceEnabled READ locationServiceEnabled WRITE setLocationServiceEnabled NOTIFY locationServiceEnabledChanged)
Q_PROPERTY(int distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
Q_PROPERTY(int timeThreshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged)
+ Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
public:
QMLManager();
~QMLManager();
@@ -40,6 +41,9 @@ public:
int timeThreshold() const;
void setTimeThreshold(int time);
+ bool loadFromCloud() const;
+ void setLoadFromCloud(bool done);
+
QString logText() const;
void setLogText(const QString &logText);
void appendTextToLog(const QString &newText);
@@ -64,6 +68,7 @@ private:
int m_distanceThreshold;
int m_timeThreshold;
GpsLocation *locationProvider;
+ bool m_loadFromCloud;
signals:
void cloudUserNameChanged();
@@ -73,6 +78,7 @@ signals:
void logTextChanged();
void timeThresholdChanged();
void distanceThresholdChanged();
+ void loadFromCloudChanged();
};
#endif