[PATCH 4/4] Include dive site on divelogs export

Miika Turkia miika.turkia at gmail.com
Sun Sep 6 11:40:15 PDT 2015


Due to the new dive site management, we need to include this information
before transforming the XML to divelogs.de format.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 qt-ui/subsurfacewebservices.cpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 128e199..1722da4 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -192,7 +192,25 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
 			continue;
 		/* make sure the buffer is empty and add the dive */
 		mb.len = 0;
+
+		struct dive_site *ds = get_dive_site_by_uuid(dive->dive_site_uuid);
+
+		if (ds) {
+			put_format(&mb, "<divelog><divesites><site uuid='%8x' name='", dive->dive_site_uuid);
+			put_quoted(&mb, ds->name, 1, 0);
+			put_format(&mb, "'");
+			if (ds->latitude.udeg || ds->longitude.udeg) {
+				put_degrees(&mb, ds->latitude, " gps='", " ");
+				put_degrees(&mb, ds->longitude, "", "'");
+			}
+			put_format(&mb, "/>\n</divesites>\n");
+		}
+
 		save_one_dive_to_mb(&mb, dive);
+
+		if (ds) {
+			put_format(&mb, "</divelog>\n");
+		}
 		membuf = mb_cstring(&mb);
 		streamsize = strlen(membuf);
 		/*
-- 
2.1.4



More information about the subsurface mailing list