Changeset View
Changeset View
Standalone View
Standalone View
plugins/notifications/notificationsplugin.cpp
Show All 31 Lines | |||||
32 | NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& args) | 32 | NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& args) | ||
33 | : KdeConnectPlugin(parent, args) | 33 | : KdeConnectPlugin(parent, args) | ||
34 | { | 34 | { | ||
35 | notificationsDbusInterface = new NotificationsDbusInterface(this); | 35 | notificationsDbusInterface = new NotificationsDbusInterface(this); | ||
36 | } | 36 | } | ||
37 | 37 | | |||
38 | void NotificationsPlugin::connected() | 38 | void NotificationsPlugin::connected() | ||
39 | { | 39 | { | ||
40 | NetworkPackage np(PACKAGE_TYPE_NOTIFICATION_REQUEST, {{"request", true}}); | 40 | NetworkPacket np(PACKET_TYPE_NOTIFICATION_REQUEST, {{"request", true}}); | ||
41 | sendPackage(np); | 41 | sendPacket(np); | ||
42 | } | 42 | } | ||
43 | 43 | | |||
44 | NotificationsPlugin::~NotificationsPlugin() | 44 | NotificationsPlugin::~NotificationsPlugin() | ||
45 | { | 45 | { | ||
46 | qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Destroying NotificationsPlugin"; | 46 | qCDebug(KDECONNECT_PLUGIN_NOTIFICATION) << "Destroying NotificationsPlugin"; | ||
47 | //FIXME: Qt dbus does not allow to remove an adaptor! (it causes a crash in | 47 | //FIXME: Qt dbus does not allow to remove an adaptor! (it causes a crash in | ||
48 | // the next dbus access to its parent). The implication of not deleting this | 48 | // the next dbus access to its parent). The implication of not deleting this | ||
49 | // is that disabling the plugin leaks the interface. As a mitigation we are | 49 | // is that disabling the plugin leaks the interface. As a mitigation we are | ||
50 | // cleaning up the notifications inside the adaptor here. | 50 | // cleaning up the notifications inside the adaptor here. | ||
51 | //notificationsDbusInterface->deleteLater(); | 51 | //notificationsDbusInterface->deleteLater(); | ||
52 | notificationsDbusInterface->clearNotifications(); | 52 | notificationsDbusInterface->clearNotifications(); | ||
53 | } | 53 | } | ||
54 | 54 | | |||
55 | bool NotificationsPlugin::receivePackage(const NetworkPackage& np) | 55 | bool NotificationsPlugin::receivePacket(const NetworkPacket& np) | ||
56 | { | 56 | { | ||
57 | if (np.get<bool>(QStringLiteral("request"))) return false; | 57 | if (np.get<bool>(QStringLiteral("request"))) return false; | ||
58 | 58 | | |||
59 | notificationsDbusInterface->processPackage(np); | 59 | notificationsDbusInterface->processPacket(np); | ||
60 | 60 | | |||
61 | return true; | 61 | return true; | ||
62 | } | 62 | } | ||
63 | 63 | | |||
64 | #include "notificationsplugin.moc" | 64 | #include "notificationsplugin.moc" |