Changeset View
Changeset View
Standalone View
Standalone View
src/notifybyandroid.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (C) 2018 Volker Krause <vkrause@kde.org> | ||||
3 | | ||||
4 | This program is free software; you can redistribute it and/or modify it | ||||
5 | under the terms of the GNU Library General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||||
7 | option) any later version. | ||||
8 | | ||||
9 | This program is distributed in the hope that it will be useful, but WITHOUT | ||||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||||
12 | License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU General Public License | ||||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||
16 | */ | ||||
17 | | ||||
18 | #ifndef NOTIFYBYANDROID_H | ||||
19 | #define NOTIFYBYANDROID_H | ||||
20 | | ||||
21 | #include "knotificationplugin.h" | ||||
22 | | ||||
23 | #include <QAndroidJniObject> | ||||
24 | #include <QPointer> | ||||
25 | | ||||
26 | /** Android notification backend. */ | ||||
27 | class NotifyByAndroid : public KNotificationPlugin | ||||
28 | { | ||||
29 | Q_OBJECT | ||||
30 | public: | ||||
31 | explicit NotifyByAndroid(QObject *parent = nullptr); | ||||
32 | ~NotifyByAndroid() override; | ||||
33 | | ||||
34 | // interface of KNotificationPlugin | ||||
35 | QString optionName() override; | ||||
36 | void notify(KNotification *notification, KNotifyConfig *config) override; | ||||
37 | void close(KNotification * notification) override; | ||||
38 | | ||||
39 | // interface from Java | ||||
40 | void notificationFinished(int id); | ||||
41 | void notificationActionInvoked(int id, int action); | ||||
42 | | ||||
43 | private: | ||||
44 | void notifyDeferred(KNotification *notification, const KNotifyConfig *config); | ||||
45 | | ||||
46 | QAndroidJniObject m_backend; | ||||
47 | QHash<int, QPointer<KNotification>> m_notifications; | ||||
48 | }; | ||||
49 | | ||||
50 | #endif // NOTIFYBYANDROID_H |