2015-09-10 15:36:03 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2015 Holger Kaelberer <holger.k@elberer.de>
|
2015-09-10 15:36:03 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2015-09-10 15:36:03 +01:00
|
|
|
*/
|
|
|
|
|
2023-07-21 19:22:59 +01:00
|
|
|
#pragma once
|
2018-10-26 22:29:28 +01:00
|
|
|
|
2023-07-30 18:05:15 +01:00
|
|
|
#include <optional>
|
|
|
|
|
2023-08-13 20:43:59 +01:00
|
|
|
#include <QHash>
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QSharedPointer>
|
2023-03-13 02:20:12 +00:00
|
|
|
|
2015-09-10 15:36:03 +01:00
|
|
|
class KdeConnectPlugin;
|
2015-12-07 02:21:35 +00:00
|
|
|
struct NotifyingApplication;
|
2015-09-10 15:36:03 +01:00
|
|
|
|
2023-08-13 20:43:59 +01:00
|
|
|
#define PACKET_TYPE_NOTIFICATION QStringLiteral("kdeconnect.notification")
|
|
|
|
|
2023-03-13 02:20:12 +00:00
|
|
|
class NotificationsListener : public QObject
|
2015-09-10 15:36:03 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-09-10 22:23:52 +01:00
|
|
|
explicit NotificationsListener(KdeConnectPlugin *aPlugin);
|
2016-06-20 08:05:02 +01:00
|
|
|
~NotificationsListener() override;
|
2015-09-10 15:36:03 +01:00
|
|
|
|
2015-12-05 22:13:34 +00:00
|
|
|
protected:
|
2023-07-30 18:05:15 +01:00
|
|
|
bool checkApplicationName(const QString &appName, std::optional<std::reference_wrapper<const QString>> iconName = std::nullopt);
|
|
|
|
bool checkIsInBlacklist(const QString &appName, const QString &content);
|
2023-08-13 20:43:59 +01:00
|
|
|
QSharedPointer<QIODevice> iconFromQImage(const QImage &image) const;
|
2015-12-05 22:11:57 +00:00
|
|
|
|
2023-07-30 18:05:15 +01:00
|
|
|
KdeConnectPlugin *m_plugin;
|
|
|
|
|
2015-12-05 22:11:57 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void loadApplications();
|
|
|
|
|
2016-04-27 18:45:58 +01:00
|
|
|
private:
|
2023-07-30 18:05:15 +01:00
|
|
|
void setTranslatedAppName();
|
|
|
|
|
|
|
|
QHash<QString, NotifyingApplication> m_applications;
|
|
|
|
QString m_translatedAppName;
|
2015-09-10 15:36:03 +01:00
|
|
|
};
|