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

Method scriptChanged

src/plugins/GreaseMonkey/gm_manager.cpp:354–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354void GM_Manager::scriptChanged()
355{
356 auto *script = qobject_cast<GM_Script*>(sender());
357 if (!script) {
358 return;
359 }
360
361 QWebEngineScriptCollection *collection = mApp->webProfile()->scripts();
362 const auto scripts = collection->find(script->fullName());
363 for (const auto &script : scripts) {
364 collection->remove(script);
365 }
366 for (const auto &cmScript : std::as_const(m_contextMenuScripts)) {
367 if (cmScript->fullName() == script->fullName()) {
368 m_contextMenuScripts.removeOne(cmScript);
369 }
370 }
371
372 if (script->startAt() == GM_Script::ContextMenu) {
373 m_contextMenuScripts.append(script);
374 }
375 else if (isEnabled()) {
376 collection->insert(script->webScript());
377 }
378}
379
380bool GM_Manager::canRunOnScheme(const QString &scheme)
381{

Callers

nothing calls this directly

Calls 7

webProfileMethod · 0.80
findMethod · 0.80
fullNameMethod · 0.80
startAtMethod · 0.80
insertMethod · 0.80
webScriptMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected