aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Matrix.cpp')
-rw-r--r--src/plugins/Matrix.cpp13
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;