summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-21 09:46:24 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-21 09:46:24 -0800
commitfc7f0c621501e90b723fb66c81effc6b47065647 (patch)
tree9f785c42f487ec8ceeb7852b2075b2098add5652
parent61cc1c4dbe98e78080510e1d16e44200a3475e98 (diff)
downloadsubsurface-fc7f0c621501e90b723fb66c81effc6b47065647.tar.gz
Use getSaveFileName() as the file open dialog
This way we can specify file names that don't exist and therefore make our git syntax (/path/to/dir[branch]) work. Thanks to Tomaz for pointing this out. 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 d908fcd08..0b97d8c94 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -208,7 +208,10 @@ void MainWindow::on_actionOpen_triggered()
if (!okToClose(tr("Please save or cancel the current dive edit before opening a new file.")))
return;
- QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), lastUsedDir(), filter());
+ // yes, this look wrong to use getSaveFileName() for the open dialog, but we need to be able
+ // to enter file names that don't exist in order to use our git syntax /path/to/dir[branch]
+ // with is a potentially valid input, but of course won't exist. So getOpenFileName() wouldn't work
+ QString filename = QFileDialog::getSaveFileName(this, tr("Open file"), lastUsedDir(), filter());
if (filename.isEmpty())
return;
updateLastUsedDir(QFileInfo(filename).dir().path());