/** * SPDX-FileCopyrightText: 2015 Holger Kaelberer * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ #ifndef NOTIFICATIONSLISTENER_H #define NOTIFICATIONSLISTENER_H #include #include #include #include #include #include class KdeConnectPlugin; class Notification; struct NotifyingApplication; class NotificationsListener : public QObject { Q_OBJECT public: explicit NotificationsListener(KdeConnectPlugin *aPlugin); ~NotificationsListener() override; protected: KdeConnectPlugin *m_plugin; QHash m_applications; // virtual helper function to make testing possible (QDBusArgument can not // be injected without making a DBUS-call): virtual bool parseImageDataArgument(GVariant *argument, int &width, int &height, int &rowStride, int &bitsPerSample, int &channels, bool &hasAlpha, QByteArray &imageData) const; QSharedPointer iconForImageData(GVariant *argument) const; static QSharedPointer iconForIconName(const QString &iconName); static GDBusMessage *onMessageFiltered(GDBusConnection *connection, GDBusMessage *msg, int incoming, void *parent); private Q_SLOTS: void loadApplications(); private: void setTranslatedAppName(); QString m_translatedAppName; GDBusConnection *m_gdbusConnection = nullptr; unsigned m_gdbusFilterId = 0; }; #endif // NOTIFICATIONSLISTENER_H