diff options
-rw-r--r-- | qt-ui/divelistview.cpp | 13 | ||||
-rw-r--r-- | qt-ui/divelistview.h | 1 |
2 files changed, 14 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); +} diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h index 9c468f342..9e0713b49 100644 --- a/qt-ui/divelistview.h +++ b/qt-ui/divelistview.h @@ -40,6 +40,7 @@ public slots: void mergeTripAbove(); void mergeTripBelow(); void mergeDives(); + void saveSelectedDivesAs(); signals: void currentDiveChanged(int divenr); |