summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2022-06-01 15:40:56 +0400
committerIlya Fedin <fedin-ilja2010@ya.ru>2022-06-09 01:49:41 +0400
commitfb981a0954119ed0dfa4a402fdef78e7257ffc96 (patch)
tree30ca313836422a64447b52d9018b3516452e51be /src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
parent17454bf9c60d9a7f836461234f48e1bb9d7d5bf9 (diff)
Fallback to another file dialog implementation when XDP is inaccessible
Fixes: QTBUG-98988 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: Idca1ab4cae0e9eabebc599f3c8efa136a7973918 Reviewed-by: Jan Grulich <jgrulich@redhat.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp')
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
index 60d5474ed2..e6a72e4289 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp
@@ -166,11 +166,12 @@ QPlatformDialogHelper* QXdgDesktopPortalTheme::createPlatformDialogHelper(Dialog
{
Q_D(const QXdgDesktopPortalTheme);
- if (type == FileDialog) {
+ if (type == FileDialog && d->fileChooserPortalVersion) {
// Older versions of FileChooser portal don't support opening directories, therefore we fallback
// to native file dialog opened inside the sandbox to open a directory.
- if (d->fileChooserPortalVersion < 3 && d->baseTheme->usePlatformNativeDialog(type))
- return new QXdgDesktopPortalFileDialog(static_cast<QPlatformFileDialogHelper*>(d->baseTheme->createPlatformDialogHelper(type)));
+ if (d->baseTheme->usePlatformNativeDialog(type))
+ return new QXdgDesktopPortalFileDialog(static_cast<QPlatformFileDialogHelper*>(d->baseTheme->createPlatformDialogHelper(type)),
+ d->fileChooserPortalVersion);
return new QXdgDesktopPortalFileDialog;
}