diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 5985f2966..05c0d4aa4 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -74,6 +74,8 @@ const auto CommandByName = base::flat_map{ { qsl("first_chat") , Command::ChatFirst }, { qsl("last_chat") , Command::ChatLast }, { qsl("self_chat") , Command::ChatSelf }, + + { qsl("save_draft") , Command::SaveDraft }, }; const auto CommandNames = base::flat_map{ @@ -96,6 +98,8 @@ const auto CommandNames = base::flat_map{ { Command::ChatFirst , qsl("first_chat") }, { Command::ChatLast , qsl("last_chat") }, { Command::ChatSelf , qsl("self_chat") }, + + { Command::SaveDraft , qsl("save_draft") }, }; class Manager { @@ -331,6 +335,8 @@ void Manager::fillDefaults() { set(qsl("ctrl+5"), Command::ChatPinned5); set(qsl("ctrl+0"), Command::ChatSelf); + + set(qsl("ctrl+s"), Command::SaveDraft); } void Manager::writeDefaultFile() { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index b94f03c17..55503cc8c 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -40,6 +40,8 @@ enum class Command { SupportScrollToCurrent, SupportHistoryBack, SupportHistoryForward, + + SaveDraft, }; [[nodiscard]] FnMut RequestHandler(Command command); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 17e110603..bf84df541 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1484,6 +1484,10 @@ void HistoryWidget::setupShortcuts() { return true; }); } + request->check(Command::SaveDraft, 1) && request->handle([=] { + onCloudDraftSave(); + return true; + }); } }, lifetime()); }