From ed2862844958a6a849a8930263b65106e77df3a7 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 17 Oct 2013 21:50:08 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'qt-ui/divelistview.cpp') 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 #include #include +#include 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); +} -- cgit v1.2.3-70-g09d2