• 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
calendar.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcal library.
3 
4  Copyright (c) 1998 Preston Brown <pbrown@kde.org>
5  Copyright (c) 2001,2003,2004 Cornelius Schumacher <schumacher@kde.org>
6  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
7  Copyright (c) 2006 David Jarvie <software@astrojar.org.uk>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
35 #ifndef KCAL_CALENDAR_H
36 #define KCAL_CALENDAR_H
37 
38 #include <QtCore/QObject>
39 #include <QtCore/QString>
40 #include <QtCore/QList>
41 #include <QtCore/QMultiHash>
42 
43 #include <kdatetime.h>
44 
45 #include "customproperties.h"
46 #include "event.h"
47 #include "todo.h"
48 #include "journal.h"
49 #include "kcalversion.h"
50 
51 namespace KCal {
52 
53 class ICalTimeZone;
54 class ICalTimeZones;
55 class CalFilter;
56 class Person;
57 
61 enum SortDirection {
62  SortDirectionAscending,
63  SortDirectionDescending
64 };
65 
69 enum EventSortField {
70  EventSortUnsorted,
71  EventSortStartDate,
72  EventSortEndDate,
73  EventSortSummary
74 };
75 
79 enum TodoSortField {
80  TodoSortUnsorted,
81  TodoSortStartDate,
82  TodoSortDueDate,
83  TodoSortPriority,
84  TodoSortPercentComplete,
85  TodoSortSummary
86 };
87 
91 enum JournalSortField {
92  JournalSortUnsorted,
93  JournalSortDate,
94  JournalSortSummary
95 };
96 
119 class KCAL_DEPRECATED_EXPORT Calendar : public QObject, public CustomProperties,
120  public IncidenceBase::IncidenceObserver
121 {
122  Q_OBJECT
123 
124  public:
125 
136  explicit Calendar( const KDateTime::Spec &timeSpec );
137 
151  explicit Calendar( const QString &timeZoneId );
152 
156  virtual ~Calendar();
157 
165  void setProductId( const QString &id );
166 
172  QString productId() const;
173 
181  void setOwner( const Person &owner );
182 
190  Person owner() const;
191 
200  void setTimeSpec( const KDateTime::Spec &timeSpec );
201 
208  KDateTime::Spec timeSpec() const;
209 
223  void setTimeZoneId( const QString &timeZoneId );
224 
232  QString timeZoneId() const;
233 
248  void setViewTimeSpec( const KDateTime::Spec &timeSpec ) const;
249 
268  void setViewTimeZoneId( const QString &timeZoneId ) const;
269 
276  KDateTime::Spec viewTimeSpec() const;
277 
284  QString viewTimeZoneId() const;
285 
302  void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
303 
311  ICalTimeZones *timeZones() const;
312 
319  void setTimeZones( const ICalTimeZones &zones );
320 
329  void setModified( bool modified );
330 
338  bool isModified() const;
339 
343  virtual void close() = 0;
344 
350  virtual bool save() = 0;
351 
358  virtual bool reload() = 0;
359 
365  virtual bool isSaving();
366 
372  QStringList categories();
373 
374  // Incidence Specific Methods //
375 
385  virtual bool addIncidence( Incidence *incidence );
386 
396  virtual bool deleteIncidence( Incidence *incidence );
397 
403  virtual Incidence::List incidences();
404 
412  virtual Incidence::List incidences( const QDate &date );
413 
419  virtual Incidence::List rawIncidences();
420 
429  Incidence *incidence( const QString &uid );
430 
439  Incidence *incidenceFromSchedulingID( const QString &sid );
440 
447  Incidence::List incidencesFromSchedulingID( const QString &sid );
448 
458  static Incidence::List mergeIncidenceList( const Event::List &events,
459  const Todo::List &todos,
460  const Journal::List &journals );
461 
467  virtual bool beginChange( Incidence *incidence );
468 
474  virtual bool endChange( Incidence *incidence );
475 
493  Incidence *dissociateOccurrence( Incidence *incidence, const QDate &date,
494  const KDateTime::Spec &spec,
495  bool single = true );
496 
497  // Event Specific Methods //
498 
508  virtual bool addEvent( Event *event ) = 0;
509 
519  virtual bool deleteEvent( Event *event ) = 0;
520 
525  virtual void deleteAllEvents() = 0;
526 
536  static Event::List sortEvents( Event::List *eventList,
537  EventSortField sortField,
538  SortDirection sortDirection );
539 
553  static Event::List sortEventsForDate( Event::List *eventList,
554  const QDate &date,
555  const KDateTime::Spec &timeSpec,
556  EventSortField sortField,
557  SortDirection sortDirection );
558 
567  virtual Event::List events(
568  EventSortField sortField = EventSortUnsorted,
569  SortDirection sortDirection = SortDirectionAscending );
570 
578  Event::List events( const KDateTime &dt );
579 
593  Event::List events( const QDate &start, const QDate &end,
594  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
595  bool inclusive = false );
596 
610  Event::List events(
611  const QDate &date,
612  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
613  EventSortField sortField = EventSortUnsorted,
614  SortDirection sortDirection = SortDirectionAscending );
615 
624  virtual Event::List rawEvents(
625  EventSortField sortField = EventSortUnsorted,
626  SortDirection sortDirection = SortDirectionAscending ) = 0;
627 
637  virtual Event::List rawEventsForDate( const KDateTime &dt ) = 0;
638 
652  virtual Event::List rawEvents( const QDate &start, const QDate &end,
653  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
654  bool inclusive = false ) = 0;
655 
669  virtual Event::List rawEventsForDate(
670  const QDate &date, const KDateTime::Spec &timeSpec = KDateTime::Spec(),
671  EventSortField sortField = EventSortUnsorted,
672  SortDirection sortDirection = SortDirectionAscending ) = 0;
673 
682  virtual Event *event( const QString &uid ) = 0;
683 
684  // Todo Specific Methods //
685 
695  virtual bool addTodo( Todo *todo ) = 0;
696 
706  virtual bool deleteTodo( Todo *todo ) = 0;
707 
712  virtual void deleteAllTodos() = 0;
713 
723  static Todo::List sortTodos( Todo::List *todoList,
724  TodoSortField sortField,
725  SortDirection sortDirection );
726 
735  virtual Todo::List todos(
736  TodoSortField sortField = TodoSortUnsorted,
737  SortDirection sortDirection = SortDirectionAscending );
738 
746  virtual Todo::List todos( const QDate &date );
747 
756  virtual Todo::List rawTodos(
757  TodoSortField sortField = TodoSortUnsorted,
758  SortDirection sortDirection = SortDirectionAscending ) = 0;
759 
767  virtual Todo::List rawTodosForDate( const QDate &date ) = 0;
768 
777  virtual Todo *todo( const QString &uid ) = 0;
778 
779  // Journal Specific Methods //
780 
790  virtual bool addJournal( Journal *journal ) = 0;
791 
801  virtual bool deleteJournal( Journal *journal ) = 0;
802 
807  virtual void deleteAllJournals() = 0;
808 
818  static Journal::List sortJournals( Journal::List *journalList,
819  JournalSortField sortField,
820  SortDirection sortDirection );
829  virtual Journal::List journals(
830  JournalSortField sortField = JournalSortUnsorted,
831  SortDirection sortDirection = SortDirectionAscending );
832 
840  virtual Journal::List journals( const QDate &date );
841 
850  virtual Journal::List rawJournals(
851  JournalSortField sortField = JournalSortUnsorted,
852  SortDirection sortDirection = SortDirectionAscending ) = 0;
853 
861  virtual Journal::List rawJournalsForDate( const QDate &date ) = 0;
862 
871  virtual Journal *journal( const QString &uid ) = 0;
872 
885  void beginBatchAdding();
886 
895  void endBatchAdding();
896 
897  // Relations Specific Methods //
898 
905  virtual void setupRelations( Incidence *incidence );
906 
913  virtual void removeRelations( Incidence *incidence );
914 
921  bool isAncestorOf( Incidence *ancestor, Incidence *incidence );
922 
923  // Filter Specific Methods //
924 
934  void setFilter( CalFilter *filter );
935 
944  CalFilter *filter();
945 
946  // Alarm Specific Methods //
947 
956  virtual Alarm::List alarms( const KDateTime &from,
957  const KDateTime &to ) = 0;
958 
959  // Observer Specific Methods //
960 
966  class KCAL_DEPRECATED_EXPORT CalendarObserver //krazy:exclude=dpointer
967  {
968  public:
972  virtual ~CalendarObserver() {}
973 
981  virtual void calendarModified( bool modified, Calendar *calendar );
982 
988  virtual void calendarIncidenceAdded( Incidence *incidence );
989 
995  virtual void calendarIncidenceChanged( Incidence *incidence );
996 
1002  virtual void calendarIncidenceDeleted( Incidence *incidence );
1003  };
1004 
1013  void registerObserver( CalendarObserver *observer );
1014 
1023  void unregisterObserver( CalendarObserver *observer );
1024 
1025  using QObject::event; // prevent warning about hidden virtual method
1026 
1027  Q_SIGNALS:
1031  void calendarChanged();
1032 
1036  void calendarSaved();
1037 
1041  void calendarLoaded();
1042 
1047  void batchAddingBegins();
1048 
1053  void batchAddingEnds();
1054 
1055  protected:
1061  void incidenceUpdated( IncidenceBase *incidenceBase );
1062 
1069  virtual void doSetTimeSpec( const KDateTime::Spec &timeSpec );
1070 
1076  void notifyIncidenceAdded( Incidence *incidence );
1077 
1083  void notifyIncidenceChanged( Incidence *incidence );
1084 
1090  void notifyIncidenceDeleted( Incidence *incidence );
1091 
1096  virtual void customPropertyUpdated();
1097 
1104  void setObserversEnabled( bool enabled );
1105 
1115  void appendAlarms( Alarm::List &alarms, Incidence *incidence,
1116  const KDateTime &from, const KDateTime &to );
1117 
1127  void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
1128  const KDateTime &from, const KDateTime &to );
1129 
1130  private:
1131  //@cond PRIVATE
1132  class Private;
1133  Private *const d;
1134  //@endcond
1135 
1136  Q_DISABLE_COPY( Calendar )
1137 };
1138 
1139 }
1140 
1141 #endif
KCal::CustomProperties
A class to manage custom calendar properties.
Definition: customproperties.h:52
customproperties.h
This file is part of the API for handling calendar data and defines the CustomProperties class...
KCal::Todo
Provides a To-do in the sense of RFC2445.
Definition: todo.h:44
KCal::Calendar
Represents the main calendar class.
Definition: calendar.h:119
KCal::IncidenceBase
An abstract class that provides a common base for all calendar incidence classes. ...
Definition: incidencebase.h:102
KCal::CalFilter
Provides a filter for calendars.
Definition: calfilter.h:57
KCal::Event
This class provides an Event in the sense of RFC2445.
Definition: event.h:41
KCal::IncidenceBase::IncidenceObserver
The IncidenceObserver class.
Definition: incidencebase.h:157
KCal::Calendar::CalendarObserver::~CalendarObserver
virtual ~CalendarObserver()
Destructor.
Definition: calendar.h:972
KCal::Calendar::CalendarObserver
The CalendarObserver class.
Definition: calendar.h:966
KCal::Person
Represents a person, by name ane email address.
Definition: person.h:48
todo.h
This file is part of the API for handling calendar data and defines the Todo class.
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::Journal
Provides a Journal in the sense of RFC2445.
Definition: journal.h:43
journal.h
This file is part of the API for handling calendar data and defines the Journal class.
KCal::ICalTimeZones
The ICalTimeZones class represents a time zone database which consists of a collection of individual ...
Definition: icaltimezones.h:64
event.h
This file is part of the API for handling calendar data and defines the Event class.
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