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

KCal Library

  • 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::TodoSortField
TodoSortField
Calendar Todo sort keys.
Definition: calendar.h:79
KCal::TodoSortSummary
@ TodoSortSummary
Sort Todos alphabetically, by summary.
Definition: calendar.h:85
KCal::TodoSortDueDate
@ TodoSortDueDate
Sort Todos chronologically, by due date.
Definition: calendar.h:82
KCal::TodoSortPriority
@ TodoSortPriority
Sort Todos by priority.
Definition: calendar.h:83
KCal::TodoSortPercentComplete
@ TodoSortPercentComplete
Sort Todos by percentage completed.
Definition: calendar.h:84
KCal::TodoSortStartDate
@ TodoSortStartDate
Sort Todos chronologically, by start date.
Definition: calendar.h:81
KCal::TodoSortUnsorted
@ TodoSortUnsorted
Do not sort Todos.
Definition: calendar.h:80
KCal::JournalSortField
JournalSortField
Calendar Journal sort keys.
Definition: calendar.h:91
KCal::JournalSortUnsorted
@ JournalSortUnsorted
Do not sort Journals.
Definition: calendar.h:92
KCal::JournalSortDate
@ JournalSortDate
Sort Journals chronologically by date.
Definition: calendar.h:93
KCal::JournalSortSummary
@ JournalSortSummary
Sort Journals alphabetically, by summary.
Definition: calendar.h:94
KCal::EventSortField
EventSortField
Calendar Event sort keys.
Definition: calendar.h:69
KCal::EventSortUnsorted
@ EventSortUnsorted
Do not sort Events.
Definition: calendar.h:70
KCal::EventSortEndDate
@ EventSortEndDate
Sort Events chronologically, by end date.
Definition: calendar.h:72
KCal::EventSortSummary
@ EventSortSummary
Sort Events alphabetically, by summary.
Definition: calendar.h:73
KCal::EventSortStartDate
@ EventSortStartDate
Sort Events chronologically, by start date.
Definition: calendar.h:71
KCal::SortDirection
SortDirection
Calendar Incidence sort directions.
Definition: calendar.h:61
KCal::SortDirectionAscending
@ SortDirectionAscending
Sort in ascending order (first to last)
Definition: calendar.h:62
KCal::SortDirectionDescending
@ SortDirectionDescending
Sort in descending order (last to first)
Definition: calendar.h:63
KCal::CalFilter
Provides a filter for calendars.
Definition: calfilter.h:58
KCal::Calendar::CalendarObserver
The CalendarObserver class.
Definition: calendar.h:967
KCal::Calendar::CalendarObserver::~CalendarObserver
virtual ~CalendarObserver()
Destructor.
Definition: calendar.h:972
KCal::Calendar
Represents the main calendar class.
Definition: calendar.h:121
KCal::Calendar::calendarLoaded
void calendarLoaded()
Signals that the calendar has been loaded into memory.
KCal::Calendar::reload
virtual bool reload()=0
Loads the calendar contents from storage.
KCal::Calendar::rawTodosForDate
virtual Todo::List rawTodosForDate(const QDate &date)=0
Returns an unfiltered list of all Todos which due on the specified date.
KCal::Calendar::rawJournals
virtual Journal::List rawJournals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Returns a sorted, unfiltered list of all Journals for this Calendar.
KCal::Calendar::addJournal
virtual bool addJournal(Journal *journal)=0
Inserts a Journal into the calendar.
KCal::Calendar::deleteAllTodos
virtual void deleteAllTodos()=0
Removes all To-dos from the calendar.
KCal::Calendar::save
virtual bool save()=0
Syncs changes in memory to persistent storage.
KCal::Calendar::calendarSaved
void calendarSaved()
Signals that the calendar has been saved.
KCal::Calendar::rawEventsForDate
virtual Event::List rawEventsForDate(const QDate &date, const KDateTime::Spec &timeSpec=KDateTime::Spec(), EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Returns a sorted, unfiltered list of all Events which occur on the given date.
KCal::Calendar::addEvent
virtual bool addEvent(Event *event)=0
Inserts an Event into the calendar.
KCal::Calendar::rawEventsForDate
virtual Event::List rawEventsForDate(const KDateTime &dt)=0
Returns an unfiltered list of all Events which occur on the given timestamp.
KCal::Calendar::addTodo
virtual bool addTodo(Todo *todo)=0
Inserts a Todo into the calendar.
KCal::Calendar::todo
virtual Todo * todo(const QString &uid)=0
Returns the Todo associated with the given unique identifier.
KCal::Calendar::event
virtual Event * event(const QString &uid)=0
Returns the Event associated with the given unique identifier.
KCal::Calendar::rawEvents
virtual Event::List rawEvents(const QDate &start, const QDate &end, const KDateTime::Spec &timeSpec=KDateTime::Spec(), bool inclusive=false)=0
Returns an unfiltered list of all Events occurring within a date range.
KCal::Calendar::deleteAllEvents
virtual void deleteAllEvents()=0
Removes all Events from the calendar.
KCal::Calendar::deleteEvent
virtual bool deleteEvent(Event *event)=0
Removes an Event from the calendar.
KCal::Calendar::calendarChanged
void calendarChanged()
Signals that the calendar has been modified.
KCal::Calendar::journal
virtual Journal * journal(const QString &uid)=0
Returns the Journal associated with the given unique identifier.
KCal::Calendar::rawEvents
virtual Event::List rawEvents(EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Returns a sorted, unfiltered list of all Events for this Calendar.
KCal::Calendar::deleteTodo
virtual bool deleteTodo(Todo *todo)=0
Removes a Todo from the calendar.
KCal::Calendar::deleteJournal
virtual bool deleteJournal(Journal *journal)=0
Removes a Journal from the calendar.
KCal::Calendar::rawTodos
virtual Todo::List rawTodos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Returns a sorted, unfiltered list of all Todos for this Calendar.
KCal::Calendar::batchAddingEnds
void batchAddingEnds()
KCal::Calendar::deleteAllJournals
virtual void deleteAllJournals()=0
Removes all Journals from the calendar.
KCal::Calendar::batchAddingBegins
void batchAddingBegins()
KCal::Calendar::close
virtual void close()=0
Clears out the current calendar, freeing all used memory etc.
KCal::Calendar::rawJournalsForDate
virtual Journal::List rawJournalsForDate(const QDate &date)=0
Returns an unfiltered list of all Journals for on the specified date.
KCal::Calendar::alarms
virtual Alarm::List alarms(const KDateTime &from, const KDateTime &to)=0
Returns a list of Alarms within a time range for this Calendar.
KCal::Calendar::setTimeZones
void setTimeZones(const ICalTimeZones &zones)
Set the time zone collection used by the calendar.
KCal::CustomProperties
A class to manage custom calendar properties.
Definition: customproperties.h:53
KCal::Event
This class provides an Event in the sense of RFC2445.
Definition: event.h:42
KCal::ICalTimeZones
The ICalTimeZones class represents a time zone database which consists of a collection of individual ...
Definition: icaltimezones.h:65
KCal::IncidenceBase::IncidenceObserver
The IncidenceObserver class.
Definition: incidencebase.h:158
KCal::IncidenceBase
An abstract class that provides a common base for all calendar incidence classes.
Definition: incidencebase.h:103
KCal::Incidence
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:70
KCal::Journal
Provides a Journal in the sense of RFC2445.
Definition: journal.h:44
KCal::ListBase
This class provides a template for lists of pointers.
Definition: listbase.h:45
KCal::Person
Represents a person, by name ane email address.
Definition: person.h:49
KCal::Todo
Provides a To-do in the sense of RFC2445.
Definition: todo.h:45
customproperties.h
This file is part of the API for handling calendar data and defines the CustomProperties class.
event.h
This file is part of the API for handling calendar data and defines the Event class.
journal.h
This file is part of the API for handling calendar data and defines the Journal class.
todo.h
This file is part of the API for handling calendar data and defines the Todo class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 26 2021 00:00:00 by doxygen 1.9.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
  • File Members
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 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