From 76810461fe3eb7f04aaa84462009501becf08be1 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 11 Sep 2022 03:34:49 +0300 Subject: [PATCH] [Improvement] Shortcut to restart application --- Telegram/SourceFiles/core/application.cpp | 4 ++++ Telegram/SourceFiles/core/shortcuts.cpp | 2 ++ Telegram/SourceFiles/core/shortcuts.h | 1 + 3 files changed, 7 insertions(+) diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 13df129ef..9a0e0feeb 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -1283,6 +1283,10 @@ void Application::startShortcuts() { Ui::Toast::Show(ktr("ktg_language_reloaded")); return true; }); + request->check(Command::Restart) && request->handle([=] { + Restart(); + return true; + }); }, _lifetime); } diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index acdf42234..60a2b0934 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -101,6 +101,7 @@ const auto CommandByName = base::flat_map{ { qsl("save_draft") , Command::SaveDraft }, { qsl("jump_to_date") , Command::JumpToDate }, { qsl("reload_lang") , Command::ReloadLang }, + { qsl("restart_app") , Command::Restart }, }; const auto CommandNames = base::flat_map{ @@ -144,6 +145,7 @@ const auto CommandNames = base::flat_map{ { Command::SaveDraft , qsl("save_draft") }, { Command::JumpToDate , qsl("jump_to_date") }, { Command::ReloadLang , qsl("reload_lang") }, + { Command::Restart , qsl("restart_app") }, }; class Manager { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 279aebc9d..30ca6e8fc 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -65,6 +65,7 @@ enum class Command { SaveDraft, JumpToDate, ReloadLang, + Restart, }; [[maybe_unused]] constexpr auto kShowFolder = {