kdeconnect-kde/plugins/notifications
Jean Vincent c864267f04 Replace Q_FOREACH with C++11 range-for
Summary:
The use of Q_FOREACH is advised against (https://doc.qt.io/qt-5/qtglobal.html#Q_FOREACH) since Qt 5.7 and will eventually be removed from Qt.

I replaced all occurrences with the range-for loop introduced in C++11 (except for the one in daemon.cpp in deviceIdByName which might have a bug / typo in it).

I added const to the container or casted it with qAsConst when appropriate to avoid unnecessary copies.

(This is my first submission. I did all the unit tests, and they all passed but I don't know how to show it here.)

Reviewers: #kde_connect, nicolasfella, apol

Reviewed By: #kde_connect, nicolasfella, apol

Subscribers: albertvaka, apol, nicolasfella

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D6724
2017-07-21 09:57:19 +02:00
..
CMakeLists.txt These changes allow replying to any notifications that offer quick reply text fields 2017-05-31 15:36:43 +02:00
kdeconnect_notifications.json SVN_SILENT made messages (.desktop file) - always resolve ours 2017-06-08 04:52:02 +02:00
notification.cpp Show no notification icon if there is no 2017-07-11 23:27:41 +02:00
notification.h show icon and reply toolbutton in plasmoid 2017-06-01 16:17:45 +02:00
notification_debug.h Fix various krazy2 warnings 2015-08-21 22:38:54 +06:00
notificationsdbusinterface.cpp Replace Q_FOREACH with C++11 range-for 2017-07-21 09:57:19 +02:00
notificationsdbusinterface.h These changes allow replying to any notifications that offer quick reply text fields 2017-05-31 15:36:43 +02:00
notificationsplugin.cpp Clazy says all this QStringLiteral and QLatin1String were missing/wrong 2016-11-26 16:21:29 +01:00
notificationsplugin.h These changes allow replying to any notifications that offer quick reply text fields 2017-05-31 15:36:43 +02:00
README Move the plugins into a different top-ĺevel directory 2014-06-14 16:34:11 +02:00
sendreplydialog.cpp These changes allow replying to any notifications that offer quick reply text fields 2017-05-31 15:36:43 +02:00
sendreplydialog.h These changes allow replying to any notifications that offer quick reply text fields 2017-05-31 15:36:43 +02:00

This plugin listens to packages with type "kdeconnect.notification" that will
contain all the information of the other device notifications.

The other device will report us every notification that is created or dismissed,
so we can keep in sync a local list of notifications.

At the beginning we can request the already existing notifications by sending a
package with the boolean "request" set to true.

The received packages will contain the following fields:

"id" (string): A unique notification id.
"appName" (string): The app that generated the notification
"ticker" (string): The title or headline of the notification.
"isClearable" (boolean): True if we can request to dismiss the notification.
"isCancel" (boolean): True if the notification was dismissed in the peer device.
"requestAnswer" (boolean): True if this is an answer to a "request" package.

Additionally the package can contain a payload with the icon of the notification
in PNG format.

The content of these fields is used to display the notifications to the user.
Note that if we receive a second notification with the same "id", we should
update the existent notification instead of creating a new one.

If the user dismisses a notification from this device, we have to request the
other device to remove it. This is done by sending a package with the fields
"id" set to the id of the notification we want to dismiss and a boolean "cancel"
set to true. The other device will answer with a notification package with
"isCancel" set to true when it is dismissed.