From 9682e3754707b5deaa93ad08f592a390c4d1365e Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 12 Mar 2025 03:43:29 +0300 Subject: [PATCH] Added shortcut to open chat preview from dialogs. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/core/shortcuts.cpp | 2 ++ Telegram/SourceFiles/core/shortcuts.h | 1 + Telegram/SourceFiles/dialogs/dialogs_widget.cpp | 8 ++++++++ Telegram/SourceFiles/settings/settings_shortcuts.cpp | 1 + 5 files changed, 13 insertions(+) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 5f59ce1b35..5d4370b535 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -681,6 +681,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_shortcuts_archive_chat" = "Archive chat"; "lng_shortcuts_media_fullscreen" = "Toggle video fullscreen"; "lng_shortcuts_show_chat_menu" = "Show chat menu"; +"lng_shortcuts_show_chat_preview" = "Show chat preview"; "lng_settings_chat_reactions_title" = "Quick Reaction"; "lng_settings_chat_reactions_subtitle" = "Choose your favorite reaction"; diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index eaad16558a..fe26109b7c 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -110,6 +110,7 @@ const auto CommandByName = base::flat_map{ { u"read_chat"_q , Command::ReadChat }, { u"show_chat_menu"_q , Command::ShowChatMenu }, + { u"show_chat_preview"_q , Command::ShowChatPreview }, // Shortcuts that have no default values. { u"message"_q , Command::JustSendMessage }, @@ -506,6 +507,7 @@ void Manager::fillDefaults() { set(u"ctrl+r"_q, Command::ReadChat); set(u"ctrl+\\"_q, Command::ShowChatMenu); + set(u"ctrl+]"_q, Command::ShowChatPreview); _defaults = keysCurrents(); } diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 70c8eb63af..7be77d4eca 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -72,6 +72,7 @@ enum class Command { MediaViewerFullscreen, ShowChatMenu, + ShowChatPreview, SupportReloadTemplates, SupportToggleMuted, diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index b7bddc5064..76d8930205 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -1314,6 +1314,14 @@ void Widget::setupShortcuts() { } return true; }); + request->check(Command::ShowChatPreview, 1) + && request->handle([=] { + if (_inner) { + Window::ActivateWindow(controller()); + return _inner->showChatPreview(); + } + return true; + }); } }, lifetime()); } diff --git a/Telegram/SourceFiles/settings/settings_shortcuts.cpp b/Telegram/SourceFiles/settings/settings_shortcuts.cpp index 0fd7cf5fb0..9d5135f614 100644 --- a/Telegram/SourceFiles/settings/settings_shortcuts.cpp +++ b/Telegram/SourceFiles/settings/settings_shortcuts.cpp @@ -98,6 +98,7 @@ struct Labeled { { C::ArchiveChat, tr::lng_shortcuts_archive_chat() }, { C::ShowScheduled, tr::lng_shortcuts_scheduled() }, { C::ShowChatMenu, tr::lng_shortcuts_show_chat_menu() }, + { C::ShowChatPreview, tr::lng_shortcuts_show_chat_preview() }, separator, { C::JustSendMessage, tr::lng_shortcuts_just_send() }, { C::SendSilentMessage, tr::lng_shortcuts_silent_send() },