File indexing completed on 2024-03-24 04:59:51
0001 /** 0002 * SPDX-FileCopyrightText: 2015 Holger Kaelberer <holger.k@elberer.de> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <optional> 0010 0011 #include <QHash> 0012 #include <QIODevice> 0013 #include <QSharedPointer> 0014 0015 class KdeConnectPlugin; 0016 struct NotifyingApplication; 0017 0018 #define PACKET_TYPE_NOTIFICATION QStringLiteral("kdeconnect.notification") 0019 0020 class NotificationsListener : public QObject 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit NotificationsListener(KdeConnectPlugin *aPlugin); 0026 ~NotificationsListener() override; 0027 0028 protected: 0029 bool checkApplicationName(const QString &appName, std::optional<std::reference_wrapper<const QString>> iconName = std::nullopt); 0030 bool checkIsInBlacklist(const QString &appName, const QString &content); 0031 QSharedPointer<QIODevice> iconFromQImage(const QImage &image) const; 0032 0033 KdeConnectPlugin *m_plugin; 0034 0035 private Q_SLOTS: 0036 void loadApplications(); 0037 0038 private: 0039 void setTranslatedAppName(); 0040 0041 QHash<QString, NotifyingApplication> m_applications; 0042 QString m_translatedAppName; 0043 };