mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
15c7ee5db0
commit
03143f1ef1
2 changed files with 9 additions and 1 deletions
|
@ -258,7 +258,12 @@ Kirigami.Page {
|
|||
buddyIndex = manager.buddyList.indexOf(currentItem.modelData.dive.buddy)
|
||||
}
|
||||
buddyText = currentItem.modelData.dive.buddy;
|
||||
divemasterIndex = manager.divemasterList.indexOf(currentItem.modelData.dive.divemaster)
|
||||
if (currentItem.modelData.dive.divemaster.indexOf(",") > 0) {
|
||||
divemasterIndex = manager.divemasterList.indexOf(currentItem.modelData.dive.divemaster.split(",", 1).toString())
|
||||
} else {
|
||||
divemasterIndex = manager.divemasterList.indexOf(currentItem.modelData.dive.divemaster)
|
||||
}
|
||||
divemasterText = currentItem.modelData.dive.divemaster
|
||||
notes = currentItem.modelData.dive.notes
|
||||
if (currentItem.modelData.dive.singleWeight) {
|
||||
// we have only one weight, go ahead, have fun and edit it
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue