1 | /* Copyright 2011 Thomas McGuire <mcguire@kde.org> |
2 | |
3 | This library is free software; you can redistribute it and/or modify |
4 | it under the terms of the GNU Library General Public License as published |
5 | by the Free Software Foundation; either version 2 of the License or |
6 | (at your option) version 3 or, at the discretion of KDE e.V. |
7 | (which shall act as a proxy as in section 14 of the GPLv3), any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef KFBAPI_EVENTINFO_H |
21 | #define KFBAPI_EVENTINFO_H |
22 | |
23 | #include "libkfbapi_export.h" |
24 | |
25 | #include <KDateTime> |
26 | |
27 | #include <KCalCore/Event> |
28 | #include <KCalCore/Attendee> |
29 | |
30 | namespace KFbAPI { |
31 | |
32 | typedef KCalCore::Event Event; |
33 | typedef KCalCore::Attendee Attendee; |
34 | typedef KCalCore::Event::Ptr EventPtr; |
35 | typedef KCalCore::Incidence::Ptr IncidencePtr; |
36 | typedef KCalCore::Attendee::Ptr AttendeePtr; |
37 | |
38 | /** |
39 | * An attendee to an event |
40 | */ |
41 | class LIBKFBAPI_EXPORT AttendeeInfo |
42 | { |
43 | public: |
44 | |
45 | /** |
46 | * @brief Construct an attendee to an event. |
47 | * |
48 | * @param name The name of the attendee. |
49 | * @param id The facebook id of the attendee. |
50 | * @param status The RSVP status of the attendee. |
51 | */ |
52 | AttendeeInfo(const QString &name, const QString &id, const Attendee::PartStat &status); |
53 | AttendeeInfo(const AttendeeInfo &other); |
54 | ~AttendeeInfo(); |
55 | |
56 | AttendeeInfo &operator=(const AttendeeInfo &other); |
57 | |
58 | /** |
59 | * @return The name of the attendee. |
60 | */ |
61 | QString name() const; |
62 | /** |
63 | * @return Returns the facebook id of the attendee. |
64 | */ |
65 | QString id() const; |
66 | /** |
67 | * @return Returns the RSVP state of the attendee. |
68 | */ |
69 | Attendee::PartStat status() const; |
70 | |
71 | private: |
72 | class AttendeeInfoPrivate; |
73 | QSharedDataPointer<AttendeeInfoPrivate> d; |
74 | }; |
75 | |
76 | typedef QSharedPointer<AttendeeInfo> AttendeeInfoPtr; |
77 | |
78 | |
79 | /** |
80 | * Class to describe a facebook event. |
81 | */ |
82 | class LIBKFBAPI_EXPORT EventInfo |
83 | { |
84 | public: |
85 | EventInfo(); |
86 | EventInfo(const EventInfo &other); |
87 | ~EventInfo(); |
88 | |
89 | EventInfo &operator=(const EventInfo &other); |
90 | |
91 | /** |
92 | * @brief Set the name of the event. |
93 | * @param name The name of the event. |
94 | */ |
95 | void setName(const QString &name); |
96 | /** |
97 | * @return The name of the event. |
98 | */ |
99 | QString name() const; |
100 | |
101 | /** |
102 | * @brief Set the start time of the event. |
103 | * @param startTime The start time of the event as a QString in the |
104 | * "facebook format". |
105 | */ |
106 | void setStartTimeString(const QString &startTime); |
107 | /** |
108 | * @return The start time of the event as a QString in the "facebook format". |
109 | */ |
110 | QString startTimeString() const; |
111 | /** |
112 | * @return The start time of the event as a KDateTime object. |
113 | */ |
114 | KDateTime startTime() const; |
115 | |
116 | /** |
117 | * @brief Set the end time of the event. |
118 | * @param endTime The end time of the event as a QString in the |
119 | * "facebook format". |
120 | */ |
121 | void setEndTimeString(const QString &endTime); |
122 | /** |
123 | * @return The end time of the event as a QString in the "facebook format". |
124 | */ |
125 | QString endTimeString() const; |
126 | /** |
127 | * @return The end time of the event as a KDateTime object. |
128 | */ |
129 | KDateTime endTime() const; |
130 | |
131 | /** |
132 | * @brief Set the location of the event, |
133 | * @param location The location of the event, |
134 | */ |
135 | void setLocation(const QString &location); |
136 | /** |
137 | * @return The location of the event |
138 | */ |
139 | QString location() const; |
140 | |
141 | /** |
142 | * @brief Set the facebook id of the event. |
143 | * @param id The facebook id of the event. |
144 | */ |
145 | void setId(const QString &id); |
146 | /** |
147 | * @return The facebook id of the event. |
148 | */ |
149 | QString id() const; |
150 | |
151 | /** |
152 | * @brief Set the description of the event. |
153 | * @param description The description of the event. |
154 | */ |
155 | void setDescription(const QString &description); |
156 | /** |
157 | * @return The description of the event. |
158 | */ |
159 | QString description() const; |
160 | |
161 | /** |
162 | * @brief Set the organizer of the event. |
163 | * @param organizer The organizer of the event. |
164 | */ |
165 | void setOrganizer(const QString &organizer); |
166 | /** |
167 | * @return The organizer of the event as a QString. |
168 | */ |
169 | QString organizer() const; |
170 | |
171 | /** |
172 | * @brief Set the time the event is last updated. |
173 | * @param updatedTime The last update time of the event in "facebook format". |
174 | */ |
175 | void setUpdatedTimeString(const QString &updatedTime); |
176 | /** |
177 | * @return The time of the last update of the event in "facebook format". |
178 | */ |
179 | QString updatedTimeString() const; |
180 | /** |
181 | * @return The time of the last update of the event as a KDateTime object. |
182 | */ |
183 | KDateTime updatedTime() const; |
184 | |
185 | /** |
186 | * @brief Add a list of attendee objects to this event. |
187 | * @param attendees A list of attendee objects of people that have responded |
188 | * or are requested to respond to this event. |
189 | */ |
190 | void addAttendees(const QList<AttendeeInfoPtr> &attendees); |
191 | QList<AttendeeInfoPtr> attendees() const; |
192 | |
193 | EventPtr asEvent() const; |
194 | |
195 | private: |
196 | class EventInfoPrivate; |
197 | QSharedDataPointer<EventInfoPrivate> d; |
198 | }; |
199 | |
200 | } |
201 | |
202 | #endif |
203 | |