Make sure we open native dialogs when opening folders inside sandbox

We have to take obsoleted QFileDialog::DirectoryOnly file mode option
into account, because it is actually used, even internally in Qt when
using static QFileDialog::getExistingDirectory() method.

Change-Id: I6cdd35ae4724a1d889a0fb1c3555dc3ca4f3bf4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jan Grulich 2018-05-28 10:58:27 +02:00
parent 4b944f7bc7
commit 2f5c9ae576

View File

@ -291,7 +291,7 @@ QUrl QFlatpakFileDialog::directory() const
{
Q_D(const QFlatpakFileDialog);
if (d->nativeFileDialog && options()->fileMode() == QFileDialogOptions::Directory)
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
return d->nativeFileDialog->directory();
return d->directory;
@ -313,7 +313,7 @@ QList<QUrl> QFlatpakFileDialog::selectedFiles() const
{
Q_D(const QFlatpakFileDialog);
if (d->nativeFileDialog && options()->fileMode() == QFileDialogOptions::Directory)
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
return d->nativeFileDialog->selectedFiles();
QList<QUrl> files;
@ -353,7 +353,7 @@ void QFlatpakFileDialog::exec()
{
Q_D(QFlatpakFileDialog);
if (d->nativeFileDialog && options()->fileMode() == QFileDialogOptions::Directory) {
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) {
d->nativeFileDialog->exec();
return;
}
@ -382,7 +382,7 @@ bool QFlatpakFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
d->modal = windowModality != Qt::NonModal;
d->winId = parent ? parent->winId() : 0;
if (d->nativeFileDialog && options()->fileMode() == QFileDialogOptions::Directory)
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
return d->nativeFileDialog->show(windowFlags, windowModality, parent);
openPortal();