diff options
Diffstat (limited to 'src/plugins/platformthemes/xdgdesktopportal')
-rw-r--r-- | src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp index 54e600fcbe..9e3afea7c5 100644 --- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp +++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp @@ -173,9 +173,12 @@ void QXdgDesktopPortalFileDialog::openPortal(Qt::WindowFlags windowFlags, Qt::Wi if (!d->selectedFiles.isEmpty()) { // current_file for the file to be pre-selected, current_name for the file name to be pre-filled - // current_file accepts absolute path while current_name accepts just file name - options.insert("current_file"_L1, QFile::encodeName(d->selectedFiles.first()).append('\0')); - options.insert("current_name"_L1, QFileInfo(d->selectedFiles.first()).fileName()); + // current_file accepts absolute path and requires the file to exist + // while current_name accepts just file name + QFileInfo selectedFileInfo(d->selectedFiles.first()); + if (selectedFileInfo.exists()) + options.insert("current_file"_L1, QFile::encodeName(d->selectedFiles.first()).append('\0')); + options.insert("current_name"_L1, selectedFileInfo.fileName()); } } diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp index e6a72e4289..552a78278f 100644 --- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp +++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportaltheme.cpp @@ -75,7 +75,7 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme() QStringList themeNames; themeNames += QGuiApplicationPrivate::platform_integration->themeNames(); // 1) Look for a theme plugin. - for (const QString &themeName : qAsConst(themeNames)) { + for (const QString &themeName : std::as_const(themeNames)) { d->baseTheme = QPlatformThemeFactory::create(themeName, nullptr); if (d->baseTheme) break; @@ -84,7 +84,7 @@ QXdgDesktopPortalTheme::QXdgDesktopPortalTheme() // 2) If no theme plugin was found ask the platform integration to // create a theme if (!d->baseTheme) { - for (const QString &themeName : qAsConst(themeNames)) { + for (const QString &themeName : std::as_const(themeNames)) { d->baseTheme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName); if (d->baseTheme) break; |