From 58cae6f66cf78721207244718af4f52f29cf6e39 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 17 Dec 2020 18:43:15 +0200 Subject: [PATCH] New option "Don't use the native file dialog". --- ChangeLog.txt | 1 + .../tapepreferencesconfigurationpage.cpp | 10 +++++- .../tapepreferencesconfigurationpage.ui | 29 ++++++++-------- .../configpages/tapepreferencespathpage.cpp | 5 +-- src/app/tape/tmainwindow.cpp | 21 ++++++------ .../preferencesconfigurationpage.cpp | 8 +++++ .../preferencesconfigurationpage.ui | 11 +++++-- .../configpages/preferencespathpage.cpp | 10 ++---- .../dialogs/dialogpatternproperties.cpp | 14 +++----- .../valentina/dialogs/dialogsavelayout.cpp | 10 ++---- src/app/valentina/mainwindow.cpp | 33 +++++++------------ src/app/valentina/watermarkwindow.cpp | 7 ++-- src/libs/vmisc/vabstractapplication.cpp | 11 +++++++ src/libs/vmisc/vabstractapplication.h | 3 ++ src/libs/vmisc/vcommonsettings.cpp | 16 +++++++++ src/libs/vmisc/vcommonsettings.h | 3 ++ .../dialogs/support/dialogeditlabel.cpp | 13 ++------ src/libs/vwidgets/vabstractmainwindow.cpp | 7 ++-- 18 files changed, 120 insertions(+), 92 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a8bbf3420..d24cf08bc 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -4,6 +4,7 @@ - Fix a regression in tool Segment a spline path. - Fix invalid visualization for tool Point of intersection circles. - New warning. Warn about empty measurements dimension value when preparing placeholders. +- New option "Don't use the native file dialog". # Version 0.7.41 Dec 4, 2020 - Bug fixes. diff --git a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp index b0854aa25..0525e3d29 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.cpp @@ -53,7 +53,10 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare ui->osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator()); // Theme - ui->darkModeCheck->setChecked(qApp->TapeSettings()->GetDarkMode()); + ui->darkModeCheck->setChecked(qApp->TapeSettings()->GetDarkMode()); + + // Native dialogs + ui->checkBoxDontUseNativeDialog->setChecked(qApp->TapeSettings()->IsDontUseNativeDialog()); //---------------------- Pattern making system ui->systemBookValueLabel->setFixedHeight(4 * QFontMetrics(ui->systemBookValueLabel->font()).lineSpacing()); @@ -106,6 +109,11 @@ QStringList TapePreferencesConfigurationPage::Apply() preferences.append(tr("dark mode")); } + if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked()) + { + settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked()); + } + if (m_langChanged || m_systemChanged) { const QString locale = qvariant_cast(ui->langCombo->currentData()); diff --git a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.ui b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.ui index 55a8f6328..659ca5168 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.ui +++ b/src/app/tape/dialogs/configpages/tapepreferencesconfigurationpage.ui @@ -170,19 +170,22 @@ User Interface - - - - 20 - 30 - 351 - 20 - - - - Activate dark mode - - + + + + + Activate dark mode + + + + + + + Don't use the native file dialog + + + + diff --git a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp index be64952b3..15d964d22 100644 --- a/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp +++ b/src/app/tape/dialogs/configpages/tapepreferencespathpage.cpp @@ -149,8 +149,9 @@ void TapePreferencesPathPage::EditPath() usedNotExistedDir = directory.mkpath(QChar('.')); } - const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path, - QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + const QString dir = QFileDialog::getExistingDirectory( + this, tr("Open Directory"), path, + qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks)); if (dir.isEmpty()) { if (usedNotExistedDir) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 2733fb09b..c8b404b52 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -520,7 +520,8 @@ void TMainWindow::CreateFromExisting() usedNotExistedDir = directory.mkpath(QChar('.')); } - const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter); + const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter, nullptr, + qApp->NativeFileDialog()); if (not mPath.isEmpty()) { @@ -889,7 +890,8 @@ bool TMainWindow::FileSaveAs() usedNotExistedDir = directory.mkpath(QChar('.')); } - QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr, + qApp->NativeFileDialog()); auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]() { @@ -997,11 +999,8 @@ void TMainWindow::ImportDataFromCSV() const QString filters = tr("Comma-Separated Values") + QStringLiteral(" (*.csv)"); const QString suffix = QStringLiteral("csv"); - QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + QString fileName = QFileDialog::getOpenFileName(this, tr("Import from CSV"), QDir::homePath(), filters, nullptr, + qApp->NativeFileDialog()); if (fileName.isEmpty()) { @@ -1471,7 +1470,8 @@ void TMainWindow::ImportFromPattern() //Use standard path to individual measurements QString pathTo = qApp->TapeSettings()->GetPathPattern(); - const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter); + const QString mPath = QFileDialog::getOpenFileName(this, tr("Import from a pattern"), pathTo, filter, nullptr, + qApp->NativeFileDialog()); if (mPath.isEmpty()) { return; @@ -2189,7 +2189,7 @@ void TMainWindow::ExportToIndividual() QString filters = tr("Individual measurements") + QStringLiteral(" (*.vit)"); QString fName = tr("measurements.vit"); QString fileName = QFileDialog::getSaveFileName(this, tr("Export to individual"), dir + QChar('/') + fName, - filters); + filters, nullptr, qApp->NativeFileDialog()); auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]() { @@ -3358,7 +3358,8 @@ bool TMainWindow::EvalFormula(const QString &formula, bool fromUser, VContainer //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::Open(const QString &pathTo, const QString &filter) { - const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter); + const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter, nullptr, + qApp->NativeFileDialog()); if (not mPath.isEmpty()) { diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp index 27757cb39..9a35dbc0d 100644 --- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp @@ -130,6 +130,9 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent) // Tool panel ui->checkBoxToolPanelScaling->setChecked(settings->GetToolPanelScaling()); + // Native dialogs + ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog()); + // Tab Scrolling ui->spinBoxDuration->setMinimum(VSettings::scrollingDurationMin); ui->spinBoxDuration->setMaximum(VSettings::scrollingDurationMax); @@ -186,6 +189,11 @@ QStringList PreferencesConfigurationPage::Apply() settings->SetToolPanelScaling(ui->checkBoxToolPanelScaling->isChecked()); } + if (settings->IsDontUseNativeDialog() != ui->checkBoxDontUseNativeDialog->isChecked()) + { + settings->SetDontUseNativeDialog(ui->checkBoxDontUseNativeDialog->isChecked()); + } + settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked()); settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked()); diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui index 2433eb5b2..5004dcd15 100644 --- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui +++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui @@ -33,9 +33,9 @@ 0 - -161 + -189 624 - 717 + 745 @@ -283,6 +283,13 @@ + + + + Don't use the native file dialog + + + diff --git a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp index 9d9195630..c700941e3 100644 --- a/src/app/valentina/dialogs/configpages/preferencespathpage.cpp +++ b/src/app/valentina/dialogs/configpages/preferencespathpage.cpp @@ -166,13 +166,9 @@ void PreferencesPathPage::EditPath() usedNotExistedDir = directory.mkpath(QChar('.')); } - const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path, - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks -#ifdef Q_OS_LINUX - | QFileDialog::DontUseNativeDialog -#endif - ); + const QString dir = QFileDialog::getExistingDirectory( + this, tr("Open Directory"), path, + qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks)); if (dir.isEmpty()) { if (usedNotExistedDir) diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 61b949bbe..8bfd1e708 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -411,11 +411,8 @@ void DialogPatternProperties::InitImage() void DialogPatternProperties::ChangeImage() { const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)"); - const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + const QString fileName = QFileDialog::getOpenFileName(this, tr("Image for pattern"), QString(), filter, nullptr, + qApp->NativeFileDialog()); if (not fileName.isEmpty()) { QImage image; @@ -456,11 +453,8 @@ void DialogPatternProperties::SaveImage() QByteArray ba = QByteArray::fromBase64(byteArray); const QString extension = doc->GetImageExtension().prepend(QChar('.')); QString filter = tr("Images") + QStringLiteral(" (*") + extension + QChar(')'); - QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + QString filename = QFileDialog::getSaveFileName(this, tr("Save File"), tr("untitled"), filter, &filter, + qApp->NativeFileDialog()); if (not filename.isEmpty()) { if (not filename.endsWith(extension.toUpper())) diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index af2a962c9..55b1490c5 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -127,13 +127,9 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName usedNotExistedDir = directory.mkpath(QChar('.')); } - const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), dirPath, - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks -#ifdef Q_OS_LINUX - | QFileDialog::DontUseNativeDialog -#endif - ); + const QString dir = QFileDialog::getExistingDirectory( + this, tr("Select folder"), dirPath, + qApp->NativeFileDialog(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks)); if (not dir.isEmpty()) {// If paths equal the signal will not be called, we will do this manually dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index f18988a76..8b9292c46 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1769,11 +1769,8 @@ void MainWindow::LoadIndividual() usedNotExistedDir = directory.mkpath(QChar('.')); } - const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr, + qApp->NativeFileDialog()); if (not mPath.isEmpty()) { @@ -1810,11 +1807,8 @@ void MainWindow::LoadMultisize() //Use standard path to multisize measurements QString path = qApp->ValentinaSettings()->GetPathMultisizeMeasurements(); path = VCommonSettings::PrepareMultisizeTables(path); - const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter, nullptr, + qApp->NativeFileDialog()); if (not mPath.isEmpty()) { @@ -2034,7 +2028,8 @@ void MainWindow::LoadWatermark() const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)")); QString dir = QDir::homePath(); qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); - const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr); + const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr, + qApp->NativeFileDialog()); if (filePath.isEmpty()) { return; @@ -3108,11 +3103,7 @@ bool MainWindow::on_actionSaveAs_triggered() QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"), - filters, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + filters, nullptr, qApp->NativeFileDialog()); auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]() { @@ -3305,11 +3296,8 @@ void MainWindow::on_actionOpen_triggered() dir = QFileInfo(files.first()).absolutePath(); } qCDebug(vMainWindow, "Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); - const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr, + qApp->NativeFileDialog()); if (filePath.isEmpty()) { return; @@ -4762,7 +4750,7 @@ void MainWindow::CreateActions() QString fileName = QFileDialog::getSaveFileName(this, tr("Export recipe"), QDir::homePath() + '/' + tr("recipe") + QStringLiteral(".vpr"), - filters, nullptr); + filters, nullptr, qApp->NativeFileDialog()); if (fileName.isEmpty()) { return; @@ -5569,6 +5557,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS QFileDialog dialog(this, tr("Open file"), dirPath, filter); dialog.selectFile(selectedName); dialog.setFileMode(QFileDialog::ExistingFile); + dialog.setOption(QFileDialog::DontUseNativeDialog, qApp->Settings()->IsDontUseNativeDialog()); if (dialog.exec() == QDialog::Accepted) { mPath = dialog.selectedFiles().value(0); diff --git a/src/app/valentina/watermarkwindow.cpp b/src/app/valentina/watermarkwindow.cpp index 484009b50..d29c487c3 100644 --- a/src/app/valentina/watermarkwindow.cpp +++ b/src/app/valentina/watermarkwindow.cpp @@ -93,7 +93,7 @@ WatermarkWindow::WatermarkWindow(const QString &patternPath, QWidget *parent) : { const QString filter = tr("Images") + QLatin1String(" (*.png *.jpg *.jpeg *.bmp)"); const QString fileName = QFileDialog::getOpenFileName(this, tr("Watermark image"), QString(), filter, - nullptr); + nullptr, qApp->NativeFileDialog()); if (not fileName.isEmpty()) { ui->lineEditPath->setText(fileName); @@ -284,7 +284,7 @@ bool WatermarkWindow::on_actionSaveAs_triggered() QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QLatin1String("/") + tr("watermark") + QLatin1String(".vwm"), - filters, nullptr); + filters, nullptr, qApp->NativeFileDialog()); if (fileName.isEmpty()) { @@ -426,7 +426,8 @@ void WatermarkWindow::on_actionOpen_triggered() const QString filter(tr("Watermark files") + QLatin1String(" (*.vwm)")); QString dir = QDir::homePath(); qDebug("Run QFileDialog::getOpenFileName: dir = %s.", qUtf8Printable(dir)); - const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr); + const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter, nullptr, + qApp->NativeFileDialog()); if (filePath.isEmpty()) { return; diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 9c185d0e6..6e9359cd4 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -313,3 +313,14 @@ bool VAbstractApplication::IsWarningMessage(const QString &message) const { return VAbstractApplication::ClearMessage(message).startsWith(warningMessageSignature); } + +//--------------------------------------------------------------------------------------------------------------------- +QFileDialog::Options VAbstractApplication::NativeFileDialog(QFileDialog::Options options) const +{ + if (settings->IsDontUseNativeDialog()) + { + options |= QFileDialog::DontUseNativeDialog; + } + + return options; +} diff --git a/src/libs/vmisc/vabstractapplication.h b/src/libs/vmisc/vabstractapplication.h index 6afaf899d..907627c59 100644 --- a/src/libs/vmisc/vabstractapplication.h +++ b/src/libs/vmisc/vabstractapplication.h @@ -39,6 +39,7 @@ #include #include #include +#include #include "../vmisc/def.h" #include "../vpatterndb/vtranslatevars.h" @@ -82,6 +83,8 @@ public: static const QString warningMessageSignature; bool IsWarningMessage(const QString &message) const; + QFileDialog::Options NativeFileDialog(QFileDialog::Options options = QFileDialog::Options()) const; + #if defined(Q_OS_WIN) static void WinAttachConsole(); #endif diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 53597647d..c751b1783 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -66,6 +66,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewrit Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP"))) +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDontUseNativeDialog, (QLatin1String("configuration/dontUseNativeDialog"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping"))) @@ -1170,6 +1171,21 @@ void VCommonSettings::SetPieceShowMainPath(bool value) setValue(*settingPatternPieceShowMainPath, pieceShowMainPath); } +//--------------------------------------------------------------------------------------------------------------------- +bool VCommonSettings::IsDontUseNativeDialog() const +{ + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + return settings.value(*settingConfigurationDontUseNativeDialog, false).toBool(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetDontUseNativeDialog(bool value) +{ + QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename); + settings.setValue(*settingConfigurationDontUseNativeDialog, value); + settings.sync(); +} + //--------------------------------------------------------------------------------------------------------------------- qreal VCommonSettings::GetLineWidth() const { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 26f5acd17..dcaf01daf 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -214,6 +214,9 @@ public: bool IsPieceShowMainPath() const; void SetPieceShowMainPath(bool value); + bool IsDontUseNativeDialog() const; + void SetDontUseNativeDialog(bool value); + static qreal DefaultLineWidth(); static qreal MinimalLineWidth(); static qreal MaximalLineWidth(); diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index cead64f07..264180196 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -300,11 +300,7 @@ void DialogEditLabel::ExportTemplate() QString fileName = QFileDialog::getSaveFileName(this, tr("Export label template"), path + QLatin1String("/") + tr("template") + QLatin1String(".xml"), - filters, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + filters, nullptr, qApp->NativeFileDialog()); if (fileName.isEmpty()) { @@ -353,11 +349,8 @@ void DialogEditLabel::ImportTemplate() QString filter(tr("Label template") + QLatin1String(" (*.xml)")); //Use standard path to label templates const QString path = VCommonSettings::PrepareLabelTemplates(qApp->Settings()->GetPathLabelTemplate()); - const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + const QString fileName = QFileDialog::getOpenFileName(this, tr("Import template"), path, filter, nullptr, + qApp->NativeFileDialog()); if (fileName.isEmpty()) { return; diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp index 6f59a2958..73ae710fa 100644 --- a/src/libs/vwidgets/vabstractmainwindow.cpp +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -180,11 +180,8 @@ QString VAbstractMainWindow::CSVFilePath() const QString suffix("csv"); const QString path = QDir::homePath() + QChar('/') + tr("values") + QChar('.') + suffix; - QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr -#ifdef Q_OS_LINUX - , QFileDialog::DontUseNativeDialog -#endif - ); + QString fileName = QFileDialog::getSaveFileName(this, tr("Export to CSV"), path, filters, nullptr, + qApp->NativeFileDialog()); if (fileName.isEmpty()) {