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

KCal Library

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 <klocalizedstring.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 }
KCal::Person::email
QString email() const
Returns the email address for this person.
Definition: person.cpp:144
attendee.h
This file is part of the API for handling calendar data and defines the Attendee class.
KCal::CustomProperties
A class to manage custom calendar properties.
Definition: customproperties.h:52
KCal::Attendee::setUid
void setUid(const QString &uid)
Sets the UID of the attendee to uid.
Definition: attendee.cpp:195
KCal::Attendee::setCustomProperty
void setCustomProperty(const QByteArray &xname, const QString &xvalue)
Adds a custom property.
Definition: attendee.cpp:255
KCal::Attendee
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
Definition: attendee.h:58
KCal::Attendee::InProcess
To-do in process of being completed.
Definition: attendee.h:78
KCal::Attendee::setDelegate
void setDelegate(const QString &delegate)
Sets the delegate.
Definition: attendee.cpp:235
KCal::Attendee::setRole
void setRole(Role role)
Sets the Role of the attendee to role.
Definition: attendee.cpp:180
KCal::Attendee::operator==
bool operator==(const Attendee &attendee)
Compares this with attendee for equality.
Definition: attendee.cpp:85
KCal::Attendee::Chair
Chairperson.
Definition: attendee.h:89
KCal::Attendee::Completed
To-do completed.
Definition: attendee.h:77
KCal::Attendee::status
PartStat status() const
Returns the PartStat of the attendee.
Definition: attendee.cpp:125
KCal::Attendee::PartStat
PartStat
The different types of participant status.
Definition: attendee.h:71
KCal::Attendee::Declined
Event, to-do or journal declined.
Definition: attendee.h:74
KCal::Person::setEmail
void setEmail(const QString &email)
Sets the email address for this person to email.
Definition: person.cpp:159
KCal::Attendee::Role
Role
The different types of participation roles.
Definition: attendee.h:85
KCal::Attendee::NonParticipant
Non-Participant; copied for information purposes.
Definition: attendee.h:88
KCal::Person
Represents a person, by name ane email address.
Definition: person.h:48
KCal::Attendee::roleStr
QString roleStr() const
Returns the attendee Role as a text string.
Definition: attendee.cpp:190
KCal::Person::name
QString name() const
Returns the person name string.
Definition: person.cpp:139
KCal::Attendee::~Attendee
~Attendee()
Destroys the attendee.
Definition: attendee.cpp:80
KCal::Attendee::uid
QString uid() const
Returns the UID of the attendee.
Definition: attendee.cpp:200
KCal::Person::setName
void setName(const QString &name)
Sets the name of the person to name.
Definition: person.cpp:154
KCal::Attendee::Accepted
Event, to-do or journal accepted.
Definition: attendee.h:73
KCal::Attendee::statusName
static QString statusName(PartStat status)
Returns the specified PartStat status as a text string.
Definition: attendee.cpp:135
KCal::Attendee::NeedsAction
Event, to-do or journal needs action (default)
Definition: attendee.h:72
KCal::Attendee::delegate
QString delegate() const
Returns the delegate.
Definition: attendee.cpp:240
KCal::Attendee::RSVP
bool RSVP() const
Returns the attendee RSVP flag.
Definition: attendee.cpp:115
KCal::Attendee::delegator
QString delegator() const
Returns the delegator.
Definition: attendee.cpp:250
KCal::Attendee::Attendee
Attendee(const QString &name, const QString &email, bool rsvp=false, PartStat status=None, Role role=ReqParticipant, const QString &uid=QString())
Constructs an attendee consisting of a Person name (name) and email address (email); invitation statu...
Definition: attendee.cpp:62
KCal::Attendee::ReqParticipant
Participation is required (default)
Definition: attendee.h:86
KCal::Attendee::roleList
static QStringList roleList()
Returns a list of strings representing each Role.
Definition: attendee.cpp:224
KCal::Attendee::role
Role role() const
Returns the Role of the attendee.
Definition: attendee.cpp:185
KCal::Attendee::setRSVP
void setRSVP(bool rsvp)
Sets the RSVP flag of the attendee to rsvp.
Definition: attendee.cpp:110
KCal::Attendee::setDelegator
void setDelegator(const QString &delegator)
Sets the delegator.
Definition: attendee.cpp:245
KCal::Attendee::OptParticipant
Participation is optional.
Definition: attendee.h:87
KCal::Attendee::statusStr
QString statusStr() const
Returns the attendee PartStat as a text string.
Definition: attendee.cpp:130
KCal::Attendee::statusList
static QStringList statusList()
Returns a list of strings representing each PartStat.
Definition: attendee.cpp:166
KCal::Attendee::Delegated
Event or to-do delegated.
Definition: attendee.h:76
KCal::Attendee::customProperties
CustomProperties & customProperties()
Returns a reference to the CustomProperties object.
Definition: attendee.cpp:260
KCal::Attendee::setStatus
void setStatus(PartStat status)
Sets the PartStat of the attendee to status.
Definition: attendee.cpp:120
KCal::Attendee::roleName
static QString roleName(Role role)
Returns the specified Role role as a text string.
Definition: attendee.cpp:205
KCal::Attendee::Tentative
Event or to-do tentatively accepted.
Definition: attendee.h:75
KCal::Attendee::operator=
Attendee & operator=(const Attendee &attendee)
Sets this attendee equal to attendee.
Definition: attendee.cpp:97
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:57 by doxygen 1.8.7 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
  • File Members
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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