| 247 | } |
| 248 | |
| 249 | bool GM_Manager::addScript(GM_Script* script) |
| 250 | { |
| 251 | if (!script || !script->isValid()) { |
| 252 | return false; |
| 253 | } |
| 254 | |
| 255 | m_scripts.append(script); |
| 256 | connect(script, &GM_Script::scriptChanged, this, &GM_Manager::scriptChanged); |
| 257 | |
| 258 | if (script->startAt() == GM_Script::ContextMenu) { |
| 259 | m_contextMenuScripts.append(script); |
| 260 | } |
| 261 | else if (isEnabled()) { |
| 262 | QWebEngineScriptCollection *collection = mApp->webProfile()->scripts(); |
| 263 | collection->insert(script->webScript()); |
| 264 | } |
| 265 | |
| 266 | Q_EMIT scriptsChanged(); |
| 267 | return true; |
| 268 | } |
| 269 | |
| 270 | bool GM_Manager::removeScript(GM_Script* script, const bool removeFile) |
| 271 | { |
no test coverage detected