kdeconnect-kde/plugins/sendnotifications/notificationslistener.h

58 lines
1.8 KiB
C
Raw Normal View History

/**
* SPDX-FileCopyrightText: 2015 Holger Kaelberer <holger.k@elberer.de>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
2019-12-22 07:49:55 +00:00
#ifndef NOTIFICATIONSLISTENER_H
#define NOTIFICATIONSLISTENER_H
#include <QBuffer>
2018-10-07 19:23:20 +01:00
#include <QDBusAbstractAdaptor>
#include <QDBusArgument>
#include <QFile>
#include <core/device.h>
class KdeConnectPlugin;
class Notification;
struct NotifyingApplication;
class NotificationsListener : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications")
public:
explicit NotificationsListener(KdeConnectPlugin *aPlugin);
~NotificationsListener() override;
protected:
KdeConnectPlugin *m_plugin;
QHash<QString, NotifyingApplication> m_applications;
// virtual helper function to make testing possible (QDBusArgument can not
// be injected without making a DBUS-call):
virtual bool parseImageDataArgument(const QVariant &argument,
int &width,
int &height,
int &rowStride,
int &bitsPerSample,
int &channels,
bool &hasAlpha,
QByteArray &imageData) const;
QSharedPointer<QIODevice> iconForImageData(const QVariant &argument) const;
QSharedPointer<QIODevice> iconForIconName(const QString &iconName) const;
public Q_SLOTS:
Q_SCRIPTABLE uint Notify(const QString &, uint, const QString &, const QString &, const QString &, const QStringList &, const QVariantMap &, int);
private Q_SLOTS:
void loadApplications();
private:
void setTranslatedAppName();
QString m_translatedAppName;
};
2019-12-22 07:49:55 +00:00
#endif // NOTIFICATIONSLISTENER_H