diff options
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/Browser/BookmarksBarWidget.cpp | 14 | ||||
-rw-r--r-- | Applications/Browser/BookmarksBarWidget.h | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Applications/Browser/BookmarksBarWidget.cpp b/Applications/Browser/BookmarksBarWidget.cpp index edb1636297..9953fa9b67 100644 --- a/Applications/Browser/BookmarksBarWidget.cpp +++ b/Applications/Browser/BookmarksBarWidget.cpp @@ -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(); diff --git a/Applications/Browser/BookmarksBarWidget.h b/Applications/Browser/BookmarksBarWidget.h index ba9772fa73..2eeed8fec5 100644 --- a/Applications/Browser/BookmarksBarWidget.h +++ b/Applications/Browser/BookmarksBarWidget.h @@ -70,6 +70,7 @@ private: RefPtr<GUI::Menu> m_additional_menu; RefPtr<GUI::Menu> m_context_menu; + RefPtr<GUI::Action> m_context_menu_default_action; String m_context_menu_url; NonnullRefPtrVector<GUI::Button> m_bookmarks; |