QML UI: change the dive add/edit action button to be save

Remove the button on the page and instead use the action button to save
and the back key to cancel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-02-13 21:25:10 -08:00
parent 5952b09b51
commit 0ce1dd80cc
2 changed files with 33 additions and 34 deletions

View file

@ -74,12 +74,10 @@ MobileComponents.Page {
]
*/
mainAction: Action {
iconName: state !== "view" ? "dialog-cancel" : "document-edit"
iconName: state !== "view" ? "document-save" : "document-edit"
onTriggered: {
if (state === "edit") {
endEditMode()
} else if (state === "add") {
endAddMode()
if (state === "edit" || state === "add") {
detailsEdit.saveData()
} else {
startEditMode()
}
@ -87,10 +85,14 @@ MobileComponents.Page {
}
onBackRequested: {
if (state === "edit" || state === "add") {
endEditMode();
if (state === "edit") {
endEditMode()
event.accepted = true;
} else if (state === "add") {
endAddMode()
event.accepted = true;
}
// if we were in view mode, don't accept the event and pop the page
}
function showDiveIndex(index) {