kdeconnect-kde/plugins/notifications/notificationsdbusinterface.h

63 lines
1.8 KiB
C
Raw Normal View History

2013-08-20 12:55:03 +01:00
/**
* SPDX-FileCopyrightText: 2013 Albert Vaca <albertvaka@gmail.com>
2013-08-20 12:55:03 +01:00
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
2013-08-20 12:55:03 +01:00
*/
#ifndef NOTIFICATIONSDBUSINTERFACE_H
#define NOTIFICATIONSDBUSINTERFACE_H
#include <QDBusAbstractAdaptor>
#include <QHash>
#include <QString>
#include <QStringList>
#include <QDir>
#include <QPointer>
2013-08-20 12:55:03 +01:00
#include "notification.h"
class KdeConnectPlugin;
class Device;
2013-08-20 12:55:03 +01:00
class NotificationsDbusInterface
: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.notifications")
public:
explicit NotificationsDbusInterface(KdeConnectPlugin* plugin);
~NotificationsDbusInterface() override;
2013-08-20 12:55:03 +01:00
void processPacket(const NetworkPacket& np);
void clearNotifications();
void dismissRequested(const QString& notification);
void replyRequested(Notification* noti);
void addNotification(Notification* noti);
2013-08-20 12:55:03 +01:00
public Q_SLOTS:
Q_SCRIPTABLE QStringList activeNotifications();
Q_SCRIPTABLE void sendReply(const QString& replyId, const QString& message);
Q_SCRIPTABLE void sendAction(const QString& key, const QString& action);
2013-08-20 12:55:03 +01:00
Q_SIGNALS:
Q_SCRIPTABLE void notificationPosted(const QString& publicId);
Q_SCRIPTABLE void notificationRemoved(const QString& publicId);
Q_SCRIPTABLE void notificationUpdated(const QString& publicId);
Q_SCRIPTABLE void allNotificationsRemoved();
2013-08-20 12:55:03 +01:00
private /*methods*/:
void removeNotification(const QString& internalId);
2018-12-11 17:23:06 +00:00
QString newId(); //Generates successive identifiers to use as public ids
void notificationReady();
2013-08-20 12:55:03 +01:00
private /*attributes*/:
const Device* m_device;
KdeConnectPlugin* m_plugin;
QHash<QString, QPointer<Notification>> m_notifications;
QHash<QString, QString> m_internalIdToPublicId;
int m_lastId;
2013-08-20 12:55:03 +01:00
};
#endif