From 825afb4db4b69b507473f91234575bc9dc44a02e Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Mon, 18 Dec 2017 14:37:02 +0100 Subject: mobile: exit edit mode when navigating away from edit page Navigating using the breadcrumb in the header did leave the dive detail edit (and add) mode in such a way that (for example) navigation in the dive list was suspended. Obviously, it is debatable what should be done. Saving the edits/add, or cancelling them. For now, this commit cancels them silently. This is the exact same thing that is happening when the user selects the dive list from the drawer menu. Fixes: #932 Signed-off-by: Jan Mulder --- mobile-widgets/qml/DiveDetails.qml | 1 + mobile-widgets/qml/main.qml | 11 +++++++++++ 2 files changed, 12 insertions(+) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 2a6398816..001aed3a1 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -8,6 +8,7 @@ import org.kde.kirigami 2.2 as Kirigami Kirigami.Page { id: diveDetailsPage // but this is referenced as detailsWindow + objectName: "DiveDetails" property alias currentIndex: diveDetailsListView.currentIndex property alias currentItem: diveDetailsListView.currentItem property alias dive_id: detailsEdit.dive_id diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 6d5739a9b..00d8e544a 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -19,6 +19,7 @@ Kirigami.ApplicationWindow { preferredHeight: Math.round(Kirigami.Units.gridUnit * (Qt.platform.os == "ios" ? 2 : 1.5)) maximumHeight: Kirigami.Units.gridUnit * 2 } + property alias oldStatus: manager.oldStatus property alias notificationText: manager.notificationText property alias syncToCloud: manager.syncToCloud @@ -436,7 +437,17 @@ if you have network connectivity and want to sync your data to cloud storage."), easing.type: Easing.OutQuad } } + } + pageStack.onCurrentItemChanged: { + // This is called whenever the user navigates using the breadcrumbs in the header + + // 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" && + (detailsWindow.state === 'edit' || detailsWindow.state === 'add')) { + detailsWindow.endEditMode() + } } QMLManager { -- cgit v1.2.3-70-g09d2