• Skip to content
  • Skip to link menu
KDE 4.7 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • 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 #include <QtCore/QMetaType>
00042 
00043 namespace boost {
00044   template <typename T> class shared_ptr;
00045 }
00046 
00047 namespace KCal {
00048 
00068 class KCAL_EXPORT_DEPRECATED Incidence //krazy:exclude=dpointer since nested class templates confuse krazy
00069   : public IncidenceBase, public Recurrence::RecurrenceObserver
00070 {
00071   public:
00076     //@cond PRIVATE
00077     template<class T>
00078     class AddVisitor : public IncidenceBase::Visitor
00079     {
00080       public:
00081         AddVisitor( T *r ) : mResource( r ) {}
00082 
00083         bool visit( Event *e )
00084         {
00085           return mResource->addEvent( e );
00086         }
00087         bool visit( Todo *t )
00088         {
00089           return mResource->addTodo( t );
00090         }
00091         bool visit( Journal *j )
00092         {
00093           return mResource->addJournal( j );
00094         }
00095         bool visit( FreeBusy * )
00096         {
00097           return false;
00098         }
00099 
00100       private:
00101         T *mResource;
00102     };
00103     //@endcond
00104 
00110     //@cond PRIVATE
00111     template<class T>
00112     class DeleteVisitor : public IncidenceBase::Visitor
00113     {
00114       public:
00115         DeleteVisitor( T *r ) : mResource( r ) {}
00116 
00117         bool visit( Event *e )
00118         {
00119           mResource->deleteEvent( e );
00120           return true;
00121         }
00122         bool visit( Todo *t )
00123         {
00124           mResource->deleteTodo( t );
00125           return true;
00126         }
00127         bool visit( Journal *j )
00128         {
00129           mResource->deleteJournal( j );
00130           return true;
00131         }
00132         bool visit( FreeBusy * )
00133         {
00134           return false;
00135         }
00136 
00137       private:
00138         T *mResource;
00139     };
00140     //@endcond
00141 
00146     enum Status {
00147       StatusNone,           
00148       StatusTentative,      
00149       StatusConfirmed,      
00150       StatusCompleted,      
00151       StatusNeedsAction,    
00152       StatusCanceled,       
00153       StatusInProcess,      
00154       StatusDraft,          
00155       StatusFinal,          
00156       StatusX               
00157     };
00158 
00162     enum Secrecy {
00163       SecrecyPublic=0,      
00164       SecrecyPrivate=1,     
00165       SecrecyConfidential=2 
00166     };
00167 
00171     typedef ListBase<Incidence> List;
00172 
00176     typedef boost::shared_ptr<Incidence> Ptr;
00177 
00181     typedef boost::shared_ptr<const Incidence> ConstPtr;
00182 
00186     Incidence();
00187 
00192     Incidence( const Incidence &other );
00193 
00197     ~Incidence();
00198 
00203     virtual Incidence *clone() = 0; //TODO KDE5: make this const
00204 
00211     void setReadOnly( bool readonly );
00212 
00217     void setAllDay( bool allDay );
00218 
00224     void recreate();
00225 
00232     void setCreated( const KDateTime &dt );
00233 
00238     KDateTime created() const;
00239 
00246     void setRevision( int rev );
00247 
00252     int revision() const;
00253 
00260     virtual void setDtStart( const KDateTime &dt );
00261 
00266     virtual KDateTime dtEnd() const;
00267 
00272     virtual void shiftTimes( const KDateTime::Spec &oldSpec,
00273                              const KDateTime::Spec &newSpec );
00274 
00282     void setDescription( const QString &description, bool isRich );
00283 
00292     void setDescription( const QString &description );
00293 
00299     QString description() const;
00300 
00307     QString richDescription() const;
00308 
00313     bool descriptionIsRich() const;
00314 
00322     void setSummary( const QString &summary, bool isRich );
00323 
00331     void setSummary( const QString &summary );
00332 
00338     QString summary() const;
00339 
00346     QString richSummary() const;
00347 
00352     bool summaryIsRich() const;
00353 
00361     void setLocation( const QString &location, bool isRich );
00362 
00371     void setLocation( const QString &location );
00372 
00378     QString location() const;
00379 
00386     QString richLocation() const;
00387 
00392     bool locationIsRich() const;
00393 
00400     void setCategories( const QStringList &categories );
00401 
00409     void setCategories( const QString &catStr );
00410 
00415     QStringList categories() const;
00416 
00421     QString categoriesStr() const;
00422 
00430     void setRelatedToUid( const QString &uid );
00431 
00438     QString relatedToUid() const;
00439 
00447     void setRelatedTo( Incidence *incidence );
00448 
00455     Incidence *relatedTo() const;
00456 
00461     Incidence::List relations() const;
00462 
00469     void addRelation( Incidence *incidence );
00470 
00477     void removeRelation( Incidence *incidence );
00478 
00479 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00480 // %%%%%  Recurrence-related methods
00481 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00482 
00487     Recurrence *recurrence() const;
00488 
00492     void clearRecurrence();
00493 
00498     bool recurs() const;
00499 
00504     ushort recurrenceType() const;
00505 
00510     virtual bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
00511 
00516     bool recursAt( const KDateTime &dt ) const;
00517 
00529     virtual QList<KDateTime> startDateTimesForDate(
00530       const QDate &date,
00531       const KDateTime::Spec &timeSpec = KDateTime::LocalZone ) const;
00532 
00542     virtual QList<KDateTime> startDateTimesForDateTime(
00543       const KDateTime &datetime ) const;
00544 
00554     virtual KDateTime endDateForStart( const KDateTime &startDt ) const;
00555 
00556 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00557 // %%%%%  Attachment-related methods
00558 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00559 
00566     void addAttachment( Attachment *attachment );
00567 
00575     void deleteAttachment( Attachment *attachment );
00576 
00584     void deleteAttachments( const QString &mime );
00585 
00590     Attachment::List attachments() const;
00591 
00598     Attachment::List attachments( const QString &mime ) const;
00599 
00604     void clearAttachments();
00605 
00610     QString writeAttachmentToTempFile( Attachment *attachment ) const;
00611 
00612     void clearTempFiles();
00613 
00614 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00615 // %%%%%  Secrecy and Status methods
00616 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00617 
00624     void setSecrecy( Secrecy secrecy );
00625 
00630     Secrecy secrecy() const;
00631 
00636     QString secrecyStr() const;
00637 
00643     static QStringList secrecyList();
00644 
00651     static QString secrecyName( Secrecy secrecy );
00652 
00660     void setStatus( Status status );
00661 
00669     void setCustomStatus( const QString &status );
00670 
00675     Status status() const;
00676 
00681     QString statusStr() const;
00682 
00688     static QString statusName( Status status );
00689 
00690 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00691 // %%%%%  Other methods
00692 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00693 
00701     void setResources( const QStringList &resources );
00702 
00707     QStringList resources() const;
00708 
00717     void setPriority( int priority );
00718 
00723     int priority() const;
00724 
00730     bool hasGeo() const;
00731 
00738     void setHasGeo( bool hasGeo );
00739 
00746     void setGeoLatitude( float geolatitude );
00747 
00754     float &geoLatitude() const;
00755 
00762     void setGeoLongitude( float geolongitude );
00763 
00770     float &geoLongitude() const;
00771 
00772 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00773 // %%%%%  Alarm-related methods
00774 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00775 
00779     const Alarm::List &alarms() const;
00780 
00784     Alarm *newAlarm();
00785 
00792     void addAlarm( Alarm *alarm );
00793 
00800     void removeAlarm( Alarm *alarm );
00801 
00806     void clearAlarms();
00807 
00811     bool isAlarmEnabled() const;
00812 
00813 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00814 // %%%%%  Other methods
00815 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00816 
00829     void setSchedulingID( const QString &sid );
00830 
00836     QString schedulingID() const;
00837 
00845     virtual void recurrenceUpdated( Recurrence *recurrence );
00846 
00858     Incidence &operator=( const Incidence &other ); // KDE5: make protected to
00859                                                     // prevent accidental usage
00860 
00871     bool operator==( const Incidence &incidence ) const; // KDE5: make protected to
00872                                                          // prevent accidental usage
00873 
00874   protected:
00880     virtual KDateTime endDateRecurrenceBase() const
00881     {
00882       return dtStart();
00883     }
00884 
00885   private:
00886     void init( const Incidence &other );
00887     //@cond PRIVATE
00888     class Private;
00889     Private *const d;
00890     //@endcond
00891 };
00892 
00893 }
00894 
00895 #define KCAL_INCIDENCE_METATYPE_DEFINED 1
00896 Q_DECLARE_METATYPE( KCal::Incidence* )
00897 
00898 #endif

KCal Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.5
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