| 268 | } |
| 269 | |
| 270 | bool GM_Manager::removeScript(GM_Script* script, const bool removeFile) |
| 271 | { |
| 272 | if (!script) { |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | m_scripts.removeOne(script); |
| 277 | |
| 278 | if (script->startAt() == GM_Script::ContextMenu) { |
| 279 | m_contextMenuScripts.removeOne(script); |
| 280 | } |
| 281 | else { |
| 282 | QWebEngineScriptCollection *collection = mApp->webProfile()->scripts(); |
| 283 | const auto scripts = collection->find(script->fullName()); |
| 284 | for (const auto &script : scripts) { |
| 285 | collection->remove(script); |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | m_disabledScripts.removeOne(script->fullName()); |
| 290 | |
| 291 | if (removeFile) { |
| 292 | QFile::remove(script->fileName()); |
| 293 | delete script; |
| 294 | } |
| 295 | |
| 296 | Q_EMIT scriptsChanged(); |
| 297 | return true; |
| 298 | } |
| 299 | |
| 300 | void GM_Manager::showNotification(const QString &message, const QString &title) |
| 301 | { |