summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qml/DiveDetails.qml
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets/qml/DiveDetails.qml')
-rw-r--r--mobile-widgets/qml/DiveDetails.qml28
1 files changed, 20 insertions, 8 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index b102d7206..9970a9455 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -261,15 +261,27 @@ Kirigami.Page {
}
onBackRequested: {
- if (state === "edit") {
- endEditMode()
- event.accepted = true;
- } else if (state === "add") {
- endEditMode()
- pageStack.pop()
- event.accepted = true;
+ // if one of the drawers/menus is open, the back button should close those
+ if (globalDrawer.visible) {
+ globalDrawer.close()
+ event.accepted = true
+ }
+ if (contextDrawer.visible) {
+ contextDrawer.close()
+ event.accepted = true
+ }
+ // if we didn't close either of the drawer, check if we need to close add/edit
+ if (event.accepted === false) {
+ if (state === "edit") {
+ endEditMode()
+ event.accepted = true;
+ } else if (state === "add") {
+ endEditMode()
+ pageStack.pop()
+ event.accepted = true;
+ }
}
- // if we were in view mode, don't accept the event and pop the page
+ // if we were in view mode and no menus are open, don't accept the event and pop the page
}
onCurrentItemChanged: {