diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-12 17:06:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-12 17:07:20 +0200 |
commit | 388ae07960795939e2883f8ea9e5220891e75127 (patch) | |
tree | e5daceff71efef8aa6d7dfd26850bddb95d0e4c9 /Applications | |
parent | 8c51063a88d3d3ae6e57798dbcd8d1af011f8f63 (diff) | |
download | serenity-388ae07960795939e2883f8ea9e5220891e75127.zip |
Browser: Some action fixes
- Use the same reload action in menu and toolbar
- Scope more actions inside Browser::Tab
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/Browser/Tab.cpp | 19 | ||||
-rw-r--r-- | Applications/Browser/Tab.h | 1 |
2 files changed, 9 insertions, 11 deletions
diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index 8e075cda1b..eba8cd31aa 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -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(); diff --git a/Applications/Browser/Tab.h b/Applications/Browser/Tab.h index 0c8946a083..3c6e554e58 100644 --- a/Applications/Browser/Tab.h +++ b/Applications/Browser/Tab.h @@ -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; |