From c183479553dbc81e0eb7f632720c278fa5308b2c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 10 Nov 2020 19:14:08 +0100 Subject: Scroll page instead of changing body item if the item cant be fully displayed inside the window --- src/plugins/Matrix.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/plugins/Matrix.cpp') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index a90bb30..d6034de 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -496,7 +496,7 @@ namespace QuickMedia { for(auto &message : messages) { if(message->mentions_me) { // TODO: What if the message or username begins with "-"? also make the notification image be the avatar of the user - if(!is_window_focused || room != current_room || is_initial_sync || page_type == MatrixPageType::ROOM_LIST) + if((!is_window_focused || room != current_room || is_initial_sync || page_type == MatrixPageType::ROOM_LIST) && message->related_event_type != RelatedEventType::EDIT && message->related_event_type != RelatedEventType::REDACTION) show_notification("QuickMedia matrix - " + matrix->message_get_author_displayname(message.get()) + " (" + room->get_name() + ")", message->body); } } @@ -534,6 +534,7 @@ namespace QuickMedia { void MatrixRoomsPage::update() { { std::lock_guard lock(mutex); + int prev_selected_item = body->get_selected_item(); if(clear_data_on_update) { clear_data_on_update = false; body->clear_items(); @@ -555,6 +556,7 @@ namespace QuickMedia { } pending_remove_body_items.clear(); + body->set_selected_item(prev_selected_item, false); body->clamp_selection(); body->append_items(std::move(room_body_items)); } @@ -645,6 +647,7 @@ namespace QuickMedia { void MatrixRoomTagsPage::update() { { std::lock_guard lock(mutex); + int prev_selected_item = body->get_selected_item(); if(clear_data_on_update) { clear_data_on_update = false; body->clear_items(); @@ -696,6 +699,7 @@ namespace QuickMedia { } } add_room_body_items_by_tags.clear(); + body->set_selected_item(prev_selected_item, false); } matrix_delegate->update(MatrixPageType::ROOM_LIST); if(filter_on_update) { @@ -794,6 +798,7 @@ namespace QuickMedia { void MatrixInvitesPage::update() { std::lock_guard lock(mutex); + int prev_selected_item = body->get_selected_item(); if(clear_data_on_update) { clear_data_on_update = false; body->clear_items(); @@ -806,6 +811,7 @@ namespace QuickMedia { remove_body_item_by_url(body->items, room_id); } pending_remove_body_items.clear(); + body->set_selected_item(prev_selected_item, false); body->clamp_selection(); // TODO: Insert in reverse order (to show the latest invite at the top?) -- cgit v1.2.3