summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2022-04-12 02:55:23 +0400
committerIlya Fedin <fedin-ilja2010@ya.ru>2022-04-14 03:52:52 +0400
commit974a7bd6e0ece921e699df6c2b346f944f723b83 (patch)
tree5eeb8e395e5b7f2d5077e876fbadaa4a46384de5 /src/plugins/platformthemes
parent7de83f06c1170a1a12d57b218c4009326444d4db (diff)
FileChooser portal: set current_name
Fixes: QTBUG-100297 Pick-to: 6.3 6.2 Change-Id: I5d41e01aafeccce2d886debdb595b4c87b03a043 Reviewed-by: Jan Grulich <jgrulich@redhat.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
index 66e374f621..22873974eb 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
@@ -48,6 +48,7 @@
#include <QEventLoop>
#include <QFile>
+#include <QFileInfo>
#include <QMetaType>
#include <QMimeType>
#include <QMimeDatabase>
@@ -199,8 +200,12 @@ void QXdgDesktopPortalFileDialog::openPortal()
if (!d->directory.isEmpty())
options.insert(QLatin1String("current_folder"), QFile::encodeName(d->directory).append('\0'));
- if (!d->selectedFiles.isEmpty())
+ 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(QLatin1String("current_file"), QFile::encodeName(d->selectedFiles.first()).append('\0'));
+ options.insert(QLatin1String("current_name"), QFileInfo(d->selectedFiles.first()).fileName());
+ }
}
// Insert filters