mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-08 01:36:16 +00:00
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>
This commit is contained in:
parent
d976310094
commit
47403588e5
3 changed files with 14 additions and 15 deletions
|
@ -47,9 +47,7 @@ MobileComponents.Page {
|
||||||
iconName: state !== "view" ? "dialog-cancel" : "document-edit"
|
iconName: state !== "view" ? "dialog-cancel" : "document-edit"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (state === "edit") {
|
if (state === "edit") {
|
||||||
// just cancel the edit state
|
endEditMode()
|
||||||
state = "view"
|
|
||||||
Qt.inputMethod.hide()
|
|
||||||
} else if (state === "add") {
|
} else if (state === "add") {
|
||||||
// edit was canceled - so remove the dive from the dive list
|
// edit was canceled - so remove the dive from the dive list
|
||||||
manager.addDiveAborted(dive_id)
|
manager.addDiveAborted(dive_id)
|
||||||
|
@ -66,6 +64,12 @@ MobileComponents.Page {
|
||||||
diveDetailsListView.positionViewAtIndex(index, ListView.Beginning);
|
diveDetailsListView.positionViewAtIndex(index, ListView.Beginning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function endEditMode() {
|
||||||
|
// just cancel the edit state
|
||||||
|
state = "view";
|
||||||
|
Qt.inputMethod.hide();
|
||||||
|
}
|
||||||
|
|
||||||
function startEditMode() {
|
function startEditMode() {
|
||||||
// set things up for editing - so make sure that the detailsEdit has
|
// set things up for editing - so make sure that the detailsEdit has
|
||||||
// all the right data (using the property aliases set up above)
|
// all the right data (using the property aliases set up above)
|
||||||
|
|
|
@ -138,7 +138,7 @@ Rectangle {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
onClicked: {
|
onClicked: {
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,6 @@ MobileComponents.ApplicationWindow {
|
||||||
visible: false
|
visible: false
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
function endEditMode() {
|
|
||||||
detailsWindow.state = "view"
|
|
||||||
// somehow also should deal with the icon for the Action Button
|
|
||||||
}
|
|
||||||
|
|
||||||
globalDrawer: MobileComponents.GlobalDrawer {
|
globalDrawer: MobileComponents.GlobalDrawer {
|
||||||
title: "Subsurface"
|
title: "Subsurface"
|
||||||
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
titleIcon: "qrc:/qml/subsurface-mobile-icon.png"
|
||||||
|
@ -37,21 +32,21 @@ MobileComponents.ApplicationWindow {
|
||||||
for (var i=stackView.depth; i>1; i--) {
|
for (var i=stackView.depth; i>1; i--) {
|
||||||
stackView.pop()
|
stackView.pop()
|
||||||
}
|
}
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Action {
|
Action {
|
||||||
text: "Cloud credentials"
|
text: "Cloud credentials"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
stackView.push(cloudCredWindow)
|
stackView.push(cloudCredWindow)
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Action {
|
Action {
|
||||||
text: "Preferences"
|
text: "Preferences"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
stackView.push(prefsWindow)
|
stackView.push(prefsWindow)
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MobileComponents.ActionGroup {
|
MobileComponents.ActionGroup {
|
||||||
|
@ -61,7 +56,7 @@ MobileComponents.ApplicationWindow {
|
||||||
Action {
|
Action {
|
||||||
text: "Download from computer"
|
text: "Download from computer"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
stackView.push(downloadDivesWindow)
|
stackView.push(downloadDivesWindow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,14 +84,14 @@ MobileComponents.ApplicationWindow {
|
||||||
Action {
|
Action {
|
||||||
text: "Refresh"
|
text: "Refresh"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
manager.loadDives();
|
manager.loadDives();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Upload to cloud"
|
text: "Upload to cloud"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
endEditMode()
|
detailsWindow.endEditMode()
|
||||||
manager.saveChanges();
|
manager.saveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue