mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: Parse multiple buddies when editing a dive
This allows the user to enter multiple buddies as a comma separated list, the "Multiple Buddies" entry is still a special case as we can only populate the combobox with a single name for each entry. fixes #168 Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
parent
f5a4838519
commit
0e57033042
2 changed files with 5 additions and 8 deletions
|
@ -177,7 +177,7 @@ Item {
|
|||
}
|
||||
ComboBox {
|
||||
id: buddyBox
|
||||
editable: currentText != qsTr("Multiple Buddies")
|
||||
editable: true
|
||||
model: diveDetailsListView.currentItem.modelData.dive.buddyList
|
||||
inputMethodHints: Qt.ImhNoPredictiveText
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -869,13 +869,10 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
|||
d->suit = strdup(qPrintable(suit));
|
||||
}
|
||||
if (myDive->buddy() != buddy) {
|
||||
if (myDive->buddy().contains(",")) {
|
||||
if (!buddy.contains(tr("Multiple Buddies"))) {
|
||||
diveChanged = true;
|
||||
free(d->buddy);
|
||||
d->buddy = strdup(qPrintable(buddy));
|
||||
}
|
||||
} else {
|
||||
if (buddy.contains(",")){
|
||||
buddy = buddy.replace(QRegExp("\\s*,\\s*"), ", ");
|
||||
}
|
||||
if (!buddy.contains("Multiple Buddies")) {
|
||||
diveChanged = true;
|
||||
free(d->buddy);
|
||||
d->buddy = strdup(qPrintable(buddy));
|
||||
|
|
Loading…
Add table
Reference in a new issue