Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/server_p.cpp
Show All 17 Lines | |||||
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 "server_p.h" | 21 | #include "server_p.h" | ||
22 | 22 | | |||
23 | #include "debug.h" | 23 | #include "debug.h" | ||
24 | 24 | | |||
25 | #include "notificationsadaptor.h" | 25 | #include "notificationsadaptor.h" | ||
26 | #include "greeter_interface.h" | ||||
26 | 27 | | |||
27 | #include "notification.h" | 28 | #include "notification.h" | ||
28 | #include "notification_p.h" | 29 | #include "notification_p.h" | ||
29 | 30 | | |||
30 | #include "server.h" | 31 | #include "server.h" | ||
31 | #include "serverinfo.h" | 32 | #include "serverinfo.h" | ||
32 | 33 | | |||
33 | #include "utils_p.h" | 34 | #include "utils_p.h" | ||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Line(s) | 141 | { | |||
218 | 219 | | |||
219 | if (wasReplaced) { | 220 | if (wasReplaced) { | ||
220 | notification.resetUpdated(); | 221 | notification.resetUpdated(); | ||
221 | emit static_cast<Server*>(parent())->notificationReplaced(replaces_id, notification); | 222 | emit static_cast<Server*>(parent())->notificationReplaced(replaces_id, notification); | ||
222 | } else { | 223 | } else { | ||
223 | emit static_cast<Server*>(parent())->notificationAdded(notification); | 224 | emit static_cast<Server*>(parent())->notificationAdded(notification); | ||
224 | } | 225 | } | ||
225 | 226 | | |||
227 | // we check if notification should be shown on lockscreen? if so we forward this to ksld | ||||
228 | if (notification.showOnLockscreen()) { | ||||
229 | OrgKdeScreensaverGreeterInterface iface(QStringLiteral("org.kde.screensaver.Greeter"), | ||||
230 | QStringLiteral("/Greeter"), QDBusConnection::sessionBus()); | ||||
231 | iface.Notify(notificationId, notification.applicationName(), replaces_id, notification.applicationIconName(), | ||||
232 | notification.summary(), notification.body(), notification.actionNames(), | ||||
233 | hints, notification.timeout()); | ||||
234 | } | ||||
davidedmundson: "This" will lack any context when someone is actually debugging this. | |||||
bshah: "This" debug statement should be removed :P | |||||
235 | | ||||
226 | return notificationId; | 236 | return notificationId; | ||
227 | } | 237 | } | ||
228 | 238 | | |||
229 | void ServerPrivate::CloseNotification(uint id) | 239 | void ServerPrivate::CloseNotification(uint id) | ||
230 | { | 240 | { | ||
241 | // here we notify to ksldapp regardless if notification was shown on the lockscreen | ||||
242 | // to simplify the code base, if notification with id doesn't exist on the ksld, it can | ||||
243 | // just ignore it. | ||||
244 | OrgKdeScreensaverGreeterInterface iface(QStringLiteral("org.kde.screensaver.Greeter"), | ||||
davidedmundson: I assume you forgot to have an
iface.Close(...)
line somewhere here | |||||
bshah: Yes, I haven't got full functionality working yet, this was more of RFC. | |||||
245 | QStringLiteral("/Greeter"), QDBusConnection::sessionBus()); | ||||
246 | iface.CloseNotification(id); | ||||
231 | // spec says "If the notification no longer exists, an empty D-BUS Error message is sent back." | 247 | // spec says "If the notification no longer exists, an empty D-BUS Error message is sent back." | ||
232 | static_cast<Server*>(parent())->closeNotification(id, Server::CloseReason::Revoked); | 248 | static_cast<Server*>(parent())->closeNotification(id, Server::CloseReason::Revoked); | ||
233 | } | 249 | } | ||
234 | 250 | | |||
235 | QStringList ServerPrivate::GetCapabilities() const | 251 | QStringList ServerPrivate::GetCapabilities() const | ||
236 | { | 252 | { | ||
237 | // should this be configurable somehow so the UI can tell what it implements? | 253 | // should this be configurable somehow so the UI can tell what it implements? | ||
238 | return QStringList{ | 254 | return QStringList{ | ||
239 | QStringLiteral("body"), | 255 | QStringLiteral("body"), | ||
240 | QStringLiteral("body-hyperlinks"), | 256 | QStringLiteral("body-hyperlinks"), | ||
241 | QStringLiteral("body-markup"), | 257 | QStringLiteral("body-markup"), | ||
242 | QStringLiteral("body-images"), | 258 | QStringLiteral("body-images"), | ||
243 | QStringLiteral("icon-static"), | 259 | QStringLiteral("icon-static"), | ||
244 | QStringLiteral("actions"), | 260 | QStringLiteral("actions"), | ||
245 | QStringLiteral("inline-reply"), | 261 | QStringLiteral("inline-reply"), | ||
246 | 262 | | |||
247 | QStringLiteral("x-kde-urls"), | 263 | QStringLiteral("x-kde-urls"), | ||
248 | QStringLiteral("x-kde-origin-name"), | 264 | QStringLiteral("x-kde-origin-name"), | ||
249 | QStringLiteral("x-kde-display-appname"), | 265 | QStringLiteral("x-kde-display-appname"), | ||
266 | QStringLiteral("x-kde-show-on-lockscreen"), | ||||
250 | 267 | | |||
251 | QStringLiteral("inhibitions") | 268 | QStringLiteral("inhibitions") | ||
252 | }; | 269 | }; | ||
253 | } | 270 | } | ||
254 | 271 | | |||
255 | QString ServerPrivate::GetServerInformation(QString &vendor, QString &version, QString &specVersion) const | 272 | QString ServerPrivate::GetServerInformation(QString &vendor, QString &version, QString &specVersion) const | ||
256 | { | 273 | { | ||
257 | vendor = QStringLiteral("KDE"); | 274 | vendor = QStringLiteral("KDE"); | ||
▲ Show 20 Lines • Show All 227 Lines • Show Last 20 Lines |
"This" will lack any context when someone is actually debugging this.