From 2af6d4aa5e582ac5af76dfa4b192af7d148d7fb3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 13 Oct 2015 21:58:33 +0200 Subject: [PATCH] GUI: ensure initial directory for file dialog exists Older Windows versions show an error message if the initial directory doesn't exist. Fixes #1438. --- ChangeLog | 7 +++ src/mkvtoolnix-gui/chapter_editor/tab.cpp | 7 +-- src/mkvtoolnix-gui/chapter_editor/tool.cpp | 17 +++-- src/mkvtoolnix-gui/header_editor/tool.cpp | 6 +- .../main_window/preferences_dialog.cpp | 3 +- src/mkvtoolnix-gui/merge/attachments.cpp | 17 ++--- .../merge/executable_location_dialog.cpp | 4 +- src/mkvtoolnix-gui/merge/input.cpp | 17 ++--- src/mkvtoolnix-gui/merge/tab.cpp | 11 ++-- src/mkvtoolnix-gui/merge/tool.cpp | 5 +- src/mkvtoolnix-gui/util/file_dialog.cpp | 62 +++++++++++++++++++ src/mkvtoolnix-gui/util/file_dialog.h | 23 +++++++ src/mkvtoolnix-gui/watch_jobs/tab.cpp | 3 +- 13 files changed, 129 insertions(+), 53 deletions(-) create mode 100644 src/mkvtoolnix-gui/util/file_dialog.cpp create mode 100644 src/mkvtoolnix-gui/util/file_dialog.h diff --git a/ChangeLog b/ChangeLog index 1cca5245d..2ca0048c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-10-13 Moritz Bunkus + + * MKVToolNix GUI: enhancement: if the last directory opened + doesn't exist anymore then default to one that does in order to + prevent an error message from older Windows versions about a + location not being available. Fixes #1438. + 2015-10-10 Moritz Bunkus * MKVToolNix GUI: enhancement: the context menu for the status bar diff --git a/src/mkvtoolnix-gui/chapter_editor/tab.cpp b/src/mkvtoolnix-gui/chapter_editor/tab.cpp index 387fb3956..a6c7d136f 100644 --- a/src/mkvtoolnix-gui/chapter_editor/tab.cpp +++ b/src/mkvtoolnix-gui/chapter_editor/tab.cpp @@ -1,6 +1,5 @@ #include "common/common_pch.h" -#include #include #include #include @@ -31,6 +30,7 @@ #include "mkvtoolnix-gui/main_window/main_window.h" #include "mkvtoolnix-gui/main_window/select_character_set_dialog.h" #include "mkvtoolnix-gui/util/file.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/header_view_manager.h" #include "mkvtoolnix-gui/util/message_box.h" #include "mkvtoolnix-gui/util/model.h" @@ -486,7 +486,7 @@ Tab::saveAsXmlImpl(bool requireNewFileName) { saveAsImpl(requireNewFileName, [this](bool doRequireNewFileName, QString &newFileName) -> bool { if (doRequireNewFileName) { auto defaultFilePath = !m_fileName.isEmpty() ? QFileInfo{m_fileName}.path() : Util::Settings::get().m_lastOpenDir.path(); - newFileName = QFileDialog::getSaveFileName(this, QY("Save chapters as XML"), defaultFilePath, QY("XML chapter files") + Q(" (*.xml);;") + QY("All files") + Q(" (*)"), nullptr, QFileDialog::DontUseCustomDirectoryIcons); + newFileName = Util::getSaveFileName(this, QY("Save chapters as XML"), defaultFilePath, QY("XML chapter files") + Q(" (*.xml);;") + QY("All files") + Q(" (*)")); if (newFileName.isEmpty()) return false; @@ -523,8 +523,7 @@ Tab::saveToMatroskaImpl(bool requireNewFileName) { if (doRequireNewFileName) { auto defaultFilePath = !m_fileName.isEmpty() ? QFileInfo{m_fileName}.path() : Util::Settings::get().m_lastOpenDir.path(); - newFileName = QFileDialog::getOpenFileName(this, QY("Save chapters to Matroska file"), defaultFilePath, QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") + QY("All files") + Q(" (*)"), - nullptr, QFileDialog::DontUseCustomDirectoryIcons); + newFileName = Util::getOpenFileName(this, QY("Save chapters to Matroska file"), defaultFilePath, QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") + QY("All files") + Q(" (*)")); if (newFileName.isEmpty()) return false; diff --git a/src/mkvtoolnix-gui/chapter_editor/tool.cpp b/src/mkvtoolnix-gui/chapter_editor/tool.cpp index 37c9edb14..bd03f7373 100644 --- a/src/mkvtoolnix-gui/chapter_editor/tool.cpp +++ b/src/mkvtoolnix-gui/chapter_editor/tool.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include "mkvtoolnix-gui/chapter_editor/tool.h" #include "mkvtoolnix-gui/main_window/main_window.h" #include "mkvtoolnix-gui/merge/mux_config.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/message_box.h" #include "mkvtoolnix-gui/util/settings.h" #include "mkvtoolnix-gui/util/widget.h" @@ -165,14 +165,13 @@ Tool::openFilesFromCommandLine(QStringList const &fileNames) { void Tool::selectFileToOpen() { - auto fileNames = QFileDialog::getOpenFileNames(this, QY("Open files in chapter editor"), Util::Settings::get().m_lastOpenDir.path(), - QY("Supported file types") + Q(" (*.mpls *.mkv *.mka *.mks *.mk3d *.txt *.xml);;") + - QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") + - QY("Blu-ray playlist files") + Q(" (*.mpls);;") + - QY("XML chapter files") + Q(" (*.xml);;") + - QY("Simple OGM-style chapter files") + Q(" (*.txt);;") + - QY("All files") + Q(" (*)"), - nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileNames = Util::getOpenFileNames(this, QY("Open files in chapter editor"), Util::Settings::get().m_lastOpenDir.path(), + QY("Supported file types") + Q(" (*.mpls *.mkv *.mka *.mks *.mk3d *.txt *.xml);;") + + QY("Matroska files") + Q(" (*.mkv *.mka *.mks *.mk3d);;") + + QY("Blu-ray playlist files") + Q(" (*.mpls);;") + + QY("XML chapter files") + Q(" (*.xml);;") + + QY("Simple OGM-style chapter files") + Q(" (*.txt);;") + + QY("All files") + Q(" (*)")); if (fileNames.isEmpty()) return; diff --git a/src/mkvtoolnix-gui/header_editor/tool.cpp b/src/mkvtoolnix-gui/header_editor/tool.cpp index 124950c8a..a7bb478c7 100644 --- a/src/mkvtoolnix-gui/header_editor/tool.cpp +++ b/src/mkvtoolnix-gui/header_editor/tool.cpp @@ -16,6 +16,7 @@ #include "mkvtoolnix-gui/header_editor/tool.h" #include "mkvtoolnix-gui/main_window/main_window.h" #include "mkvtoolnix-gui/merge/mux_config.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/message_box.h" #include "mkvtoolnix-gui/util/settings.h" #include "mkvtoolnix-gui/util/widget.h" @@ -139,9 +140,8 @@ Tool::openFile(QString const &fileName) { void Tool::selectFileToOpen() { - auto fileNames = QFileDialog::getOpenFileNames(this, QY("Open files in header editor"), Util::Settings::get().m_lastOpenDir.path(), - QY("Matroska and WebM files") + Q(" (*.mkv *.mka *.mks *.mk3d *.webm);;") + QY("All files") + Q(" (*)"), - nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileNames = Util::getOpenFileNames(this, QY("Open files in header editor"), Util::Settings::get().m_lastOpenDir.path(), + QY("Matroska and WebM files") + Q(" (*.mkv *.mka *.mks *.mk3d *.webm);;") + QY("All files") + Q(" (*)")); if (fileNames.isEmpty()) return; diff --git a/src/mkvtoolnix-gui/main_window/preferences_dialog.cpp b/src/mkvtoolnix-gui/main_window/preferences_dialog.cpp index c804f10fc..cdff3ac98 100644 --- a/src/mkvtoolnix-gui/main_window/preferences_dialog.cpp +++ b/src/mkvtoolnix-gui/main_window/preferences_dialog.cpp @@ -11,6 +11,7 @@ #include "mkvtoolnix-gui/forms/main_window/preferences_dialog.h" #include "mkvtoolnix-gui/main_window/preferences_dialog.h" #include "mkvtoolnix-gui/merge/additional_command_line_options_dialog.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/widget.h" namespace mtx { namespace gui { @@ -484,7 +485,7 @@ PreferencesDialog::enableOutputFileNameControls() { void PreferencesDialog::browseFixedOutputDirectory() { - auto dir = QFileDialog::getExistingDirectory(this, QY("Select output directory"), ui->leMAutoSetFixedDirectory->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontUseCustomDirectoryIcons); + auto dir = Util::getExistingDirectory(this, QY("Select output directory"), ui->leMAutoSetFixedDirectory->text()); if (!dir.isEmpty()) ui->leMAutoSetFixedDirectory->setText(dir); } diff --git a/src/mkvtoolnix-gui/merge/attachments.cpp b/src/mkvtoolnix-gui/merge/attachments.cpp index 56ff9cd69..21b4ba83e 100644 --- a/src/mkvtoolnix-gui/merge/attachments.cpp +++ b/src/mkvtoolnix-gui/merge/attachments.cpp @@ -1,12 +1,12 @@ #include "common/common_pch.h" -#include #include #include "common/extern_data.h" #include "common/qt.h" #include "mkvtoolnix-gui/merge/tab.h" #include "mkvtoolnix-gui/forms/merge/tab.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/files_drag_drop_widget.h" #include "mkvtoolnix-gui/util/header_view_manager.h" #include "mkvtoolnix-gui/util/model.h" @@ -141,19 +141,12 @@ Tab::onAddAttachments() { QStringList Tab::selectAttachmentsToAdd() { - QFileDialog dlg{this}; - dlg.setNameFilter(QY("All files") + Q(" (*)")); - dlg.setFileMode(QFileDialog::ExistingFiles); - dlg.setOptions(QFileDialog::DontUseCustomDirectoryIcons); - dlg.setDirectory(Util::Settings::get().m_lastOpenDir); - dlg.setWindowTitle(QY("Add attachments")); + auto fileNames = Util::getOpenFileNames(this, QY("Add attachments"), Util::Settings::get().m_lastOpenDir.path(), QY("All files") + Q(" (*)")); - if (!dlg.exec()) - return QStringList{}; + if (!fileNames.isEmpty()) + Util::Settings::get().m_lastOpenDir = QFileInfo{fileNames[0]}.path(); - Util::Settings::get().m_lastOpenDir = dlg.directory(); - - return dlg.selectedFiles(); + return fileNames; } void diff --git a/src/mkvtoolnix-gui/merge/executable_location_dialog.cpp b/src/mkvtoolnix-gui/merge/executable_location_dialog.cpp index 38c876e2a..543991e48 100644 --- a/src/mkvtoolnix-gui/merge/executable_location_dialog.cpp +++ b/src/mkvtoolnix-gui/merge/executable_location_dialog.cpp @@ -1,12 +1,12 @@ #include "common/common_pch.h" #include -#include #include #include "common/qt.h" #include "mkvtoolnix-gui/forms/merge/executable_location_dialog.h" #include "mkvtoolnix-gui/merge/executable_location_dialog.h" +#include "mkvtoolnix-gui/util/file_dialog.h" namespace mtx { namespace gui { namespace Merge { @@ -62,7 +62,7 @@ ExecutableLocationDialog::browse() { #endif filters << QY("All files") + Q(" (*)"); - auto fileName = QFileDialog::getOpenFileName(this, QY("Select executable"), m_ui->leExecutable->text(), filters.join(Q(";;")), nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getOpenFileName(this, QY("Select executable"), m_ui->leExecutable->text(), filters.join(Q(";;"))); if (!fileName.isEmpty()) m_ui->leExecutable->setText(fileName); } diff --git a/src/mkvtoolnix-gui/merge/input.cpp b/src/mkvtoolnix-gui/merge/input.cpp index 218b92f32..31a9f8dc5 100644 --- a/src/mkvtoolnix-gui/merge/input.cpp +++ b/src/mkvtoolnix-gui/merge/input.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -29,6 +28,7 @@ #include "mkvtoolnix-gui/merge/tool.h" #include "mkvtoolnix-gui/merge/playlist_scanner.h" #include "mkvtoolnix-gui/util/file_identifier.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/file_type_filter.h" #include "mkvtoolnix-gui/util/header_view_manager.h" #include "mkvtoolnix-gui/util/message_box.h" @@ -1018,19 +1018,12 @@ Tab::setDefaultsFromSettingsForAddedFiles(QList const &files) { QStringList Tab::selectFilesToAdd(QString const &title) { - QFileDialog dlg{this}; - dlg.setNameFilters(Util::FileTypeFilter::get()); - dlg.setFileMode(QFileDialog::ExistingFiles); - dlg.setDirectory(Util::Settings::get().m_lastOpenDir); - dlg.setWindowTitle(title); - dlg.setOptions(QFileDialog::HideNameFilterDetails | QFileDialog::DontUseCustomDirectoryIcons); + auto fileNames = Util::getOpenFileNames(this, title, Util::Settings::get().m_lastOpenDir.path(), Util::FileTypeFilter::get().join(Q(";;")), nullptr, QFileDialog::HideNameFilterDetails); - if (!dlg.exec()) - return QStringList{}; + if (!fileNames.isEmpty()) + Util::Settings::get().m_lastOpenDir = QFileInfo{fileNames[0]}.path(); - Util::Settings::get().m_lastOpenDir = dlg.directory(); - - return dlg.selectedFiles(); + return fileNames; } void diff --git a/src/mkvtoolnix-gui/merge/tab.cpp b/src/mkvtoolnix-gui/merge/tab.cpp index df2aa9f54..b9a48d291 100644 --- a/src/mkvtoolnix-gui/merge/tab.cpp +++ b/src/mkvtoolnix-gui/merge/tab.cpp @@ -12,6 +12,7 @@ #include "mkvtoolnix-gui/merge/tool.h" #include "mkvtoolnix-gui/forms/main_window/main_window.h" #include "mkvtoolnix-gui/forms/merge/tab.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/message_box.h" #include "mkvtoolnix-gui/util/option_file.h" #include "mkvtoolnix-gui/util/settings.h" @@ -22,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -163,7 +163,7 @@ Tab::onSaveConfig() { void Tab::onSaveOptionFile() { auto &settings = Util::Settings::get(); - auto fileName = QFileDialog::getSaveFileName(this, QY("Save option file"), settings.m_lastConfigDir.path(), QY("All files") + Q(" (*)"), nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getSaveFileName(this, QY("Save option file"), settings.m_lastConfigDir.path(), QY("All files") + Q(" (*)")); if (fileName.isEmpty()) return; @@ -177,8 +177,7 @@ Tab::onSaveOptionFile() { void Tab::onSaveConfigAs() { auto &settings = Util::Settings::get(); - auto fileName = QFileDialog::getSaveFileName(this, QY("Save settings file as"), settings.m_lastConfigDir.path(), QY("MKVToolnix GUI config files") + Q(" (*.mtxcfg);;") + QY("All files") + Q(" (*)"), - nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getSaveFileName(this, QY("Save settings file as"), settings.m_lastConfigDir.path(), QY("MKVToolnix GUI config files") + Q(" (*.mtxcfg);;") + QY("All files") + Q(" (*)")); if (fileName.isEmpty()) return; @@ -231,7 +230,7 @@ Tab::getOpenFileName(QString const &title, auto &settings = Util::Settings::get(); auto dir = determineInitialDir(lineEdit, initialDirMode); - auto fileName = QFileDialog::getOpenFileName(this, title, dir, fullFilter, nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getOpenFileName(this, title, dir, fullFilter); if (fileName.isEmpty()) return fileName; @@ -258,7 +257,7 @@ Tab::getSaveFileName(QString const &title, auto dir = !lineEdit->text().isEmpty() ? lineEdit->text() : !settings.m_lastOutputDir.path().isEmpty() && (settings.m_lastOutputDir.path() != Q(".")) ? settings.m_lastOutputDir.path() : settings.m_lastOpenDir.path(); - auto fileName = QFileDialog::getSaveFileName(this, title, dir, fullFilter, nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getSaveFileName(this, title, dir, fullFilter); if (fileName.isEmpty()) return fileName; diff --git a/src/mkvtoolnix-gui/merge/tool.cpp b/src/mkvtoolnix-gui/merge/tool.cpp index 6f4c7349e..1c9bffcd0 100644 --- a/src/mkvtoolnix-gui/merge/tool.cpp +++ b/src/mkvtoolnix-gui/merge/tool.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -14,6 +13,7 @@ #include "mkvtoolnix-gui/merge/tab.h" #include "mkvtoolnix-gui/merge/tool.h" #include "mkvtoolnix-gui/main_window/main_window.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/message_box.h" #include "mkvtoolnix-gui/util/settings.h" #include "mkvtoolnix-gui/util/widget.h" @@ -135,8 +135,7 @@ Tool::newConfig() { void Tool::openConfig() { auto &settings = Util::Settings::get(); - auto fileName = QFileDialog::getOpenFileName(this, QY("Open settings file"), settings.m_lastConfigDir.path(), QY("MKVToolnix GUI config files") + Q(" (*.mtxcfg);;") + QY("All files") + Q(" (*)"), - nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getOpenFileName(this, QY("Open settings file"), settings.m_lastConfigDir.path(), QY("MKVToolnix GUI config files") + Q(" (*.mtxcfg);;") + QY("All files") + Q(" (*)")); if (fileName.isEmpty()) return; diff --git a/src/mkvtoolnix-gui/util/file_dialog.cpp b/src/mkvtoolnix-gui/util/file_dialog.cpp new file mode 100644 index 000000000..a963a5658 --- /dev/null +++ b/src/mkvtoolnix-gui/util/file_dialog.cpp @@ -0,0 +1,62 @@ +#include "common/common_pch.h" + +#include +#include + +#include "common/qt.h" +#include "mkvtoolnix-gui/util/file_dialog.h" + +namespace mtx { namespace gui { namespace Util { + +QString +sanitizeDirectory(QString const &directory) { + auto dir = to_utf8(directory.isEmpty() || (directory == Q(".")) ? QStandardPaths::writableLocation(QStandardPaths::MoviesLocation) : directory); + auto path = bfs::absolute(bfs::path{dir}); + auto ec = boost::system::error_code{}; + + while ( !(bfs::exists(path, ec) && bfs::is_directory(path, ec)) + && !path.parent_path().empty()) + path = path.parent_path(); + + return Q(path.string()); +} + +QString +getOpenFileName(QWidget *parent, + QString const &caption, + QString const &dir, + QString const &filter, + QString *selectedFilter, + QFileDialog::Options options) { + return QFileDialog::getOpenFileName(parent, caption, sanitizeDirectory(dir), filter, selectedFilter, options & QFileDialog::DontUseCustomDirectoryIcons); +} + +QStringList +getOpenFileNames(QWidget *parent, + QString const &caption, + QString const &dir, + QString const &filter, + QString *selectedFilter, + QFileDialog::Options options) { + return QFileDialog::getOpenFileNames(parent, caption, sanitizeDirectory(dir), filter, selectedFilter, options & QFileDialog::DontUseCustomDirectoryIcons); +} + +QString +getSaveFileName(QWidget *parent, + QString const &caption, + QString const &dir, + QString const &filter, + QString *selectedFilter, + QFileDialog::Options options) { + return QFileDialog::getSaveFileName(parent, caption, sanitizeDirectory(dir), filter, selectedFilter, options & QFileDialog::DontUseCustomDirectoryIcons); +} + +QString +getExistingDirectory(QWidget *parent, + QString const &caption, + QString const &dir, + QFileDialog::Options options) { + return QFileDialog::getExistingDirectory(parent, caption, sanitizeDirectory(dir), options & QFileDialog::DontUseCustomDirectoryIcons); +} + +}}} diff --git a/src/mkvtoolnix-gui/util/file_dialog.h b/src/mkvtoolnix-gui/util/file_dialog.h new file mode 100644 index 000000000..776980752 --- /dev/null +++ b/src/mkvtoolnix-gui/util/file_dialog.h @@ -0,0 +1,23 @@ +#ifndef MTX_MKVTOOLNIX_GUI_UTIL_FILE_DIALOG_H +#define MTX_MKVTOOLNIX_GUI_UTIL_FILE_DIALOG_H + +#include "common/common_pch.h" + +#include + +class QString; + +namespace mtx { namespace gui { namespace Util { + +QString sanitizeDirectory(QString const &directory); +QString getOpenFileName(QWidget *parent = nullptr, QString const &caption = QString{}, QString const &dir = QString{}, QString const &filter = QString{}, + QString *selectedFilter = nullptr, QFileDialog::Options options = QFileDialog::Options{}); +QStringList getOpenFileNames(QWidget *parent = nullptr, QString const &caption = QString{}, QString const &dir = QString{}, QString const &filter = QString{}, + QString *selectedFilter = nullptr, QFileDialog::Options options = QFileDialog::Options{}); +QString getSaveFileName(QWidget *parent = nullptr, QString const &caption = QString{}, QString const &dir = QString{}, QString const &filter = QString{}, + QString *selectedFilter = nullptr, QFileDialog::Options options = QFileDialog::Options{}); +QString getExistingDirectory(QWidget *parent = nullptr, QString const &caption = QString{}, QString const &dir = QString{}, QFileDialog::Options options = QFileDialog::ShowDirsOnly); + +}}} + +#endif // MTX_MKVTOOLNIX_GUI_UTIL_FILE_DIALOG_H diff --git a/src/mkvtoolnix-gui/watch_jobs/tab.cpp b/src/mkvtoolnix-gui/watch_jobs/tab.cpp index ef630d6e8..b65cb45ce 100644 --- a/src/mkvtoolnix-gui/watch_jobs/tab.cpp +++ b/src/mkvtoolnix-gui/watch_jobs/tab.cpp @@ -14,6 +14,7 @@ #include "mkvtoolnix-gui/jobs/mux_job.h" #include "mkvtoolnix-gui/jobs/tool.h" #include "mkvtoolnix-gui/main_window/main_window.h" +#include "mkvtoolnix-gui/util/file_dialog.h" #include "mkvtoolnix-gui/util/message_box.h" #include "mkvtoolnix-gui/util/settings.h" #include "mkvtoolnix-gui/util/string.h" @@ -352,7 +353,7 @@ Tab::onSaveOutput() { Q_D(Tab); auto &cfg = Util::Settings::get(); - auto fileName = QFileDialog::getSaveFileName(this, QY("Save job output"), cfg.m_lastOpenDir.path(), QY("Text files") + Q(" (*.txt);;") + QY("All files") + Q(" (*)"), nullptr, QFileDialog::DontUseCustomDirectoryIcons); + auto fileName = Util::getSaveFileName(this, QY("Save job output"), cfg.m_lastOpenDir.path(), QY("Text files") + Q(" (*.txt);;") + QY("All files") + Q(" (*)")); if (fileName.isEmpty()) return;