aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Joakim Bygdell <j.bygdell@gmail.com>2016-09-12 20:30:07 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-09-17 13:46:15 -0700
commit1219dc693170e4a04fff992bd5aed990674779c1 (patch)
treed81c6c58626c4fbed1b9b0605e015263c7056517 /mobile-widgets/qmlmanager.cpp
parented11dab7fb4564369339e580511fa7913362b77b (diff)
downloadsubsurface-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/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 9de5ac1c8..1b9aebe10 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -869,9 +869,17 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
d->suit = strdup(qPrintable(suit));
}
if (myDive->buddy() != buddy) {
- diveChanged = true;
- free(d->buddy);
- d->buddy = strdup(qPrintable(buddy));
+ if (myDive->buddy().contains(",")) {
+ if (!buddy.contains("Multiple Buddies")) {
+ diveChanged = true;
+ free(d->buddy);
+ d->buddy = strdup(qPrintable(buddy));
+ }
+ } else {
+ diveChanged = true;
+ free(d->buddy);
+ d->buddy = strdup(qPrintable(buddy));
+ }
}
if (myDive->divemaster() != diveMaster) {
diveChanged = true;