mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to set shortcut to archive chat from dialogs list.
This commit is contained in:
parent
5509c1810b
commit
00a89883fd
3 changed files with 20 additions and 0 deletions
|
@ -106,6 +106,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
|
||||||
{ u"message_scheduled"_q , Command::ScheduleMessage },
|
{ u"message_scheduled"_q , Command::ScheduleMessage },
|
||||||
{ u"media_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen },
|
{ u"media_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen },
|
||||||
{ u"show_scheduled"_q , Command::ShowScheduled },
|
{ u"show_scheduled"_q , Command::ShowScheduled },
|
||||||
|
{ u"archive_chat"_q , Command::ArchiveChat },
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ enum class Command {
|
||||||
ScheduleMessage,
|
ScheduleMessage,
|
||||||
|
|
||||||
ReadChat,
|
ReadChat,
|
||||||
|
ArchiveChat,
|
||||||
|
|
||||||
MediaViewerFullscreen,
|
MediaViewerFullscreen,
|
||||||
|
|
||||||
|
|
|
@ -4011,6 +4011,24 @@ void InnerWidget::setupShortcuts() {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(!_openedForum)
|
||||||
|
&& request->check(Command::ArchiveChat)
|
||||||
|
&& request->handle([=] {
|
||||||
|
const auto thread = _selected ? _selected->thread() : nullptr;
|
||||||
|
if (!thread) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const auto history = thread->owningHistory();
|
||||||
|
const auto isArchived = history->folder()
|
||||||
|
&& (history->folder()->id() == Data::Folder::kId);
|
||||||
|
|
||||||
|
Window::ToggleHistoryArchived(
|
||||||
|
_controller->uiShow(),
|
||||||
|
history,
|
||||||
|
!isArchived);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
request->check(Command::ShowContacts) && request->handle([=] {
|
request->check(Command::ShowContacts) && request->handle([=] {
|
||||||
_controller->show(PrepareContactsBox(_controller));
|
_controller->show(PrepareContactsBox(_controller));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue