From 5509c1810b7fc2ebcda7bea5c5bc09492f683017 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 24 Mar 2024 16:28:25 +0300 Subject: [PATCH] Added ability to set shortcut to open section with scheduled messages. --- Telegram/SourceFiles/core/shortcuts.cpp | 1 + Telegram/SourceFiles/core/shortcuts.h | 2 ++ Telegram/SourceFiles/history/history_widget.cpp | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 545c9b55a..04a251017 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -105,6 +105,7 @@ const auto CommandByName = base::flat_map{ { u"message_silently"_q , Command::SendSilentMessage }, { u"message_scheduled"_q , Command::ScheduleMessage }, { u"media_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen }, + { u"show_scheduled"_q , Command::ShowScheduled }, // }; diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index b562517d5..0472c1be8 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -57,6 +57,8 @@ enum class Command { FolderNext, FolderPrevious, + ShowScheduled, + ShowArchive, ShowContacts, diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5ce512bf6..e24f131ee 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1915,6 +1915,14 @@ void HistoryWidget::setupShortcuts() { controller()->searchInChat(_history); return true; }); + _canSendMessages + && request->check(Command::ShowScheduled, 1) + && request->handle([=] { + using Scheduled = HistoryView::ScheduledMemento; + controller()->showSection( + std::make_shared(_history)); + return true; + }); if (session().supportMode()) { request->check( Command::SupportToggleMuted