diff options
Diffstat (limited to 'qt-mobile/qml')
-rw-r--r-- | qt-mobile/qml/DiveDetails.qml | 16 | ||||
-rw-r--r-- | qt-mobile/qml/DiveDetailsEdit.qml | 51 |
2 files changed, 33 insertions, 34 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index c906ba268..a8db2990c 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -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) { diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml index ae943ca03..de9d84262 100644 --- a/qt-mobile/qml/DiveDetailsEdit.qml +++ b/qt-mobile/qml/DiveDetailsEdit.qml @@ -26,6 +26,30 @@ Item { property alias endpressureText: txtEndPressure.text property alias gasmixText: txtGasMix.text + function saveData() { + // apply the changes to the dive_table + manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText, + detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText, + detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText, + detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText) + // apply the changes to the dive detail view - since the edit could have changed the order + // first make sure that we are looking at the correct dive - our model allows us to look + // up the index based on the unique dive_id + diveDetailsListView.currentIndex = diveModel.getIdxForId(dive_id) + diveDetailsListView.currentItem.modelData.date = detailsEdit.dateText + diveDetailsListView.currentItem.modelData.location = detailsEdit.locationText + diveDetailsListView.currentItem.modelData.duration = detailsEdit.durationText + diveDetailsListView.currentItem.modelData.depth = detailsEdit.depthText + diveDetailsListView.currentItem.modelData.airtemp = detailsEdit.airtempText + diveDetailsListView.currentItem.modelData.watertemp = detailsEdit.watertempText + diveDetailsListView.currentItem.modelData.suit = detailsEdit.suitText + diveDetailsListView.currentItem.modelData.buddy = detailsEdit.buddyText + diveDetailsListView.currentItem.modelData.divemaster = detailsEdit.divemasterText + diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText + diveDetailsPage.state = "view" + Qt.inputMethod.hide() + } + height: editArea.height ColumnLayout { id: editArea @@ -195,33 +219,6 @@ Item { wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere } } - SubsurfaceButton { - anchors.horizontalCenter: parent.horizontalCenter - text: "Save" - onClicked: { - // apply the changes to the dive_table - manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText, - detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText, - detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText, - detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText) - // apply the changes to the dive detail view - since the edit could have changed the order - // first make sure that we are looking at the correct dive - our model allows us to look - // up the index based on the unique dive_id - diveDetailsListView.currentIndex = diveModel.getIdxForId(dive_id) - diveDetailsListView.currentItem.modelData.date = detailsEdit.dateText - diveDetailsListView.currentItem.modelData.location = detailsEdit.locationText - diveDetailsListView.currentItem.modelData.duration = detailsEdit.durationText - diveDetailsListView.currentItem.modelData.depth = detailsEdit.depthText - diveDetailsListView.currentItem.modelData.airtemp = detailsEdit.airtempText - diveDetailsListView.currentItem.modelData.watertemp = detailsEdit.watertempText - diveDetailsListView.currentItem.modelData.suit = detailsEdit.suitText - diveDetailsListView.currentItem.modelData.buddy = detailsEdit.buddyText - diveDetailsListView.currentItem.modelData.divemaster = detailsEdit.divemasterText - diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText - diveDetailsPage.state = "view" - Qt.inputMethod.hide() - } - } Item { height: MobileComponents.Units.gridUnit * 3 width: height // just to make sure the spacer doesn't produce scrollbars, but also isn't null |