aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-05 03:34:27 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-05 16:35:08 +0100
commit021af8144362a22c036c83a5d30f42edf8e9c16e (patch)
treedf4e06cb5c4be5af89845199895272db89f341ff
parent1719a7f59ec24cb08b839534e60b163386663add (diff)
downloadsubsurface-021af8144362a22c036c83a5d30f42edf8e9c16e.tar.gz
With no filename set pick reasonable directory for Save as
If the user has no default filename set and starts Subsurface without a filename, the directory that is opened with Save as ends up being the current working directory of the executable, which might be its installation directory - which in general is not a good place to save data files to. With this change we pick the directory which is usually used for the default file, which should give us reasonable places on all OSs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1f131402e..104dfee04 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1433,7 +1433,10 @@ int MainWindow::file_save_as(void)
selection_dialog.setAcceptMode(QFileDialog::AcceptSave);
selection_dialog.setFileMode(QFileDialog::AnyFile);
selection_dialog.setDefaultSuffix("");
-
+ if (same_string(default_filename, "")) {
+ QFileInfo defaultFile(system_default_filename());
+ selection_dialog.setDirectory(qPrintable(defaultFile.absolutePath()));
+ }
/* if the exit/cancel button is pressed return */
if (!selection_dialog.exec())
return 0;