Changeset View
Changeset View
Standalone View
Standalone View
plugins/notifications/notificationsdbusinterface.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 100 | { | |||
---|---|---|---|---|---|
108 | 108 | | |||
109 | connect(noti, &Notification::dismissRequested, | 109 | connect(noti, &Notification::dismissRequested, | ||
110 | this, &NotificationsDbusInterface::dismissRequested); | 110 | this, &NotificationsDbusInterface::dismissRequested); | ||
111 | 111 | | |||
112 | connect(noti, &Notification::replyRequested, this, [this,noti]{ | 112 | connect(noti, &Notification::replyRequested, this, [this,noti]{ | ||
113 | replyRequested(noti); | 113 | replyRequested(noti); | ||
114 | }); | 114 | }); | ||
115 | 115 | | |||
116 | connect(noti, &Notification::actionTriggered, this, &NotificationsDbusInterface::sendAction); | ||||
117 | | ||||
116 | const QString& publicId = newId(); | 118 | const QString& publicId = newId(); | ||
117 | m_notifications[publicId] = noti; | 119 | m_notifications[publicId] = noti; | ||
118 | m_internalIdToPublicId[internalId] = publicId; | 120 | m_internalIdToPublicId[internalId] = publicId; | ||
119 | 121 | | |||
120 | QDBusConnection::sessionBus().registerObject(m_device->dbusPath()+"/notifications/"+publicId, noti, QDBusConnection::ExportScriptableContents); | 122 | QDBusConnection::sessionBus().registerObject(m_device->dbusPath()+"/notifications/"+publicId, noti, QDBusConnection::ExportScriptableContents); | ||
121 | Q_EMIT notificationPosted(publicId); | 123 | Q_EMIT notificationPosted(publicId); | ||
122 | } | 124 | } | ||
123 | 125 | | |||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
172 | void NotificationsDbusInterface::sendReply(const QString& replyId, const QString& message) | 174 | void NotificationsDbusInterface::sendReply(const QString& replyId, const QString& message) | ||
173 | { | 175 | { | ||
174 | NetworkPacket np(PACKET_TYPE_NOTIFICATION_REPLY); | 176 | NetworkPacket np(PACKET_TYPE_NOTIFICATION_REPLY); | ||
175 | np.set<QString>(QStringLiteral("requestReplyId"), replyId); | 177 | np.set<QString>(QStringLiteral("requestReplyId"), replyId); | ||
176 | np.set<QString>(QStringLiteral("message"), message); | 178 | np.set<QString>(QStringLiteral("message"), message); | ||
177 | m_plugin->sendPacket(np); | 179 | m_plugin->sendPacket(np); | ||
178 | } | 180 | } | ||
179 | 181 | | |||
182 | void NotificationsDbusInterface::sendAction(const QString& key, const QString& action) | ||||
183 | { | ||||
184 | NetworkPacket np(PACKET_TYPE_NOTIFICATION_ACTION); | ||||
185 | np.set<QString>("key", key); | ||||
186 | np.set<QString>("action", action); | ||||
187 | m_plugin->sendPacket(np); | ||||
188 | } | ||||
189 | | ||||
180 | QString NotificationsDbusInterface::newId() | 190 | QString NotificationsDbusInterface::newId() | ||
181 | { | 191 | { | ||
182 | return QString::number(++m_lastId); | 192 | return QString::number(++m_lastId); | ||
183 | } | 193 | } |