File indexing completed on 2024-04-28 15:29:13
0001 /* 0002 SPDX-FileCopyrightText: 2005-2006 Olivier Goffart <ogoffart at kde.org> 0003 SPDX-FileCopyrightText: 2008 Dmitry Suzdalev <dimsuz@gmail.com> 0004 SPDX-FileCopyrightText: 2014 Martin Klapetek <mklapetek@kde.org> 0005 SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com> 0006 0007 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0008 */ 0009 0010 #ifndef NOTIFYBYPORTAL_H 0011 #define NOTIFYBYPORTAL_H 0012 0013 #include "knotificationplugin.h" 0014 0015 #include <QVariantList> 0016 0017 #include <memory> 0018 0019 class KNotification; 0020 class NotifyByPortalPrivate; 0021 0022 class NotifyByPortal : public KNotificationPlugin 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit NotifyByPortal(QObject *parent = nullptr); 0027 ~NotifyByPortal() override; 0028 0029 QString optionName() override 0030 { 0031 return QStringLiteral("Popup"); 0032 } 0033 void notify(KNotification *notification, KNotifyConfig *notifyConfig) override; 0034 void close(KNotification *notification) override; 0035 void update(KNotification *notification, KNotifyConfig *config) override; 0036 0037 private Q_SLOTS: 0038 0039 // slot to catch appearance or disappearance of org.freedesktop.Desktop DBus service 0040 void onServiceOwnerChanged(const QString &, const QString &, const QString &); 0041 0042 void onPortalNotificationActionInvoked(const QString &, const QString &, const QVariantList &); 0043 0044 private: 0045 // TODO KF6, replace current public notify/update 0046 void notify(KNotification *notification, const KNotifyConfig ¬ifyConfig); 0047 void update(KNotification *notification, const KNotifyConfig ¬ifyConfig); 0048 0049 std::unique_ptr<NotifyByPortalPrivate> const d; 0050 }; 0051 0052 #endif