/* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original * location: https://neueland.iserlohn-fortress.net/smolbote.hg * * SPDX-License-Identifier: GPL-3.0 */ #include "pagetoolsmenu.h" #include "../webview.h" #include #include PageToolsMenu::PageToolsMenu(WebView *parent) : QMenu(parent) { Q_CHECK_PTR(parent); parentView = parent; connect(this, &QMenu::aboutToShow, this, &PageToolsMenu::createEntries); } void PageToolsMenu::createEntries() { clear(); auto *scriptsMenu = new QMenu(tr("Injected scripts"), this); for(const auto &script : parentView->page()->scripts().toList()) { scriptsMenu->addAction(script.name())->setEnabled(false); } addMenu(scriptsMenu); auto *devToolsAction = addAction(tr("Dev tools page")); connect(devToolsAction, &QAction::triggered, this, [this]() { parentView->popupPage(parentView->page()->devToolsPage()); }); }