diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-11-10 19:14:08 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-11-10 19:22:07 +0100 |
commit | c183479553dbc81e0eb7f632720c278fa5308b2c (patch) | |
tree | ce2ab325e48837ba8f7b1d3c9ee2d14f067a41d4 /src/plugins | |
parent | e8085267aeb23e33fd5cdbc2e4b6d43c64cc7a78 (diff) |
Scroll page instead of changing body item if the item cant be fully displayed inside the window
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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<std::mutex> 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<std::recursive_mutex> 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<std::mutex> 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?) |