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>
This commit is contained in:
Dirk Hohndel 2015-10-05 03:34:27 +01:00
parent 1719a7f59e
commit 021af81443

View file

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