mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
Browser: Add more tab options
Add more tab options to Browser: "Duplicate Tab" and "Close Other Tabs".
This commit is contained in:
parent
8a0d465fbc
commit
9899addb1d
3 changed files with 15 additions and 0 deletions
|
@ -542,6 +542,14 @@ void BrowserWindow::create_new_tab(URL url, bool activate)
|
|||
});
|
||||
};
|
||||
|
||||
new_tab.on_tab_close_other_request = [this](auto& tab) {
|
||||
m_tab_widget->deferred_invoke([this, &tab](auto&) {
|
||||
m_tab_widget->remove_all_tabs_except(tab);
|
||||
VERIFY(m_tab_widget->children().size() == 1);
|
||||
m_tab_widget->set_bar_visible(false);
|
||||
});
|
||||
};
|
||||
|
||||
new_tab.on_get_cookie = [this](auto& url, auto source) -> String {
|
||||
return m_cookie_jar.get_cookie(url, source);
|
||||
};
|
||||
|
|
|
@ -337,6 +337,12 @@ Tab::Tab(BrowserWindow& window, Type type)
|
|||
m_tab_context_menu->add_action(GUI::Action::create("&Close Tab", [this](auto&) {
|
||||
on_tab_close_request(*this);
|
||||
}));
|
||||
m_tab_context_menu->add_action(GUI::Action::create("&Duplicate Tab", [this](auto&) {
|
||||
on_tab_open_request(url());
|
||||
}));
|
||||
m_tab_context_menu->add_action(GUI::Action::create("Close &Other Tabs", [this](auto&) {
|
||||
on_tab_close_other_request(*this);
|
||||
}));
|
||||
|
||||
m_page_context_menu = GUI::Menu::construct();
|
||||
m_page_context_menu->add_action(window.go_back_action());
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
Function<void(const String&)> on_title_change;
|
||||
Function<void(const URL&)> on_tab_open_request;
|
||||
Function<void(Tab&)> on_tab_close_request;
|
||||
Function<void(Tab&)> on_tab_close_other_request;
|
||||
Function<void(const Gfx::Bitmap&)> on_favicon_change;
|
||||
Function<String(const URL&, Web::Cookie::Source source)> on_get_cookie;
|
||||
Function<void(const URL&, const Web::Cookie::ParsedCookie& cookie, Web::Cookie::Source source)> on_set_cookie;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue