dirk, take a look at 01, as I have never ever touched the c part of
subsurface before.
From 82acd10a9ab2726474ebe50d5f4a7327b23a4e01 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 24 Apr 2014 12:59:42 -0300
Subject: [PATCH 1/3] Save latitude and longitude on XML even if location not
 set.

This bug don't exists on the git file format, only on the
xml. The latitude and Longitude were being discarded if
the Location name was not set and this breaks some users
workflow. Not nice.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 save-xml.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/save-xml.c b/save-xml.c
index 4ad03db..1db2513 100644
--- a/save-xml.c
+++ b/save-xml.c
@@ -71,19 +71,16 @@ static void quote(struct membuffer *b, const char *text, int is_attribute)
 static void show_utf8(struct membuffer *b, const char *text, const char *pre, const char *post, int is_attribute)
 {
 	int len;
-
-	if (!text)
-		return;
-	while (isspace(*text))
-		text++;
-	len = strlen(text);
-	if (!len)
-		return;
-	while (len && isspace(text[len - 1]))
-		len--;
-	/* FIXME! Quoting! */
 	put_string(b, pre);
-	quote(b, text, is_attribute);
+	if (text){
+		while (isspace(*text))
+			text++;
+		len = strlen(text);
+		while (len && isspace(text[len - 1]))
+			len--;
+		/* FIXME! Quoting! */
+		quote(b, text, is_attribute);
+	}
 	put_string(b, post);
 }
 
@@ -188,13 +185,7 @@ static void show_location(struct membuffer *b, struct dive *dive)
 	 */
 	if (latitude.udeg || longitude.udeg) {
 		int len = sprintf(buffer, "  <location ");
-
 		len += format_location(buffer + len, latitude, longitude);
-		if (!dive->location) {
-			memcpy(buffer + len, "/>\n", 4);
-			put_string(b, buffer);
-			return;
-		}
 		buffer[len++] = '>';
 		buffer[len] = 0;
 		prefix = buffer;
-- 
1.9.2

From 7e09fb615f2f731ee04e684d77b28489abb65367 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 24 Apr 2014 13:16:57 -0300
Subject: [PATCH 2/3] Attemp to fix 'cancelling divecomputer download'

This is an attemp to fix the cancelling divecomputer download
that didn't really cancelled the divecomputer download, it kept
the dives around. I *didn't* tested as my divecomputer is not with
me right now.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/downloadfromdivecomputer.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index 26635c6..a5b3d61 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -378,7 +378,13 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
 		} else {
 			process_dives(true, preferDownloaded());
 		}
-	} else {
+	} else if (currentState == CANCELLING || currentState == CANCELLED){
+		if (import_thread_cancelled) {
+			// walk backwards so we don't keep moving the dives
+			// down in the dive_table
+			for (int i = dive_table.nr - 1; i >= previousLast; i--)
+				delete_single_dive(i);
+		}
 		updateState(CANCELLED);
 	}
 }
-- 
1.9.2

From 15ef66cf646b38fc0ed8227ee4cbbc71ce9f3695 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 24 Apr 2014 15:17:30 -0300
Subject: [PATCH 3/3] Better handling of mouse on the delegates ( Equipment
 Edition )

This adds more handling of missing actions for the mouse on
the equipment edition. it complements the stuff talked about
on bug 359, but it's a different issue. 359 seems already fixed.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/modeldelegates.cpp | 9 +++++++++
 qt-ui/modeldelegates.h   | 1 +
 2 files changed, 10 insertions(+)

diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 7ddfb9a..9073ac1 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -95,8 +95,12 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
 	comboDelegate->view()->setEditTriggers(QAbstractItemView::AllEditTriggers);
 	comboDelegate->lineEdit()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this)));
 	comboDelegate->view()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this)));
+	QAbstractItemView *comboPopup = comboDelegate->lineEdit()->completer()->popup();
+	comboPopup->setMouseTracking(true);
 	connect(comboDelegate, SIGNAL(highlighted(QString)), this, SLOT(testActivation(QString)));
 	connect(comboDelegate, SIGNAL(activated(QString)), this, SLOT(fakeActivation()));
+	connect(comboPopup, SIGNAL(entered(QModelIndex)), this, SLOT(testActivation(QModelIndex)));
+	connect(comboPopup, SIGNAL(activated(QModelIndex)), this, SLOT(fakeActivation()));
 	connect(this, SIGNAL(closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)), this, SLOT(fixTabBehavior()));
 	currCombo.comboEditor = comboDelegate;
 	currCombo.currRow = index.row();
@@ -126,6 +130,11 @@ void ComboBoxDelegate::testActivation(const QString &currText)
 	setModelData(currCombo.comboEditor, currCombo.model, QModelIndex());
 }
 
+void ComboBoxDelegate::testActivation(const QModelIndex &currIndex)
+{
+	testActivation(currIndex.data().toString());
+}
+
 // HACK, send a fake event so Qt thinks we hit 'enter' on the line edit.
 void ComboBoxDelegate::fakeActivation()
 {
diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h
index d4060f9..e2b705e 100644
--- a/qt-ui/modeldelegates.h
+++ b/qt-ui/modeldelegates.h
@@ -36,6 +36,7 @@ public:
 public
 slots:
 	void testActivation(const QString &currString = QString());
+	void testActivation(const QModelIndex &currIndex);
 	//HACK: try to get rid of this in the future.
 	void fakeActivation();
 	void fixTabBehavior();
-- 
1.9.2

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to