diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-07-30 12:16:58 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-30 13:38:20 +0200 |
commit | 5de7775d22b5b0cde49a99632e8504fbb083efaf (patch) | |
tree | 28ffe9b825b11bc0104a5926d4906bcb1baea1ee /Userland/Applications/Browser | |
parent | c88756078ac7a575fed8449a4a36e2b1466fc673 (diff) | |
download | serenity-5de7775d22b5b0cde49a99632e8504fbb083efaf.zip |
Browser: Show a message when attempting to search with no search engine
Previously, it just showed an error message saying that "" failed to
load, which made me think that search engines were broken.
Diffstat (limited to 'Userland/Applications/Browser')
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 22805a177a..aa7fe0bc53 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -21,6 +21,7 @@ #include <LibGUI/Button.h> #include <LibGUI/Clipboard.h> #include <LibGUI/Menu.h> +#include <LibGUI/MessageBox.h> #include <LibGUI/Statusbar.h> #include <LibGUI/TextBox.h> #include <LibGUI/Toolbar.h> @@ -145,6 +146,11 @@ Tab::Tab(BrowserWindow& window, Type type) m_location_box->set_placeholder("Address"); m_location_box->on_return_pressed = [this] { + if (m_location_box->text().starts_with('?') && g_search_engine.is_empty()) { + GUI::MessageBox::show(&this->window(), "Select a search engine in the Settings menu before searching.", "No search engine selected", GUI::MessageBox::Type::Information); + return; + } + auto url = url_from_user_input(m_location_box->text()); load(url); view().set_focus(true); |