[PATCH] QML UI: Fix lingering edit mode

subsurface at henrik.synth.no subsurface at henrik.synth.no
Tue Feb 9 12:38:59 PST 2016


From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>

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 at henrik.synth.no>
---
 qt-mobile/qml/TopBar.qml | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/qt-mobile/qml/TopBar.qml b/qt-mobile/qml/TopBar.qml
index 107b261..ec18298 100644
--- a/qt-mobile/qml/TopBar.qml
+++ b/qt-mobile/qml/TopBar.qml
@@ -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()
 				}
 			}
-- 
2.7.0



More information about the subsurface mailing list