QML UI: Fix lingering edit mode

A dive would linger in edit mode when following these steps:

start mobile. show theme info. click on dive in dive list.
click edit. click back in topbar, again click back in the topbar.
click on dive in dive list, still in edit mode.

Not anymore. Also enable back button when viewing a dive.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Henrik Brautaset Aronsen 2016-02-09 21:38:59 +01:00 committed by Dirk Hohndel
parent 37438e28d2
commit 0eebfb284e

View file

@ -83,11 +83,11 @@ Rectangle {
}
Item {
id: editButton
anchors.right: contextDrawer.enabled ? contextMenu.left : parent.right
anchors.right: backButton.visible ? backButton.left : contextDrawer.enabled ? contextMenu.left : parent.right
anchors.top: parent.top
Layout.preferredHeight: editButtonIcon.height
width: editButtonIcon.width
visible: !backButton.visible && detailsWindow.state === "view" && detailsWindow.visible
visible: detailsWindow.state === "view" && detailsWindow.visible
Image {
id: editButtonIcon
source: "qrc:/qml/menu-edit.png"
@ -114,8 +114,7 @@ Rectangle {
anchors.top: parent.top
Layout.preferredHeight: backButtonIcon.height
width: backButtonIcon.width
visible: logWindow.visible || themetest.visible ||
(detailsWindow.state === "edit" && detailsWindow.visible)
visible: logWindow.visible || themetest.visible || detailsWindow.visible
Image {
id: backButtonIcon
source: "qrc:/qml/menu-back.png"
@ -132,9 +131,9 @@ Rectangle {
height: parent.height
width: parent.width
onClicked: {
if (logWindow.visible || themetest.visible)
if (detailsWindow.state === "view" || logWindow.visible || themetest.visible)
stackView.pop()
else
if (detailsWindow.state === "edit")
detailsWindow.endEditMode()
}
}