KCalCore Library
incidencebase.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcalcore library. 00003 00004 Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org> 00005 Copyright (c) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 00006 Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net> 00007 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 00008 Contact: Alvaro Manera <alvaro.manera@nokia.com> 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Library General Public 00012 License as published by the Free Software Foundation; either 00013 version 2 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Library General Public License for more details. 00019 00020 You should have received a copy of the GNU Library General Public License 00021 along with this library; see the file COPYING.LIB. If not, write to 00022 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00023 Boston, MA 02110-1301, USA. 00024 */ 00056 #ifndef KCALCORE_INCIDENCEBASE_H 00057 #define KCALCORE_INCIDENCEBASE_H 00058 00059 #include "attendee.h" 00060 #include "customproperties.h" 00061 #include "duration.h" 00062 #include "sortablelist.h" 00063 00064 #include <KDE/KDateTime> 00065 00066 #include <QtCore/QSet> 00067 00068 class KUrl; 00069 class QDate; 00070 00071 namespace KCalCore { 00072 00074 typedef SortableList<QDate> DateList; 00075 00077 typedef SortableList<KDateTime> DateTimeList; 00078 00079 class Event; 00080 class Todo; 00081 class Journal; 00082 class FreeBusy; 00083 class Visitor; 00084 00107 class KCALCORE_EXPORT IncidenceBase : public CustomProperties 00108 { 00109 public: 00113 typedef QSharedPointer<IncidenceBase> Ptr; 00114 00119 enum IncidenceType { 00120 TypeEvent = 0, 00121 TypeTodo, 00122 TypeJournal, 00123 TypeFreeBusy, 00124 TypeUnknown 00125 }; 00126 00131 enum DateTimeRole { 00132 RoleAlarmStartOffset = 0, 00133 RoleAlarmEndOffset, 00134 RoleSort, 00135 RoleCalendarHashing, 00136 RoleStartTimeZone, 00137 RoleEndTimeZone, 00138 RoleEndRecurrenceBase, 00139 RoleEnd, 00141 RoleDisplayEnd, 00143 RoleAlarm, 00145 RoleRecurrenceStart, 00150 RoleDisplayStart 00152 }; 00153 00154 enum Field { 00155 FieldDtStart, 00156 FieldDtEnd, 00157 FieldLastModified, 00158 FieldDescription, 00159 FieldSummary, 00160 FieldLocation, 00161 FieldCompleted, 00162 FieldPercentComplete, 00163 FieldDtDue, 00164 FieldCategories, 00165 FieldRelatedTo, 00166 FieldRecurrence, 00167 FieldAttachment, 00168 FieldSecrecy, 00169 FieldStatus, 00170 FieldTransparency, 00171 FieldResources, 00172 FieldPriority, 00173 FieldGeoLatitude, 00174 FieldGeoLongitude, 00175 FieldRecurrenceId, 00176 FieldAlarms, 00177 FieldSchedulingId, 00178 FieldAttendees, 00179 FieldOrganizer, 00180 FieldCreated, 00181 FieldRevision, 00182 FieldDuration, 00183 FieldContact, 00184 FieldComment, 00185 FieldUid, 00186 FieldUnknown 00187 }; 00188 00192 class KCALCORE_EXPORT IncidenceObserver 00193 { 00194 public: 00195 00199 virtual ~IncidenceObserver(); 00200 00207 virtual void incidenceUpdate( const QString &uid, const KDateTime &recurrenceId ) = 0; 00208 00215 virtual void incidenceUpdated( const QString &uid, const KDateTime &recurrenceId ) = 0; 00216 }; 00217 00221 IncidenceBase(); 00222 00226 virtual ~IncidenceBase(); 00227 00245 IncidenceBase &operator=( const IncidenceBase &other ); 00246 00253 bool operator==( const IncidenceBase &ib ) const; 00254 00260 bool operator!=( const IncidenceBase &ib ) const; 00261 00272 virtual bool accept( Visitor &v, IncidenceBase::Ptr incidence ); 00273 00277 virtual IncidenceType type() const = 0; 00278 00282 virtual QByteArray typeStr() const = 0; 00283 00289 void setUid( const QString &uid ); 00290 00295 QString uid() const; 00296 00300 KUrl uri() const; 00301 00310 virtual void setLastModified( const KDateTime &lm ); 00311 00316 KDateTime lastModified() const; 00317 00324 void setOrganizer( const Person::Ptr &organizer ); 00325 00332 void setOrganizer( const QString &organizer ); 00333 00338 Person::Ptr organizer() const; 00339 00347 virtual void setReadOnly( bool readOnly ); 00348 00353 bool isReadOnly() const; 00354 00363 virtual void setDtStart( const KDateTime &dtStart ); 00364 00369 virtual KDateTime dtStart() const; 00370 00378 virtual void setDuration( const Duration &duration ); 00379 00384 Duration duration() const; 00385 00391 void setHasDuration( bool hasDuration ); 00392 00397 bool hasDuration() const; 00398 00404 bool allDay() const; 00405 00414 void setAllDay( bool allDay ); 00415 00430 virtual void shiftTimes( const KDateTime::Spec &oldSpec, 00431 const KDateTime::Spec &newSpec ); 00432 00440 void addComment( const QString &comment ); 00441 00450 bool removeComment( const QString &comment ); 00451 00455 void clearComments(); 00456 00460 QStringList comments() const; 00461 00469 void addContact( const QString &contact ); 00470 00479 bool removeContact( const QString &contact ); 00480 00484 void clearContacts(); 00485 00489 QStringList contacts() const; 00490 00498 void addAttendee( const Attendee::Ptr &attendee, 00499 bool doUpdate = true ); 00500 00504 void clearAttendees(); 00505 00514 void deleteAttendee( const Attendee::Ptr &attendee, 00515 bool doUpdate = true ); 00516 00521 Attendee::List attendees() const; 00522 00526 int attendeeCount() const; 00527 00535 Attendee::Ptr attendeeByMail( const QString &email ) const; 00536 00547 Attendee::Ptr attendeeByMails( const QStringList &emails, 00548 const QString &email = QString() ) const; 00549 00556 Attendee::Ptr attendeeByUid( const QString &uid ) const; 00557 00566 void registerObserver( IncidenceObserver *observer ); 00567 00575 void unRegisterObserver( IncidenceObserver *observer ); 00576 00581 void update(); 00582 00587 void updated(); 00588 00594 void startUpdates(); 00595 00601 void endUpdates(); 00602 00607 virtual KDateTime dateTime( DateTimeRole role ) const = 0; 00608 00614 virtual void setDateTime( const KDateTime &dateTime, DateTimeRole role ) = 0; 00615 00620 virtual QLatin1String mimeType() const = 0; 00621 00627 virtual KDateTime recurrenceId() const; 00628 00635 QSet<IncidenceBase::Field> dirtyFields() const; 00636 00642 void setDirtyFields( const QSet<IncidenceBase::Field> & ); 00643 00648 void resetDirtyFields(); 00649 00650 protected: 00651 00656 void setFieldDirty( IncidenceBase::Field field ); 00657 00662 virtual void customPropertyUpdate(); 00663 00668 virtual void customPropertyUpdated(); 00669 00675 IncidenceBase( const IncidenceBase &ib ); 00676 00684 virtual bool equals( const IncidenceBase &incidenceBase ) const; 00685 00690 virtual IncidenceBase &assign( const IncidenceBase &other ); 00691 00699 virtual void virtual_hook( int id, void *data ) = 0; 00700 00704 bool mReadOnly; 00705 00706 private: 00707 //@cond PRIVATE 00708 class Private; 00709 Private *const d; 00710 //@endcond 00711 }; 00712 00713 } 00714 00715 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:48:21 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:48:21 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.