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 mFlag =
true;
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 }
00053
00054 void Attendee::setStatus( Attendee::PartStat s )
00055 {
00056 mStatus = s;
00057 }
00058
00059 Attendee::PartStat
Attendee::status()
const
00060
{
00061
return mStatus;
00062 }
00063
00064 QString Attendee::statusStr()
const
00065
{
00066
return statusName( mStatus );
00067 }
00068
00069 QString Attendee::statusName( Attendee::PartStat s )
00070 {
00071
switch ( s ) {
00072
default:
00073
case NeedsAction:
00074
return i18n(
"Needs Action");
00075
break;
00076
case Accepted:
00077
return i18n(
"Accepted");
00078
break;
00079
case Declined:
00080
return i18n(
"Declined");
00081
break;
00082
case Tentative:
00083
return i18n(
"Tentative");
00084
break;
00085
case Delegated:
00086
return i18n(
"Delegated");
00087
break;
00088
case Completed:
00089
return i18n(
"Completed");
00090
break;
00091
case InProcess:
00092
return i18n(
"In Process");
00093
break;
00094 }
00095 }
00096
00097 QStringList Attendee::statusList()
00098 {
00099
QStringList list;
00100 list <<
statusName( NeedsAction );
00101 list <<
statusName( Accepted );
00102 list <<
statusName( Declined );
00103 list <<
statusName( Tentative );
00104 list <<
statusName( Delegated );
00105 list <<
statusName( Completed );
00106 list <<
statusName( InProcess );
00107
00108
return list;
00109 }
00110
00111
00112 void Attendee::setRole( Attendee::Role r )
00113 {
00114 mRole = r;
00115 }
00116
00117 Attendee::Role
Attendee::role()
const
00118
{
00119
return mRole;
00120 }
00121
00122 QString Attendee::roleStr()
const
00123
{
00124
return roleName( mRole );
00125 }
00126
00127 void Attendee::setUid(
const QString &uid )
00128 {
00129 mUid = uid;
00130 }
00131
00132 QString Attendee::uid()
const
00133
{
00134
return mUid;
00135 }
00136
00137 QString Attendee::roleName( Attendee::Role r )
00138 {
00139
switch ( r ) {
00140
case Chair:
00141
return i18n(
"Chair");
00142
break;
00143
default:
00144
case ReqParticipant:
00145
return i18n(
"Participant");
00146
break;
00147
case OptParticipant:
00148
return i18n(
"Optional Participant");
00149
break;
00150
case NonParticipant:
00151
return i18n(
"Observer");
00152
break;
00153 }
00154 }
00155
00156 QStringList Attendee::roleList()
00157 {
00158
QStringList list;
00159 list <<
roleName( ReqParticipant );
00160 list <<
roleName( OptParticipant );
00161 list <<
roleName( NonParticipant );
00162 list <<
roleName( Chair );
00163
00164
return list;
00165 }