The main-tab view is inconsistent as mentioned in #804, this patch fixes
the notes view.

Regards,
Gehad
From b86ac5633ce73ab22a600ff3986dcfc2dfe8d63c Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Fri, 30 Jan 2015 22:27:16 +0200
Subject: [PATCH] Don't go to edit mode if the dive notes field didn't change.

The maintab view must 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.

Signed-off-by: Gehad elrobey <[email protected]>
---
 qt-ui/maintab.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index c247b77..0c62ae4 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1159,9 +1159,13 @@ void MainTab::on_notes_textChanged()
 	if (editMode == IGNORE || acceptingEdit == true)
 		return;
 	if (currentTrip) {
+		if (displayedTrip.notes && !strcmp(displayedTrip.notes, ui.notes->toPlainText().toUtf8().data()))
+			return;
 		free(displayedTrip.notes);
 		displayedTrip.notes = strdup(ui.notes->toPlainText().toUtf8().data());
 	} else {
+		if (!strcmp(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());
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to