libkcal

attendee.cpp
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include <tqstringlist.h>
23 
24 #include <kdebug.h>
25 #include <tdelocale.h>
26 
27 #include "attendee.h"
28 
29 using namespace KCal;
30 
31 Attendee::Attendee( const TQString &name, const TQString &email, bool _rsvp,
32  Attendee::PartStat s, Attendee::Role r, const TQString &u)
33  : Person( name, email )
34 {
35  mRSVP = _rsvp;
36  mStatus = s;
37  mRole = r;
38  mUid = u;
39 }
40 
42 {
43 }
44 
45 bool KCal::operator==( const Attendee& a1, const Attendee& a2 )
46 {
47  return ( operator==( (const Person&)a1, (const Person&) a2 ) &&
48  a1.RSVP() == a2.RSVP() &&
49  a1.role() == a2.role() &&
50  a1.status() == a2.status() &&
51  a1.uid() == a2.uid() &&
52  a1.delegate() == a2.delegate() &&
53  a1.delegator() == a2.delegator() );
54 }
55 
56 void Attendee::setStatus( Attendee::PartStat s )
57 {
58  mStatus = s;
59 }
60 
61 Attendee::PartStat Attendee::status() const
62 {
63  return mStatus;
64 }
65 
66 TQString Attendee::statusStr() const
67 {
68  return statusName( mStatus );
69 }
70 
71 TQString Attendee::statusName( Attendee::PartStat s )
72 {
73  switch ( s ) {
74  default:
75  case NeedsAction:
76  return i18n("Needs Action");
77  break;
78  case Accepted:
79  return i18n("Accepted");
80  break;
81  case Declined:
82  return i18n("Declined");
83  break;
84  case Tentative:
85  return i18n("attendee status", "Tentative");
86  break;
87  case Delegated:
88  return i18n("Delegated");
89  break;
90  case Completed:
91  return i18n("Completed");
92  break;
93  case InProcess:
94  return i18n("In Process");
95  break;
96  case None:
97  return i18n("attendee status unknown", "Unknown");
98  break;
99  }
100 }
101 
102 TQStringList Attendee::statusList()
103 {
104  TQStringList list;
105  list << statusName( NeedsAction );
106  list << statusName( Accepted );
107  list << statusName( Declined );
108  list << statusName( Tentative );
109  list << statusName( Delegated );
110  list << statusName( Completed );
111  list << statusName( InProcess );
112 
113  return list;
114 }
115 
116 
117 void Attendee::setRole( Attendee::Role r )
118 {
119  mRole = r;
120 }
121 
122 Attendee::Role Attendee::role() const
123 {
124  return mRole;
125 }
126 
127 TQString Attendee::roleStr() const
128 {
129  return roleName( mRole );
130 }
131 
132 void Attendee::setUid( const TQString &uid )
133 {
134  mUid = uid;
135 }
136 
137 TQString Attendee::uid() const
138 {
139  return mUid;
140 }
141 
142 TQString Attendee::roleName( Attendee::Role r )
143 {
144  switch ( r ) {
145  case Chair:
146  return i18n("Chair");
147  break;
148  default:
149  case ReqParticipant:
150  return i18n("Participant");
151  break;
152  case OptParticipant:
153  return i18n("Optional Participant");
154  break;
155  case NonParticipant:
156  return i18n("Observer");
157  break;
158  }
159 }
160 
161 TQStringList Attendee::roleList()
162 {
163  TQStringList list;
164  list << roleName( ReqParticipant );
165  list << roleName( OptParticipant );
166  list << roleName( NonParticipant );
167  list << roleName( Chair );
168 
169  return list;
170 }
This class represents information related to an attendee of an event.
Definition: attendee.h:37
void setRole(Role)
Set role of Attendee.
Definition: attendee.cpp:117
TQString roleStr() const
Return role as clear text string.
Definition: attendee.cpp:127
Attendee(const TQString &name, const TQString &email, bool rsvp=false, PartStat status=None, Role role=ReqParticipant, const TQString &u=TQString())
Create Attendee.
Definition: attendee.cpp:31
static TQStringList roleList()
Return string representations of all available roles.
Definition: attendee.cpp:161
TQString uid() const
Return unique id of the attendee.
Definition: attendee.cpp:137
void setUid(const TQString &)
Set unique id of attendee.
Definition: attendee.cpp:132
Role role() const
Return role of Attendee.
Definition: attendee.cpp:122
static TQString roleName(Role)
Return string represenation of role.
Definition: attendee.cpp:142
virtual ~Attendee()
Destruct Attendee.
Definition: attendee.cpp:41
static TQStringList statusList()
Return string representations of all available attendee status values.
Definition: attendee.cpp:102
void setStatus(PartStat s)
Set status.
Definition: attendee.cpp:56
static TQString statusName(PartStat)
Return string representation of attendee status.
Definition: attendee.cpp:71
PartStat status() const
Return status.
Definition: attendee.cpp:61
TQString statusStr() const
Return status as human-readable string.
Definition: attendee.cpp:66
This class represents a person.
Definition: person.h:35
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38