Mobile: Enable editing multiple buddies

While the autocomplete function only works for the first entry
adding multiple comma separated buddies can still be done.

Fixes #608

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
Joakim Bygdell 2017-12-06 18:54:46 +01:00 committed by Dirk Hohndel
parent a2a2aec9f0
commit e9bcca9103
2 changed files with 4 additions and 6 deletions

View file

@ -229,7 +229,7 @@ Kirigami.Page {
watertemp = currentItem.modelData.dive.waterTemp
suitIndex = currentItem.modelData.dive.suitList.indexOf(currentItem.modelData.dive.suit)
if (currentItem.modelData.dive.buddy.indexOf(",") > 0) {
buddyIndex = currentItem.modelData.dive.buddyList.indexOf(qsTr("Multiple Buddies"));
buddyText = currentItem.modelData.dive.buddy;
} else {
buddyIndex = currentItem.modelData.dive.buddyList.indexOf(currentItem.modelData.dive.buddy)
}

View file

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