From 7de9bcad03959faa6eaa48aa0dc1df9907252f22 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 7 Oct 2020 21:06:22 +0300 Subject: [PATCH] Added ability to open contacts with shortcut. Fixed #8775. --- Telegram/SourceFiles/core/shortcuts.cpp | 3 +++ Telegram/SourceFiles/core/shortcuts.h | 1 + Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 3e39a37cbf..ef50008ef5 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -88,6 +88,7 @@ const auto CommandByName = base::flat_map{ { qsl("last_folder") , Command::ShowFolderLast }, { qsl("show_archive") , Command::ShowArchive }, + { qsl("show_contacts") , Command::ShowContacts }, { qsl("read_chat") , Command::ReadChat }, @@ -132,6 +133,7 @@ const auto CommandNames = base::flat_map{ { Command::ShowFolderLast , qsl("last_folder") }, { Command::ShowArchive , qsl("show_archive") }, + { Command::ShowContacts , qsl("show_contacts") }, { Command::ReadChat , qsl("read_chat") }, }; @@ -383,6 +385,7 @@ void Manager::fillDefaults() { set(qsl("ctrl+0"), Command::ChatSelf); set(qsl("ctrl+9"), Command::ShowArchive); + set(qsl("ctrl+shift+n"), Command::ShowContacts); set(qsl("ctrl+r"), Command::ReadChat); } diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index c64877dca5..c6a8b596a5 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -48,6 +48,7 @@ enum class Command { FolderPrevious, ShowArchive, + ShowContacts, JustSendMessage, SendSilentMessage, diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index f978ecbe57..5f4e323355 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -3178,6 +3178,11 @@ void InnerWidget::setupShortcuts() { return (history != nullptr); }); + request->check(Command::ShowContacts) && request->handle([=] { + Ui::show(PrepareContactsBox(_controller)); + return true; + }); + if (session().supportMode() && row.key.history()) { request->check( Command::SupportScrollToCurrent