aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-12 22:42:57 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-10 09:25:57 -0700
commit65fe892cba622ef2b9a5f7ec70e78eb98909f90c (patch)
tree6de296784689c62704ea33b1b218192f0e2dec15 /mobile-widgets
parent28bf078ff7da221d4172fa64ad20c0a57218eaba (diff)
downloadsubsurface-65fe892cba622ef2b9a5f7ec70e78eb98909f90c.tar.gz
mobile UI: set the correct location string when editing dives
In some situations we ended up with the wrong location name. One way to reproduce the problem was to edit an existing dive location to be a substring of an existing location name. Save the dive, then immediately edit it again. The wrong location would be filled in. The code here looks strange and unnecessary, but it seems to fix the issue. The aliases don't seem to make the code any easier to understand. This replaces them in the case of the location combo box with direct accesses to the data on the DiveDetailsEdit page. It may be worth removing all of them. The locationModel alias was unused. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DiveDetails.qml12
1 files changed, 8 insertions, 4 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml
index 2a20271ef..46e9952a2 100644
--- a/mobile-widgets/qml/DiveDetails.qml
+++ b/mobile-widgets/qml/DiveDetails.qml
@@ -25,8 +25,6 @@ Kirigami.Page {
property alias depth: detailsEdit.depthText
property alias duration: detailsEdit.durationText
property alias location: detailsEdit.locationText
- property alias locationModel: detailsEdit.locationModel
- property alias locationIndex: detailsEdit.locationIndex
property alias gps: detailsEdit.gpsText
property alias notes: detailsEdit.notesText
property alias suitIndex: detailsEdit.suitIndex
@@ -251,8 +249,14 @@ Kirigami.Page {
dive_id = modelData.id
number = modelData.number
date = modelData.dateTime
- location = modelData.location !== undefined ? location : ""
- locationIndex = manager.locationList.indexOf(modelData.location)
+ var locationText = modelData.location !== undefined ? modelData.location : ""
+ var locationIndex = manager.locationList.indexOf(modelData.location)
+ if (locationIndex >= 0) {
+ detailsEdit.locationIndex = locationIndex
+ detailsEdit.locationText = manager.locationList[locationIndex] // this shouldn't be necessary, but apparently it is
+ } else {
+ detailsEdit.locationText = locationText
+ }
gps = modelData.gps
gpsCheckbox = false
duration = modelData.duration