aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-28 18:31:24 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-01-28 18:33:22 -0800
commit6dd3e4c30e50a839d840194d4df7613b2e87585f (patch)
tree4564b021919cd0b9e3e05d786ea2e5f14e516329 /qt-mobile/qml
parentadaaaaf32be802ce8dbc1d336a94dde24abecef3 (diff)
downloadsubsurface-6dd3e4c30e50a839d840194d4df7613b2e87585f.tar.gz
QML UI: use the new helper to ensure the right dive is selected after edit
There are two cases where this is important - when running Manually add dive which may add a dive in the middle of the dive list - when editing the date and time of a dive which may move it around in the dive list Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml')
-rw-r--r--qt-mobile/qml/DiveDetailsEdit.qml5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml
index 992f620ff..1c6c4a0f5 100644
--- a/qt-mobile/qml/DiveDetailsEdit.qml
+++ b/qt-mobile/qml/DiveDetailsEdit.qml
@@ -169,7 +169,10 @@ Item {
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.notesText)
- // apply the changes to the dive detail view
+ // 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