Changeset View
Changeset View
Standalone View
Standalone View
plugin/mycroftplasmoidplugin.cpp
Show All 16 Lines | |||||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "mycroftplasmoidplugin.h" | 19 | #include "mycroftplasmoidplugin.h" | ||
20 | #include "mycroftplasmoid_dbus.h" | 20 | #include "mycroftplasmoid_dbus.h" | ||
21 | #include "launchapp.h" | 21 | #include "launchapp.h" | ||
22 | #include "notify.h" | 22 | #include "notify.h" | ||
23 | #include "filereader.h" | 23 | #include "filereader.h" | ||
24 | #include "msmapp.h" | 24 | #include "msmapp.h" | ||
25 | #include "connectioncheck.h" | ||||
25 | #include <QtQml> | 26 | #include <QtQml> | ||
26 | #include <QtDebug> | 27 | #include <QtDebug> | ||
27 | #include <QtDBus> | 28 | #include <QtDBus> | ||
28 | 29 | | |||
29 | static QObject *notify_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) | 30 | static QObject *notify_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
30 | { | 31 | { | ||
31 | Q_UNUSED(engine) | 32 | Q_UNUSED(engine) | ||
32 | Q_UNUSED(scriptEngine) | 33 | Q_UNUSED(scriptEngine) | ||
Show All 12 Lines | |||||
45 | static QObject *filereader_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) | 46 | static QObject *filereader_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
46 | { | 47 | { | ||
47 | Q_UNUSED(engine) | 48 | Q_UNUSED(engine) | ||
48 | Q_UNUSED(scriptEngine) | 49 | Q_UNUSED(scriptEngine) | ||
49 | 50 | | |||
50 | return new FileReader; | 51 | return new FileReader; | ||
51 | } | 52 | } | ||
52 | 53 | | |||
54 | static QObject *connectioncheck_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) | ||||
55 | { | ||||
56 | Q_UNUSED(engine) | ||||
57 | Q_UNUSED(scriptEngine) | ||||
58 | | ||||
59 | return new ConnectionCheck; | ||||
60 | } | ||||
61 | | ||||
53 | void MycroftPlasmoidPlugin::registerTypes(const char *uri) | 62 | void MycroftPlasmoidPlugin::registerTypes(const char *uri) | ||
54 | { | 63 | { | ||
55 | Q_ASSERT(uri == QLatin1String("org.kde.private.mycroftplasmoid")); | 64 | Q_ASSERT(uri == QLatin1String("org.kde.private.mycroftplasmoid")); | ||
56 | qmlRegisterSingletonType<Notify>(uri, 1, 0, "Notify", notify_singleton); | 65 | qmlRegisterSingletonType<Notify>(uri, 1, 0, "Notify", notify_singleton); | ||
57 | qmlRegisterSingletonType<LaunchApp>(uri, 1, 0, "LaunchApp", launchapp_singleton); | 66 | qmlRegisterSingletonType<LaunchApp>(uri, 1, 0, "LaunchApp", launchapp_singleton); | ||
58 | qmlRegisterSingletonType<FileReader>(uri, 1, 0, "FileReader", filereader_singleton); | 67 | qmlRegisterSingletonType<FileReader>(uri, 1, 0, "FileReader", filereader_singleton); | ||
68 | qmlRegisterSingletonType<ConnectionCheck>(uri, 1, 0, "ConnectionCheck", connectioncheck_singleton); | ||||
59 | qmlRegisterType<MsmApp>(uri, 1, 0, "MsmApp"); | 69 | qmlRegisterType<MsmApp>(uri, 1, 0, "MsmApp"); | ||
60 | } | 70 | } | ||
61 | 71 | | |||
62 | void MycroftPlasmoidPlugin::initializeEngine(QQmlEngine* engine, const char* uri) | 72 | void MycroftPlasmoidPlugin::initializeEngine(QQmlEngine* engine, const char* uri) | ||
63 | { | 73 | { | ||
64 | QQmlExtensionPlugin::initializeEngine(engine, uri); | 74 | QQmlExtensionPlugin::initializeEngine(engine, uri); | ||
65 | auto mycroftDbusAdapterInterface = new MycroftDbusAdapterInterface(engine); | 75 | auto mycroftDbusAdapterInterface = new MycroftDbusAdapterInterface(engine); | ||
66 | engine->rootContext()->setContextProperty("main2", mycroftDbusAdapterInterface); | 76 | engine->rootContext()->setContextProperty("main2", mycroftDbusAdapterInterface); | ||
67 | } | 77 | } |