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