diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 37a6f6adb..c536a3a7e 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -98,6 +98,8 @@ const auto CommandByName = base::flat_map{ { u"message_silently"_q , Command::SendSilentMessage }, { u"message_scheduled"_q , Command::ScheduleMessage }, // + + { qsl("save_draft") , Command::SaveDraft }, }; const auto CommandNames = base::flat_map{ @@ -137,6 +139,8 @@ const auto CommandNames = base::flat_map{ { Command::ShowContacts , u"show_contacts"_q }, { Command::ReadChat , u"read_chat"_q }, + + { Command::SaveDraft , u"save_draft"_q }, }; class Manager { @@ -400,6 +404,7 @@ void Manager::fillDefaults() { set(u"ctrl+j"_q, Command::ShowContacts); set(u"ctrl+r"_q, Command::ReadChat); + set(u"ctrl+s"_q, Command::SaveDraft); } void Manager::writeDefaultFile() { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 6e1904c68..45cc32ba9 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -64,6 +64,8 @@ enum class Command { SupportScrollToCurrent, SupportHistoryBack, SupportHistoryForward, + + SaveDraft, }; [[maybe_unused]] constexpr auto kShowFolder = { diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index b1631d22a..b5cae58a1 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1941,6 +1941,10 @@ void HistoryWidget::setupShortcuts() { return true; }); } + request->check(Command::SaveDraft, 1) && request->handle([=] { + saveCloudDraft(); + return true; + }); }, lifetime()); }