diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-09 05:38:12 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2019-08-09 05:38:14 +0200 |
commit | 10fcdec298ccef4971dc6d109222079a0f438004 (patch) | |
tree | 90124b9d9cfd51c582d4d212c08cd17893d0f4ea /src/QuickMedia.cpp | |
parent | 452311e6bf54368a9dac94c8ee973febf015dfd1 (diff) |
Do not allow search until results are available
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r-- | src/QuickMedia.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index d010693..db2eeb0 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -215,16 +215,16 @@ namespace QuickMedia { update_search_text = text; }; - search_bar->onTextSubmitCallback = [this](const std::string &text) { + search_bar->onTextSubmitCallback = [this](const std::string &text) -> bool { Page next_page = current_plugin->get_page_after_search(); if(search_selected_suggestion(body, current_plugin, content_title, content_url) != SearchResult::OK) - return; + return false; if(next_page == Page::EPISODE_LIST) { Path content_storage_dir = get_storage_dir().join("manga"); if(create_directory_recursive(content_storage_dir) != 0) { show_notification("Storage", "Failed to create directory: " + content_storage_dir.data, Urgency::CRITICAL); - return; + return false; } content_storage_file = content_storage_dir.join(base64_encode(content_title)); @@ -239,6 +239,7 @@ namespace QuickMedia { next_page = Page::SEARCH_RESULT; } current_page = next_page; + return true; }; sf::Vector2f body_pos; @@ -575,10 +576,10 @@ namespace QuickMedia { body->clamp_selection(); }; - search_bar->onTextSubmitCallback = [this](const std::string &text) { + search_bar->onTextSubmitCallback = [this](const std::string &text) -> bool { BodyItem *selected_item = body->get_selected(); if(!selected_item) - return; + return false; images_url = selected_item->url; chapter_title = selected_item->title; @@ -594,7 +595,8 @@ namespace QuickMedia { image_index = current.asInt() - 1; } } - + + return true; }; const Json::Value &json_chapters = content_storage_json["chapters"]; |