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>
This commit is contained in:
Tomaz Canabrava 2013-10-17 21:50:08 -03:00 committed by Dirk Hohndel
parent 8259b1a59a
commit ed28628449
2 changed files with 14 additions and 0 deletions

View file

@ -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);
}

View file

@ -40,6 +40,7 @@ public slots:
void mergeTripAbove();
void mergeTripBelow();
void mergeDives();
void saveSelectedDivesAs();
signals:
void currentDiveChanged(int divenr);