aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qmlmanager.cpp19
-rw-r--r--qt-mobile/qmlmanager.h8
2 files changed, 26 insertions, 1 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index 76ffb13af..085f3d5f8 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -53,6 +53,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
qDebug() << "Starting" << getUserAgent();
qDebug() << QStringLiteral("build with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion());
setStartPageText(tr("Starting..."));
+ setAccessingCloud(false);
// create location manager service
locationProvider = new GpsLocation(&appendTextToLogStandalone, this);
set_git_update_cb(&gitProgressCB);
@@ -88,6 +89,7 @@ void QMLManager::openLocalThenRemote(QString url)
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(i));
}
appendTextToLog(QStringLiteral("have cloud credentials, trying to connect"));
+ setAccessingCloud(true);
tryRetrieveDataFromBackend();
}
@@ -250,6 +252,7 @@ void QMLManager::retrieveUserid()
{
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) != 302) {
appendTextToLog(QStringLiteral("Cloud storage connection not working correctly: ") + reply->readAll());
+ setAccessingCloud(false);
return;
}
setCredentialStatus(VALID);
@@ -288,6 +291,7 @@ void QMLManager::loadDivesWithValidCredentials()
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) != 302) {
appendTextToLog(QStringLiteral("Cloud storage connection not working correctly: ") + reply->readAll());
setStartPageText(tr("Cannot connect to cloud storage"));
+ setAccessingCloud(false);
return;
}
setCredentialStatus(VALID);
@@ -299,6 +303,7 @@ void QMLManager::loadDivesWithValidCredentials()
QString errorString(get_error_string());
appendTextToLog(errorString);
setStartPageText(tr("Cloud storage error: %1").arg(errorString));
+ setAccessingCloud(false);
return;
}
QByteArray fileNamePrt = QFile::encodeName(url);
@@ -306,6 +311,7 @@ void QMLManager::loadDivesWithValidCredentials()
qDebug() << "local cache was current, no need to modify dive list";
appendTextToLog("Cloud sync shows local cache was current");
setLoadFromCloud(true);
+ setAccessingCloud(false);
return;
}
clear_dive_file_data();
@@ -322,6 +328,7 @@ void QMLManager::loadDivesWithValidCredentials()
QString errorString(get_error_string());
appendTextToLog(errorString);
setStartPageText(tr("Cloud storage error: %1").arg(errorString));
+ setAccessingCloud(false);
return;
}
prefs.unit_system = informational_prefs.unit_system;
@@ -340,6 +347,7 @@ void QMLManager::loadDivesWithValidCredentials()
if (dive_table.nr == 0)
setStartPageText(tr("Cloud storage open successfully. No dives in dive list."));
setLoadFromCloud(true);
+ setAccessingCloud(false);
}
void QMLManager::refreshDiveList()
@@ -930,3 +938,14 @@ QString QMLManager::getVersion() const
return versionRe.cap(1);
}
+
+bool QMLManager::accessingCloud() const
+{
+ return m_accessingCloud;
+}
+
+void QMLManager::setAccessingCloud(bool status)
+{
+ m_accessingCloud = status;
+ emit accessingCloudChanged();
+}
diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h
index 17fe699e4..ff3507991 100644
--- a/qt-mobile/qmlmanager.h
+++ b/qt-mobile/qmlmanager.h
@@ -21,6 +21,8 @@ class QMLManager : public QObject {
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
Q_PROPERTY(credentialStatus_t credentialStatus READ credentialStatus WRITE setCredentialStatus NOTIFY credentialStatusChanged)
+ Q_PROPERTY(bool accessingCloud READ accessingCloud WRITE setAccessingCloud NOTIFY accessingCloudChanged)
+
public:
QMLManager();
~QMLManager();
@@ -70,6 +72,9 @@ public:
void setLogText(const QString &logText);
void appendTextToLog(const QString &newText);
+ bool accessingCloud() const;
+ void setAccessingCloud(bool status);
+
typedef void (QMLManager::*execute_function_type)();
public slots:
@@ -129,7 +134,7 @@ private:
QNetworkRequest request;
struct dive *deletedDive;
struct dive_trip *deletedTrip;
-
+ bool m_accessingCloud;
credentialStatus_t m_credentialStatus;
signals:
@@ -144,6 +149,7 @@ signals:
void loadFromCloudChanged();
void startPageTextChanged();
void credentialStatusChanged();
+ void accessingCloudChanged();
};
#endif