mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 16:13:56 +02:00
Added ability to mark as read selected chat with shortcut.
This commit is contained in:
parent
f81271d1fe
commit
5968219fe4
3 changed files with 20 additions and 0 deletions
|
@ -89,6 +89,8 @@ const auto CommandByName = base::flat_map<QString, Command>{
|
||||||
|
|
||||||
{ qsl("show_archive") , Command::ShowArchive },
|
{ qsl("show_archive") , Command::ShowArchive },
|
||||||
|
|
||||||
|
{ qsl("read_chat") , Command::ReadChat },
|
||||||
|
|
||||||
// Shortcuts that have no default values.
|
// Shortcuts that have no default values.
|
||||||
{ qsl("message") , Command::JustSendMessage },
|
{ qsl("message") , Command::JustSendMessage },
|
||||||
{ qsl("message_silently") , Command::SendSilentMessage },
|
{ qsl("message_silently") , Command::SendSilentMessage },
|
||||||
|
@ -130,6 +132,8 @@ const auto CommandNames = base::flat_map<Command, QString>{
|
||||||
{ Command::ShowFolderLast , qsl("last_folder") },
|
{ Command::ShowFolderLast , qsl("last_folder") },
|
||||||
|
|
||||||
{ Command::ShowArchive , qsl("show_archive") },
|
{ Command::ShowArchive , qsl("show_archive") },
|
||||||
|
|
||||||
|
{ Command::ReadChat , qsl("read_chat") },
|
||||||
};
|
};
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
|
@ -379,6 +383,8 @@ void Manager::fillDefaults() {
|
||||||
set(qsl("ctrl+0"), Command::ChatSelf);
|
set(qsl("ctrl+0"), Command::ChatSelf);
|
||||||
|
|
||||||
set(qsl("ctrl+9"), Command::ShowArchive);
|
set(qsl("ctrl+9"), Command::ShowArchive);
|
||||||
|
|
||||||
|
set(qsl("ctrl+r"), Command::ReadChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::writeDefaultFile() {
|
void Manager::writeDefaultFile() {
|
||||||
|
|
|
@ -53,6 +53,8 @@ enum class Command {
|
||||||
SendSilentMessage,
|
SendSilentMessage,
|
||||||
ScheduleMessage,
|
ScheduleMessage,
|
||||||
|
|
||||||
|
ReadChat,
|
||||||
|
|
||||||
SupportReloadTemplates,
|
SupportReloadTemplates,
|
||||||
SupportToggleMuted,
|
SupportToggleMuted,
|
||||||
SupportScrollToCurrent,
|
SupportScrollToCurrent,
|
||||||
|
|
|
@ -3166,6 +3166,18 @@ void InnerWidget::setupShortcuts() {
|
||||||
return nearFolder(false);
|
return nearFolder(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
request->check(Command::ReadChat) && request->handle([=] {
|
||||||
|
const auto history = _selected ? _selected->history() : nullptr;
|
||||||
|
if (history) {
|
||||||
|
if ((history->chatListUnreadCount() > 0)
|
||||||
|
|| history->chatListUnreadMark()) {
|
||||||
|
session().data().histories().readInbox(history);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return (history != nullptr);
|
||||||
|
});
|
||||||
|
|
||||||
if (session().supportMode() && row.key.history()) {
|
if (session().supportMode() && row.key.history()) {
|
||||||
request->check(
|
request->check(
|
||||||
Command::SupportScrollToCurrent
|
Command::SupportScrollToCurrent
|
||||||
|
|
Loading…
Add table
Reference in a new issue