attendee.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <qstringlist.h>
00022
00023 #include <kdebug.h>
00024 #include <klocale.h>
00025
00026 #include "attendee.h"
00027
00028 using namespace KCal;
00029
00030 Attendee::Attendee( const QString &name, const QString &email, bool _rsvp,
00031 Attendee::PartStat s, Attendee::Role r, const QString &u)
00032 : Person( name, email )
00033 {
00034 mRSVP = _rsvp;
00035 mStatus = s;
00036 mRole = r;
00037 mUid = u;
00038 }
00039
00040 Attendee::~Attendee()
00041 {
00042 }
00043
00044 bool KCal::operator==( const Attendee& a1, const Attendee& a2 )
00045 {
00046 return ( operator==( (const Person&)a1, (const Person&) a2 ) &&
00047 a1.RSVP() == a2.RSVP() &&
00048 a1.role() == a2.role() &&
00049 a1.status() == a2.status() &&
00050 a1.uid() == a2.uid() );
00051 }
00052
00053 void Attendee::setStatus( Attendee::PartStat s )
00054 {
00055 mStatus = s;
00056 }
00057
00058 Attendee::PartStat Attendee::status() const
00059 {
00060 return mStatus;
00061 }
00062
00063 QString Attendee::statusStr() const
00064 {
00065 return statusName( mStatus );
00066 }
00067
00068 QString Attendee::statusName( Attendee::PartStat s )
00069 {
00070 switch ( s ) {
00071 default:
00072 case NeedsAction:
00073 return i18n("Needs Action");
00074 break;
00075 case Accepted:
00076 return i18n("Accepted");
00077 break;
00078 case Declined:
00079 return i18n("Declined");
00080 break;
00081 case Tentative:
00082 return i18n("Tentative");
00083 break;
00084 case Delegated:
00085 return i18n("Delegated");
00086 break;
00087 case Completed:
00088 return i18n("Completed");
00089 break;
00090 case InProcess:
00091 return i18n("In Process");
00092 break;
00093 }
00094 }
00095
00096 QStringList Attendee::statusList()
00097 {
00098 QStringList list;
00099 list << statusName( NeedsAction );
00100 list << statusName( Accepted );
00101 list << statusName( Declined );
00102 list << statusName( Tentative );
00103 list << statusName( Delegated );
00104 list << statusName( Completed );
00105 list << statusName( InProcess );
00106
00107 return list;
00108 }
00109
00110
00111 void Attendee::setRole( Attendee::Role r )
00112 {
00113 mRole = r;
00114 }
00115
00116 Attendee::Role Attendee::role() const
00117 {
00118 return mRole;
00119 }
00120
00121 QString Attendee::roleStr() const
00122 {
00123 return roleName( mRole );
00124 }
00125
00126 void Attendee::setUid( const QString &uid )
00127 {
00128 mUid = uid;
00129 }
00130
00131 QString Attendee::uid() const
00132 {
00133 return mUid;
00134 }
00135
00136 QString Attendee::roleName( Attendee::Role r )
00137 {
00138 switch ( r ) {
00139 case Chair:
00140 return i18n("Chair");
00141 break;
00142 default:
00143 case ReqParticipant:
00144 return i18n("Participant");
00145 break;
00146 case OptParticipant:
00147 return i18n("Optional Participant");
00148 break;
00149 case NonParticipant:
00150 return i18n("Observer");
00151 break;
00152 }
00153 }
00154
00155 QStringList Attendee::roleList()
00156 {
00157 QStringList list;
00158 list << roleName( ReqParticipant );
00159 list << roleName( OptParticipant );
00160 list << roleName( NonParticipant );
00161 list << roleName( Chair );
00162
00163 return list;
00164 }
This file is part of the documentation for libkcal Library Version 3.3.2.