From 204a08df1463771d154dffc0f4871fe0d8358f94 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 1 Nov 2020 14:55:19 +0400 Subject: [PATCH] Add a cheat code to install launcher on Linux --- Telegram/SourceFiles/platform/linux/specific_linux.cpp | 6 ++++-- Telegram/SourceFiles/platform/linux/specific_linux.h | 2 +- Telegram/SourceFiles/settings/settings_codes.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 26c8e43b0..49e83e643 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -1129,13 +1129,15 @@ void start() { void finish() { } -void InstallLauncher() { +void InstallLauncher(bool force) { static const auto DisabledByEnv = qEnvironmentVariableIsSet( "TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION"); // don't update desktop file for alpha version or if updater is disabled - if (cAlphaVersion() || Core::UpdaterDisabled() || DisabledByEnv) + if ((cAlphaVersion() || Core::UpdaterDisabled() || DisabledByEnv) + && !force) { return; + } const auto applicationsPath = QStandardPaths::writableLocation( QStandardPaths::ApplicationsLocation) + '/'; diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.h b/Telegram/SourceFiles/platform/linux/specific_linux.h index ff39fe802..e6b961df0 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.h +++ b/Telegram/SourceFiles/platform/linux/specific_linux.h @@ -41,7 +41,7 @@ QString GetIconName(); inline void IgnoreApplicationActivationRightNow() { } -void InstallLauncher(); +void InstallLauncher(bool force = false); } // namespace Platform diff --git a/Telegram/SourceFiles/settings/settings_codes.cpp b/Telegram/SourceFiles/settings/settings_codes.cpp index 9c9ae0031..9f77b4578 100644 --- a/Telegram/SourceFiles/settings/settings_codes.cpp +++ b/Telegram/SourceFiles/settings/settings_codes.cpp @@ -157,6 +157,13 @@ auto GenerateCodes() { }); #endif // Q_OS_WIN || Q_OS_MAC +#if defined Q_OS_UNIX && !defined Q_OS_MAC + codes.emplace(qsl("installauncher"), [](SessionController *window) { + Platform::InstallLauncher(true); + Ui::Toast::Show("Forced launcher installation."); + }); +#endif // Q_OS_UNIX && !Q_OS_MAC + auto audioFilters = qsl("Audio files (*.wav *.mp3);;") + FileDialog::AllFilesFilter(); auto audioKeys = { qsl("msg_incoming"),