aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-22 16:06:01 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-22 16:06:01 -0800
commit38bbed978a86d5b748ed61540632a25859cab7df (patch)
tree6e6bcd5ffe75d9ffa251cdcef0fe36780dbfc493 /qt-ui/mainwindow.cpp
parentba1631f52d931b5fdc66d0ae6033203d133b74c2 (diff)
downloadsubsurface-38bbed978a86d5b748ed61540632a25859cab7df.tar.gz
Use our own file open dialog
Clearly the static dialogs don't work. Even with the previous commit the dialog still said "Save" insted of "Open". So let's just assemble our own dialog and be done with it. I hope I got all the options right... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index c455a43fe..a02ff0357 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -211,12 +211,19 @@ void MainWindow::on_actionOpen_triggered()
// 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(), NULL, QFileDialog::DontConfirmOverwrite);
- if (filename.isEmpty())
+ QFileDialog dialog(this, tr("Open file"), lastUsedDir(), filter());
+ dialog.setFileMode(QFileDialog::AnyFile);
+ dialog.setViewMode(QFileDialog::Detail);
+ dialog.setLabelText(QFileDialog::Accept, tr("Open"));
+ dialog.setLabelText(QFileDialog::Reject, tr("Cancel"));
+ QStringList filenames;
+ if (dialog.exec())
+ filenames = dialog.selectedFiles();
+ if (filenames.isEmpty())
return;
- updateLastUsedDir(QFileInfo(filename).dir().path());
+ updateLastUsedDir(QFileInfo(filenames.first()).dir().path());
closeCurrentFile();
- loadFiles(QStringList() << filename);
+ loadFiles(filenames);
}
void MainWindow::on_actionSave_triggered()