From 94428b9a1823fd7df9f2f0f7815900efca2213a4 Mon Sep 17 00:00:00 2001 From: Jocke Date: Mon, 16 Jul 2018 18:01:56 +0200 Subject: Mobile: save edited cylinders Save the edited cylinder in the correct slot. Since the cylinder number and the used cylinder number need not be the same we first need to test if the cylinder are used. Signed-off-by: Joakim Bygdell --- mobile-widgets/qml/DiveDetailsEdit.qml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'mobile-widgets/qml/DiveDetailsEdit.qml') diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index 7a05975a5..7de718b82 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -70,14 +70,30 @@ Item { function saveData() { diveDetailsPage.state = "view" // run the transition + // join cylinder info from separate string into a list. + if (usedCyl[0] != null) { + usedCyl[0] = cylinderBox0.currentText + } + if (usedCyl[1] != null) { + usedCyl[1] = cylinderBox1.currentText + } + if (usedCyl[2] != null) { + usedCyl[2] = cylinderBox2.currentText + } + if (usedCyl[3] != null) { + usedCyl[3] = cylinderBox3.currentText + } + if (usedCyl[4] != null) { + usedCyl[4] = cylinderBox4.currentText + } + // apply the changes to the dive_table manager.commitChanges(dive_id, detailsEdit.dateText, locationBox.editText, detailsEdit.gpsText, detailsEdit.durationText, detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.currentText != "" ? suitBox.currentText : suitBox.editText, buddyBox.editText, divemasterBox.currentText != "" ? divemasterBox.currentText : divemasterBox.editText, detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText, - detailsEdit.endpressureText, detailsEdit.gasmixText, - cylinderBox.currentText != "" ? cylinderBox.currentText : cylinderBox.editText, + detailsEdit.endpressureText, detailsEdit.gasmixText, usedCyl , detailsEdit.rating, detailsEdit.visibility) // trigger the profile to be redrawn @@ -97,7 +113,6 @@ Item { diveDetailsListView.currentItem.modelData.suit = suitBox.currentText diveDetailsListView.currentItem.modelData.buddy = buddyBox.currentText diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText - diveDetailsListView.currentItem.modelData.cylinder = cylinderBox.currentText diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText diveDetailsListView.currentItem.modelData.rating = detailsEdit.rating diveDetailsListView.currentItem.modelData.visibility = detailsEdit.visibility -- cgit v1.2.3-70-g09d2