diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-03 04:51:26 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-03 04:51:26 +0200 |
commit | 46d5b735fdbaaf49fe41be4d209fb7d8c314b36b (patch) | |
tree | 83656f14b59f971a82e4d21e7e9bf5a9b59b440a | |
parent | 837c9a29dc72dc42a160d6777f1935f1f272d072 (diff) |
Do not clear youtube search when selecting video
-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) { |