summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-17 20:26:38 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-17 20:26:38 -0700
commit75a004d44a6bdbb9396996f3a7bb0c3b59d6c05c (patch)
tree79a15d48100e64a843a3845e6146f410399df942 /qt-ui/divelistview.cpp
parented2862844958a6a849a8930263b65106e77df3a7 (diff)
downloadsubsurface-75a004d44a6bdbb9396996f3a7bb0c3b59d6c05c.tar.gz
Some adjustments to "save as"
The popup menu entries should be all lowercase. Also we should handle this the same as regular save and open when it comes to remembering the last path. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index ee077081b..19fc51a5d 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -412,7 +412,7 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
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()));
+ 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());
@@ -426,10 +426,27 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
void DiveListView::saveSelectedDivesAs()
{
+ QSettings settings;
+ QString lastDir = QDir::homePath();
+
+ settings.beginGroup("FileDialog");
+ if (settings.contains("LastDir")) {
+ if(QDir::setCurrent(settings.value("LastDir").toString())) {
+ lastDir = settings.value("LastDir").toString();
+ }
+ }
+ settings.endGroup();
+
QString fileName = QFileDialog::getOpenFileName(mainWindow(), tr("Save Dives As..."), QDir::homePath());
if (fileName.isEmpty())
return;
+ // Keep last open dir
+ QFileInfo fileInfo(fileName);
+ settings.beginGroup("FileDialog");
+ settings.setValue("LastDir",fileInfo.dir().path());
+ settings.endGroup();
+
QByteArray bt = fileName.toLocal8Bit();
save_dives_logic(bt.data(), TRUE);
}