[Improvement] Shortcut to save draft
This commit is contained in:
parent
3a42cf128b
commit
41db6b210b
3 changed files with 11 additions and 0 deletions
|
|
@ -98,6 +98,8 @@ const auto CommandByName = base::flat_map<QString, Command>{
|
|||
{ u"message_silently"_q , Command::SendSilentMessage },
|
||||
{ u"message_scheduled"_q , Command::ScheduleMessage },
|
||||
//
|
||||
|
||||
{ qsl("save_draft") , Command::SaveDraft },
|
||||
};
|
||||
|
||||
const auto CommandNames = base::flat_map<Command, QString>{
|
||||
|
|
@ -137,6 +139,8 @@ const auto CommandNames = base::flat_map<Command, QString>{
|
|||
{ 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() {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ enum class Command {
|
|||
SupportScrollToCurrent,
|
||||
SupportHistoryBack,
|
||||
SupportHistoryForward,
|
||||
|
||||
SaveDraft,
|
||||
};
|
||||
|
||||
[[maybe_unused]] constexpr auto kShowFolder = {
|
||||
|
|
|
|||
|
|
@ -1941,6 +1941,10 @@ void HistoryWidget::setupShortcuts() {
|
|||
return true;
|
||||
});
|
||||
}
|
||||
request->check(Command::SaveDraft, 1) && request->handle([=] {
|
||||
saveCloudDraft();
|
||||
return true;
|
||||
});
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue