aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-08 08:41:42 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-08 08:41:42 -0800
commitd43a2c032bc7f0d76047cf9d55c32b850c669cd8 (patch)
treee50fcb29a776f7021f5d9cebf80e89d5fe9b8873 /qt-mobile
parentec9aad4487260c036b32b91ff2b080824c05c31b (diff)
downloadsubsurface-d43a2c032bc7f0d76047cf9d55c32b850c669cd8.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qml/DiveDetails.qml7
1 files changed, 7 insertions, 0 deletions
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);