From 16c7256f555d41e8e86da3bcdf7990e75157b856 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 9 Feb 2021 17:54:49 +0100 Subject: The final solution to the room selection question --- plugins/Matrix.hpp | 1 + src/QuickMedia.cpp | 1 + src/plugins/Matrix.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index 7b81b61..9fb35fe 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -203,6 +203,7 @@ namespace QuickMedia { bool message_contains_user_mention(const std::string &msg, const std::string &username); bool message_is_timeline(Message *message); + void body_set_selected_item(Body *body, BodyItem *selected_item); enum class MatrixPageType { ROOM_LIST, diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 0c3bb09..3bd75d6 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1112,6 +1112,7 @@ namespace QuickMedia { current_page = PageType::VIDEO_CONTENT; video_content_page(static_cast(new_tabs[0].page.get()), selected_item->url, selected_item->get_title(), false); } else if(new_tabs.size() == 1 && new_tabs[0].page->get_type() == PageTypez::CHAT) { + body_set_selected_item(tabs[selected_tab].body.get(), selected_item); current_page = PageType::CHAT; current_chat_room = matrix->get_room_by_id(selected_item->url); while(window.isOpen()) { diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 4b980a0..8e1e54e 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -415,7 +415,7 @@ namespace QuickMedia { }); } - static void body_set_selected_item(Body *body, BodyItem *selected_item) { + 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); -- cgit v1.2.3