summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes
diff options
context:
space:
mode:
authorJan Grulich <jgrulich@redhat.com>2018-04-05 10:47:14 +0200
committerJan Grulich <jgrulich@redhat.com>2018-04-06 05:07:05 +0000
commit470a50375a7f521078e55611c87c57e6d05924cb (patch)
tree7ec7bfd535842c10c3cc3e78f4433e7bb36ae94a /src/plugins/platformthemes
parentb6f7230cda02d9b11b309816ca1e41dbd2716fe0 (diff)
Avoid multiple connections to same response in FileChooser portal
When not specified, xdg-desktop-portal keeps using same Request object over and over when returning response, causing multiple connections to same slot on same DBus object. While this is not problem when using FileDialog just once, it is a problem for QML FileDialog which is usually reused. For this purpose x-d-p provides handle_token option where you can specify token to be used when creating Request objects. Change-Id: Ie6569700c48e05fcefa4d5c22c921410f87ea7ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/platformthemes')
-rw-r--r--src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp b/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
index 1a24015ce5..186084abd4 100644
--- a/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
+++ b/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
@@ -51,6 +51,7 @@
#include <QMetaType>
#include <QMimeType>
#include <QMimeDatabase>
+#include <QRandomGenerator>
#include <QWindow>
QT_BEGIN_NAMESPACE
@@ -231,6 +232,8 @@ void QFlatpakFileDialog::openPortal()
if (!filterList.isEmpty())
options.insert(QLatin1String("filters"), QVariant::fromValue(filterList));
+ options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));
+
// TODO choices a(ssa(ss)s)
// List of serialized combo boxes to add to the file chooser.