From 48b24d12b2435ef7a219e995d53f8e12240394f6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 21 Jan 2020 18:39:13 +0300 Subject: [PATCH] Always ask for TDESKTOP_LAUNCHER_BASENAME on Linux. --- Telegram/SourceFiles/core/launcher.cpp | 6 ++---- .../SourceFiles/platform/linux/main_window_linux.cpp | 5 +---- .../platform/linux/notifications_manager_linux.cpp | 7 +------ Telegram/cmake/telegram_options.cmake | 11 ++++++++--- Telegram/lib_base | 2 +- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index e7afa1912..4ba3e197c 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -248,10 +248,8 @@ void Launcher::init() { QApplication::setApplicationName(qsl("TelegramDesktop")); -#ifdef TDESKTOP_LAUNCHER_FILENAME - QApplication::setDesktopFileName(qsl(MACRO_TO_STRING(TDESKTOP_LAUNCHER_FILENAME))); -#elif defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) - QApplication::setDesktopFileName(qsl("telegramdesktop.desktop")); +#if defined(Q_OS_LINUX) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) + QApplication::setDesktopFileName(qsl(MACRO_TO_STRING(TDESKTOP_LAUNCHER_BASENAME)) + ".desktop"); #endif #ifndef OS_MAC_OLD diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 7d7ea6cdf..5a99062d7 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -548,10 +548,7 @@ void MainWindow::psFirstShow() { auto snapName = QString::fromLatin1(qgetenv("SNAP_NAME")); if(snapName.isEmpty()) { std::vector possibleDesktopFiles = { -#ifdef TDESKTOP_LAUNCHER_FILENAME - MACRO_TO_STRING(TDESKTOP_LAUNCHER_FILENAME), -#endif // TDESKTOP_LAUNCHER_FILENAME - "telegramdesktop.desktop", + MACRO_TO_STRING(TDESKTOP_LAUNCHER_BASENAME) + ".desktop", "Telegram.desktop" }; diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 8c854012d..2197daca9 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -145,13 +145,8 @@ NotificationData::NotificationData( _hints["category"] = qsl("im.received"); -#ifdef TDESKTOP_LAUNCHER_FILENAME _hints["desktop-entry"] = - qsl(MACRO_TO_STRING(TDESKTOP_LAUNCHER_FILENAME)) - .remove(QRegExp(qsl("\\.desktop$"), Qt::CaseInsensitive)); -#else - _hints["desktop-entry"] = qsl("telegramdesktop"); -#endif + qsl(MACRO_TO_STRING(TDESKTOP_LAUNCHER_BASENAME)); connect(_notificationInterface.get(), SIGNAL(NotificationClosed(uint, uint)), diff --git a/Telegram/cmake/telegram_options.cmake b/Telegram/cmake/telegram_options.cmake index 4517f4edd..085947394 100644 --- a/Telegram/cmake/telegram_options.cmake +++ b/Telegram/cmake/telegram_options.cmake @@ -13,7 +13,7 @@ option(TDESKTOP_USE_PACKAGED_TGVOIP "Find libtgvoip using CMake instead of bundl option(TDESKTOP_API_TEST "Use test API credentials." OFF) set(TDESKTOP_API_ID "0" CACHE STRING "Provide 'api_id' for the Telegram API access.") set(TDESKTOP_API_HASH "" CACHE STRING "Provide 'api_hash' for the Telegram API access.") -set(TDESKTOP_LAUNCHER_FILENAME "" CACHE STRING "Use custom desktop file name (Linux only).") +set(TDESKTOP_LAUNCHER_BASENAME "" CACHE STRING "Desktop file base name (Linux only).") if (TDESKTOP_API_TEST) set(TDESKTOP_API_ID 17349) @@ -85,6 +85,11 @@ if (TDESKTOP_DISABLE_GTK_INTEGRATION) target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_GTK_INTEGRATION) endif() -if (TDESKTOP_LAUNCHER_FILENAME) - target_compile_definitions(Telegram PRIVATE TDESKTOP_LAUNCHER_FILENAME=${TDESKTOP_LAUNCHER_FILENAME}) +if (NOT TDESKTOP_LAUNCHER_BASENAME) + if (NOT DESKTOP_APP_USE_PACKAGED) + set(TDESKTOP_LAUNCHER_BASENAME "telegramdesktop") + elseif (LINUX) + message(FATAL_ERROR "Please provide .desktop file base name (-D TDESKTOP_LAUNCHER_BASENAME=[basename]).") + endif() endif() +target_compile_definitions(Telegram PRIVATE TDESKTOP_LAUNCHER_BASENAME=${TDESKTOP_LAUNCHER_BASENAME}) diff --git a/Telegram/lib_base b/Telegram/lib_base index 9f8f5465d..db99f556f 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 9f8f5465d2178c5c0df9f0f0e93de87798e7237a +Subproject commit db99f556f328f8e1fdc44ab30041f655b68b8312