mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +00: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_separator = GUI::Widget::construct();
|
||||||
|
|
||||||
m_context_menu = GUI::Menu::construct();
|
m_context_menu = GUI::Menu::construct();
|
||||||
auto default_action = GUI::Action::create("&Open", [this](auto&) {
|
auto default_action = GUI::Action::create(
|
||||||
|
"&Open", [this](auto&) {
|
||||||
if (on_bookmark_click)
|
if (on_bookmark_click)
|
||||||
on_bookmark_click(m_context_menu_url, Mod_None);
|
on_bookmark_click(m_context_menu_url, Mod_None);
|
||||||
});
|
},
|
||||||
|
this);
|
||||||
m_context_menu_default_action = default_action;
|
m_context_menu_default_action = default_action;
|
||||||
m_context_menu->add_action(default_action);
|
m_context_menu->add_action(default_action);
|
||||||
m_context_menu->add_action(GUI::Action::create("Open in New &Tab", [this](auto&) {
|
m_context_menu->add_action(GUI::Action::create(
|
||||||
|
"Open in New &Tab", [this](auto&) {
|
||||||
if (on_bookmark_click)
|
if (on_bookmark_click)
|
||||||
on_bookmark_click(m_context_menu_url, Mod_Ctrl);
|
on_bookmark_click(m_context_menu_url, Mod_Ctrl);
|
||||||
}));
|
},
|
||||||
|
this));
|
||||||
m_context_menu->add_separator();
|
m_context_menu->add_separator();
|
||||||
m_context_menu->add_action(GUI::Action::create("&Edit...", [this](auto&) {
|
m_context_menu->add_action(GUI::Action::create(
|
||||||
|
"&Edit...", [this](auto&) {
|
||||||
edit_bookmark(m_context_menu_url);
|
edit_bookmark(m_context_menu_url);
|
||||||
}));
|
},
|
||||||
m_context_menu->add_action(GUI::CommonActions::make_delete_action([this](auto&) {
|
this));
|
||||||
|
m_context_menu->add_action(GUI::CommonActions::make_delete_action(
|
||||||
|
[this](auto&) {
|
||||||
remove_bookmark(m_context_menu_url);
|
remove_bookmark(m_context_menu_url);
|
||||||
}));
|
},
|
||||||
|
this));
|
||||||
|
|
||||||
Vector<GUI::JsonArrayModel::FieldSpec> fields;
|
Vector<GUI::JsonArrayModel::FieldSpec> fields;
|
||||||
fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft);
|
fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue