[PATCH 5/5] Add exporting selected dives into CSV file
Miika Turkia
miika.turkia at gmail.com
Sat Apr 26 00:55:43 PDT 2014
This adds option to export selected dives into a CSV file to the right
click menu on dive list.
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
qt-ui/divelistview.cpp | 12 ++++++++++++
qt-ui/divelistview.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index cbabdcf..28ed09f 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -761,6 +761,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
if (amount_selected >= 1) {
popup.addAction(tr("save As"), this, SLOT(saveSelectedDivesAs()));
popup.addAction(tr("export As UDDF"), this, SLOT(exportSelectedDivesAsUDDF()));
+ popup.addAction(tr("export As CSV"), this, SLOT(exportSelectedDivesAsCSV()));
popup.addAction(tr("shift times"), this, SLOT(shiftTimes()));
popup.addAction(tr("load images"), this, SLOT(loadImages()));
}
@@ -816,6 +817,17 @@ void DiveListView::exportSelectedDivesAsUDDF()
export_dives_xslt(filename.toUtf8(), true, "uddf-export.xslt");
}
+void DiveListView::exportSelectedDivesAsCSV()
+{
+ QString filename;
+ QFileInfo fi(system_default_filename());
+
+ filename = QFileDialog::getSaveFileName(this, tr("Export CSV File as"), fi.absolutePath(),
+ tr("CSV files (*.csv *.CSV)"));
+ if (!filename.isNull() && !filename.isEmpty())
+ export_dives_xslt(filename.toUtf8(), true, "xml2csv.xslt");
+}
+
void DiveListView::shiftTimes()
{
diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h
index 3079cdd..d946b18 100644
--- a/qt-ui/divelistview.h
+++ b/qt-ui/divelistview.h
@@ -50,6 +50,7 @@ slots:
void mergeDives();
void saveSelectedDivesAs();
void exportSelectedDivesAsUDDF();
+ void exportSelectedDivesAsCSV();
void shiftTimes();
void loadImages();
void uploadToDivelogsDE();
--
1.8.3.2
More information about the subsurface
mailing list