libkcal
incidence.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 #ifndef INCIDENCE_H
00023 #define INCIDENCE_H
00024
00025 #include <qdatetime.h>
00026 #include <qstringlist.h>
00027 #include <qvaluelist.h>
00028
00029 #include "recurrence.h"
00030 #include "alarm.h"
00031 #include "attachment.h"
00032 #include "libkcal_export.h"
00033
00034 #include "incidencebase.h"
00035 #include <kdepimmacros.h>
00036
00037 namespace KCal {
00038
00039
00043 class LIBKCAL_EXPORT Incidence : public IncidenceBase, public Recurrence::Observer
00044 {
00045 public:
00050 template<class T>
00051 class AddVisitor : public IncidenceBase::Visitor
00052 {
00053 public:
00054 AddVisitor( T *r ) : mResource( r ) {}
00055
00056 bool visit( Event *e ) { return mResource->addEvent( e ); }
00057 bool visit( Todo *t ) { return mResource->addTodo( t ); }
00058 bool visit( Journal *j ) { return mResource->addJournal( j ); }
00059
00060 private:
00061 T *mResource;
00062 };
00063
00068 template<class T>
00069 class DeleteVisitor : public IncidenceBase::Visitor
00070 {
00071 public:
00072 DeleteVisitor( T *r ) : mResource( r ) {}
00073
00074 bool visit( Event *e ) { mResource->deleteEvent( e ); return true; }
00075 bool visit( Todo *t ) { mResource->deleteTodo( t ); return true; }
00076 bool visit( Journal *j ) { mResource->deleteJournal( j ); return true; }
00077
00078 private:
00079 T *mResource;
00080 };
00081
00083 enum Status {
00084 StatusNone, StatusTentative, StatusConfirmed, StatusCompleted,
00085 StatusNeedsAction, StatusCanceled, StatusInProcess, StatusDraft,
00086 StatusFinal,
00087 StatusX
00088 };
00089
00091 enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
00092
00093 typedef ListBase<Incidence> List;
00094
00095 Incidence();
00096 Incidence( const Incidence & );
00097 ~Incidence();
00098
00099 Incidence& operator=( const Incidence &i );
00100 bool operator==( const Incidence & ) const;
00101
00105 virtual Incidence *clone() = 0;
00106
00113 void setReadOnly( bool readonly );
00114
00116 void setFloats( bool f );
00117
00123 void recreate();
00124
00128 void setCreated( const QDateTime & );
00132 QDateTime created() const;
00133
00137 void setRevision( int rev );
00141 int revision() const;
00142
00146 virtual void setDtStart( const QDateTime &dtStart );
00150 virtual QDateTime dtEnd() const { return QDateTime(); }
00151
00155 void setDescription( const QString &description );
00159 QString description() const;
00160
00164 void setSummary( const QString &summary );
00168 QString summary() const;
00169
00173 void setCategories( const QStringList &categories );
00177 void setCategories(const QString &catStr);
00181 QStringList categories() const;
00185 QString categoriesStr() const;
00186
00192 void setRelatedToUid(const QString &);
00198 QString relatedToUid() const;
00202 void setRelatedTo(Incidence *relatedTo);
00206 Incidence *relatedTo() const;
00210 Incidence::List relations() const;
00214 void addRelation(Incidence *);
00218 void removeRelation(Incidence *);
00219
00220
00221
00222
00223
00224
00229 Recurrence *recurrence() const;
00230
00232 void clearRecurrence();
00233
00237 bool doesRecur() const;
00238 uint recurrenceType() const;
00239
00244 virtual bool recursOn( const QDate &qd ) const;
00249 bool recursAt( const QDateTime &qdt ) const;
00250
00259 virtual QValueList<QDateTime> startDateTimesForDate( const QDate &date ) const;
00260
00269 virtual QValueList<QDateTime> startDateTimesForDateTime( const QDateTime &datetime ) const;
00270
00272 virtual QDateTime endDateForStart( const QDateTime &startDt ) const;
00273
00274
00275
00276
00277
00278
00282 void addAttachment( Attachment *attachment );
00286 void deleteAttachment( Attachment *attachment );
00290 void deleteAttachments( const QString &mime );
00294 Attachment::List attachments() const;
00298 Attachment::List attachments( const QString &mime ) const;
00302 void clearAttachments();
00303
00304
00305
00306
00307
00308
00313 void setSecrecy( int );
00317 int secrecy() const;
00321 QString secrecyStr() const;
00325 static QStringList secrecyList();
00329 static QString secrecyName( int );
00330
00335 void setStatus( Status status );
00341 void setCustomStatus( const QString &status );
00345 Status status() const;
00349 QString statusStr() const;
00353 static QString statusName( Status );
00354
00355
00356
00357
00358
00359
00363 void setResources( const QStringList &resources );
00367 QStringList resources() const;
00368
00374 void setPriority( int priority );
00379 int priority() const;
00380
00381
00382
00383
00384
00385
00389 const Alarm::List &alarms() const;
00393 Alarm *newAlarm();
00397 void addAlarm( Alarm * );
00401 void removeAlarm( Alarm * );
00405 void clearAlarms();
00409 bool isAlarmEnabled() const;
00410
00411
00412
00413
00414
00415
00416
00417
00421 void setLocation(const QString &location);
00425 QString location() const;
00426
00436 void setSchedulingID( const QString& sid );
00441 QString schedulingID() const;
00442
00446 virtual void recurrenceUpdated( Recurrence * );
00447 protected:
00451 virtual QDateTime endDateRecurrenceBase() const { return dtStart(); }
00452
00453 private:
00454 int mRevision;
00455
00456
00457 QDateTime mCreated;
00458 QString mDescription;
00459 QString mSummary;
00460 QStringList mCategories;
00461 Incidence *mRelatedTo;
00462 QString mRelatedToUid;
00463 Incidence::List mRelations;
00464 Attachment::List mAttachments;
00465 QStringList mResources;
00466
00467 QString mStatusString;
00468 Status mStatus;
00469 int mSecrecy;
00470 int mPriority;
00471
00472 Alarm::List mAlarms;
00473 Recurrence *mRecurrence;
00474
00475 QString mLocation;
00476
00477
00478 QString mSchedulingID;
00479
00480 class Private;
00481 Private *d;
00482 };
00483
00484 }
00485
00486 #endif
|