mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
Browser: Add setting to change homepage URL
This commit is contained in:
parent
3c6d99f696
commit
24c243942d
Notes:
sideshowbarker
2024-07-18 12:06:09 +09:00
Author: https://github.com/mrkct Commit: https://github.com/SerenityOS/serenity/commit/24c243942d3 Pull-request: https://github.com/SerenityOS/serenity/pull/8077
@ -248,6 +248,23 @@ void BrowserWindow::build_menus()
|
||||
|
||||
auto& settings_menu = menubar->add_menu("&Settings");
|
||||
|
||||
m_change_homepage_action = GUI::Action::create(
|
||||
"Set Homepage URL", [this](auto&) {
|
||||
auto config = Core::ConfigFile::get_for_app("Browser");
|
||||
String homepage_url = config->read_entry("Preferences", "Home", "about:blank");
|
||||
if (GUI::InputBox::show(this, homepage_url, "Enter URL", "Change homepage URL") == GUI::InputBox::ExecOK) {
|
||||
if (URL(homepage_url).is_valid()) {
|
||||
config->write_entry("Preferences", "Home", homepage_url);
|
||||
Browser::g_home_url = homepage_url;
|
||||
} else {
|
||||
GUI::MessageBox::show_error(this, "The URL you have entered is not valid");
|
||||
}
|
||||
}
|
||||
},
|
||||
this);
|
||||
|
||||
settings_menu.add_action(*m_change_homepage_action);
|
||||
|
||||
m_search_engine_actions.set_exclusive(true);
|
||||
auto& search_engine_menu = settings_menu.add_submenu("&Search Engine");
|
||||
|
||||
|
@ -55,6 +55,7 @@ private:
|
||||
GUI::ActionGroup m_search_engine_actions;
|
||||
RefPtr<GUI::Action> m_disable_user_agent_spoofing;
|
||||
RefPtr<GUI::Action> m_disable_search_engine_action;
|
||||
RefPtr<GUI::Action> m_change_homepage_action;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user