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>
This commit is contained in:
Jan Grulich 2018-04-05 10:47:14 +02:00
parent b6f7230cda
commit 470a50375a

View File

@ -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.