1 | /* |
2 | This file is part of the kcalcore library. |
3 | |
4 | Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org> |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | #ifndef KCALCORE_SCHEDULEMESSAGE_H |
22 | #define KCALCORE_SCHEDULEMESSAGE_H |
23 | |
24 | #include "incidencebase.h" |
25 | |
26 | #include "kcalcore_export.h" |
27 | |
28 | namespace KCalCore { |
29 | |
30 | class IncidenceBase; |
31 | |
32 | /** |
33 | iTIP methods. |
34 | */ |
35 | enum iTIPMethod { |
36 | iTIPPublish, /**< Event, to-do, journal or freebusy posting */ |
37 | iTIPRequest, /**< Event, to-do or freebusy scheduling request */ |
38 | iTIPReply, /**< Event, to-do or freebusy reply to request */ |
39 | iTIPAdd, /**< Event, to-do or journal additional property request */ |
40 | iTIPCancel, /**< Event, to-do or journal cancellation notice */ |
41 | iTIPRefresh, /**< Event or to-do description update request */ |
42 | iTIPCounter, /**< Event or to-do submit counter proposal */ |
43 | iTIPDeclineCounter,/**< Event or to-do decline a counter proposal */ |
44 | iTIPNoMethod /**< No method */ |
45 | }; |
46 | |
47 | /** |
48 | @brief |
49 | A Scheduling message class. |
50 | |
51 | This class provides an encapsulation of a scheduling message. |
52 | It associates an incidence with an iTIPMethod and status information. |
53 | */ |
54 | class KCALCORE_EXPORT ScheduleMessage |
55 | { |
56 | public: |
57 | /** |
58 | Message status. |
59 | */ |
60 | enum Status { |
61 | PublishNew, /**< New message posting */ |
62 | PublishUpdate, /**< Updated message */ |
63 | Obsolete, /**< obsolete */ |
64 | RequestNew, /**< Request new message posting */ |
65 | RequestUpdate, /**< Request updated message */ |
66 | Unknown /**< No status */ |
67 | }; |
68 | |
69 | /** |
70 | A shared pointer to a ScheduleMessage. |
71 | */ |
72 | typedef QSharedPointer<ScheduleMessage> Ptr; |
73 | |
74 | /** |
75 | Creates a scheduling message with method as defined in iTIPMethod and a status. |
76 | @param incidence a pointer to a valid Incidence to be associated with this message. |
77 | @param method an iTIPMethod. |
78 | @param status a Status. |
79 | */ |
80 | ScheduleMessage(IncidenceBase::Ptr incidence, iTIPMethod method, Status status); |
81 | |
82 | /** |
83 | Destructor. |
84 | */ |
85 | ~ScheduleMessage(); |
86 | |
87 | /** |
88 | Returns the event associated with this message. |
89 | */ |
90 | IncidenceBase::Ptr event() const; |
91 | |
92 | /** |
93 | Returns the iTIP method associated with this message. |
94 | */ |
95 | iTIPMethod method() const; |
96 | |
97 | /** |
98 | Returns a machine-readable (not translatable) name for a iTIP method. |
99 | @param method an iTIPMethod. |
100 | */ |
101 | static QString methodName(iTIPMethod method); |
102 | |
103 | /** |
104 | Returns the status of this message. |
105 | */ |
106 | Status status() const; |
107 | |
108 | /** |
109 | Returns the error message if there is any. |
110 | */ |
111 | QString error() const; |
112 | |
113 | private: |
114 | //@cond PRIVATE |
115 | Q_DISABLE_COPY(ScheduleMessage) |
116 | class Private; |
117 | Private *const d; |
118 | //@endcond |
119 | }; |
120 | |
121 | } |
122 | |
123 | #endif |
124 | |