diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index 8c6eb554b..08f9ae384 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -84,27 +84,31 @@ ApplicationDialog::~ApplicationDialog() void ApplicationDialog::Browse() { - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::ExistingFiles); - - if (dialog.exec()) - { - QStringList list = dialog.selectedFiles(); - if (list.size() > 0) - { - QString path(QDir::toNativeSeparators(list[0])); - - // In Windows we must surround paths including spaces with quotation marks. + QString filter; #ifdef Q_WS_WIN - if (path.indexOf(" ") > -1) - { - path.insert(0, "\""); - path.append("\""); - } + // In Windows (almost) all executables have .exe extension + // so it does not make sense to show everything. + filter += tr("Executable files (*.exe);;All files(*.*)"); +#endif // Q_WS_WIN + QString selectedFile = QFileDialog::getOpenFileName(this, + tr("Select viewer application"), + QString(), + filter); + + if (!selectedFile.isEmpty()) + { + QString path(QDir::toNativeSeparators(selectedFile)); + + // In Windows we must surround paths including spaces with quotation marks. +#ifdef Q_WS_WIN + if (path.indexOf(" ") > -1) + { + path.insert(0, "\""); + path.append("\""); + } #endif // Q_WS_WIN - mPath->setText(path); - } + mPath->setText(path); } }