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

KCal Library

  • 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_EXPORT_DEPRECATED 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
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:29:14 by doxygen 1.8.3.1 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
  • Related Pages

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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