Changeset View
Changeset View
Standalone View
Standalone View
src/attendee.cpp
Show All 26 Lines | 23 | /** | |||
---|---|---|---|---|---|
27 | 27 | | |||
28 | @brief | 28 | @brief | ||
29 | Represents information related to an attendee of an Calendar Incidence. | 29 | Represents information related to an attendee of an Calendar Incidence. | ||
30 | 30 | | |||
31 | @author Cornelius Schumacher \<schumacher@kde.org\> | 31 | @author Cornelius Schumacher \<schumacher@kde.org\> | ||
32 | */ | 32 | */ | ||
33 | 33 | | |||
34 | #include "attendee.h" | 34 | #include "attendee.h" | ||
35 | #include "person.h" | ||||
36 | #include "person_p.h" | ||||
35 | 37 | | |||
36 | #include <QDataStream> | 38 | #include <QDataStream> | ||
37 | 39 | | |||
38 | using namespace KCalCore; | 40 | using namespace KCalCore; | ||
39 | 41 | | |||
40 | /** | 42 | /** | ||
41 | Private class that helps to provide binary compatibility between releases. | 43 | Private class that helps to provide binary compatibility between releases. | ||
42 | @internal | 44 | @internal | ||
Show All 9 Lines | 49 | public: | |||
52 | 54 | | |||
53 | bool mRSVP = false; | 55 | bool mRSVP = false; | ||
54 | Role mRole; | 56 | Role mRole; | ||
55 | PartStat mStatus; | 57 | PartStat mStatus; | ||
56 | QString mUid; | 58 | QString mUid; | ||
57 | QString mDelegate; | 59 | QString mDelegate; | ||
58 | QString mDelegator; | 60 | QString mDelegator; | ||
59 | CustomProperties mCustomProperties; | 61 | CustomProperties mCustomProperties; | ||
62 | QString mName; | ||||
63 | QString mEmail; | ||||
60 | private: | 64 | private: | ||
61 | QString sCuType; | 65 | QString sCuType; | ||
62 | CuType mCuType; | 66 | CuType mCuType; | ||
63 | }; | 67 | }; | ||
64 | //@endcond | 68 | //@endcond | ||
65 | 69 | | |||
66 | void KCalCore::Attendee::Private::setCuType(Attendee::CuType cuType) | 70 | void KCalCore::Attendee::Private::setCuType(Attendee::CuType cuType) | ||
67 | { | 71 | { | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 124 | { | |||
123 | d->mRSVP = rsvp; | 127 | d->mRSVP = rsvp; | ||
124 | d->mStatus = status; | 128 | d->mStatus = status; | ||
125 | d->mRole = role; | 129 | d->mRole = role; | ||
126 | d->mUid = uid; | 130 | d->mUid = uid; | ||
127 | d->setCuType(Attendee::Individual); | 131 | d->setCuType(Attendee::Individual); | ||
128 | } | 132 | } | ||
129 | 133 | | |||
130 | Attendee::Attendee(const Attendee &attendee) | 134 | Attendee::Attendee(const Attendee &attendee) | ||
131 | : Person(attendee), | 135 | : d(new Attendee::Private(*attendee.d)) | ||
132 | d(new Attendee::Private(*attendee.d)) | | |||
133 | { | 136 | { | ||
134 | } | 137 | } | ||
135 | 138 | | |||
136 | Attendee::~Attendee() | 139 | Attendee::~Attendee() | ||
137 | { | 140 | { | ||
138 | delete d; | 141 | delete d; | ||
139 | } | 142 | } | ||
140 | 143 | | |||
141 | bool KCalCore::Attendee::operator==(const Attendee &attendee) const | 144 | bool KCalCore::Attendee::operator==(const Attendee &attendee) const | ||
142 | { | 145 | { | ||
143 | return | 146 | return | ||
144 | d->mUid == attendee.d->mUid && | 147 | d->mUid == attendee.d->mUid && | ||
145 | d->mRSVP == attendee.d->mRSVP && | 148 | d->mRSVP == attendee.d->mRSVP && | ||
146 | d->mRole == attendee.d->mRole && | 149 | d->mRole == attendee.d->mRole && | ||
147 | d->mStatus == attendee.d->mStatus && | 150 | d->mStatus == attendee.d->mStatus && | ||
148 | d->mDelegate == attendee.d->mDelegate && | 151 | d->mDelegate == attendee.d->mDelegate && | ||
149 | d->mDelegator == attendee.d->mDelegator && | 152 | d->mDelegator == attendee.d->mDelegator && | ||
150 | d->cuTypeStr() == attendee.d->cuTypeStr() && | 153 | d->cuTypeStr() == attendee.d->cuTypeStr() && | ||
151 | (const Person &) * this == (const Person &)attendee; | 154 | d->mName == attendee.d->mName && | ||
155 | d->mEmail == attendee.d->mEmail; | ||||
152 | } | 156 | } | ||
153 | 157 | | |||
154 | bool KCalCore::Attendee::operator!=(const Attendee &attendee) const | 158 | bool KCalCore::Attendee::operator!=(const Attendee &attendee) const | ||
155 | { | 159 | { | ||
156 | return !operator==(attendee); | 160 | return !operator==(attendee); | ||
157 | } | 161 | } | ||
158 | 162 | | |||
159 | Attendee &KCalCore::Attendee::operator=(const Attendee &attendee) | 163 | Attendee &KCalCore::Attendee::operator=(const Attendee &attendee) | ||
160 | { | 164 | { | ||
161 | // check for self assignment | 165 | // check for self assignment | ||
162 | if (&attendee == this) { | 166 | if (&attendee == this) { | ||
163 | return *this; | 167 | return *this; | ||
164 | } | 168 | } | ||
165 | 169 | | |||
166 | *d = *attendee.d; | 170 | *d = *attendee.d; | ||
167 | setName(attendee.name()); | | |||
168 | setEmail(attendee.email()); | | |||
169 | return *this; | 171 | return *this; | ||
170 | } | 172 | } | ||
171 | 173 | | |||
174 | QString Attendee::name() const | ||||
175 | { | ||||
176 | return d->mName; | ||||
177 | } | ||||
178 | | ||||
179 | void Attendee::setName(const QString &name) | ||||
180 | { | ||||
181 | d->mName = name; | ||||
182 | } | ||||
183 | | ||||
184 | QString Attendee::fullName() const | ||||
185 | { | ||||
186 | return fullNameHelper(d->mName, d->mEmail); | ||||
187 | } | ||||
188 | | ||||
189 | QString Attendee::email() const | ||||
190 | { | ||||
191 | return d->mEmail; | ||||
192 | } | ||||
193 | | ||||
194 | void Attendee::setEmail(const QString &email) | ||||
195 | { | ||||
196 | d->mEmail = email; | ||||
197 | } | ||||
198 | | ||||
172 | void Attendee::setRSVP(bool r) | 199 | void Attendee::setRSVP(bool r) | ||
173 | { | 200 | { | ||
174 | d->mRSVP = r; | 201 | d->mRSVP = r; | ||
175 | } | 202 | } | ||
176 | 203 | | |||
177 | bool Attendee::RSVP() const | 204 | bool Attendee::RSVP() const | ||
178 | { | 205 | { | ||
179 | return d->mRSVP; | 206 | return d->mRSVP; | ||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | |||||
261 | 288 | | |||
262 | const CustomProperties &Attendee::customProperties() const | 289 | const CustomProperties &Attendee::customProperties() const | ||
263 | { | 290 | { | ||
264 | return d->mCustomProperties; | 291 | return d->mCustomProperties; | ||
265 | } | 292 | } | ||
266 | 293 | | |||
267 | QDataStream &KCalCore::operator<<(QDataStream &stream, const KCalCore::Attendee::Ptr &attendee) | 294 | QDataStream &KCalCore::operator<<(QDataStream &stream, const KCalCore::Attendee::Ptr &attendee) | ||
268 | { | 295 | { | ||
269 | KCalCore::Person::Ptr p(new KCalCore::Person(*((Person *)attendee.data()))); | 296 | KCalCore::Person::Ptr p(new KCalCore::Person(attendee->name(), attendee->email())); | ||
270 | stream << p; | 297 | stream << p; | ||
271 | return stream << attendee->d->mRSVP | 298 | return stream << attendee->d->mRSVP | ||
272 | << int(attendee->d->mRole) | 299 | << int(attendee->d->mRole) | ||
273 | << int(attendee->d->mStatus) | 300 | << int(attendee->d->mStatus) | ||
274 | << attendee->d->mUid | 301 | << attendee->d->mUid | ||
275 | << attendee->d->mDelegate | 302 | << attendee->d->mDelegate | ||
276 | << attendee->d->mDelegator | 303 | << attendee->d->mDelegator | ||
277 | << attendee->d->cuTypeStr() | 304 | << attendee->d->cuTypeStr() | ||
Show All 39 Lines |