Browser: Some action fixes

- Use the same reload action in menu and toolbar
- Scope more actions inside Browser::Tab
This commit is contained in:
Andreas Kling 2020-05-12 17:06:16 +02:00
parent 8c51063a88
commit 388ae07960
Notes: sideshowbarker 2024-07-19 06:42:32 +09:00
2 changed files with 9 additions and 11 deletions

View file

@ -75,26 +75,28 @@ Tab::Tab()
update_actions();
TemporaryChange<bool> change(m_should_push_loads_to_history, false);
m_html_widget->load(m_history.current());
});
}, this);
m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) {
m_history.go_forward();
update_actions();
TemporaryChange<bool> change(m_should_push_loads_to_history, false);
m_html_widget->load(m_history.current());
});
}, this);
toolbar.add_action(*m_go_back_action);
toolbar.add_action(*m_go_forward_action);
toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) {
m_html_widget->load(g_home_url);
}));
}, this));
toolbar.add_action(GUI::CommonActions::make_reload_action([this](auto&) {
m_reload_action = GUI::CommonActions::make_reload_action([this](auto&) {
TemporaryChange<bool> change(m_should_push_loads_to_history, false);
m_html_widget->reload();
}));
}, this);
toolbar.add_action(*m_reload_action);
m_location_box = toolbar.add<GUI::TextBox>();
@ -221,12 +223,7 @@ Tab::Tab()
},
this));
app_menu.add_action(GUI::Action::create(
"Reload", { Mod_None, Key_F5 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"), [this](auto&) {
TemporaryChange<bool> change(m_should_push_loads_to_history, false);
m_html_widget->reload();
},
this));
app_menu.add_action(*m_reload_action);
app_menu.add_separator();
app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
GUI::Application::the().quit();

View file

@ -62,6 +62,7 @@ private:
RefPtr<Web::HtmlView> m_html_widget;
RefPtr<GUI::Action> m_go_back_action;
RefPtr<GUI::Action> m_go_forward_action;
RefPtr<GUI::Action> m_reload_action;
RefPtr<GUI::TextBox> m_location_box;
RefPtr<GUI::Button> m_bookmark_button;
RefPtr<GUI::Window> m_dom_inspector_window;