aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index a14edd09d..ee077081b 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -19,6 +19,7 @@
#include <QLineEdit>
#include <QKeyEvent>
#include <QMenu>
+#include <QFileDialog>
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
currentHeaderClicked(-1), searchBox(new QLineEdit(this))
@@ -410,6 +411,8 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
popup.addAction(tr("delete dive"), this, SLOT(deleteDive()));
if (amount_selected > 1 && consecutive_selected())
popup.addAction(tr("merge selected dives"), this, SLOT(mergeDives()));
+ if (amount_selected >= 1)
+ popup.addAction(tr("Save As"), this, SLOT(saveSelectedDivesAs()));
// "collapse all" really closes all trips,
// "collapse" keeps the trip with the selected dive open
QAction * actionTaken = popup.exec(event->globalPos());
@@ -420,3 +423,13 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
}
event->accept();
}
+
+void DiveListView::saveSelectedDivesAs()
+{
+ QString fileName = QFileDialog::getOpenFileName(mainWindow(), tr("Save Dives As..."), QDir::homePath());
+ if (fileName.isEmpty())
+ return;
+
+ QByteArray bt = fileName.toLocal8Bit();
+ save_dives_logic(bt.data(), TRUE);
+}