Added shortcut to open chat preview from dialogs.

This commit is contained in:
23rd 2025-03-12 03:43:29 +03:00 committed by John Preston
parent 7197d9480b
commit 9682e37547
5 changed files with 13 additions and 0 deletions

View file

@ -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";

View file

@ -110,6 +110,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
{ 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();
}

View file

@ -72,6 +72,7 @@ enum class Command {
MediaViewerFullscreen,
ShowChatMenu,
ShowChatPreview,
SupportReloadTemplates,
SupportToggleMuted,

View file

@ -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());
}

View file

@ -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() },