Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/declarative/notificationmanagerplugin.cpp
Show All 16 Lines | |||||
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "notificationmanagerplugin.h" | 21 | #include "notificationmanagerplugin.h" | ||
22 | 22 | | |||
23 | #include "notifications.h" | 23 | #include "notifications.h" | ||
24 | #include "job.h" | 24 | #include "job.h" | ||
25 | #include "server.h" | ||||
25 | #include "settings.h" | 26 | #include "settings.h" | ||
26 | 27 | | |||
27 | #include <QQmlEngine> | 28 | #include <QQmlEngine> | ||
28 | 29 | | |||
29 | using namespace NotificationManager; | 30 | using namespace NotificationManager; | ||
30 | 31 | | |||
31 | void NotificationManagerPlugin::registerTypes(const char *uri) | 32 | void NotificationManagerPlugin::registerTypes(const char *uri) | ||
32 | { | 33 | { | ||
33 | Q_ASSERT(uri == QLatin1String("org.kde.notificationmanager")); | 34 | Q_ASSERT(uri == QLatin1String("org.kde.notificationmanager")); | ||
34 | 35 | | |||
35 | qmlRegisterType<Notifications>(uri, 1, 0, "Notifications"); | 36 | qmlRegisterType<Notifications>(uri, 1, 0, "Notifications"); | ||
36 | qmlRegisterUncreatableType<Job>(uri, 1, 0, "Job", QStringLiteral("Can only access Job via JobDetailsRole of JobsModel")); | 37 | qmlRegisterUncreatableType<Job>(uri, 1, 0, "Job", QStringLiteral("Can only access Job via JobDetailsRole of JobsModel")); | ||
37 | qmlRegisterType<Settings>(uri, 1, 0, "Settings"); | 38 | qmlRegisterType<Settings>(uri, 1, 0, "Settings"); | ||
39 | qmlRegisterSingletonType<Server>(uri, 1, 0, "Server", [](QQmlEngine *, QJSEngine *) -> QObject* { | ||||
40 | QQmlEngine::setObjectOwnership(&Server::self(), QQmlEngine::CppOwnership); | ||||
41 | return &Server::self(); | ||||
42 | }); | ||||
38 | } | 43 | } |