From 47403588e5241368c43dd407090b1be214b56252 Mon Sep 17 00:00:00 2001 From: Henrik Brautaset Aronsen Date: Sun, 7 Feb 2016 22:23:07 +0100 Subject: Move endEditMode() to DiveDetails.qml Having endEditMode() in main.qml seemed wrong somehow. Signed-off-by: Henrik Brautaset Aronsen Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveDetails.qml | 10 +++++++--- qt-mobile/qml/TopBar.qml | 2 +- qt-mobile/qml/main.qml | 17 ++++++----------- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'qt-mobile') diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index b2744ec1e..7fc2a8be9 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -47,9 +47,7 @@ MobileComponents.Page { iconName: state !== "view" ? "dialog-cancel" : "document-edit" onTriggered: { if (state === "edit") { - // just cancel the edit state - state = "view" - Qt.inputMethod.hide() + endEditMode() } else if (state === "add") { // edit was canceled - so remove the dive from the dive list manager.addDiveAborted(dive_id) @@ -66,6 +64,12 @@ MobileComponents.Page { diveDetailsListView.positionViewAtIndex(index, ListView.Beginning); } + function endEditMode() { + // just cancel the edit state + state = "view"; + Qt.inputMethod.hide(); + } + function startEditMode() { // set things up for editing - so make sure that the detailsEdit has // all the right data (using the property aliases set up above) diff --git a/qt-mobile/qml/TopBar.qml b/qt-mobile/qml/TopBar.qml index 4f3f6fef8..338b78f87 100644 --- a/qt-mobile/qml/TopBar.qml +++ b/qt-mobile/qml/TopBar.qml @@ -138,7 +138,7 @@ Rectangle { height: parent.height width: parent.width onClicked: { - endEditMode() + detailsWindow.endEditMode() } } } diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml index fae6422fd..6af5a364d 100644 --- a/qt-mobile/qml/main.qml +++ b/qt-mobile/qml/main.qml @@ -20,11 +20,6 @@ MobileComponents.ApplicationWindow { visible: false opacity: 0 - function endEditMode() { - detailsWindow.state = "view" - // somehow also should deal with the icon for the Action Button - } - globalDrawer: MobileComponents.GlobalDrawer { title: "Subsurface" titleIcon: "qrc:/qml/subsurface-mobile-icon.png" @@ -37,21 +32,21 @@ MobileComponents.ApplicationWindow { for (var i=stackView.depth; i>1; i--) { stackView.pop() } - endEditMode() + detailsWindow.endEditMode() } }, Action { text: "Cloud credentials" onTriggered: { stackView.push(cloudCredWindow) - endEditMode() + detailsWindow.endEditMode() } }, Action { text: "Preferences" onTriggered: { stackView.push(prefsWindow) - endEditMode() + detailsWindow.endEditMode() } }, MobileComponents.ActionGroup { @@ -61,7 +56,7 @@ MobileComponents.ApplicationWindow { Action { text: "Download from computer" onTriggered: { - endEditMode() + detailsWindow.endEditMode() stackView.push(downloadDivesWindow) } } @@ -89,14 +84,14 @@ MobileComponents.ApplicationWindow { Action { text: "Refresh" onTriggered: { - endEditMode() + detailsWindow.endEditMode() manager.loadDives(); } } Action { text: "Upload to cloud" onTriggered: { - endEditMode() + detailsWindow.endEditMode() manager.saveChanges(); } } -- cgit v1.2.3-70-g09d2