diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 4daae9e2f..b93512a4e 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1245,17 +1245,13 @@ elseif (APPLE) endif() endif() else() - target_link_libraries(Telegram - PRIVATE - desktop-app::external_glibmm - desktop-app::external_glib - ) - if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) target_link_libraries(Telegram PRIVATE desktop-app::external_statusnotifieritem desktop-app::external_dbusmenu_qt + desktop-app::external_glibmm + desktop-app::external_glib ) endif() diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp index b4494bfee..0437363c3 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp @@ -15,13 +15,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION #include #include +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION namespace Platform { namespace File { void UnsafeOpenUrl(const QString &url) { +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION try { if (Gio::AppInfo::launch_default_for_uri(url.toStdString())) { return; @@ -29,6 +32,7 @@ void UnsafeOpenUrl(const QString &url) { } catch (const Glib::Error &e) { LOG(("App Error: %1").arg(QString::fromStdString(e.what()))); } +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION if (QDesktopServices::openUrl(url)) { return; @@ -52,6 +56,7 @@ bool UnsafeShowOpenWith(const QString &filepath) { } void UnsafeLaunch(const QString &filepath) { +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION try { if (Gio::AppInfo::launch_default_for_uri( Glib::filename_to_uri(filepath.toStdString()))) { @@ -64,6 +69,7 @@ void UnsafeLaunch(const QString &filepath) { if (UnsafeShowOpenWith(filepath)) { return; } +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION const auto qUrlPath = QUrl::fromLocalFile(filepath); if (QDesktopServices::openUrl(qUrlPath)) { diff --git a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp index 1fc136357..9db2ce660 100644 --- a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp @@ -16,8 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION #include #include +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION #include #include @@ -57,8 +59,10 @@ Launcher::Launcher(int argc, char *argv[]) } int Launcher::exec() { +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION Glib::init(); Gio::init(); +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_WEBKITGTK for (auto i = begin(_arguments), e = end(_arguments); i != e; ++i) { diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 39efcf502..77a7a6a24 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/openssl_help.h" #include "base/platform/base_platform_info.h" -#include "base/platform/linux/base_linux_glibmm_helper.h" #include "ui/platform/linux/ui_linux_wayland_integration.h" #include "platform/linux/linux_desktop_environment.h" #include "platform/linux/linux_wayland_integration.h" @@ -24,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_controller.h" #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +#include "base/platform/linux/base_linux_glibmm_helper.h" #include "base/platform/linux/base_linux_dbus_utilities.h" #include "base/platform/linux/base_linux_xdp_utilities.h" #include "platform/linux/linux_xdp_file_dialog.h" @@ -46,9 +46,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include + +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION #include #include -#include +#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION #include #include @@ -577,23 +580,14 @@ void psActivateProcess(uint64 pid) { namespace { -QString GetHomeDir() { - const auto home = QString::fromStdString(Glib::get_home_dir()); - if (!home.isEmpty() && !home.endsWith('/')) { - return home + '/'; - } - - return home; -} - #ifdef __HAIKU__ void HaikuAutostart(bool start) { - const auto home = GetHomeDir(); + const auto home = QDir::homePath(); if (home.isEmpty()) { return; } - QFile file(home + "config/settings/boot/launch/telegram-desktop"); + QFile file(home + "/config/settings/boot/launch/telegram-desktop"); if (start) { if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream out(&file); @@ -618,9 +612,9 @@ void HaikuAutostart(bool start) { QString psAppDataPath() { // Previously we used ~/.TelegramDesktop, so look there first. // If we find data there, we should still use it. - auto home = GetHomeDir(); + auto home = QDir::homePath(); if (!home.isEmpty()) { - auto oldPath = home + qsl(".TelegramDesktop/"); + auto oldPath = home + qsl("/.TelegramDesktop/"); auto oldSettingsBase = oldPath + qsl("tdata/settings"); if (QFile::exists(oldSettingsBase + '0') || QFile::exists(oldSettingsBase + '1') @@ -671,18 +665,10 @@ void start() { qputenv("PULSE_PROP_application.name", AppName.utf8()); qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1()); +#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION Glib::set_prgname(cExeName().toStdString()); Glib::set_application_name(std::string(AppName)); -#ifndef DESKTOP_APP_DISABLE_WEBKITGTK - const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath()); - char h[33] = { 0 }; - hashMd5Hex(d.constData(), d.size(), h); - - Webview::WebKit2Gtk::SetServiceName( - kWebviewService.utf16().arg(h).arg("%1").toStdString()); -#endif // !DESKTOP_APP_DISABLE_WEBKITGTK - #ifdef DESKTOP_APP_USE_PACKAGED_RLOTTIE g_warning( "Application has been built with foreign rlottie, " @@ -695,7 +681,6 @@ void start() { "this may lead to font issues."); #endif // DESKTOP_APP_USE_PACKAGED_FONTS -#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION // IBus has changed its socket path several times // and each change should be synchronized with Qt. // Moreover, the last time Qt changed the path, @@ -709,6 +694,15 @@ void start() { qputenv("IBUS_USE_PORTAL", "1"); } #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION + +#ifndef DESKTOP_APP_DISABLE_WEBKITGTK + const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath()); + char h[33] = { 0 }; + hashMd5Hex(d.constData(), d.size(), h); + + Webview::WebKit2Gtk::SetServiceName( + kWebviewService.utf16().arg(h).arg("%1").toStdString()); +#endif // !DESKTOP_APP_DISABLE_WEBKITGTK } void finish() { diff --git a/Telegram/lib_base b/Telegram/lib_base index 4ccf5d6c8..50d2d313e 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 4ccf5d6c8c7f04a3b4b583f713ada2434f3d8243 +Subproject commit 50d2d313e7127802ae25965b6144515cb5d243c2 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 246b947fa..15d1560e4 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 246b947fa747a1fd54e0b4a58516e1b3a9465c1a +Subproject commit 15d1560e41e79a2dcd0571ea75fdaeada15f017f diff --git a/cmake b/cmake index 750861b4a..03fad319f 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 750861b4ab7433c3cb3706c4392eec743cba74a2 +Subproject commit 03fad319f5911419e736c26f9458598a4d1e55f8