File indexing completed on 2024-04-21 03:56:29

0001 /*
0002     SPDX-FileCopyrightText: 2019 Piyush Aggarwal <piyushaggarwal002@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef NOTIFYBYSNORE_H
0008 #define NOTIFYBYSNORE_H
0009 
0010 #include "knotificationplugin.h"
0011 
0012 #include <QLocalServer>
0013 #include <QPointer>
0014 #include <QProcess>
0015 #include <QTemporaryDir>
0016 
0017 class NotifyBySnore : public KNotificationPlugin
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     explicit NotifyBySnore(QObject *parent = nullptr);
0023     ~NotifyBySnore() override;
0024 
0025     QString optionName() override
0026     {
0027         return QStringLiteral("Popup");
0028     }
0029     void notify(KNotification *notification, const KNotifyConfig &notifyConfig) override;
0030     void notifyDeferred(KNotification *notification);
0031     void close(KNotification *notification) override;
0032     void update(KNotification *notification, const KNotifyConfig &notifyConfig) override;
0033 
0034 private:
0035     QHash<int, QPointer<KNotification>> m_notifications;
0036     QLocalServer m_server;
0037     QTemporaryDir m_iconDir;
0038 };
0039 
0040 #endif // NOTIFYBYSNORE_H