From b3fbbd12c1c623e108103c5be20febbecc730777 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 3 Nov 2020 02:18:04 +0100 Subject: Matrix: update body item filter when switching tab --- src/plugins/Matrix.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/plugins/Matrix.cpp') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index fd05399..2e96cd0 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -442,7 +442,7 @@ namespace QuickMedia { pending_room_messages.clear(); } - MatrixRoomsPage::MatrixRoomsPage(Program *program, Body *body, std::string title, MatrixRoomTagsPage *room_tags_page) : Page(program), body(body), title(std::move(title)), room_tags_page(room_tags_page) { + MatrixRoomsPage::MatrixRoomsPage(Program *program, Body *body, std::string title, MatrixRoomTagsPage *room_tags_page, SearchBar *search_bar) : Page(program), body(body), title(std::move(title)), room_tags_page(room_tags_page), search_bar(search_bar) { if(room_tags_page) room_tags_page->set_current_rooms_page(this); } @@ -460,6 +460,11 @@ namespace QuickMedia { return PluginResult::OK; } + void MatrixRoomsPage::on_navigate_to_page(Body *body) { + if(search_bar) + body->filter_search_fuzzy(search_bar->get_text()); + } + void MatrixRoomsPage::update() { { std::lock_guard lock(mutex); @@ -548,9 +553,10 @@ namespace QuickMedia { TagData &tag_data = tag_body_items_by_name[url]; body->items = tag_data.room_body_items; sort_room_body_items(body->items); - auto rooms_page = std::make_unique(program, body_ptr, tag_data.tag_item->get_title(), this); + auto search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER); + auto rooms_page = std::make_unique(program, body_ptr, tag_data.tag_item->get_title(), this, search_bar.get()); rooms_page->matrix_delegate = matrix_delegate; - result_tabs.push_back(Tab{std::move(body), std::move(rooms_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)}); + result_tabs.push_back(Tab{std::move(body), std::move(rooms_page), std::move(search_bar)}); return PluginResult::OK; } -- cgit v1.2.3