From d43a2c032bc7f0d76047cf9d55c32b850c669cd8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 8 Feb 2016 08:41:42 -0800 Subject: QML UI: correctly handle back key on edits This requires mobile components that include commit 03c868fc57e5 from earlier today. With this a single press on the back key cancels the edit and a second press on the back key brings you up one level in the page stack (usually back to the dive list). Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveDetails.qml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'qt-mobile') diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index 7fc2a8be9..162e31b9d 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -59,6 +59,13 @@ MobileComponents.Page { } } + onBackRequested: { + if (state === "edit" || state === "add") { + endEditMode(); + event.accepted = true; + } + } + function showDiveIndex(index) { currentIndex = index; diveDetailsListView.positionViewAtIndex(index, ListView.Beginning); -- cgit v1.2.3-70-g09d2