diff options
-rw-r--r-- | src/QuickMedia.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 55f8688..6ab8c19 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -91,17 +91,21 @@ namespace QuickMedia { XCloseDisplay(disp); } - static SearchResult search_selected_suggestion(Body *input_body, Body *output_body, Plugin *plugin, std::string &selected_title, std::string &selected_url) { + static SearchResult search_selected_suggestion(Body *input_body, Body *output_body, Plugin *plugin, std::string &selected_title, std::string &selected_url, bool skip_search) { BodyItem *selected_item = input_body->get_selected(); if(!selected_item) return SearchResult::ERR; selected_title = selected_item->title; selected_url = selected_item->url; - output_body->clear_items(); - SearchResult search_result = plugin->search(!selected_url.empty() ? selected_url : selected_title, output_body->items); - output_body->reset_selected(); - return search_result; + if(!skip_search) { + output_body->clear_items(); + SearchResult search_result = plugin->search(!selected_url.empty() ? selected_url : selected_title, output_body->items); + output_body->reset_selected(); + return search_result; + } else { + return SearchResult::OK; + } } static void usage() { @@ -411,8 +415,9 @@ namespace QuickMedia { return false; Page next_page = current_plugin->get_page_after_search(); + bool skip_search = next_page == Page::VIDEO_CONTENT; // TODO: This shouldn't be done if search_selected_suggestion fails - if(search_selected_suggestion(tabs[selected_tab].body, body, current_plugin, content_title, content_url) != SearchResult::OK) { + if(search_selected_suggestion(tabs[selected_tab].body, body, current_plugin, content_title, content_url, skip_search) != SearchResult::OK) { show_notification("Search", "Search failed!", Urgency::CRITICAL); return false; } @@ -444,6 +449,8 @@ namespace QuickMedia { else { page_stack.push(Page::SEARCH_SUGGESTION); } + current_page = next_page; + return false; } else if(next_page == Page::CONTENT_LIST) { content_list_url = content_url; } else if(next_page == Page::IMAGE_BOARD_THREAD_LIST) { |