KCalCore Library
incidence.h
Go 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 KCALCORE_INCIDENCE_H
00032 #define KCALCORE_INCIDENCE_H
00033
00034 #include "kcalcore_export.h"
00035 #include "alarm.h"
00036 #include "attachment.h"
00037 #include "incidencebase.h"
00038 #include "recurrence.h"
00039
00040 #include <QtCore/QMetaType>
00041
00042
00043
00044 #define INVALID_LATLON 255.0
00045
00046
00047 namespace KCalCore {
00048
00068 class KCALCORE_EXPORT Incidence
00069 : public IncidenceBase, public Recurrence::RecurrenceObserver
00070 {
00071 public:
00072
00077 enum Status {
00078 StatusNone,
00079 StatusTentative,
00080 StatusConfirmed,
00081 StatusCompleted,
00082 StatusNeedsAction,
00083 StatusCanceled,
00084 StatusInProcess,
00085 StatusDraft,
00086 StatusFinal,
00087 StatusX
00088 };
00089
00093 enum Secrecy {
00094 SecrecyPublic,
00095 SecrecyPrivate,
00096 SecrecyConfidential
00097 };
00098
00103 enum RelType {
00104 RelTypeParent,
00105 RelTypeChild,
00106 RelTypeSibling
00107 };
00108
00112 typedef QSharedPointer<Incidence> Ptr;
00113
00117 typedef QVector<Ptr> List;
00118
00122 Incidence();
00123
00127 virtual ~Incidence();
00128
00135 virtual Incidence *clone() const = 0;
00136
00143 void setReadOnly( bool readonly );
00144
00149 void setLastModified( const KDateTime &lm );
00150
00159 void setLocalOnly( bool localonly );
00160
00167 bool localOnly() const;
00168
00173 void setAllDay( bool allDay );
00174
00180 void recreate();
00181
00188 void setCreated( const KDateTime &dt );
00189
00194 KDateTime created() const;
00195
00202 void setRevision( int rev );
00203
00208 int revision() const;
00209
00216 virtual void setDtStart( const KDateTime &dt );
00217
00222 virtual void shiftTimes( const KDateTime::Spec &oldSpec,
00223 const KDateTime::Spec &newSpec );
00224
00232 void setDescription( const QString &description, bool isRich );
00233
00241 void setDescription( const QString &description );
00242
00248 QString description() const;
00249
00255 QString richDescription() const;
00256
00261 bool descriptionIsRich() const;
00262
00270 void setSummary( const QString &summary, bool isRich );
00271
00278 void setSummary( const QString &summary );
00279
00285 QString summary() const;
00286
00292 QString richSummary() const;
00293
00298 bool summaryIsRich() const;
00299
00307 void setLocation( const QString &location, bool isRich );
00308
00316 void setLocation( const QString &location );
00317
00323 QString location() const;
00324
00330 QString richLocation() const;
00331
00336 bool locationIsRich() const;
00337
00344 void setCategories( const QStringList &categories );
00345
00353 void setCategories( const QString &catStr );
00354
00359 QStringList categories() const;
00360
00365 QString categoriesStr() const;
00366
00378 void setRelatedTo( const QString &uid, RelType relType = RelTypeParent );
00379
00391 QString relatedTo( RelType relType = RelTypeParent ) const;
00392
00393
00394
00395
00401 bool hasAltDescription() const;
00409 void setAltDescription( const QString &altdescription );
00410
00415 QString altDescription() const;
00416
00417
00418
00419
00420
00425 Recurrence *recurrence() const;
00426
00430 void clearRecurrence();
00431
00436 bool recurs() const;
00437
00442 ushort recurrenceType() const;
00443
00448 virtual bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00449
00454 bool recursAt( const KDateTime &dt ) const;
00455
00467 virtual QList<KDateTime> startDateTimesForDate(
00468 const QDate &date,
00469 const KDateTime::Spec &timeSpec = KDateTime::LocalZone ) const;
00470
00480 virtual QList<KDateTime> startDateTimesForDateTime(
00481 const KDateTime &datetime ) const;
00482
00492 virtual KDateTime endDateForStart( const KDateTime &startDt ) const;
00493
00494
00495
00496
00497
00504 void addAttachment( const Attachment::Ptr &attachment );
00505
00513 void deleteAttachment( const Attachment::Ptr &attachment );
00514
00522 void deleteAttachments( const QString &mime );
00523
00528 Attachment::List attachments() const;
00529
00536 Attachment::List attachments( const QString &mime ) const;
00537
00542 void clearAttachments();
00543
00552 QString writeAttachmentToTempFile( const Attachment::Ptr &attachment ) const;
00553
00558 void clearTempFiles();
00559
00560
00561
00562
00563
00570 void setSecrecy( Secrecy secrecy );
00571
00576 Secrecy secrecy() const;
00577
00585 void setStatus( Status status );
00586
00594 void setCustomStatus( const QString &status );
00595
00600 QString customStatus() const;
00601
00606 Status status() const;
00607
00608
00609
00610
00611
00619 void setResources( const QStringList &resources );
00620
00625 QStringList resources() const;
00626
00635 void setPriority( int priority );
00636
00641 int priority() const;
00642
00647 bool hasGeo() const;
00648
00654 void setHasGeo( bool hasGeo );
00655
00661 void setGeoLatitude( float geolatitude );
00662
00668 float geoLatitude() const;
00669
00675 void setGeoLongitude( float geolongitude );
00676
00682 float geoLongitude() const;
00683
00688 bool hasRecurrenceId() const;
00689
00695 void setRecurrenceId( const KDateTime &recurrenceId );
00696
00702 KDateTime recurrenceId() const;
00703
00704
00705
00706
00707
00711 Alarm::List alarms() const;
00712
00716 Alarm::Ptr newAlarm();
00717
00724 void addAlarm( const Alarm::Ptr &alarm );
00725
00732 void removeAlarm( const Alarm::Ptr &alarm );
00733
00738 void clearAlarms();
00739
00743 bool hasEnabledAlarms() const;
00744
00745
00746
00747
00748
00773 void setSchedulingID( const QString &sid,
00774 const QString &uid = QString() );
00775
00781 QString schedulingID() const;
00782
00790 virtual void recurrenceUpdated( Recurrence *recurrence );
00791
00799 virtual QLatin1String iconName( const KDateTime &recurrenceId = KDateTime() ) const = 0;
00800
00801 protected:
00802
00807 Incidence( const Incidence &other );
00808
00814 virtual bool equals( const IncidenceBase &incidence ) const;
00815
00820 virtual IncidenceBase &assign( const IncidenceBase &other );
00821
00822 private:
00829 Incidence &operator=( const Incidence &other );
00830
00831
00832 class Private;
00833 Private *const d;
00834
00835 };
00836
00837 }
00838
00839
00840 inline uint qHash( const QSharedPointer<KCalCore::Incidence> &key )
00841 {
00842 return qHash<KCalCore::Incidence>( key.data() );
00843 }
00844
00845
00846 Q_DECLARE_TYPEINFO( KCalCore::Incidence::Ptr, Q_MOVABLE_TYPE );
00847 Q_DECLARE_METATYPE( KCalCore::Incidence * )
00848
00849 #endif