From 6dd3e4c30e50a839d840194d4df7613b2e87585f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 28 Jan 2016 18:31:24 -0800 Subject: 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 --- qt-mobile/qml/DiveDetailsEdit.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qt-mobile/qml') 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 -- cgit v1.2.3-70-g09d2