summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-10-17 21:50:08 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-17 20:19:50 -0700
commited2862844958a6a849a8930263b65106e77df3a7 (patch)
treead38145bebf09acf2419e97ac19293124192b57f /qt-ui/divelistview.cpp
parent8259b1a59aa679a65df2130d507fcccab9fa4fe1 (diff)
downloadsubsurface-ed2862844958a6a849a8930263b65106e77df3a7.tar.gz
Added 'Save As' option on the dive list menu.
This adds the 'Save As' option on the dive list, very straigth forward, just simple and beauty. tested and working. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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);
+}