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.cpp14
-rw-r--r--desktop-widgets/tab-widgets/maintab.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 49cf5312c..962cdc645 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -342,6 +342,9 @@ void MainTab::divesEdited(const QVector<dive *> &, DiveField field)
return;
switch(field) {
+ case DiveField::SUIT:
+ ui.suit->setText(QString(current_dive->suit));
+ break;
case DiveField::NOTES:
updateNotes(current_dive);
break;
@@ -795,8 +798,6 @@ void MainTab::acceptChanges()
struct dive *cd = current_dive;
// now check if something has changed and if yes, edit the selected dives that
// were identical with the master dive shown (and mark the divelist as changed)
- if (!same_string(displayed_dive.suit, cd->suit))
- MODIFY_DIVES(selectedDives, EDIT_TEXT(suit));
if (displayed_dive.rating != cd->rating)
MODIFY_DIVES(selectedDives, EDIT_VALUE(rating));
if (displayed_dive.visibility != cd->visibility)
@@ -1343,13 +1344,12 @@ void MainTab::on_diveTripLocation_textEdited(const QString& text)
}
}
-void MainTab::on_suit_textChanged(const QString &text)
+void MainTab::on_suit_editingFinished()
{
- if (editMode == IGNORE || acceptingEdit == true)
+ if (editMode == IGNORE || acceptingEdit == true || !current_dive)
return;
- free(displayed_dive.suit);
- displayed_dive.suit = copy_qstring(text);
- markChangedWidget(ui.suit);
+
+ Command::editSuit(getSelectedDivesCurrentLast(), ui.suit->text(), QString(current_dive->suit));
}
void MainTab::on_notes_textChanged()
diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h
index 2ac463aec..14a077ba9 100644
--- a/desktop-widgets/tab-widgets/maintab.h
+++ b/desktop-widgets/tab-widgets/maintab.h
@@ -76,7 +76,7 @@ slots:
void on_location_textChanged();
void on_divemaster_textChanged();
void on_buddy_textChanged();
- void on_suit_textChanged(const QString &text);
+ void on_suit_editingFinished();
void on_diveTripLocation_textEdited(const QString& text);
void on_notes_textChanged();
void on_notes_editingFinished();