summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-21 23:34:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-25 13:59:04 -0700
commit3358bff4322714b59c6f54e67a0db980f215a29d (patch)
treea4c89ede782fbe399f4c67c9fd65bfa31f7a4502 /mobile-widgets
parentc263487e7ce7c7b22e516650eb857c646728c34a (diff)
downloadsubsurface-3358bff4322714b59c6f54e67a0db980f215a29d.tar.gz
cleanup: move mark_divelist_changed() to qmlmanager.cpp
Desktop does not use mark_divelist_changed() anymore - all is done via the undo machinery. Therefore move this function (and its counterpart unsaved_changes()) to qmlmanager.cpp. Ultimately, it probably should be removed from there as well, but currently I don't dare to touch all the cloud-logic! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmanager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 8f28ab912..81c6c7420 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -93,6 +93,23 @@ static void appendTextToLogStandalone(const char *text)
self->appendTextToLog(QString(text));
}
+// This flag is set to true by operations that are not implemented in the
+// undo system. It is therefore only cleared on save and load.
+static bool dive_list_changed = false;
+
+void mark_divelist_changed(bool changed)
+{
+ if (dive_list_changed == changed)
+ return;
+ dive_list_changed = changed;
+ updateWindowTitle();
+}
+
+int unsaved_changes()
+{
+ return dive_list_changed;
+}
+
// this callback is used from the uiNotification() function
// the detour via callback allows us to keep the core code independent from QMLManager
// I'm not sure it makes sense to have three different progress callbacks,
@@ -455,6 +472,7 @@ void QMLManager::mergeLocalRepo()
struct filter_preset_table filter_presets;
parse_file(qPrintable(nocloud_localstorage()), &table, &trips, &sites, &devices, &filter_presets);
add_imported_dives(&table, &trips, &sites, &devices, IMPORT_MERGE_ALL_TRIPS);
+ mark_divelist_changed(true);
}
void QMLManager::copyAppLogToClipboard()