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>
This commit is contained in:
Miika Turkia 2014-04-26 10:55:43 +03:00 committed by Dirk Hohndel
parent f6be4ccf22
commit 28f4e9b10e
2 changed files with 13 additions and 0 deletions

View file

@ -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()
{

View file

@ -50,6 +50,7 @@ slots:
void mergeDives();
void saveSelectedDivesAs();
void exportSelectedDivesAsUDDF();
void exportSelectedDivesAsCSV();
void shiftTimes();
void loadImages();
void uploadToDivelogsDE();