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.cpp23
-rw-r--r--desktop-widgets/tab-widgets/maintab.h1
2 files changed, 13 insertions, 11 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index a077ad2a2..ab2eabd4c 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -767,8 +767,6 @@ void MainTab::acceptChanges()
// 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 (!same_string(displayed_dive.notes, cd->notes))
- MODIFY_DIVES(selectedDives, EDIT_TEXT(notes));
if (displayed_dive.rating != cd->rating)
MODIFY_DIVES(selectedDives, EDIT_VALUE(rating));
if (displayed_dive.visibility != cd->visibility)
@@ -1343,16 +1341,19 @@ void MainTab::on_notes_textChanged()
return;
free(displayedTrip.notes);
displayedTrip.notes = copy_qstring(ui.notes->toPlainText());
- } else {
- if (same_string(displayed_dive.notes, qPrintable(ui.notes->toPlainText())))
- return;
- free(displayed_dive.notes);
- if (ui.notes->toHtml().indexOf("<div") != -1)
- displayed_dive.notes = copy_qstring(ui.notes->toHtml());
- else
- displayed_dive.notes = copy_qstring(ui.notes->toPlainText());
+ markChangedWidget(ui.notes);
}
- markChangedWidget(ui.notes);
+}
+
+void MainTab::on_notes_editingFinished()
+{
+ if (currentTrip || !current_dive)
+ return; // Trip-note editing is done via on_notes_textChanged()
+
+ QString notes = ui.notes->toHtml().indexOf("<div") != -1 ?
+ ui.notes->toHtml() : ui.notes->toPlainText();
+
+ Command::editNotes(getSelectedDivesCurrentLast(), notes, QString(current_dive->notes));
}
void MainTab::on_rating_valueChanged(int value)
diff --git a/desktop-widgets/tab-widgets/maintab.h b/desktop-widgets/tab-widgets/maintab.h
index 094f3d053..00b94d1a0 100644
--- a/desktop-widgets/tab-widgets/maintab.h
+++ b/desktop-widgets/tab-widgets/maintab.h
@@ -75,6 +75,7 @@ slots:
void on_suit_textChanged(const QString &text);
void on_diveTripLocation_textEdited(const QString& text);
void on_notes_textChanged();
+ void on_notes_editingFinished();
void on_airtemp_textChanged(const QString &text);
void on_duration_textChanged(const QString &text);
void on_depth_textChanged(const QString &text);