mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-28 09:32:56 +00:00
Ctrl+[1-5] jump to the relevant pinned chat.
This commit is contained in:
parent
a11ca58f36
commit
ea7796dccc
@ -310,6 +310,12 @@ void Manager::fillDefaults() {
|
||||
set(qsl("f5"), Command::SupportReloadTemplates);
|
||||
set(qsl("ctrl+delete"), Command::SupportToggleMuted);
|
||||
set(qsl("ctrl+insert"), Command::SupportScrollToCurrent);
|
||||
|
||||
set(qsl("ctrl+1"), Command::ChatPinned1);
|
||||
set(qsl("ctrl+2"), Command::ChatPinned2);
|
||||
set(qsl("ctrl+3"), Command::ChatPinned3);
|
||||
set(qsl("ctrl+4"), Command::ChatPinned4);
|
||||
set(qsl("ctrl+5"), Command::ChatPinned5);
|
||||
}
|
||||
|
||||
void Manager::writeDefaultFile() {
|
||||
|
@ -28,6 +28,11 @@ enum class Command {
|
||||
ChatNext,
|
||||
ChatFirst,
|
||||
ChatLast,
|
||||
ChatPinned1,
|
||||
ChatPinned2,
|
||||
ChatPinned3,
|
||||
ChatPinned4,
|
||||
ChatPinned5,
|
||||
|
||||
SupportReloadTemplates,
|
||||
SupportToggleMuted,
|
||||
|
@ -2844,6 +2844,25 @@ void DialogsInner::setupShortcuts() {
|
||||
request->check(Command::ChatLast) && request->handle([=] {
|
||||
return jumpToDialogRow(last);
|
||||
});
|
||||
|
||||
static const auto kPinned = {
|
||||
Command::ChatPinned1,
|
||||
Command::ChatPinned2,
|
||||
Command::ChatPinned3,
|
||||
Command::ChatPinned4,
|
||||
Command::ChatPinned5,
|
||||
};
|
||||
auto &&pinned = ranges::view::zip(kPinned, ranges::view::ints(0));
|
||||
for (const auto [command, index] : pinned) {
|
||||
request->check(command) && request->handle([=, index = index] {
|
||||
const auto count = shownPinnedCount();
|
||||
if (index >= count) {
|
||||
return false;
|
||||
}
|
||||
const auto row = *(shownDialogs()->cbegin() + index);
|
||||
return jumpToDialogRow({ row->key(), FullMsgId() });
|
||||
});
|
||||
}
|
||||
if (Auth().supportMode() && row.key.history()) {
|
||||
request->check(
|
||||
Command::SupportScrollToCurrent
|
||||
|
Loading…
Reference in New Issue
Block a user