From 28f4e9b10e04cd5429dd62d0274d6263ebaa4d04 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 26 Apr 2014 10:55:43 +0300 Subject: Add exporting selected dives into CSV file This adds option to export selected dives into a CSV file to the right click menu on dive list. Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- 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 cbabdcffe..28ed09f2c 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 3079cddab..d946b1854 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(); -- cgit v1.2.3-70-g09d2