• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KCal Library

incidence.h

Go to the documentation of this file.
00001 /*
00002   This file is part of the kcal library.
00003 
00004   Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
00005   Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007   This library is free software; you can redistribute it and/or
00008   modify it under the terms of the GNU Library General Public
00009   License as published by the Free Software Foundation; either
00010   version 2 of the License, or (at your option) any later version.
00011 
00012   This library is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015   Library General Public License for more details.
00016 
00017   You should have received a copy of the GNU Library General Public License
00018   along with this library; see the file COPYING.LIB.  If not, write to
00019   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020   Boston, MA 02110-1301, USA.
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 //krazy:exclude=dpointer since nested class templates confuse krazy
00068   : public IncidenceBase, public Recurrence::RecurrenceObserver
00069 {
00070   public:
00075     //@cond PRIVATE
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     //@endcond
00103 
00109     //@cond PRIVATE
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     //@endcond
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; //TODO KDE5: make this const
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 // %%%%%  Recurrence-related methods
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 // %%%%%  Attachment-related methods
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 // %%%%%  Secrecy and Status methods
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 // %%%%%  Other methods
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 // %%%%%  Alarm-related methods
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 // %%%%%  Other methods
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 ); // KDE5: make protected to
00850                                                     // prevent accidental usage
00851 
00862     bool operator==( const Incidence &incidence ) const; // KDE5: make protected to
00863                                                          // prevent accidental usage
00864 
00865   protected:
00871     virtual KDateTime endDateRecurrenceBase() const
00872     {
00873       return dtStart();
00874     }
00875 
00876   private:
00877     void init( const Incidence &other );
00878     //@cond PRIVATE
00879     class Private;
00880     Private *const d;
00881     //@endcond
00882 };
00883 
00884 }
00885 
00886 #endif

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.2-20100208
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal