Changeset View
Changeset View
Standalone View
Standalone View
plugins/sendnotifications/notificationslistener.cpp
Show All 21 Lines | |||||
22 | #include <QtDBus/QDBusInterface> | 22 | #include <QtDBus/QDBusInterface> | ||
23 | #include <QtDBus/QDBusArgument> | 23 | #include <QtDBus/QDBusArgument> | ||
24 | #include <QtDebug> | 24 | #include <QtDebug> | ||
25 | #include <QLoggingCategory> | 25 | #include <QLoggingCategory> | ||
26 | #include <QStandardPaths> | 26 | #include <QStandardPaths> | ||
27 | #include <QImage> | 27 | #include <QImage> | ||
28 | #include <KConfig> | 28 | #include <KConfig> | ||
29 | #include <KConfigGroup> | 29 | #include <KConfigGroup> | ||
30 | | ||||
31 | #include <kiconloader.h> | 30 | #include <kiconloader.h> | ||
32 | #include <kicontheme.h> | 31 | #include <kicontheme.h> | ||
33 | 32 | | |||
34 | #include <core/device.h> | 33 | #include <core/device.h> | ||
35 | #include <core/kdeconnectplugin.h> | 34 | #include <core/kdeconnectplugin.h> | ||
36 | 35 | | |||
37 | #include "notificationslistener.h" | 36 | #include "notificationslistener.h" | ||
38 | #include "sendnotificationsplugin.h" | 37 | #include "sendnotificationsplugin.h" | ||
39 | #include "sendnotification_debug.h" | 38 | #include "sendnotification_debug.h" | ||
40 | #include "notifyingapplication.h" | 39 | #include "notifyingapplication.h" | ||
41 | 40 | | |||
41 | //In older Qt released, qAsConst isnt available | ||||
42 | #include "qtcompat_p.h" | ||||
43 | | ||||
42 | NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin) | 44 | NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin) | ||
43 | : QDBusAbstractAdaptor(aPlugin), | 45 | : QDBusAbstractAdaptor(aPlugin), | ||
44 | m_plugin(aPlugin) | 46 | m_plugin(aPlugin) | ||
45 | { | 47 | { | ||
46 | qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication"); | 48 | qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication"); | ||
47 | 49 | | |||
48 | bool ret = QDBusConnection::sessionBus() | 50 | bool ret = QDBusConnection::sessionBus() | ||
49 | .registerObject(QStringLiteral("/org/freedesktop/Notifications"), | 51 | .registerObject(QStringLiteral("/org/freedesktop/Notifications"), | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 169 | if (!iconPath.endsWith(QLatin1String(".png")) && | |||
174 | } | 176 | } | ||
175 | } | 177 | } | ||
176 | } | 178 | } | ||
177 | 179 | | |||
178 | if (iconPath.endsWith(QLatin1String(".png"))) | 180 | if (iconPath.endsWith(QLatin1String(".png"))) | ||
179 | return QSharedPointer<QIODevice>(new QFile(iconPath)); | 181 | return QSharedPointer<QIODevice>(new QFile(iconPath)); | ||
180 | return QSharedPointer<QIODevice>(); | 182 | return QSharedPointer<QIODevice>(); | ||
181 | } | 183 | } | ||
184 | | ||||
182 | uint NotificationsListener::Notify(const QString& appName, uint replacesId, | 185 | uint NotificationsListener::Notify(const QString& appName, uint replacesId, | ||
183 | const QString& appIcon, | 186 | const QString& appIcon, | ||
184 | const QString& summary, const QString& body, | 187 | const QString& summary, const QString& body, | ||
185 | const QStringList& actions, | 188 | const QStringList& actions, | ||
186 | const QVariantMap& hints, int timeout) | 189 | const QVariantMap& hints, int timeout) | ||
187 | { | 190 | { | ||
188 | static int id = 0; | 191 | static int id = 0; | ||
189 | Q_UNUSED(actions); | 192 | Q_UNUSED(actions); | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |