• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KCal Library

  • kcal
attendee.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the kcal library.
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 */
32 #include "attendee.h"
33 
34 #include <kdebug.h>
35 #include <klocale.h>
36 #include <kglobal.h>
37 
38 #include <QtCore/QStringList>
39 
40 static const KCatalogLoader loader("libkcal");
41 
42 using namespace KCal;
43 
48 //@cond PRIVATE
49 class KCal::Attendee::Private
50 {
51  public:
52  bool mRSVP;
53  Role mRole;
54  PartStat mStatus;
55  QString mUid;
56  QString mDelegate;
57  QString mDelegator;
58  CustomProperties mCustomProperties;
59 };
60 //@endcond
61 
62 Attendee::Attendee( const QString &name, const QString &email, bool rsvp,
63  Attendee::PartStat status, Attendee::Role role, const QString &uid )
64  : d( new Attendee::Private )
65 {
66  setName( name );
67  setEmail( email );
68  d->mRSVP = rsvp;
69  d->mStatus = status;
70  d->mRole = role;
71  d->mUid = uid;
72 }
73 
74 Attendee::Attendee( const Attendee &attendee )
75  : Person( attendee ),
76  d( new Attendee::Private( *attendee.d ) )
77 {
78 }
79 
80 Attendee::~Attendee()
81 {
82  delete d;
83 }
84 
85 bool KCal::Attendee::operator==( const Attendee &attendee )
86 {
87  return
88  ( Person & )*this == ( const Person & )attendee &&
89  d->mRSVP == attendee.d->mRSVP &&
90  d->mRole == attendee.d->mRole &&
91  d->mStatus == attendee.d->mStatus &&
92  d->mUid == attendee.d->mUid &&
93  d->mDelegate == attendee.d->mDelegate &&
94  d->mDelegator == attendee.d->mDelegator;
95 }
96 
97 Attendee &KCal::Attendee::operator=( const Attendee &attendee )
98 {
99  // check for self assignment
100  if ( &attendee == this ) {
101  return *this;
102  }
103 
104  *d = *attendee.d;
105  setName( attendee.name() );
106  setEmail( attendee.email() );
107  return *this;
108 }
109 
110 void Attendee::setRSVP( bool r )
111 {
112  d->mRSVP = r;
113 }
114 
115 bool Attendee::RSVP() const
116 {
117  return d->mRSVP;
118 }
119 
120 void Attendee::setStatus( Attendee::PartStat status )
121 {
122  d->mStatus = status;
123 }
124 
125 Attendee::PartStat Attendee::status() const
126 {
127  return d->mStatus;
128 }
129 
130 QString Attendee::statusStr() const
131 {
132  return statusName( d->mStatus );
133 }
134 
135 QString Attendee::statusName( Attendee::PartStat status )
136 {
137  switch ( status ) {
138  default:
139  case NeedsAction:
140  return i18nc( "@item event, to-do or journal needs action", "Needs Action" );
141  break;
142  case Accepted:
143  return i18nc( "@item event, to-do or journal accepted", "Accepted" );
144  break;
145  case Declined:
146  return i18nc( "@item event, to-do or journal declined", "Declined" );
147  break;
148  case Tentative:
149  return i18nc( "@item event or to-do tentatively accepted", "Tentative" );
150  break;
151  case Delegated:
152  return i18nc( "@item event or to-do delegated", "Delegated" );
153  break;
154  case Completed:
155  return i18nc( "@item to-do completed", "Completed" );
156  break;
157  case InProcess:
158  return i18nc( "@item to-do in process of being completed", "In Process" );
159  break;
160  case None:
161  return i18nc( "@item event or to-do status unknown", "Unknown" );
162  break;
163  }
164 }
165 
166 QStringList Attendee::statusList()
167 {
168  QStringList list;
169  list << statusName( NeedsAction );
170  list << statusName( Accepted );
171  list << statusName( Declined );
172  list << statusName( Tentative );
173  list << statusName( Delegated );
174  list << statusName( Completed );
175  list << statusName( InProcess );
176 
177  return list;
178 }
179 
180 void Attendee::setRole( Attendee::Role role )
181 {
182  d->mRole = role;
183 }
184 
185 Attendee::Role Attendee::role() const
186 {
187  return d->mRole;
188 }
189 
190 QString Attendee::roleStr() const
191 {
192  return roleName( d->mRole );
193 }
194 
195 void Attendee::setUid( const QString &uid )
196 {
197  d->mUid = uid;
198 }
199 
200 QString Attendee::uid() const
201 {
202  return d->mUid;
203 }
204 
205 QString Attendee::roleName( Attendee::Role role )
206 {
207  switch ( role ) {
208  case Chair:
209  return i18nc( "@item chairperson", "Chair" );
210  break;
211  default:
212  case ReqParticipant:
213  return i18nc( "@item participation is required", "Participant" );
214  break;
215  case OptParticipant:
216  return i18nc( "@item participation is optional", "Optional Participant" );
217  break;
218  case NonParticipant:
219  return i18nc( "@item non-participant copied for information", "Observer" );
220  break;
221  }
222 }
223 
224 QStringList Attendee::roleList()
225 {
226  QStringList list;
227  list << roleName( ReqParticipant );
228  list << roleName( OptParticipant );
229  list << roleName( NonParticipant );
230  list << roleName( Chair );
231 
232  return list;
233 }
234 
235 void Attendee::setDelegate( const QString &delegate )
236 {
237  d->mDelegate = delegate;
238 }
239 
240 QString Attendee::delegate() const
241 {
242  return d->mDelegate;
243 }
244 
245 void Attendee::setDelegator( const QString &delegator )
246 {
247  d->mDelegator = delegator;
248 }
249 
250 QString Attendee::delegator() const
251 {
252  return d->mDelegator;
253 }
254 
255 void Attendee::setCustomProperty( const QByteArray &xname, const QString &xvalue )
256 {
257  d->mCustomProperties.setNonKDECustomProperty( xname, xvalue );
258 }
259 
260 CustomProperties &Attendee::customProperties()
261 {
262  return d->mCustomProperties;
263 }
264 
265 const CustomProperties &Attendee::customProperties() const
266 {
267  return d->mCustomProperties;
268 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:29:13 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal