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
00031 #ifndef INCIDENCE_H
00032 #define INCIDENCE_H
00033
00034 #include "kcal_export.h"
00035 #include "incidencebase.h"
00036 #include "alarm.h"
00037 #include "attachment.h"
00038 #include "recurrence.h"
00039
00040 #include <QtCore/QList>
00041
00042 namespace boost {
00043 template <typename T> class shared_ptr;
00044 }
00045
00046 namespace KCal {
00047
00067 class KCAL_EXPORT Incidence
00068 : public IncidenceBase, public Recurrence::RecurrenceObserver
00069 {
00070 public:
00075
00076 template<class T>
00077 class AddVisitor : public IncidenceBase::Visitor
00078 {
00079 public:
00080 AddVisitor( T *r ) : mResource( r ) {}
00081
00082 bool visit( Event *e )
00083 {
00084 return mResource->addEvent( e );
00085 }
00086 bool visit( Todo *t )
00087 {
00088 return mResource->addTodo( t );
00089 }
00090 bool visit( Journal *j )
00091 {
00092 return mResource->addJournal( j );
00093 }
00094 bool visit( FreeBusy * )
00095 {
00096 return false;
00097 }
00098
00099 private:
00100 T *mResource;
00101 };
00102
00103
00109
00110 template<class T>
00111 class DeleteVisitor : public IncidenceBase::Visitor
00112 {
00113 public:
00114 DeleteVisitor( T *r ) : mResource( r ) {}
00115
00116 bool visit( Event *e )
00117 {
00118 mResource->deleteEvent( e );
00119 return true;
00120 }
00121 bool visit( Todo *t )
00122 {
00123 mResource->deleteTodo( t );
00124 return true;
00125 }
00126 bool visit( Journal *j )
00127 {
00128 mResource->deleteJournal( j );
00129 return true;
00130 }
00131 bool visit( FreeBusy * )
00132 {
00133 return false;
00134 }
00135
00136 private:
00137 T *mResource;
00138 };
00139
00140
00145 enum Status {
00146 StatusNone,
00147 StatusTentative,
00148 StatusConfirmed,
00149 StatusCompleted,
00150 StatusNeedsAction,
00151 StatusCanceled,
00152 StatusInProcess,
00153 StatusDraft,
00154 StatusFinal,
00155 StatusX
00156 };
00157
00161 enum Secrecy {
00162 SecrecyPublic=0,
00163 SecrecyPrivate=1,
00164 SecrecyConfidential=2
00165 };
00166
00170 typedef ListBase<Incidence> List;
00171
00175 typedef boost::shared_ptr<Incidence> Ptr;
00176
00180 typedef boost::shared_ptr<const Incidence> ConstPtr;
00181
00185 Incidence();
00186
00191 Incidence( const Incidence &other );
00192
00196 ~Incidence();
00197
00202 virtual Incidence *clone() = 0;
00203
00210 void setReadOnly( bool readonly );
00211
00216 void setAllDay( bool allDay );
00217
00223 void recreate();
00224
00231 void setCreated( const KDateTime &dt );
00232
00237 KDateTime created() const;
00238
00245 void setRevision( int rev );
00246
00251 int revision() const;
00252
00259 virtual void setDtStart( const KDateTime &dt );
00260
00265 virtual KDateTime dtEnd() const;
00266
00271 virtual void shiftTimes( const KDateTime::Spec &oldSpec,
00272 const KDateTime::Spec &newSpec );
00273
00281 void setDescription( const QString &description, bool isRich );
00282
00291 void setDescription( const QString &description );
00292
00298 QString description() const;
00299
00306 QString richDescription() const;
00307
00312 bool descriptionIsRich() const;
00313
00321 void setSummary( const QString &summary, bool isRich );
00322
00330 void setSummary( const QString &summary );
00331
00337 QString summary() const;
00338
00345 QString richSummary() const;
00346
00351 bool summaryIsRich() const;
00352
00360 void setLocation( const QString &location, bool isRich );
00361
00370 void setLocation( const QString &location );
00371
00377 QString location() const;
00378
00385 QString richLocation() const;
00386
00391 bool locationIsRich() const;
00392
00399 void setCategories( const QStringList &categories );
00400
00408 void setCategories( const QString &catStr );
00409
00414 QStringList categories() const;
00415
00420 QString categoriesStr() const;
00421
00429 void setRelatedToUid( const QString &uid );
00430
00437 QString relatedToUid() const;
00438
00446 void setRelatedTo( Incidence *incidence );
00447
00454 Incidence *relatedTo() const;
00455
00460 Incidence::List relations() const;
00461
00468 void addRelation( Incidence *incidence );
00469
00476 void removeRelation( Incidence *incidence );
00477
00478
00479
00480
00481
00486 Recurrence *recurrence() const;
00487
00491 void clearRecurrence();
00492
00497 bool recurs() const;
00498
00503 ushort recurrenceType() const;
00504
00509 virtual bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00510
00515 bool recursAt( const KDateTime &dt ) const;
00516
00528 virtual QList<KDateTime> startDateTimesForDate(
00529 const QDate &date,
00530 const KDateTime::Spec &timeSpec = KDateTime::LocalZone ) const;
00531
00541 virtual QList<KDateTime> startDateTimesForDateTime(
00542 const KDateTime &datetime ) const;
00543
00553 virtual KDateTime endDateForStart( const KDateTime &startDt ) const;
00554
00555
00556
00557
00558
00565 void addAttachment( Attachment *attachment );
00566
00574 void deleteAttachment( Attachment *attachment );
00575
00583 void deleteAttachments( const QString &mime );
00584
00589 Attachment::List attachments() const;
00590
00597 Attachment::List attachments( const QString &mime ) const;
00598
00603 void clearAttachments();
00604
00605
00606
00607
00608
00615 void setSecrecy( Secrecy secrecy );
00616
00621 Secrecy secrecy() const;
00622
00627 QString secrecyStr() const;
00628
00634 static QStringList secrecyList();
00635
00642 static QString secrecyName( Secrecy secrecy );
00643
00651 void setStatus( Status status );
00652
00660 void setCustomStatus( const QString &status );
00661
00666 Status status() const;
00667
00672 QString statusStr() const;
00673
00679 static QString statusName( Status status );
00680
00681
00682
00683
00684
00692 void setResources( const QStringList &resources );
00693
00698 QStringList resources() const;
00699
00708 void setPriority( int priority );
00709
00714 int priority() const;
00715
00721 bool hasGeo() const;
00722
00729 void setHasGeo( bool hasGeo );
00730
00737 void setGeoLatitude( float geolatitude );
00738
00745 float &geoLatitude() const;
00746
00753 void setGeoLongitude( float geolongitude );
00754
00761 float &geoLongitude() const;
00762
00763
00764
00765
00766
00770 const Alarm::List &alarms() const;
00771
00775 Alarm *newAlarm();
00776
00783 void addAlarm( Alarm *alarm );
00784
00791 void removeAlarm( Alarm *alarm );
00792
00797 void clearAlarms();
00798
00802 bool isAlarmEnabled() const;
00803
00804
00805
00806
00807
00820 void setSchedulingID( const QString &sid );
00821
00827 QString schedulingID() const;
00828
00836 virtual void recurrenceUpdated( Recurrence *recurrence );
00837
00849 Incidence &operator=( const Incidence &other );
00850
00851
00862 bool operator==( const Incidence &incidence ) const;
00863
00864
00865 protected:
00871 virtual KDateTime endDateRecurrenceBase() const
00872 {
00873 return dtStart();
00874 }
00875
00876 private:
00877 void init( const Incidence &other );
00878
00879 class Private;
00880 Private *const d;
00881
00882 };
00883
00884 }
00885
00886 #endif
|