MCPcopy Create free account
hub / github.com/KDE/falkon / showMenu

Method showMenu

src/plugins/StatusBarIcons/sbi_javascripticon.cpp:46–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void SBI_JavaScriptIcon::showMenu(const QPoint &point)
47{
48 QFont boldFont = font();
49 boldFont.setBold(true);
50
51 QMenu menu;
52 menu.addAction(m_icon, tr("Current Page Settings"))->setFont(boldFont);
53
54 if (testCurrentPageWebAttribute(QWebEngineSettings::JavascriptEnabled)) {
55 menu.addAction(tr("Disable JavaScript (temporarily)"), this, &SBI_JavaScriptIcon::toggleJavaScript);
56 }
57 else {
58 menu.addAction(tr("Enable JavaScript (temporarily)"), this, &SBI_JavaScriptIcon::toggleJavaScript);
59 }
60
61 // JavaScript needs to be always enabled for falkon: sites
62 if (currentPage() && currentPage()->url().scheme() == QLatin1String("falkon")) {
63 menu.actions().at(1)->setEnabled(false);
64 }
65
66 menu.addSeparator();
67 menu.addAction(m_icon, tr("Global Settings"))->setFont(boldFont);
68 menu.addAction(tr("Manage JavaScript settings"), this, &SBI_JavaScriptIcon::openJavaScriptSettings);
69 menu.exec(point);
70}
71
72void SBI_JavaScriptIcon::updateIcon()
73{

Callers

nothing calls this directly

Calls 6

addActionMethod · 0.80
atMethod · 0.80
execMethod · 0.80
urlMethod · 0.45
setEnabledMethod · 0.45
addSeparatorMethod · 0.45

Tested by

no test coverage detected