diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index c3524a651..03bd7c893 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -97,6 +97,8 @@ const auto CommandByName = base::flat_map{ { qsl("message_silently") , Command::SendSilentMessage }, { qsl("message_scheduled") , Command::ScheduleMessage }, // + + { qsl("save_draft") , Command::SaveDraft }, }; const auto CommandNames = base::flat_map{ @@ -136,6 +138,8 @@ const auto CommandNames = base::flat_map{ { Command::ShowContacts , qsl("show_contacts") }, { Command::ReadChat , qsl("read_chat") }, + + { Command::SaveDraft , qsl("save_draft") }, }; class Manager { @@ -388,6 +392,7 @@ void Manager::fillDefaults() { set(qsl("ctrl+j"), Command::ShowContacts); set(qsl("ctrl+r"), Command::ReadChat); + set(qsl("ctrl+s"), Command::SaveDraft); } void Manager::writeDefaultFile() { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index ef1d16486..fd614db15 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -61,6 +61,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 e1595dc7e..0f9104d77 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1958,6 +1958,10 @@ void HistoryWidget::setupShortcuts() { return true; }); } + request->check(Command::SaveDraft, 1) && request->handle([=] { + saveCloudDraft(); + return true; + }); } }, lifetime()); }