Mobile: Allow multiple divemasters

While not something that many will use, editing a dive on
Subsurface-mobile should not result in data loss.
This makes the divemaster field behave in the same way as the buddy
field with regards to multiple entries.

Fixes #1853

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Jocke 2018-11-13 21:28:18 +01:00 committed by Dirk Hohndel
parent 15c7ee5db0
commit 03143f1ef1
2 changed files with 9 additions and 1 deletions

View file

@ -1093,6 +1093,9 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
d->buddy = copy_qstring(buddy);
}
if (myDive->divemaster() != diveMaster) {
if (diveMaster.contains(",")){
diveMaster = diveMaster.replace(QRegExp("\\s*,\\s*"), ", ");
}
diveChanged = true;
free(d->divemaster);
d->divemaster = copy_qstring(diveMaster);