[Improvement] Shortcut to jump to date

This commit is contained in:
Eric Kotato 2022-09-11 03:28:36 +03:00 committed by Eric Kotato
parent 41db6b210b
commit 5be5011a52
3 changed files with 8 additions and 0 deletions

View file

@ -100,6 +100,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
//
{ qsl("save_draft") , Command::SaveDraft },
{ qsl("jump_to_date") , Command::JumpToDate },
};
const auto CommandNames = base::flat_map<Command, QString>{
@ -141,6 +142,7 @@ const auto CommandNames = base::flat_map<Command, QString>{
{ Command::ReadChat , u"read_chat"_q },
{ Command::SaveDraft , u"save_draft"_q },
{ Command::JumpToDate , u"jump_to_date"_q },
};
class Manager {
@ -405,6 +407,7 @@ void Manager::fillDefaults() {
set(u"ctrl+r"_q, Command::ReadChat);
set(u"ctrl+s"_q, Command::SaveDraft);
set(u"ctrl+h"_q, Command::JumpToDate);
}
void Manager::writeDefaultFile() {

View file

@ -66,6 +66,7 @@ enum class Command {
SupportHistoryForward,
SaveDraft,
JumpToDate,
};
[[maybe_unused]] constexpr auto kShowFolder = {

View file

@ -1940,6 +1940,10 @@ void HistoryWidget::setupShortcuts() {
toggleMuteUnmute();
return true;
});
request->check(Command::JumpToDate, 1) && request->handle([=] {
controller()->showCalendar(Dialogs::Key(_history), QDateTime());
return true;
});
}
request->check(Command::SaveDraft, 1) && request->handle([=] {
saveCloudDraft();