diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-02-09 12:34:00 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-02-09 12:34:00 +0100 |
commit | 43f21b54ff2ff80ed1d480b07116ba0cfa0b5e47 (patch) | |
tree | 3d4a775f7324c247bdd95641e47ecfcb12236504 /src/plugins | |
parent | 02071aa486675ab521d180adbdc830bedb17ffa2 (diff) |
Matrix: dont change seleection, or something
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index b16b551..4133637 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -433,6 +433,15 @@ namespace QuickMedia { }); } + static void body_set_selected_item(Body *body, BodyItem *selected_item) { + for(size_t i = 0; i < body->items.size(); ++i) { + if(body->items[i]->url == selected_item->url) { + body->set_selected_item(i); + return; + } + } + } + void MatrixQuickMedia::update(MatrixPageType page_type) { update_pending_room_messages(page_type); std::lock_guard<std::mutex> room_body_lock(room_body_items_mutex); @@ -625,7 +634,9 @@ namespace QuickMedia { } if(sort_on_update) { sort_on_update = false; + BodyItem *selected_item = body->get_selected(); sort_room_body_items(body->items); + body_set_selected_item(body, selected_item); } matrix_delegate->update(MatrixPageType::ROOM_LIST); if(filter_on_update) { @@ -697,7 +708,9 @@ namespace QuickMedia { Body *body_ptr = body.get(); TagData &tag_data = tag_body_items_by_name[url]; body->items = tag_data.room_body_items; + BodyItem *selected_item = body->get_selected(); sort_room_body_items(body->items); + body_set_selected_item(body.get(), selected_item); auto search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER); auto rooms_page = std::make_unique<MatrixRoomsPage>(program, body_ptr, tag_data.tag_item->get_title(), this, search_bar.get()); rooms_page->matrix_delegate = matrix_delegate; |