summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp18
-rw-r--r--desktop-widgets/tab-widgets/maintab.h2
2 files changed, 7 insertions, 13 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index eff22192b..77a6c9f5c 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -378,6 +378,9 @@ void MainTab::divesEdited(const QVector<dive *> &, DiveField field)
case DiveField::BUDDY:
ui.buddy->setText(current_dive->buddy);
break;
+ case DiveField::DIVEMASTER:
+ ui.divemaster->setText(current_dive->divemaster);
+ break;
default:
break;
}
@@ -998,21 +1001,12 @@ void MainTab::on_buddy_editingFinished()
Command::editBuddies(getSelectedDivesCurrentLast(), stringToList(ui.buddy->toPlainText()), current_dive);
}
-void MainTab::on_divemaster_textChanged()
+void MainTab::on_divemaster_editingFinished()
{
- if (editMode == IGNORE || acceptingEdit == true)
- return;
-
- if (same_string(displayed_dive.divemaster, qPrintable(ui.divemaster->toPlainText())))
+ if (editMode == IGNORE || acceptingEdit == true || !current_dive)
return;
- QStringList text_list = ui.divemaster->toPlainText().split(",", QString::SkipEmptyParts);
- for (int i = 0; i < text_list.size(); i++)
- text_list[i] = text_list[i].trimmed();
- QString text = text_list.join(", ");
- free(displayed_dive.divemaster);
- displayed_dive.divemaster = copy_qstring(text);
- markChangedWidget(ui.divemaster);
+ Command::editDiveMaster(getSelectedDivesCurrentLast(), stringToList(ui.divemaster->toPlainText()), current_dive);
}
void MainTab::on_duration_textChanged(const QString &text)
diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h
index 88c2b4738..2cb82b0bd 100644
--- a/desktop-widgets/tab-widgets/maintab.h
+++ b/desktop-widgets/tab-widgets/maintab.h
@@ -74,7 +74,7 @@ slots:
void acceptChanges();
void rejectChanges();
void on_location_diveSiteSelected();
- void on_divemaster_textChanged();
+ void on_divemaster_editingFinished();
void on_buddy_editingFinished();
void on_suit_editingFinished();
void on_diveTripLocation_textEdited(const QString& text);