summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
index 2ef591a591..ec3872f174 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
@@ -175,9 +175,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());
}
}