mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: only force network access when user asks us to
So when the user taps on the manual cloud sync, we always force access to the cloud server. Otherwise we only access the cloud server if git_local_only isn't set. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
685d31cd4f
commit
4ed369b975
3 changed files with 14 additions and 7 deletions
|
@ -138,7 +138,7 @@ Kirigami.ApplicationWindow {
|
|||
onTriggered: {
|
||||
globalDrawer.close()
|
||||
detailsWindow.endEditMode()
|
||||
manager.saveChangesCloud();
|
||||
manager.saveChangesCloud(true);
|
||||
globalDrawer.close()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
|||
qDebug() << QStringLiteral("build with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion());
|
||||
setStartPageText(tr("Starting..."));
|
||||
setAccessingCloud(-1);
|
||||
setSyncToCloud(true);
|
||||
// create location manager service
|
||||
locationProvider = new GpsLocation(&appendTextToLogStandalone, this);
|
||||
set_git_update_cb(&gitProgressCB);
|
||||
|
@ -117,7 +116,7 @@ void QMLManager::applicationStateChanged(Qt::ApplicationState state)
|
|||
// FIXME
|
||||
// make sure the user sees that we are saving data if they come back
|
||||
// while this is running
|
||||
saveChangesCloud();
|
||||
saveChangesCloud(false);
|
||||
appendTextToLog(QString::number(timer.elapsed() / 1000.0,'f', 3) + ": done saving to git local / remote");
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +146,12 @@ void QMLManager::openLocalThenRemote(QString url)
|
|||
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr));
|
||||
}
|
||||
set_filename(fileNamePrt.data(), true);
|
||||
appendTextToLog(QStringLiteral("have cloud credentials, trying to connect"));
|
||||
tryRetrieveDataFromBackend();
|
||||
if (prefs.git_local_only) {
|
||||
appendTextToLog(QStringLiteral("have cloud credentials, but user asked not to connect to network"));
|
||||
} else {
|
||||
appendTextToLog(QStringLiteral("have cloud credentials, trying to connect"));
|
||||
tryRetrieveDataFromBackend();
|
||||
}
|
||||
}
|
||||
|
||||
void QMLManager::finishSetup()
|
||||
|
@ -156,6 +159,7 @@ void QMLManager::finishSetup()
|
|||
// Initialize cloud credentials.
|
||||
setCloudUserName(prefs.cloud_storage_email);
|
||||
setCloudPassword(prefs.cloud_storage_password);
|
||||
setSyncToCloud(!prefs.git_local_only);
|
||||
// if the cloud credentials are valid, we should get the GPS Webservice ID as well
|
||||
QString url;
|
||||
if (!cloudUserName().isEmpty() &&
|
||||
|
@ -771,8 +775,11 @@ void QMLManager::saveChangesLocal()
|
|||
}
|
||||
}
|
||||
|
||||
void QMLManager::saveChangesCloud()
|
||||
void QMLManager::saveChangesCloud(bool forceRemoteSync)
|
||||
{
|
||||
if (prefs.git_local_only && !forceRemoteSync)
|
||||
return;
|
||||
|
||||
git_storage_update_progress(true, "start save change to cloud");
|
||||
if (!loadFromCloud()) {
|
||||
appendTextToLog("Don't save dives without loading from the cloud, first.");
|
||||
|
|
|
@ -100,7 +100,7 @@ public slots:
|
|||
QString buddy, QString diveMaster, QString weight, QString notes,
|
||||
QString startpressure, QString endpressure, QString gasmix);
|
||||
void saveChangesLocal();
|
||||
void saveChangesCloud();
|
||||
void saveChangesCloud(bool forceRemoteSync);
|
||||
void deleteDive(int id);
|
||||
void undoDelete(int id);
|
||||
QString addDive();
|
||||
|
|
Loading…
Add table
Reference in a new issue