Changeset View
Changeset View
Standalone View
Standalone View
shell/shellcorona.cpp
Show First 20 Lines • Show All 1460 Lines • ▼ Show 20 Line(s) | |||||
1461 | { | 1461 | { | ||
1462 | showInteractiveKWinConsole(); | 1462 | showInteractiveKWinConsole(); | ||
1463 | if (m_interactiveConsole) { | 1463 | if (m_interactiveConsole) { | ||
1464 | m_interactiveConsole->rootObject()->setProperty("script", script); | 1464 | m_interactiveConsole->rootObject()->setProperty("script", script); | ||
1465 | } | 1465 | } | ||
1466 | } | 1466 | } | ||
1467 | 1467 | | |||
1468 | void ShellCorona::evaluateScript(const QString &script) { | 1468 | void ShellCorona::evaluateScript(const QString &script) { | ||
1469 | if (immutability() == Plasma::Types::SystemImmutable) { | | |||
1470 | if (calledFromDBus()) { | 1469 | if (calledFromDBus()) { | ||
1470 | if (immutability() == Plasma::Types::SystemImmutable) { | ||||
1471 | sendErrorReply(QDBusError::Failed, QStringLiteral("Widgets are locked")); | 1471 | sendErrorReply(QDBusError::Failed, QStringLiteral("Widgets are locked")); | ||
1472 | } | | |||
1473 | return; | 1472 | return; | ||
1473 | } else if (!KAuthorized::authorize(QStringLiteral("plasma-desktop/scripting_console"))) { | ||||
1474 | sendErrorReply(QDBusError::Failed, QStringLiteral("Administrative policies prevent script execution")); | ||||
1475 | return; | ||||
1476 | } | ||||
1474 | } | 1477 | } | ||
1475 | 1478 | | |||
1476 | WorkspaceScripting::ScriptEngine scriptEngine(this); | 1479 | WorkspaceScripting::ScriptEngine scriptEngine(this); | ||
1477 | 1480 | | |||
1478 | connect(&scriptEngine, &WorkspaceScripting::ScriptEngine::printError, this, | 1481 | connect(&scriptEngine, &WorkspaceScripting::ScriptEngine::printError, this, | ||
1479 | [](const QString &msg) { | 1482 | [](const QString &msg) { | ||
1480 | qWarning() << msg; | 1483 | qWarning() << msg; | ||
1481 | }); | 1484 | }); | ||
▲ Show 20 Lines • Show All 625 Lines • Show Last 20 Lines |