1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

LibGUI+Userland: Make Dialog::ExecResult an enum class

This commit is contained in:
Sam Atkins 2022-05-13 13:10:27 +01:00 committed by Linus Groh
parent 1f82beded3
commit cdffe556c8
90 changed files with 232 additions and 232 deletions

View file

@ -35,7 +35,7 @@ public:
editor->set_title("Edit Bookmark");
editor->set_icon(g_icon_bag.bookmark_filled);
if (editor->exec() == Dialog::ExecOK) {
if (editor->exec() == ExecResult::OK) {
return Vector<JsonValue> { editor->title(), editor->url() };
}
@ -58,23 +58,23 @@ private:
m_title_textbox->set_focus(true);
m_title_textbox->select_all();
m_title_textbox->on_return_pressed = [this] {
done(Dialog::ExecOK);
done(ExecResult::OK);
};
m_url_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("url_textbox");
m_url_textbox->set_text(url);
m_url_textbox->on_return_pressed = [this] {
done(Dialog::ExecOK);
done(ExecResult::OK);
};
auto& ok_button = *widget.find_descendant_of_type_named<GUI::Button>("ok_button");
ok_button.on_click = [this](auto) {
done(Dialog::ExecOK);
done(ExecResult::OK);
};
auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button");
cancel_button.on_click = [this](auto) {
done(Dialog::ExecCancel);
done(ExecResult::Cancel);
};
}

View file

@ -247,7 +247,7 @@ void BrowserWindow::build_menus()
m_change_homepage_action = GUI::Action::create(
"Set Homepage URL...", g_icon_bag.go_home, [this](auto&) {
auto homepage_url = Config::read_string("Browser", "Preferences", "Home", "about:blank");
if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecOK) {
if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecResult::OK) {
if (URL(homepage_url).is_valid()) {
Config::write_string("Browser", "Preferences", "Home", homepage_url);
Browser::g_home_url = homepage_url;
@ -373,7 +373,7 @@ void BrowserWindow::build_menus()
auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) {
String user_agent;
if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecOK || user_agent.is_empty() || user_agent.is_null()) {
if (GUI::InputBox::show(this, user_agent, "Enter User Agent:", "Custom User Agent") != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) {
m_disable_user_agent_spoofing->activate();
return;
}
@ -455,7 +455,7 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) {
String search_engine;
if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecOK || search_engine.is_empty()) {
if (GUI::InputBox::show(this, search_engine, "Enter URL template:", "Custom Search Engine", "https://host/search?q={}") != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) {
m_disable_search_engine_action->activate();
return;
}