summaryrefslogtreecommitdiffabout
path: root/libkcal/attendee.cpp
Unidiff
Diffstat (limited to 'libkcal/attendee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/attendee.cpp167
1 files changed, 167 insertions, 0 deletions
diff --git a/libkcal/attendee.cpp b/libkcal/attendee.cpp
new file mode 100644
index 0000000..41c6fcd
--- a/dev/null
+++ b/libkcal/attendee.cpp
@@ -0,0 +1,167 @@
1/*
2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#include <qstringlist.h>
22
23#include <kdebug.h>
24#include <klocale.h>
25
26#include "attendee.h"
27
28using namespace KCal;
29
30Attendee::Attendee(const QString &name, const QString &email, bool _rsvp, Attendee::PartStat s,
31 Attendee::Role r,const QString &u) :
32 Person(name,email)
33{
34 mFlag = TRUE;
35 mRSVP = _rsvp;
36 mStatus = s;
37 mRole = r;
38 mUid = u;
39}
40
41Attendee::~Attendee()
42{
43}
44
45
46bool KCal::operator==( const Attendee& a1, const Attendee& a2 )
47{
48 return ( operator==( (const Person&)a1, (const Person&) a2 ) &&
49 a1.RSVP() == a2.RSVP() &&
50 a1.role() == a2.role() &&
51 a1.status() == a2.status() &&
52 a1.uid() == a2.uid() );
53}
54
55
56void Attendee::setStatus(Attendee::PartStat s)
57{
58 mStatus = s;
59}
60
61Attendee::PartStat Attendee::status() const
62{
63 return mStatus;
64}
65
66QString Attendee::statusStr() const
67{
68 return statusName(mStatus);
69}
70
71QString 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("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 }
97}
98
99QStringList Attendee::statusList()
100{
101 QStringList list;
102 list << statusName(NeedsAction);
103 list << statusName(Accepted);
104 list << statusName(Declined);
105 list << statusName(Tentative);
106 list << statusName(Delegated);
107 list << statusName(Completed);
108 list << statusName(InProcess);
109
110 return list;
111}
112
113
114void Attendee::setRole(Attendee::Role r)
115{
116 mRole = r;
117}
118
119Attendee::Role Attendee::role() const
120{
121 return mRole;
122}
123
124QString Attendee::roleStr() const
125{
126 return roleName(mRole);
127}
128
129void Attendee::setUid(QString uid)
130{
131 mUid = uid;
132}
133
134QString Attendee::uid() const
135{
136 return mUid;
137}
138
139QString Attendee::roleName( Attendee::Role r )
140{
141 switch (r) {
142 case Chair:
143 return i18n("Chair");
144 break;
145 default:
146 case ReqParticipant:
147 return i18n("Participant");
148 break;
149 case OptParticipant:
150 return i18n("Optional Participant");
151 break;
152 case NonParticipant:
153 return i18n("Observer");
154 break;
155 }
156}
157
158QStringList Attendee::roleList()
159{
160 QStringList list;
161 list << roleName(ReqParticipant);
162 list << roleName(OptParticipant);
163 list << roleName(NonParticipant);
164 list << roleName(Chair);
165
166 return list;
167}