Commit e27ab3a7 authored by Ivan Yossi's avatar Ivan Yossi 👌

Fix native dialog save/open on macos 10.15

If native FileDialog is set as "modal" the dialog exec
method will always return "0".

Is we are in macOS and Native FileDialog is set we
avoid setting the dialog as Modal as native FileDialog
in macOS always behave as a Modal Dialog

BUG:413241
parent b0e82fe0
......@@ -248,9 +248,6 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
#endif
#ifdef Q_OS_WIN
dontUseNative = false;
#endif
#ifdef Q_OS_MACOS
m_chkNativeFileDialog->setVisible(false);
#endif
m_chkNativeFileDialog->setChecked(!group.readEntry("DontUseNativeFileDialog", dontUseNative));
......
......@@ -159,12 +159,12 @@ void KoFileDialog::createFileDialog()
dontUseNative = false;
#endif
d->fileDialog->setOption(QFileDialog::DontUseNativeDialog, group.readEntry("DontUseNativeFileDialog", dontUseNative));
bool optionDontUseNative = group.readEntry("DontUseNativeFileDialog", dontUseNative);
d->fileDialog->setOption(QFileDialog::DontUseNativeDialog, optionDontUseNative);
d->fileDialog->setOption(QFileDialog::DontConfirmOverwrite, false);
d->fileDialog->setOption(QFileDialog::HideNameFilterDetails, dontUseNative ? true : false);
#ifdef Q_OS_MACOS
d->fileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
QList<QUrl> urls = d->fileDialog->sidebarUrls();
QUrl volumes = QUrl::fromLocalFile("/Volumes");
if (!urls.contains(volumes)) {
......@@ -218,7 +218,15 @@ void KoFileDialog::createFileDialog()
if (d->type == ImportDirectory ||
d->type == ImportFile || d->type == ImportFiles ||
d->type == SaveFile) {
d->fileDialog->setWindowModality(Qt::WindowModal);
bool allowModal = true;
// MacOS do not declare native file dialog as modal BUG:413241.
#ifdef Q_OS_MACOS
allowModal = optionDontUseNative;
#endif
if (allowModal) {
d->fileDialog->setWindowModality(Qt::WindowModal);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment