aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-03-08 22:28:42 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-03-11 11:40:12 -0700
commit49f566d6d8fdbf6d731138e5110746b92d55f2e8 (patch)
tree88c0df0b530c6f42d4095930c701818367d58d75 /mobile-widgets/qml
parentfe9c3d4c956d679e48dbcaebc90af12446da80cb (diff)
downloadsubsurface-49f566d6d8fdbf6d731138e5110746b92d55f2e8.tar.gz
main.qml: handle mapPage in pageStack.onCurrentItemChanged()
When the slot pageStack.onCurrentItemChanged() is reached make sure that the stackView becomes non-interactive. This prevents swiping left on the map to "go back". Also, always reload the map markers when the map becomes visible. This is not optimal and instead something in the lines of: DiveList.model.onChanged() is a much better solution. Ideally the map reload should happen on dive removal, dive addition, dive edits and sync from cloud. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r--mobile-widgets/qml/main.qml8
1 files changed, 8 insertions, 0 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index ae22e073e..93793156d 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -476,6 +476,14 @@ if you have network connectivity and want to sync your data to cloud storage."),
pageStack.onCurrentItemChanged: {
// This is called whenever the user navigates using the breadcrumbs in the header
+ // disable the left swipe to go back when on the map page
+ stackView.interactive = pageStack.currentItem.objectName !== mapPage.objectName
+
+ // is there a better way to reload the map markers instead of doing that
+ // every time the map page is shown - e.g. link to the dive list model somehow?
+ if (pageStack.currentItem.objectName === mapPage.objectName)
+ mapPage.reloadMap()
+
// In case we land on any page, not being the DiveDetails (which can be
// in multiple states, such as add, edit or view), just end the edit/add mode
if (pageStack.currentItem.objectName !== "DiveDetails" &&