• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KCal Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kcal
incidence.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcal library.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
31 #ifndef INCIDENCE_H
32 #define INCIDENCE_H
33 
34 #include "kcal_export.h"
35 #include "incidencebase.h"
36 #include "alarm.h"
37 #include "attachment.h"
38 #include "recurrence.h"
39 
40 #include <QtCore/QList>
41 #include <QtCore/QMetaType>
42 
43 namespace boost {
44  template <typename T> class shared_ptr;
45 }
46 
47 namespace KCal {
48 
68 class KCAL_DEPRECATED_EXPORT Incidence //krazy:exclude=dpointer since nested class templates confuse krazy
69  : public IncidenceBase, public Recurrence::RecurrenceObserver
70 {
71  public:
76  //@cond PRIVATE
77  template<class T>
78  class AddVisitor : public IncidenceBase::Visitor
79  {
80  public:
81  AddVisitor( T *r ) : mResource( r ) {}
82 
83  bool visit( Event *e )
84  {
85  return mResource->addEvent( e );
86  }
87  bool visit( Todo *t )
88  {
89  return mResource->addTodo( t );
90  }
91  bool visit( Journal *j )
92  {
93  return mResource->addJournal( j );
94  }
95  bool visit( FreeBusy * )
96  {
97  return false;
98  }
99 
100  private:
101  T *mResource;
102  };
103  //@endcond
104 
110  //@cond PRIVATE
111  template<class T>
112  class DeleteVisitor : public IncidenceBase::Visitor
113  {
114  public:
115  DeleteVisitor( T *r ) : mResource( r ) {}
116 
117  bool visit( Event *e )
118  {
119  mResource->deleteEvent( e );
120  return true;
121  }
122  bool visit( Todo *t )
123  {
124  mResource->deleteTodo( t );
125  return true;
126  }
127  bool visit( Journal *j )
128  {
129  mResource->deleteJournal( j );
130  return true;
131  }
132  bool visit( FreeBusy * )
133  {
134  return false;
135  }
136 
137  private:
138  T *mResource;
139  };
140  //@endcond
141 
146  enum Status {
147  StatusNone,
148  StatusTentative,
149  StatusConfirmed,
150  StatusCompleted,
151  StatusNeedsAction,
152  StatusCanceled,
153  StatusInProcess,
154  StatusDraft,
155  StatusFinal,
156  StatusX
157  };
158 
162  enum Secrecy {
163  SecrecyPublic=0,
164  SecrecyPrivate=1,
165  SecrecyConfidential=2
166  };
167 
171  typedef ListBase<Incidence> List;
172 
176  typedef boost::shared_ptr<Incidence> Ptr;
177 
181  typedef boost::shared_ptr<const Incidence> ConstPtr;
182 
186  Incidence();
187 
192  Incidence( const Incidence &other );
193 
197  ~Incidence();
198 
203  virtual Incidence *clone() = 0; //TODO KDE5: make this const
204 
211  void setReadOnly( bool readonly );
212 
217  void setAllDay( bool allDay );
218 
224  void recreate();
225 
232  void setCreated( const KDateTime &dt );
233 
238  KDateTime created() const;
239 
246  void setRevision( int rev );
247 
252  int revision() const;
253 
260  virtual void setDtStart( const KDateTime &dt );
261 
266  virtual KDateTime dtEnd() const;
267 
272  virtual void shiftTimes( const KDateTime::Spec &oldSpec,
273  const KDateTime::Spec &newSpec );
274 
282  void setDescription( const QString &description, bool isRich );
283 
292  void setDescription( const QString &description );
293 
299  QString description() const;
300 
307  QString richDescription() const;
308 
313  bool descriptionIsRich() const;
314 
322  void setSummary( const QString &summary, bool isRich );
323 
331  void setSummary( const QString &summary );
332 
338  QString summary() const;
339 
346  QString richSummary() const;
347 
352  bool summaryIsRich() const;
353 
361  void setLocation( const QString &location, bool isRich );
362 
371  void setLocation( const QString &location );
372 
378  QString location() const;
379 
386  QString richLocation() const;
387 
392  bool locationIsRich() const;
393 
400  void setCategories( const QStringList &categories );
401 
409  void setCategories( const QString &catStr );
410 
415  QStringList categories() const;
416 
421  QString categoriesStr() const;
422 
430  void setRelatedToUid( const QString &uid );
431 
438  QString relatedToUid() const;
439 
447  void setRelatedTo( Incidence *incidence );
448 
455  Incidence *relatedTo() const;
456 
461  Incidence::List relations() const;
462 
469  void addRelation( Incidence *incidence );
470 
477  void removeRelation( Incidence *incidence );
478 
479 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
480 // %%%%% Recurrence-related methods
481 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
482 
487  Recurrence *recurrence() const;
488 
492  void clearRecurrence();
493 
498  bool recurs() const;
499 
504  ushort recurrenceType() const;
505 
510  virtual bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const;
511 
516  bool recursAt( const KDateTime &dt ) const;
517 
529  virtual QList<KDateTime> startDateTimesForDate(
530  const QDate &date,
531  const KDateTime::Spec &timeSpec = KDateTime::LocalZone ) const;
532 
542  virtual QList<KDateTime> startDateTimesForDateTime(
543  const KDateTime &datetime ) const;
544 
554  virtual KDateTime endDateForStart( const KDateTime &startDt ) const;
555 
556 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
557 // %%%%% Attachment-related methods
558 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
559 
566  void addAttachment( Attachment *attachment );
567 
575  void deleteAttachment( Attachment *attachment );
576 
584  void deleteAttachments( const QString &mime );
585 
590  Attachment::List attachments() const;
591 
598  Attachment::List attachments( const QString &mime ) const;
599 
604  void clearAttachments();
605 
610  QString writeAttachmentToTempFile( Attachment *attachment ) const;
611 
612  void clearTempFiles();
613 
614 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615 // %%%%% Secrecy and Status methods
616 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
617 
624  void setSecrecy( Secrecy secrecy );
625 
630  Secrecy secrecy() const;
631 
636  QString secrecyStr() const;
637 
643  static QStringList secrecyList();
644 
651  static QString secrecyName( Secrecy secrecy );
652 
660  void setStatus( Status status );
661 
669  void setCustomStatus( const QString &status );
670 
675  Status status() const;
676 
681  QString statusStr() const;
682 
688  static QString statusName( Status status );
689 
690 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
691 // %%%%% Other methods
692 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 
701  void setResources( const QStringList &resources );
702 
707  QStringList resources() const;
708 
717  void setPriority( int priority );
718 
723  int priority() const;
724 
730  bool hasGeo() const;
731 
738  void setHasGeo( bool hasGeo );
739 
746  void setGeoLatitude( float geolatitude );
747 
754  float &geoLatitude() const;
755 
762  void setGeoLongitude( float geolongitude );
763 
770  float &geoLongitude() const;
771 
772 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
773 // %%%%% Alarm-related methods
774 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
775 
779  const Alarm::List &alarms() const;
780 
784  Alarm *newAlarm();
785 
792  void addAlarm( Alarm *alarm );
793 
800  void removeAlarm( Alarm *alarm );
801 
806  void clearAlarms();
807 
811  bool isAlarmEnabled() const;
812 
813 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
814 // %%%%% Other methods
815 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
816 
829  void setSchedulingID( const QString &sid );
830 
836  QString schedulingID() const;
837 
845  virtual void recurrenceUpdated( Recurrence *recurrence );
846 
858  Incidence &operator=( const Incidence &other ); // KDE5: make protected to
859  // prevent accidental usage
860 
871  bool operator==( const Incidence &incidence ) const; // KDE5: make protected to
872  // prevent accidental usage
873 
874  protected:
880  virtual KDateTime endDateRecurrenceBase() const
881  {
882  return dtStart();
883  }
884 
885  private:
886  void init( const Incidence &other );
887  //@cond PRIVATE
888  class Private;
889  Private *const d;
890  //@endcond
891 };
892 
893 }
894 
895 #define KCAL_INCIDENCE_METATYPE_DEFINED 1
896 Q_DECLARE_METATYPE( KCal::Incidence* )
897 
898 #endif
KCal::Incidence::endDateRecurrenceBase
virtual KDateTime endDateRecurrenceBase() const
Returns the end date/time of the base incidence (e.g.
Definition: incidence.h:880
KCal::Incidence::Ptr
boost::shared_ptr< Incidence > Ptr
A shared pointer to an Incidence.
Definition: incidence.h:176
KCal::Incidence::StatusNone
No status.
Definition: incidence.h:147
KCal::Todo
Provides a To-do in the sense of RFC2445.
Definition: todo.h:44
KCal::IncidenceBase
An abstract class that provides a common base for all calendar incidence classes. ...
Definition: incidencebase.h:102
KCal::Incidence::StatusNeedsAction
to-do needs action
Definition: incidence.h:151
KCal::Event
This class provides an Event in the sense of RFC2445.
Definition: event.h:41
KCal::Incidence::Status
Status
Template for a class that implements a visitor for adding an Incidence to a resource supporting addEv...
Definition: incidence.h:146
KCal::Incidence::StatusDraft
journal is draft
Definition: incidence.h:154
KCal::IncidenceBase::Visitor
This class provides the interface for a visitor of calendar components.
Definition: incidencebase.h:112
KCal::Incidence::StatusCanceled
event or to-do canceled; journal removed
Definition: incidence.h:152
KCal::Incidence::StatusFinal
journal is final
Definition: incidence.h:155
KCal::Incidence
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:68
KCal::ListBase
This class provides a template for lists of pointers.
Definition: listbase.h:44
KCal::Attachment
Represents information related to an attachment for a Calendar Incidence.
Definition: attachment.h:57
KCal::Journal
Provides a Journal in the sense of RFC2445.
Definition: journal.h:43
KCal::Incidence::List
ListBase< Incidence > List
List of incidences.
Definition: incidence.h:171
KCal::Incidence::Secrecy
Secrecy
The different types of incidence access classifications.
Definition: incidence.h:162
attachment.h
This file is part of the API for handling calendar data and defines the Attachment class...
alarm.h
This file is part of the API for handling calendar data and defines the Alarm class.
incidencebase.h
This file is part of the API for handling calendar data and defines the IncidenceBase class...
KCal::Incidence::ConstPtr
boost::shared_ptr< const Incidence > ConstPtr
A shared pointer to a non-mutable Incidence.
Definition: incidence.h:181
KCal::Incidence::StatusTentative
event is tentative
Definition: incidence.h:148
KCal::FreeBusy
Provides information about the free/busy time of a calendar.
Definition: freebusy.h:50
KCal::Alarm
Represents an alarm notification.
Definition: alarm.h:66
KCal::Incidence::StatusInProcess
to-do in process
Definition: incidence.h:153
KCal::Incidence::StatusCompleted
to-do completed
Definition: incidence.h:150
KCal::Incidence::StatusConfirmed
event is definite
Definition: incidence.h:149
KCal::Recurrence
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:91
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal