mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
Browser: Scope bookmark actions so that they don't block the delete key
This fixes #10940. Previously, all presses of the Delete key without a modifier in Browser were uselessly consumed by the "Delete" action in the bookmark context menu.
This commit is contained in:
parent
fb5ea617f1
commit
97eb662e62
1 changed files with 22 additions and 14 deletions
|
@ -124,23 +124,31 @@ BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enable
|
|||
m_separator = GUI::Widget::construct();
|
||||
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
auto default_action = GUI::Action::create("&Open", [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, Mod_None);
|
||||
});
|
||||
auto default_action = GUI::Action::create(
|
||||
"&Open", [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, Mod_None);
|
||||
},
|
||||
this);
|
||||
m_context_menu_default_action = default_action;
|
||||
m_context_menu->add_action(default_action);
|
||||
m_context_menu->add_action(GUI::Action::create("Open in New &Tab", [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, Mod_Ctrl);
|
||||
}));
|
||||
m_context_menu->add_action(GUI::Action::create(
|
||||
"Open in New &Tab", [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, Mod_Ctrl);
|
||||
},
|
||||
this));
|
||||
m_context_menu->add_separator();
|
||||
m_context_menu->add_action(GUI::Action::create("&Edit...", [this](auto&) {
|
||||
edit_bookmark(m_context_menu_url);
|
||||
}));
|
||||
m_context_menu->add_action(GUI::CommonActions::make_delete_action([this](auto&) {
|
||||
remove_bookmark(m_context_menu_url);
|
||||
}));
|
||||
m_context_menu->add_action(GUI::Action::create(
|
||||
"&Edit...", [this](auto&) {
|
||||
edit_bookmark(m_context_menu_url);
|
||||
},
|
||||
this));
|
||||
m_context_menu->add_action(GUI::CommonActions::make_delete_action(
|
||||
[this](auto&) {
|
||||
remove_bookmark(m_context_menu_url);
|
||||
},
|
||||
this));
|
||||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> fields;
|
||||
fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft);
|
||||
|
|
Loading…
Add table
Reference in a new issue