From a27d78af03d3b622b32b3347daf7e727708b9f40 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 10 Jan 2016 21:40:03 -0800 Subject: [PATCH] Save a dive has to mean "save to local storage" on mobile While it makes sense to have the concept of "what's in memory" and "what's on disk" in a desktop application, on a mobile device that seems like the wrong approach. If the user edits a dive and taps on "save", they reasonably expect this to be saved to storage (so our local cache of the remote git repository). And "Upload to cloud" then pushes the data to the cloud server. It may even be reasonable to do that automagically, but that I'm not so sure about. Signed-off-by: Dirk Hohndel --- qt-mobile/qmlmanager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index dd15f429d..79528cdff 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -471,6 +471,13 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location if (diveChanged || needResort) { refreshDiveList(); mark_divelist_changed(true); + // this is called "commit" for a reason - when the user saves an + // edit they have a reasonable expectation that their data is actually + // stored - so we need to store this to the local cache + qDebug() << "save dives to local cache"; + prefs.cloud_background_sync = false; + saveChanges(); + prefs.cloud_background_sync = true; } return notes; }