Don't go to edit mode if the dive notes field didn't change.

The maintab view should be consistent; some fields just go to edit mode
whenever they acquire focus and most of them wait till their values are
changed.

Change the dive notes field to be consistent with the other fields and
only enter edit mode if its value is changed.

[Dirk Hohndel: changed to use same_string()]

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2015-01-30 22:27:16 +02:00 committed by Dirk Hohndel
parent 129b54093b
commit f16f4e2f6e

View file

@ -1159,9 +1159,13 @@ void MainTab::on_notes_textChanged()
if (editMode == IGNORE || acceptingEdit == true)
return;
if (currentTrip) {
if (same_string(displayedTrip.notes, ui.notes->toPlainText().toUtf8().data()))
return;
free(displayedTrip.notes);
displayedTrip.notes = strdup(ui.notes->toPlainText().toUtf8().data());
} else {
if (same_string(displayed_dive.notes, ui.notes->toPlainText().toUtf8().data()))
return;
free(displayed_dive.notes);
if (ui.notes->toHtml().indexOf("<table") != -1)
displayed_dive.notes = strdup(ui.notes->toHtml().toUtf8().data());