summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
authorDavid Redondo <qt@david-redondo.de>2023-05-22 14:06:37 +0200
committerDavid Redondo <qt@david-redondo.de>2023-07-12 19:15:03 +0200
commit42fd8a8e8a758e7e4ddaae9943402b2e3bae25fe (patch)
tree34257670fd9bb585684bb76c1f3b068a1e791d34 /src/plugins/platformthemes
parent3ba3f322b6b1781cfc1a64be8240b1ae74c36840 (diff)
Add support for setting the initial directory in portal file dialog
Change-Id: I2bceddb470e7870f19fc616e3dbae73cc057cb66 Reviewed-by: David Edmundson <davidedmundson@kde.org>
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
index ec3872f174..e3d55f4510 100644
--- a/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
+++ b/src/plugins/platformthemes/xdgdesktopportal/qxdgdesktopportalfiledialog.cpp
@@ -169,19 +169,18 @@ void QXdgDesktopPortalFileDialog::openPortal(Qt::WindowFlags windowFlags, Qt::Wi
options.insert("multiple"_L1, d->multipleFiles);
options.insert("directory"_L1, d->directoryMode);
- if (d->saveFile) {
- if (!d->directory.isEmpty())
- options.insert("current_folder"_L1, QFile::encodeName(d->directory).append('\0'));
-
- 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 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());
- }
+ if (!d->directory.isEmpty())
+ options.insert("current_folder"_L1, QFile::encodeName(d->directory).append('\0'));
+
+ if (d->saveFile && !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 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());
}
// Insert filters