Add keyboard navigation to chat preview.

This commit is contained in:
John Preston 2024-10-10 14:14:54 +04:00
parent ac7b2e0da0
commit 2d20e7a9e2
4 changed files with 9 additions and 2 deletions

View file

@ -509,6 +509,10 @@ void Item::setupHistory() {
_inner->refreshViewer(); _inner->refreshViewer();
_inner->setAttribute(Qt::WA_TransparentForMouseEvents); _inner->setAttribute(Qt::WA_TransparentForMouseEvents);
crl::on_main(this, [=] {
_inner->setFocus();
});
} }
void Item::paintEvent(QPaintEvent *e) { void Item::paintEvent(QPaintEvent *e) {
@ -537,6 +541,7 @@ bool Item::listScrollTo(int top, bool syntetic) {
} }
void Item::listCancelRequest() { void Item::listCancelRequest() {
_actions.fire({ .cancel = true });
} }
void Item::listDeleteRequest() { void Item::listDeleteRequest() {

View file

@ -21,6 +21,7 @@ namespace HistoryView {
struct ChatPreviewAction { struct ChatPreviewAction {
FullMsgId openItemId; FullMsgId openItemId;
bool cancel = false;
bool openInfo = false; bool openInfo = false;
bool markRead = false; bool markRead = false;
bool markUnread = false; bool markUnread = false;

View file

@ -64,7 +64,8 @@ bool ChatPreviewManager::show(
if (const auto thread = weakThread.get()) { if (const auto thread = weakThread.get()) {
const auto itemId = action.openItemId; const auto itemId = action.openItemId;
const auto owner = &thread->owner(); const auto owner = &thread->owner();
if (action.markRead) { if (action.cancel) {
} else if (action.markRead) {
MarkAsReadThread(thread); MarkAsReadThread(thread);
} else if (action.markUnread) { } else if (action.markUnread) {
if (const auto history = thread->asHistory()) { if (const auto history = thread->asHistory()) {

@ -1 +1 @@
Subproject commit 4ae0ffe56efb20f795062713780c79e79cd39879 Subproject commit bc5f66913dbc4e68d2d4314240d68df681284d3b