Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/job.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | * later version accepted by the membership of KDE e.V. (or its | ||||
9 | * successor approved by the membership of KDE e.V.), which shall | ||||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | * | ||||
12 | * This library is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | * Lesser General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU Lesser General Public | ||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | #pragma once | ||||
22 | | ||||
23 | #include <QDateTime> | ||||
24 | #include <QString> | ||||
25 | #include <QUrl> | ||||
26 | | ||||
27 | //#include "notificationmanager_export.h" | ||||
28 | | ||||
29 | #include "notifications.h" | ||||
30 | | ||||
31 | | ||||
32 | namespace NotificationManager | ||||
33 | { | ||||
34 | | ||||
35 | class JobDetails; | ||||
36 | | ||||
37 | class Job | ||||
38 | { | ||||
39 | public: | ||||
40 | explicit Job(const QString &sourceName = QString()); | ||||
41 | ~Job(); | ||||
42 | | ||||
43 | QString sourceName() const; | ||||
44 | | ||||
45 | QDateTime created() const; | ||||
46 | | ||||
47 | QDateTime updated() const; | ||||
48 | void setUpdated(); | ||||
49 | | ||||
50 | QString summary() const; | ||||
51 | | ||||
52 | QString desktopEntry() const; | ||||
53 | QString applicationName() const; | ||||
54 | QString applicationIconName() const; | ||||
55 | | ||||
56 | Notifications::JobState state() const; | ||||
57 | int percentage() const; | ||||
58 | int error() const; | ||||
59 | QString errorText() const; | ||||
60 | bool suspendable() const; | ||||
61 | bool killable() const; | ||||
62 | | ||||
63 | JobDetails *details() const; | ||||
64 | | ||||
65 | bool expired() const; | ||||
66 | void setExpired(bool expired); | ||||
67 | | ||||
68 | bool dismissed() const; | ||||
69 | void setDismissed(bool dismissed); | ||||
70 | | ||||
71 | QVector<int> processData(const QVariantMap/*Plasma::DataEngine::Data*/ &data); | ||||
72 | | ||||
73 | bool operator==(const Job &other) const; | ||||
74 | | ||||
75 | private: | ||||
76 | friend class JobsModel; | ||||
77 | | ||||
78 | QString m_sourceName; | ||||
79 | | ||||
80 | QDateTime m_created; | ||||
81 | QDateTime m_updated; | ||||
82 | | ||||
83 | QString m_summary; | ||||
84 | | ||||
85 | // raw appName and appIconName from kuiserver | ||||
86 | QString m_appName; | ||||
87 | QString m_appIconName; | ||||
88 | // names looked up from a service | ||||
89 | QString m_desktopEntry; | ||||
90 | QString m_applicationName; | ||||
91 | QString m_applicationIconName; | ||||
92 | | ||||
93 | Notifications::JobState m_state = Notifications::JobStateStopped; | ||||
94 | int m_percentage = 0; | ||||
95 | int m_error = 0; | ||||
96 | QString m_errorText; | ||||
97 | bool m_suspendable = false; | ||||
98 | bool m_killable = false; | ||||
99 | | ||||
100 | JobDetails *m_details = nullptr; | ||||
101 | | ||||
102 | bool m_expired = false; | ||||
103 | bool m_dismissed = false; | ||||
104 | | ||||
105 | }; | ||||
106 | | ||||
107 | } // namespace NotificationManager |