diff options
author | Joakim Bygdell <j.bygdell@gmail.com> | 2016-09-12 20:30:07 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-17 13:46:15 -0700 |
commit | 1219dc693170e4a04fff992bd5aed990674779c1 (patch) | |
tree | d81c6c58626c4fbed1b9b0605e015263c7056517 /mobile-widgets/qml/DiveDetails.qml | |
parent | ed11dab7fb4564369339e580511fa7913362b77b (diff) | |
download | subsurface-1219dc693170e4a04fff992bd5aed990674779c1.tar.gz |
QML UI: deal with multiple buddies correctly
When editing adive in Subsurface-mobile we can only handle one buddy
due to the limitations of the combobox. To prevent loss of data when editing
a dive with more than one buddy we display "Multiple Buddies" in the buddy
field. This creates a special case where no changes are written to the buddy field
unless the user changes buddy for that dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml/DiveDetails.qml')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 7f6ca81a0..be342886d 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -156,7 +156,11 @@ Kirigami.Page { airtemp = diveDetailsListView.currentItem.modelData.dive.airTemp watertemp = diveDetailsListView.currentItem.modelData.dive.waterTemp suitIndex = diveDetailsListView.currentItem.modelData.dive.suitList.indexOf(diveDetailsListView.currentItem.modelData.dive.suit) - buddyIndex = diveDetailsListView.currentItem.modelData.dive.buddyList.indexOf(diveDetailsListView.currentItem.modelData.dive.buddy) + if (diveDetailsListView.currentItem.modelData.dive.buddy.search(",")) { + buddyIndex = diveDetailsListView.currentItem.modelData.dive.buddyList.indexOf("Multiple Buddies"); + } else { + buddyIndex = diveDetailsListView.currentItem.modelData.dive.buddyList.indexOf(diveDetailsListView.currentItem.modelData.dive.buddy) + } divemasterIndex = diveDetailsListView.currentItem.modelData.dive.divemasterList.indexOf(diveDetailsListView.currentItem.modelData.dive.divemaster) notes = diveDetailsListView.currentItem.modelData.dive.notes if (diveDetailsListView.currentItem.modelData.dive.singleWeight) { |