diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-04-26 10:55:43 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-26 17:24:12 -0700 |
commit | 28f4e9b10e04cd5429dd62d0274d6263ebaa4d04 (patch) | |
tree | 7d34f7268b75ff85d7f6d3fcc6bf5641e152f37b /qt-ui | |
parent | f6be4ccf226da8a8f5326ac742d2cebd83d599e9 (diff) | |
download | subsurface-28f4e9b10e04cd5429dd62d0274d6263ebaa4d04.tar.gz |
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 <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/divelistview.cpp | 12 | ||||
-rw-r--r-- | qt-ui/divelistview.h | 1 |
2 files changed, 13 insertions, 0 deletions
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(); |