From d60b7e5a0132deb9d79abe5b183f6140aff13c6d Mon Sep 17 00:00:00 2001
From: Abhinav Agarwal <aagarwal.gtr@gmail.com>
Date: Fri, 20 Mar 2015 23:25:08 +0530
Subject: [PATCH] Solves Bug#860

While exporting a divelog to xml/ssrf, if given filename containsa dot it doesnt get saved as intended. Eg: if given filename is 'divelog.first' it should get saved as 'divelog.first.ssrf' but it gets saved as 'divelog.first'. This happens only on linux and not on windows. If you were to do the same on windows it would get saved as 'divelog.first.xml'. This commit solves this issue.

Signed-off-by: Abhinav Agarwal <aagarwal.gtr@gmail.com>
---
 qt-ui/divelogexportdialog.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 12a8c32..1636c4b 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -295,7 +295,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
 			filename = QFileDialog::getSaveFileName(this, tr("Export Subsurface XML"), lastDir,
 								tr("XML files (*.xml *.ssrf)"));
 			if (!filename.isNull() && !filename.isEmpty()) {
-				if (!filename.contains('.'))
+				if ((!filename.contains('.')) || (filename.contains('.') && !filename.endsWith(".xml") && !filename.endsWith(".ssrf")))
 					filename.append(".ssrf");
 				QByteArray bt = QFile::encodeName(filename);
 				save_dives_logic(bt.data(), ui->exportSelected->isChecked());
-- 
2.1.0

