From 75a004d44a6bdbb9396996f3a7bb0c3b59d6c05c Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 17 Oct 2013 20:26:38 -0700 Subject: 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 --- qt-ui/divelistview.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.3-70-g09d2