KCalCore Library
attendee.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00034 #include "attendee.h"
00035 using namespace KCalCore;
00036
00041
00042 class KCalCore::Attendee::Private
00043 {
00044 public:
00045 bool mRSVP;
00046 Role mRole;
00047 PartStat mStatus;
00048 QString mUid;
00049 QString mDelegate;
00050 QString mDelegator;
00051 CustomProperties mCustomProperties;
00052 };
00053
00054
00055 Attendee::Attendee( const QString &name, const QString &email, bool rsvp,
00056 Attendee::PartStat status, Attendee::Role role, const QString &uid )
00057 : d( new Attendee::Private )
00058 {
00059 setName( name );
00060 setEmail( email );
00061 d->mRSVP = rsvp;
00062 d->mStatus = status;
00063 d->mRole = role;
00064 d->mUid = uid;
00065 }
00066
00067 Attendee::Attendee( const Attendee &attendee )
00068 : Person( attendee ),
00069 d( new Attendee::Private( *attendee.d ) )
00070 {
00071 }
00072
00073 Attendee::~Attendee()
00074 {
00075 delete d;
00076 }
00077
00078 bool KCalCore::Attendee::operator==( const Attendee &attendee ) const
00079 {
00080 return
00081 ( Person & )*this == ( const Person & )attendee &&
00082 d->mRSVP == attendee.d->mRSVP &&
00083 d->mRole == attendee.d->mRole &&
00084 d->mStatus == attendee.d->mStatus &&
00085 d->mUid == attendee.d->mUid &&
00086 d->mDelegate == attendee.d->mDelegate &&
00087 d->mDelegator == attendee.d->mDelegator;
00088 }
00089
00090 bool KCalCore::Attendee::operator!=( const Attendee &attendee ) const
00091 {
00092 return !operator==( attendee );
00093 }
00094
00095 Attendee &KCalCore::Attendee::operator=( const Attendee &attendee )
00096 {
00097
00098 if ( &attendee == this ) {
00099 return *this;
00100 }
00101
00102 *d = *attendee.d;
00103 setName( attendee.name() );
00104 setEmail( attendee.email() );
00105 return *this;
00106 }
00107
00108 void Attendee::setRSVP( bool r )
00109 {
00110 d->mRSVP = r;
00111 }
00112
00113 bool Attendee::RSVP() const
00114 {
00115 return d->mRSVP;
00116 }
00117
00118 void Attendee::setStatus( Attendee::PartStat status )
00119 {
00120 d->mStatus = status;
00121 }
00122
00123 Attendee::PartStat Attendee::status() const
00124 {
00125 return d->mStatus;
00126 }
00127
00128 void Attendee::setRole( Attendee::Role role )
00129 {
00130 d->mRole = role;
00131 }
00132
00133 Attendee::Role Attendee::role() const
00134 {
00135 return d->mRole;
00136 }
00137
00138 void Attendee::setUid( const QString &uid )
00139 {
00140 d->mUid = uid;
00141 }
00142
00143 QString Attendee::uid() const
00144 {
00145 return d->mUid;
00146 }
00147
00148 void Attendee::setDelegate( const QString &delegate )
00149 {
00150 d->mDelegate = delegate;
00151 }
00152
00153 QString Attendee::delegate() const
00154 {
00155 return d->mDelegate;
00156 }
00157
00158 void Attendee::setDelegator( const QString &delegator )
00159 {
00160 d->mDelegator = delegator;
00161 }
00162
00163 QString Attendee::delegator() const
00164 {
00165 return d->mDelegator;
00166 }
00167
00168 void Attendee::setCustomProperty( const QByteArray &xname, const QString &xvalue )
00169 {
00170 d->mCustomProperties.setNonKDECustomProperty( xname, xvalue );
00171 }
00172
00173 CustomProperties &Attendee::customProperties()
00174 {
00175 return d->mCustomProperties;
00176 }
00177
00178 const CustomProperties &Attendee::customProperties() const
00179 {
00180 return d->mCustomProperties;
00181 }
00182
00183 QDataStream &KCalCore::operator<<( QDataStream &stream, const KCalCore::Attendee::Ptr &attendee )
00184 {
00185 KCalCore::Person::Ptr p( new KCalCore::Person( *( (Person *)attendee.data() ) ) );
00186 stream << p;
00187 return stream << attendee->d->mRSVP
00188 << int( attendee->d->mRole )
00189 << int( attendee->d->mStatus )
00190 << attendee->d->mUid
00191 << attendee->d->mDelegate
00192 << attendee->d->mDelegator
00193 << attendee->d->mCustomProperties;
00194 }
00195
00196 QDataStream &KCalCore::operator>>( QDataStream &stream, KCalCore::Attendee::Ptr &attendee )
00197 {
00198 bool RSVP;
00199 Attendee::Role role;
00200 Attendee::PartStat status;
00201 QString uid;
00202 QString delegate;
00203 QString delegator;
00204 CustomProperties customProperties;
00205 uint role_int;
00206 uint status_int;
00207
00208 KCalCore::Person::Ptr person( new Person() );
00209 stream >> person;
00210 stream >> RSVP
00211 >> role_int
00212 >> status_int
00213 >> uid
00214 >> delegate
00215 >> delegator
00216 >> customProperties;
00217
00218 role = Attendee::Role( role_int );
00219 status = Attendee::PartStat( status_int );
00220
00221 Attendee::Ptr att_temp( new KCalCore::Attendee( person->name(), person->email(),
00222 RSVP, status, role, uid ) );
00223 att_temp->setDelegate( delegate );
00224 att_temp->setDelegator( delegator );
00225 att_temp->d->mCustomProperties = customProperties;
00226 attendee.swap( att_temp );
00227 return stream;
00228 }