Add XDG Desktop Portal based file dialog implementation from Qt

This allows to use portal dialogs more flexibly (e.g. fallback mechanism)
This also allows to have any changes we want for portal dialogs without patchig Qt

No more need to override QT_QPA_PLATFORM to use portal dialogs
This commit is contained in:
Ilya Fedin
2021-02-05 02:06:21 +04:00
committed by John Preston
parent ce1b94eb16
commit 36acf60f7e
6 changed files with 700 additions and 33 deletions

View File

@@ -10,6 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/linux/linux_gtk_integration.h"
#include "platform/linux/specific_linux.h"
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "platform/linux/linux_xdp_file_dialog.h"
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <QtGui/QDesktopServices>
extern "C" {
@@ -77,6 +81,18 @@ bool Get(
if (parent) {
parent = parent->window();
}
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (XDP::Use(type)) {
return XDP::Get(
parent,
files,
remoteContent,
caption,
filter,
type,
startFile);
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (const auto integration = GtkIntegration::Instance()) {
if (integration->fileDialogSupported()
&& integration->useFileDialog(type)) {