incidencebase.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00054 #ifndef KCAL_INCIDENCEBASE_H
00055 #define KCAL_INCIDENCEBASE_H
00056
00057 #include "attendee.h"
00058 #include "customproperties.h"
00059 #include "duration.h"
00060 #include "sortablelist.h"
00061
00062 #include <kdatetime.h>
00063
00064 #include <QtCore/QStringList>
00065 #include <QtCore/QByteArray>
00066
00067 class KUrl;
00068
00069 namespace KCal {
00070
00072 typedef SortableList<QDate> DateList;
00074 typedef SortableList<KDateTime> DateTimeList;
00075 class Event;
00076 class Todo;
00077 class Journal;
00078 class FreeBusy;
00079
00102 class KCAL_EXPORT IncidenceBase : public CustomProperties
00103 {
00104 public:
00112 class KCAL_EXPORT Visitor
00113 {
00114 public:
00116 virtual ~Visitor() {}
00117
00123 virtual bool visit( Event *event );
00124
00130 virtual bool visit( Todo *todo );
00131
00137 virtual bool visit( Journal *journal );
00138
00144 virtual bool visit( FreeBusy *freebusy );
00145
00146 protected:
00151 Visitor() {}
00152 };
00153
00157 class IncidenceObserver
00158 {
00159 public:
00160
00164 virtual ~IncidenceObserver() {}
00165
00171 virtual void incidenceUpdated( IncidenceBase *incidenceBase ) = 0;
00172 };
00173
00177 IncidenceBase();
00178
00185 IncidenceBase( const IncidenceBase &ib );
00186
00190 virtual ~IncidenceBase();
00191
00203
00204 IncidenceBase &operator=( const IncidenceBase &other );
00205
00216
00217 bool operator==( const IncidenceBase &ib ) const;
00218
00228 virtual bool accept( Visitor &v )
00229 {
00230 Q_UNUSED( v );
00231 return false;
00232 }
00233
00237 virtual QByteArray type() const = 0;
00238
00242
00243
00251 void setUid( const QString &uid );
00252
00258 QString uid() const;
00259
00263 KUrl uri() const;
00264
00273 void setLastModified( const KDateTime &lm );
00274
00280 KDateTime lastModified() const;
00281
00288 void setOrganizer( const Person &organizer );
00289
00296 void setOrganizer( const QString &organizer );
00297
00303 Person organizer() const;
00304
00312 virtual void setReadOnly( bool readOnly );
00313
00318 bool isReadOnly() const { return mReadOnly; }
00319
00328 virtual void setDtStart( const KDateTime &dtStart );
00329
00334 virtual KDateTime dtStart() const;
00335
00347 virtual KDE_DEPRECATED QString dtStartTimeStr(
00348 bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
00349
00361 virtual KDE_DEPRECATED QString dtStartDateStr(
00362 bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
00363
00375 virtual KDE_DEPRECATED QString dtStartStr(
00376 bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
00377
00385 virtual void setDuration( const Duration &duration );
00386
00392 Duration duration() const;
00393
00401 void setHasDuration( bool hasDuration );
00402
00408 bool hasDuration() const;
00409
00416 bool allDay() const;
00417
00426 void setAllDay( bool allDay );
00427
00442 virtual void shiftTimes( const KDateTime::Spec &oldSpec,
00443 const KDateTime::Spec &newSpec );
00444
00452 void addComment( const QString &comment );
00453
00462 bool removeComment( const QString &comment );
00463
00467 void clearComments();
00468
00472 QStringList comments() const;
00473
00481 void addAttendee( Attendee *attendee, bool doUpdate = true );
00482
00486 void clearAttendees();
00487
00491 const Attendee::List &attendees() const;
00492
00496 int attendeeCount() const;
00497
00505 Attendee *attendeeByMail( const QString &email ) const;
00506
00517 Attendee *attendeeByMails( const QStringList &emails,
00518 const QString &email = QString() ) const;
00519
00526 Attendee *attendeeByUid( const QString &uid ) const;
00527
00536 void registerObserver( IncidenceObserver *observer );
00537
00545 void unRegisterObserver( IncidenceObserver *observer );
00546
00551 void updated();
00552
00558 void startUpdates();
00559
00565 void endUpdates();
00566
00567 protected:
00572 virtual void customPropertyUpdated();
00573
00577 bool mReadOnly;
00578
00579 private:
00580
00581 class Private;
00582 Private *const d;
00583
00584 };
00585
00586 }
00587
00588 #endif
|