From f7496475674792360f1f81f72026b127b5d19616 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 26 Oct 2020 07:27:17 +0400 Subject: [PATCH] Check Qt version in runtime in CanOpenDirectoryWithPortal It is not guaranteed that app is running with the same Qt version that was compiled --- .../platform/linux/specific_linux.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 92fc41d789..6b1f011897 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include +#include #include #include @@ -756,11 +757,20 @@ bool UseXDGDesktopPortal() { } bool CanOpenDirectoryWithPortal() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED) && !defined DESKTOP_APP_DISABLE_DBUS_INTEGRATION - return FileChooserPortalVersion() >= 3; -#else // (Qt >= 5.15 || DESKTOP_APP_QT_PATCHED) && !DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION + static const auto Result = [&] { +#ifdef DESKTOP_APP_QT_PATCHED + return FileChooserPortalVersion() >= 3; +#else // DESKTOP_APP_QT_PATCHED + return QLibraryInfo::version() >= QVersionNumber(5, 15, 0) + && FileChooserPortalVersion() >= 3; +#endif // !DESKTOP_APP_QT_PATCHED + }(); + + return Result; +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION + return false; -#endif // (Qt < 5.15 && !DESKTOP_APP_QT_PATCHED) || DESKTOP_APP_DISABLE_DBUS_INTEGRATION } QString CurrentExecutablePath(int argc, char *argv[]) {