diff --git a/Ladybird/Icons/new_tab.tvg b/Ladybird/Icons/new_tab.tvg new file mode 100644 index 00000000000..6a0f18eba07 Binary files /dev/null and b/Ladybird/Icons/new_tab.tvg differ diff --git a/Ladybird/Qt/BrowserWindow.cpp b/Ladybird/Qt/BrowserWindow.cpp index 4726e6ffc1a..2ed5e0f0ced 100644 --- a/Ladybird/Qt/BrowserWindow.cpp +++ b/Ladybird/Qt/BrowserWindow.cpp @@ -78,10 +78,9 @@ BrowserWindow::BrowserWindow(Vector const& initial_urls, WebView::Cook menu->addSeparator(); - auto* new_tab_action = new QAction("New &Tab", this); - new_tab_action->setIcon(load_icon_from_uri("resource://icons/16x16/new-tab.png"sv)); - new_tab_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::AddTab)); - menu->addAction(new_tab_action); + m_new_tab_action = new QAction("New &Tab", this); + m_new_tab_action->setShortcuts(QKeySequence::keyBindings(QKeySequence::StandardKey::AddTab)); + menu->addAction(m_new_tab_action); auto* close_current_tab_action = new QAction("&Close Current Tab", this); close_current_tab_action->setIcon(load_icon_from_uri("resource://icons/16x16/close-tab.png"sv)); @@ -396,7 +395,7 @@ BrowserWindow::BrowserWindow(Vector const& initial_urls, WebView::Cook QObject::connect(about_action, &QAction::triggered, this, [this] { new_tab_from_url("about:version"sv, Web::HTML::ActivateTab::Yes); }); - QObject::connect(new_tab_action, &QAction::triggered, this, [this] { + QObject::connect(m_new_tab_action, &QAction::triggered, this, [this] { new_tab_from_url(ak_url_from_qstring(Settings::the()->new_tab_page()), Web::HTML::ActivateTab::Yes); }); QObject::connect(open_file_action, &QAction::triggered, this, &BrowserWindow::open_file); diff --git a/Ladybird/Qt/BrowserWindow.h b/Ladybird/Qt/BrowserWindow.h index e4caab42ba3..36f47d6a870 100644 --- a/Ladybird/Qt/BrowserWindow.h +++ b/Ladybird/Qt/BrowserWindow.h @@ -51,6 +51,11 @@ public: return *m_reload_action; } + QAction& new_tab_action() + { + return *m_new_tab_action; + } + QAction& copy_selection_action() { return *m_copy_selection_action; @@ -148,6 +153,7 @@ private: QAction* m_go_back_action { nullptr }; QAction* m_go_forward_action { nullptr }; QAction* m_reload_action { nullptr }; + QAction* m_new_tab_action { nullptr }; QAction* m_copy_selection_action { nullptr }; QAction* m_paste_action { nullptr }; QAction* m_select_all_action { nullptr }; diff --git a/Ladybird/Qt/Tab.cpp b/Ladybird/Qt/Tab.cpp index 801f0f17654..a799b7d12bd 100644 --- a/Ladybird/Qt/Tab.cpp +++ b/Ladybird/Qt/Tab.cpp @@ -79,6 +79,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St m_toolbar->addAction(&m_window->go_forward_action()); m_toolbar->addAction(&m_window->reload_action()); m_toolbar->addWidget(m_location_edit); + m_toolbar->addAction(&m_window->new_tab_action()); m_toolbar->setIconSize({ 16, 16 }); // This is a little awkward, but without this Qt shrinks the button to the size of the icon. // Note: toolButtonStyle="0" -> ToolButtonIconOnly. @@ -870,6 +871,7 @@ void Tab::recreate_toolbar_icons() m_window->go_back_action().setIcon(create_tvg_icon_with_theme_colors("back", palette())); m_window->go_forward_action().setIcon(create_tvg_icon_with_theme_colors("forward", palette())); m_window->reload_action().setIcon(create_tvg_icon_with_theme_colors("reload", palette())); + m_window->new_tab_action().setIcon(create_tvg_icon_with_theme_colors("new_tab", palette())); } void Tab::show_inspector_window(InspectorTarget inspector_target) diff --git a/Ladybird/Qt/ladybird.qrc b/Ladybird/Qt/ladybird.qrc index b4c17459bf1..a3c822fb01e 100644 --- a/Ladybird/Qt/ladybird.qrc +++ b/Ladybird/Qt/ladybird.qrc @@ -4,6 +4,7 @@ ../Icons/back.tvg ../Icons/close.tvg ../Icons/forward.tvg + ../Icons/new_tab.tvg ../Icons/reload.tvg