mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
Browser: Introduce action for opening bookmarks in a new window
This change introduces an action to bookmarks that allows them to be opened in a new browser window. This is done by accessing any bookmark's context menu and pressing "Open in New Window".
This commit is contained in:
parent
abad197884
commit
1dddefa737
6 changed files with 32 additions and 11 deletions
|
@ -125,7 +125,7 @@ BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, b
|
|||
auto default_action = GUI::Action::create(
|
||||
"&Open", g_icon_bag.go_to, [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, OpenInNewTab::No);
|
||||
on_bookmark_click(m_context_menu_url, Open::InSameTab);
|
||||
},
|
||||
this);
|
||||
m_context_menu_default_action = default_action;
|
||||
|
@ -133,7 +133,14 @@ BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, b
|
|||
m_context_menu->add_action(GUI::Action::create(
|
||||
"Open in New &Tab", g_icon_bag.new_tab, [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, OpenInNewTab::Yes);
|
||||
on_bookmark_click(m_context_menu_url, Open::InNewTab);
|
||||
},
|
||||
this));
|
||||
m_context_menu->add_action(GUI::Action::create(
|
||||
"Open in New Window", g_icon_bag.new_window, [this](auto&) {
|
||||
if (on_bookmark_click) {
|
||||
on_bookmark_click(m_context_menu_url, Open::InNewWindow);
|
||||
}
|
||||
},
|
||||
this));
|
||||
m_context_menu->add_separator();
|
||||
|
@ -205,12 +212,12 @@ void BookmarksBarWidget::model_did_update(unsigned)
|
|||
|
||||
button.on_click = [title, url, this](auto) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(url, OpenInNewTab::No);
|
||||
on_bookmark_click(url, Open::InSameTab);
|
||||
};
|
||||
|
||||
button.on_middle_mouse_click = [title, url, this](auto) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(url, OpenInNewTab::Yes);
|
||||
on_bookmark_click(url, Open::InNewTab);
|
||||
};
|
||||
|
||||
button.on_context_menu_request = [this, url](auto& context_menu_event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue