aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-28 21:19:11 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-28 21:19:11 +0200
commitda9836a92ef69bb93e521985976db0322e2d5316 (patch)
treea44f09a0158f94812f887e53c7780e203c787ea9 /src
parent60f22a9cba69a8443ed1442c5294a0102ed6f1a3 (diff)
Fix submit without selected item (in matrix room directory and invites page)
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp14
-rw-r--r--src/SearchBar.cpp2
-rw-r--r--src/plugins/Matrix.cpp4
3 files changed, 13 insertions, 7 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index b52678d..6069cf9 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1702,9 +1702,13 @@ namespace QuickMedia {
std::function<void(const std::string&)> submit_handler = [this, &submit_handler, &after_submit_handler, &tabs, &tab_associated_data, &ui_tabs, &loop_running, &redraw](const std::string &search_text) {
const int selected_tab = ui_tabs.get_selected();
auto selected_item = tabs[selected_tab].body->get_selected_shared();
+ if(!selected_item && search_text.empty())
+ return;
+
if(tabs[selected_tab].page->allow_submit_no_selection() && (sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl)))
selected_item = nullptr;
- if(!selected_item && (!tabs[selected_tab].page->allow_submit_no_selection() || search_text.empty()))
+
+ if(!selected_item && !tabs[selected_tab].page->allow_submit_no_selection())
return;
hide_virtual_keyboard();
@@ -1714,7 +1718,7 @@ namespace QuickMedia {
tabs[selected_tab].page->submit_body_item = selected_item;
auto plugin_submit_handler = [&tabs, selected_tab, &selected_item, &search_text, &new_tabs]() {
- PluginResult plugin_result = tabs[selected_tab].page->submit(selected_item ? selected_item->get_title() : search_text, selected_item ? selected_item->url : "", new_tabs);
+ PluginResult plugin_result = tabs[selected_tab].page->submit(selected_item ? selected_item->get_title() : search_text, selected_item ? selected_item->url : search_text, new_tabs);
return plugin_result == PluginResult::OK;
};
@@ -4265,8 +4269,10 @@ namespace QuickMedia {
captcha_slide_fg.set_size(sf::Vector2f(std::floor(captcha_slide_fg_size.x * captcha_slide), captcha_slide_fg_size.y));
captcha_slide_fg.set_position(captcha_slide_bg.get_position() + sf::Vector2f(captcha_slide_padding_x, captcha_slide_padding_y));
- captcha_slide_bg.draw(window);
- captcha_slide_fg.draw(window);
+ if(has_captcha_bg) {
+ captcha_slide_bg.draw(window);
+ captcha_slide_fg.draw(window);
+ }
captcha_solution_text.setPosition(
sf::Vector2f(
diff --git a/src/SearchBar.cpp b/src/SearchBar.cpp
index 0634ae8..5909635 100644
--- a/src/SearchBar.cpp
+++ b/src/SearchBar.cpp
@@ -121,7 +121,7 @@ namespace QuickMedia {
time_since_search_update.restart();
}
- if(sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl))
+ if((sf::Keyboard::isKeyPressed(sf::Keyboard::LControl) || sf::Keyboard::isKeyPressed(sf::Keyboard::RControl)) && (event.type != sf::Event::TextEntered || event.text.unicode != 13)) // Enter
return;
if(event.type == sf::Event::TextEntered && event.text.unicode != 8 && event.text.unicode != 127) // 8 = backspace, 127 = del
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 6e95831..68b9524 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -981,8 +981,8 @@ namespace QuickMedia {
rooms_page->set_room_as_read(room);
}
- PluginResult MatrixRoomDirectoryPage::submit(const std::string &title, const std::string&, std::vector<Tab> &result_tabs) {
- std::string server_name = title;
+ PluginResult MatrixRoomDirectoryPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
+ std::string server_name = url;
if(strncmp(server_name.c_str(), "http://", 7) == 0)
server_name.erase(0, 7);