diff options
author | Henrik Brautaset Aronsen <subsurface@henrik.synth.no> | 2016-02-07 22:23:07 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-07 13:56:46 -0800 |
commit | 47403588e5241368c43dd407090b1be214b56252 (patch) | |
tree | 1e4bf425e0ffd722ffdc0147a8d21984a3d718d9 /qt-mobile | |
parent | d9763100940cbcff297d88a0f1597ba7bd07ea01 (diff) | |
download | subsurface-47403588e5241368c43dd407090b1be214b56252.tar.gz |
Move endEditMode() to DiveDetails.qml
Having endEditMode() in main.qml seemed wrong somehow.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r-- | qt-mobile/qml/DiveDetails.qml | 10 | ||||
-rw-r--r-- | qt-mobile/qml/TopBar.qml | 2 | ||||
-rw-r--r-- | qt-mobile/qml/main.qml | 17 |
3 files changed, 14 insertions, 15 deletions
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(); } } |