OpenFile portal: use "writable" option to specify our FD is writable

When using OpenFile portal and passing a file descriptor, we open the
file with qt_safe_open() which by defaults make the file descriptor
writable. However we didn't specify in options that the FD is writable
which leads into rejection on xdg-desktop-portal side as there is a
mismatch between writable FD and read-only request.

Pick-to: 5.15
Change-Id: I7a430339a9615f0a054e777e0f3de56e219d1706
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Jan Grulich 2020-09-24 09:59:04 +02:00
parent 2a5afb88db
commit 3e09ac369d

View File

@ -214,8 +214,10 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
QDBusUnixFileDescriptor descriptor;
descriptor.giveFileDescriptor(fd);
// FIXME parent_window_id and handle writable option
message << QString() << QVariant::fromValue(descriptor) << QVariantMap();
const QVariantMap options = {{QLatin1String("writable"), true}};
// FIXME parent_window_id
message << QString() << QVariant::fromValue(descriptor) << options;
return QDBusConnection::sessionBus().call(message);
}