Added ability to mark as read selected chat with shortcut.
This commit is contained in:
parent
f81271d1fe
commit
5968219fe4
|
@ -89,6 +89,8 @@ const auto CommandByName = base::flat_map<QString, Command>{
|
|||
|
||||
{ qsl("show_archive") , Command::ShowArchive },
|
||||
|
||||
{ qsl("read_chat") , Command::ReadChat },
|
||||
|
||||
// Shortcuts that have no default values.
|
||||
{ qsl("message") , Command::JustSendMessage },
|
||||
{ qsl("message_silently") , Command::SendSilentMessage },
|
||||
|
@ -130,6 +132,8 @@ const auto CommandNames = base::flat_map<Command, QString>{
|
|||
{ Command::ShowFolderLast , qsl("last_folder") },
|
||||
|
||||
{ Command::ShowArchive , qsl("show_archive") },
|
||||
|
||||
{ Command::ReadChat , qsl("read_chat") },
|
||||
};
|
||||
|
||||
class Manager {
|
||||
|
@ -379,6 +383,8 @@ void Manager::fillDefaults() {
|
|||
set(qsl("ctrl+0"), Command::ChatSelf);
|
||||
|
||||
set(qsl("ctrl+9"), Command::ShowArchive);
|
||||
|
||||
set(qsl("ctrl+r"), Command::ReadChat);
|
||||
}
|
||||
|
||||
void Manager::writeDefaultFile() {
|
||||
|
|
|
@ -53,6 +53,8 @@ enum class Command {
|
|||
SendSilentMessage,
|
||||
ScheduleMessage,
|
||||
|
||||
ReadChat,
|
||||
|
||||
SupportReloadTemplates,
|
||||
SupportToggleMuted,
|
||||
SupportScrollToCurrent,
|
||||
|
|
|
@ -3166,6 +3166,18 @@ void InnerWidget::setupShortcuts() {
|
|||
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()) {
|
||||
request->check(
|
||||
Command::SupportScrollToCurrent
|
||||
|
|
Loading…
Reference in New Issue