aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-mobile/qml/DiveDetailsEdit.qml5
-rw-r--r--qt-models/divelistmodel.cpp2
2 files changed, 4 insertions, 3 deletions
diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml
index 38dd5dad9..cd8417e8f 100644
--- a/qt-mobile/qml/DiveDetailsEdit.qml
+++ b/qt-mobile/qml/DiveDetailsEdit.qml
@@ -38,7 +38,8 @@ Item {
// 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)
+ var newIdx = diveModel.getIdxForId(dive_id)
+ diveDetailsListView.currentIndex = newIdx
diveDetailsListView.currentItem.modelData.date = detailsEdit.dateText
diveDetailsListView.currentItem.modelData.location = detailsEdit.locationText
diveDetailsListView.currentItem.modelData.duration = detailsEdit.durationText
@@ -52,7 +53,7 @@ Item {
diveDetailsPage.state = "view"
Qt.inputMethod.hide()
// now make sure we directly show the saved dive (this may be a new dive, or it may have moved)
- showDiveIndex(manager.getIndex(dive_id))
+ showDiveIndex(newIdx)
}
height: editArea.height
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index 5275ca2bb..af6825285 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -141,7 +141,7 @@ QString DiveListModel::startAddDive()
d->number = nr;
d->dc.model = strdup("manually added dive");
add_single_dive(-1, d);
- insertDive(dive_table.nr - 1 - get_idx_by_uniq_id(d->id), new DiveObjectHelper(d));
+ insertDive(get_idx_by_uniq_id(d->id), new DiveObjectHelper(d));
return QString::number(d->id);
}