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>
This commit is contained in:
Dirk Hohndel 2016-02-08 08:41:42 -08:00
parent ec9aad4487
commit d43a2c032b

View file

@ -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);