Changeset View
Changeset View
Standalone View
Standalone View
scripting/scripting.cpp
Show All 22 Lines | |||||
23 | // own | 23 | // own | ||
24 | #include "dbuscall.h" | 24 | #include "dbuscall.h" | ||
25 | #include "meta.h" | 25 | #include "meta.h" | ||
26 | #include "scriptingutils.h" | 26 | #include "scriptingutils.h" | ||
27 | #include "workspace_wrapper.h" | 27 | #include "workspace_wrapper.h" | ||
28 | #include "screenedgeitem.h" | 28 | #include "screenedgeitem.h" | ||
29 | #include "scripting_model.h" | 29 | #include "scripting_model.h" | ||
30 | #include "scripting_logging.h" | 30 | #include "scripting_logging.h" | ||
31 | #include "../client.h" | 31 | #include "../x11client.h" | ||
32 | #include "../thumbnailitem.h" | 32 | #include "../thumbnailitem.h" | ||
33 | #include "../options.h" | 33 | #include "../options.h" | ||
34 | #include "../workspace.h" | 34 | #include "../workspace.h" | ||
35 | // KDE | 35 | // KDE | ||
36 | #include <KConfigGroup> | 36 | #include <KConfigGroup> | ||
37 | #include <KPackage/PackageLoader> | 37 | #include <KPackage/PackageLoader> | ||
38 | // Qt | 38 | // Qt | ||
39 | #include <QDBusConnection> | 39 | #include <QDBusConnection> | ||
Show All 20 Lines | 56 | { | |||
60 | } | 60 | } | ||
61 | QString result; | 61 | QString result; | ||
62 | QTextStream stream(&result); | 62 | QTextStream stream(&result); | ||
63 | for (int i = 0; i < context->argumentCount(); ++i) { | 63 | for (int i = 0; i < context->argumentCount(); ++i) { | ||
64 | if (i > 0) { | 64 | if (i > 0) { | ||
65 | stream << " "; | 65 | stream << " "; | ||
66 | } | 66 | } | ||
67 | QScriptValue argument = context->argument(i); | 67 | QScriptValue argument = context->argument(i); | ||
68 | if (KWin::Client *client = qscriptvalue_cast<KWin::Client*>(argument)) { | 68 | if (KWin::X11Client *client = qscriptvalue_cast<KWin::X11Client *>(argument)) { | ||
69 | client->print<QTextStream>(stream); | 69 | client->print<QTextStream>(stream); | ||
70 | } else { | 70 | } else { | ||
71 | stream << argument.toString(); | 71 | stream << argument.toString(); | ||
72 | } | 72 | } | ||
73 | } | 73 | } | ||
74 | script->printMessage(result); | 74 | script->printMessage(result); | ||
75 | 75 | | |||
76 | return engine->undefinedValue(); | 76 | return engine->undefinedValue(); | ||
▲ Show 20 Lines • Show All 629 Lines • ▼ Show 20 Line(s) | 703 | { | |||
706 | qmlRegisterType<DBusCall>("org.kde.kwin", 2, 0, "DBusCall"); | 706 | qmlRegisterType<DBusCall>("org.kde.kwin", 2, 0, "DBusCall"); | ||
707 | qmlRegisterType<ScreenEdgeItem>("org.kde.kwin", 2, 0, "ScreenEdgeItem"); | 707 | qmlRegisterType<ScreenEdgeItem>("org.kde.kwin", 2, 0, "ScreenEdgeItem"); | ||
708 | qmlRegisterType<KWin::ScriptingClientModel::ClientModel>(); | 708 | qmlRegisterType<KWin::ScriptingClientModel::ClientModel>(); | ||
709 | qmlRegisterType<KWin::ScriptingClientModel::SimpleClientModel>("org.kde.kwin", 2, 0, "ClientModel"); | 709 | qmlRegisterType<KWin::ScriptingClientModel::SimpleClientModel>("org.kde.kwin", 2, 0, "ClientModel"); | ||
710 | qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreen>("org.kde.kwin", 2, 0, "ClientModelByScreen"); | 710 | qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreen>("org.kde.kwin", 2, 0, "ClientModelByScreen"); | ||
711 | qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreenAndDesktop>("org.kde.kwin", 2, 0, "ClientModelByScreenAndDesktop"); | 711 | qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreenAndDesktop>("org.kde.kwin", 2, 0, "ClientModelByScreenAndDesktop"); | ||
712 | qmlRegisterType<KWin::ScriptingClientModel::ClientFilterModel>("org.kde.kwin", 2, 0, "ClientFilterModel"); | 712 | qmlRegisterType<KWin::ScriptingClientModel::ClientFilterModel>("org.kde.kwin", 2, 0, "ClientFilterModel"); | ||
713 | qmlRegisterType<KWin::AbstractClient>(); | 713 | qmlRegisterType<KWin::AbstractClient>(); | ||
714 | qmlRegisterType<KWin::Client>(); | 714 | qmlRegisterType<KWin::X11Client>(); | ||
715 | qmlRegisterType<QAbstractItemModel>(); | 715 | qmlRegisterType<QAbstractItemModel>(); | ||
716 | 716 | | |||
717 | m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("workspace"), m_workspaceWrapper); | 717 | m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("workspace"), m_workspaceWrapper); | ||
718 | m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("options"), options); | 718 | m_qmlEngine->rootContext()->setContextProperty(QStringLiteral("options"), options); | ||
719 | 719 | | |||
720 | m_declarativeScriptSharedContext->setContextProperty(QStringLiteral("workspace"), new DeclarativeScriptWorkspaceWrapper(this)); | 720 | m_declarativeScriptSharedContext->setContextProperty(QStringLiteral("workspace"), new DeclarativeScriptWorkspaceWrapper(this)); | ||
721 | // QQmlListProperty interfaces only work via properties, rebind them as functions here | 721 | // QQmlListProperty interfaces only work via properties, rebind them as functions here | ||
722 | QQmlExpression expr(m_declarativeScriptSharedContext, nullptr, "workspace.clientList = function() { return workspace.clients }"); | 722 | QQmlExpression expr(m_declarativeScriptSharedContext, nullptr, "workspace.clientList = function() { return workspace.clients }"); | ||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |