aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-02-09 12:34:00 +0100
committerdec05eba <dec05eba@protonmail.com>2021-02-09 12:34:00 +0100
commit43f21b54ff2ff80ed1d480b07116ba0cfa0b5e47 (patch)
tree3d4a775f7324c247bdd95641e47ecfcb12236504
parent02071aa486675ab521d180adbdc830bedb17ffa2 (diff)
Matrix: dont change seleection, or something
-rw-r--r--src/QuickMedia.cpp1
-rw-r--r--src/plugins/Matrix.cpp13
2 files changed, 13 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5d4f7bd..6970920 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1114,7 +1114,6 @@ namespace QuickMedia {
} else if(new_tabs.size() == 1 && new_tabs[0].page->get_type() == PageTypez::CHAT) {
current_page = PageType::CHAT;
current_chat_room = matrix->get_room_by_id(selected_item->url);
- tabs[selected_tab].body->select_first_item();
while(window.isOpen()) {
bool move_room = chat_page(static_cast<MatrixChatPage*>(new_tabs[0].page.get()), current_chat_room, tabs, selected_tab, tab_associated_data[selected_tab]);
if(!move_room)
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;