diff --git a/Ladybird/Qt/InspectorWidget.cpp b/Ladybird/Qt/InspectorWidget.cpp index 63a697efd2c..ad61f73f055 100644 --- a/Ladybird/Qt/InspectorWidget.cpp +++ b/Ladybird/Qt/InspectorWidget.cpp @@ -6,6 +6,7 @@ #include "InspectorWidget.h" #include +#include #include #include #include @@ -59,6 +60,12 @@ InspectorWidget::InspectorWidget(QWidget* tab, WebContentView& content_view) m_copy_attribute_value_action = new QAction("Copy attribute &value", this); connect(m_copy_attribute_value_action, &QAction::triggered, [this]() { m_inspector_client->context_menu_copy_dom_node_attribute_value(); }); + m_delete_cookie_action = new QAction("&Delete cookie", this); + connect(m_delete_cookie_action, &QAction::triggered, [this]() { m_inspector_client->context_menu_delete_cookie(); }); + + m_delete_all_cookies_action = new QAction("Delete &all cookies", this); + connect(m_delete_all_cookies_action, &QAction::triggered, [this]() { m_inspector_client->context_menu_delete_all_cookies(); }); + m_dom_node_text_context_menu = new QMenu("DOM text context menu", this); m_dom_node_text_context_menu->addAction(m_edit_node_action); m_dom_node_text_context_menu->addAction(m_copy_node_action); @@ -93,6 +100,10 @@ InspectorWidget::InspectorWidget(QWidget* tab, WebContentView& content_view) m_dom_node_attribute_context_menu->addAction(m_copy_node_action); m_dom_node_attribute_context_menu->addAction(m_screenshot_node_action); + m_cookie_context_menu = new QMenu("Cookie context menu", this); + m_cookie_context_menu->addAction(m_delete_cookie_action); + m_cookie_context_menu->addAction(m_delete_all_cookies_action); + m_inspector_client->on_requested_dom_node_text_context_menu = [this](auto position) { m_edit_node_action->setText("&Edit text"); m_copy_node_action->setText("&Copy text"); @@ -120,6 +131,11 @@ InspectorWidget::InspectorWidget(QWidget* tab, WebContentView& content_view) m_dom_node_attribute_context_menu->exec(m_inspector_view->map_point_to_global_position(position)); }; + m_inspector_client->on_requested_cookie_context_menu = [this](auto position, auto const& cookie) { + m_delete_cookie_action->setText(qstring_from_ak_string(MUST(String::formatted("&Delete \"{}\"", cookie.name)))); + m_cookie_context_menu->exec(m_inspector_view->map_point_to_global_position(position)); + }; + setLayout(new QVBoxLayout); layout()->addWidget(m_inspector_view); diff --git a/Ladybird/Qt/InspectorWidget.h b/Ladybird/Qt/InspectorWidget.h index 59268212aed..784b7df524b 100644 --- a/Ladybird/Qt/InspectorWidget.h +++ b/Ladybird/Qt/InspectorWidget.h @@ -47,6 +47,7 @@ private: QMenu* m_dom_node_text_context_menu { nullptr }; QMenu* m_dom_node_tag_context_menu { nullptr }; QMenu* m_dom_node_attribute_context_menu { nullptr }; + QMenu* m_cookie_context_menu { nullptr }; QAction* m_edit_node_action { nullptr }; QAction* m_copy_node_action { nullptr }; @@ -58,6 +59,8 @@ private: QAction* m_add_attribute_action { nullptr }; QAction* m_remove_attribute_action { nullptr }; QAction* m_copy_attribute_value_action { nullptr }; + QAction* m_delete_cookie_action { nullptr }; + QAction* m_delete_all_cookies_action { nullptr }; }; }