mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
Browser: Mark default action in context menu of bookmarks
This commit is contained in:
parent
e59c415ae3
commit
a5f7b7e3e7
2 changed files with 11 additions and 4 deletions
|
@ -71,13 +71,19 @@ BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enable
|
|||
m_separator = GUI::Widget::construct();
|
||||
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
m_context_menu->add_action(GUI::Action::create("Delete", [this](auto&) {
|
||||
remove_bookmark(m_context_menu_url);
|
||||
}));
|
||||
auto default_action = GUI::Action::create("Open", [this](auto&) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(m_context_menu_url, Mod_None);
|
||||
});
|
||||
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("Delete", [this](auto&) {
|
||||
remove_bookmark(m_context_menu_url);
|
||||
}));
|
||||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> fields;
|
||||
fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -141,7 +147,7 @@ void BookmarksBarWidget::model_did_update(unsigned)
|
|||
|
||||
button.on_context_menu_request = [this, url](auto& context_menu_event) {
|
||||
m_context_menu_url = url;
|
||||
m_context_menu->popup(context_menu_event.screen_position());
|
||||
m_context_menu->popup(context_menu_event.screen_position(), m_context_menu_default_action);
|
||||
};
|
||||
|
||||
width += rect.width();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue