File indexing completed on 2024-05-19 16:41:18

0001 /*
0002     SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "notificationmanagerplugin.h"
0008 
0009 #include "job.h"
0010 #include "notifications.h"
0011 #include "server.h"
0012 #include "serverinfo.h"
0013 #include "settings.h"
0014 #include "watchednotificationsmodel.h"
0015 
0016 #include <QQmlEngine>
0017 
0018 using namespace NotificationManager;
0019 
0020 void NotificationManagerPlugin::registerTypes(const char *uri)
0021 {
0022     Q_ASSERT(uri == QLatin1String("org.kde.notificationmanager"));
0023 
0024     qmlRegisterType<Notifications>(uri, 1, 0, "Notifications");
0025     qmlRegisterUncreatableType<Job>(uri, 1, 0, "Job", QStringLiteral("Can only access Job via JobDetailsRole of JobsModel"));
0026     qmlRegisterType<Settings>(uri, 1, 0, "Settings");
0027     qmlRegisterSingletonType<Server>(uri, 1, 0, "Server", [](QQmlEngine *, QJSEngine *) -> QObject * {
0028         QQmlEngine::setObjectOwnership(&Server::self(), QQmlEngine::CppOwnership);
0029         return &Server::self();
0030     });
0031     qmlRegisterUncreatableType<ServerInfo>(uri, 1, 0, "ServerInfo", QStringLiteral("Can only access ServerInfo via Server"));
0032 
0033     // WARNING: this is unstable API and does not provide any API or ABI gurantee for future Plasma releases and can be removed without any further notice
0034     qmlRegisterType<WatchedNotificationsModel>(uri, 1, 1, "WatchedNotificationsModel");
0035 }