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

KCalCore Library

  • kcalcore
calendar.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore 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 */
48 #ifndef KCALCORE_CALENDAR_H
49 #define KCALCORE_CALENDAR_H
50 
51 #include "kcalcore_export.h"
52 #include "event.h"
53 #include "customproperties.h"
54 #include "incidence.h"
55 #include "journal.h"
56 #include "todo.h"
57 
58 #include <QtCore/QObject>
59 
60 namespace KCalCore {
61 
62 class CalFilter;
63 class Person;
64 class ICalTimeZones;
65 
69 enum SortDirection {
70  SortDirectionAscending,
71  SortDirectionDescending
72 };
73 
77 enum EventSortField {
78  EventSortUnsorted,
79  EventSortStartDate,
80  EventSortEndDate,
81  EventSortSummary
82 };
83 
87 enum TodoSortField {
88  TodoSortUnsorted,
89  TodoSortStartDate,
90  TodoSortDueDate,
91  TodoSortPriority,
92  TodoSortPercentComplete,
93  TodoSortSummary,
94  TodoSortCreated
95 };
96 
100 enum JournalSortField {
101  JournalSortUnsorted,
102  JournalSortDate,
103  JournalSortSummary
104 };
105 
128 class KCALCORE_EXPORT Calendar : public QObject, public CustomProperties,
129  public IncidenceBase::IncidenceObserver
130 {
131  Q_OBJECT
132 
133  public:
134 
138  typedef QSharedPointer<Calendar> Ptr;
139 
150  explicit Calendar( const KDateTime::Spec &timeSpec );
151 
165  explicit Calendar( const QString &timeZoneId );
166 
170  virtual ~Calendar();
171 
179  void setProductId( const QString &id );
180 
186  QString productId() const;
187 
195  void setOwner( const Person::Ptr &owner );
196 
204  Person::Ptr owner() const;
205 
214  void setTimeSpec( const KDateTime::Spec &timeSpec );
215 
222  KDateTime::Spec timeSpec() const;
223 
237  void setTimeZoneId( const QString &timeZoneId );
238 
246  QString timeZoneId() const;
247 
262  void setViewTimeSpec( const KDateTime::Spec &timeSpec ) const;
263 
282  void setViewTimeZoneId( const QString &timeZoneId ) const;
283 
290  KDateTime::Spec viewTimeSpec() const;
291 
298  QString viewTimeZoneId() const;
299 
316  void shiftTimes( const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec );
317 
325  ICalTimeZones *timeZones() const;
326 
333  void setTimeZones( ICalTimeZones *zones );
334 
343  void setModified( bool modified );
344 
352  bool isModified() const;
353 
357  virtual void close() = 0;
358 
365  virtual bool save();
366 
374  virtual bool reload();
375 
381  virtual bool isSaving() const;
382 
388  QStringList categories() const;
389 
390  // Incidence Specific Methods //
391 
398  virtual void startBatchAdding();
399 
405  virtual void endBatchAdding();
406 
410  bool batchAdding() const;
411 
421  virtual bool addIncidence( const Incidence::Ptr &incidence );
422 
432  virtual bool deleteIncidence( const Incidence::Ptr &incidence );
433 
439  virtual Incidence::List incidences() const;
440 
448  virtual Incidence::List incidences( const QDate &date ) const;
449 
455  virtual Incidence::List rawIncidences() const;
456 
464  virtual Incidence::List instances( const Incidence::Ptr &incidence ) const;
465 
466  // Notebook Specific Methods //
467 
472  virtual void clearNotebookAssociations();
473 
482  virtual bool setNotebook( const Incidence::Ptr &incidence, const QString &notebook );
483 
491  virtual QString notebook( const Incidence::Ptr &incidence ) const;
492 
500  virtual QString notebook( const QString &uid ) const;
501 
507  virtual QStringList notebooks() const;
508 
516  bool hasValidNotebook( const QString &notebook ) const;
517 
527  bool addNotebook( const QString &notebook, bool isVisible );
528 
538  bool updateNotebook( const QString &notebook, bool isVisible );
539 
548  bool deleteNotebook( const QString &notebook );
549 
556  bool setDefaultNotebook( const QString &notebook );
557 
563  QString defaultNotebook() const;
564 
570  bool isVisible( const Incidence::Ptr &incidence ) const;
571 
578  virtual Incidence::List incidences( const QString &notebook ) const;
579 
586  virtual Incidence::List duplicates( const Incidence::Ptr &incidence );
587 
597  Incidence::Ptr incidence( const QString &uid,
598  const KDateTime &recurrenceId = KDateTime() ) const;
599 
609  Incidence::Ptr deleted( const QString &uid, const KDateTime &recurrenceId = KDateTime() ) const;
610 
617  virtual bool deleteIncidenceInstances( const Incidence::Ptr &incidence ) = 0;
618 
627  virtual Incidence::Ptr incidenceFromSchedulingID( const QString &sid ) const;
628 
635  virtual Incidence::List incidencesFromSchedulingID( const QString &sid ) const;
636 
646  static Incidence::List mergeIncidenceList( const Event::List &events,
647  const Todo::List &todos,
648  const Journal::List &journals );
649 
654  virtual bool beginChange( const Incidence::Ptr &incidence );
655 
660  virtual bool endChange( const Incidence::Ptr &incidence );
661 
679  Incidence::Ptr dissociateOccurrence( const Incidence::Ptr &incidence, const QDate &date,
680  const KDateTime::Spec &spec,
681  bool single = true );
682 
683  // Event Specific Methods //
684 
694  virtual bool addEvent( const Event::Ptr &event ) = 0;
695 
705  virtual bool deleteEvent( const Event::Ptr &event ) = 0;
706 
713  virtual bool deleteEventInstances( const Event::Ptr &event ) = 0;
714 
719  virtual void deleteAllEvents() = 0;
720 
730  static Event::List sortEvents( const Event::List &eventList,
731  EventSortField sortField,
732  SortDirection sortDirection );
741  virtual Event::List events( EventSortField sortField = EventSortUnsorted,
742  SortDirection sortDirection = SortDirectionAscending ) const;
743 
751  Event::List events( const KDateTime &dt ) const;
752 
766  Event::List events( const QDate &start, const QDate &end,
767  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
768  bool inclusive = false ) const;
769 
783  Event::List events( const QDate &date,
784  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
785  EventSortField sortField = EventSortUnsorted,
786  SortDirection sortDirection = SortDirectionAscending ) const;
787 
796  virtual Event::List rawEvents(
797  EventSortField sortField = EventSortUnsorted,
798  SortDirection sortDirection = SortDirectionAscending ) const = 0;
799 
809  virtual Event::List rawEventsForDate( const KDateTime &dt ) const = 0;
810 
824  virtual Event::List rawEvents( const QDate &start, const QDate &end,
825  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
826  bool inclusive = false ) const = 0;
827 
841  virtual Event::List rawEventsForDate(
842  const QDate &date,
843  const KDateTime::Spec &timeSpec = KDateTime::Spec(),
844  EventSortField sortField = EventSortUnsorted,
845  SortDirection sortDirection = SortDirectionAscending ) const = 0;
846 
856  virtual Event::Ptr event( const QString &uid,
857  const KDateTime &recurrenceId = KDateTime() ) const = 0;
858 
868  virtual Event::Ptr deletedEvent( const QString &uid,
869  const KDateTime &recurrenceId = KDateTime() ) const = 0;
870 
879  virtual Event::List deletedEvents(
880  EventSortField sortField = EventSortUnsorted,
881  SortDirection sortDirection = SortDirectionAscending ) const = 0;
882 
892  virtual Event::List eventInstances(
893  const Incidence::Ptr &event,
894  EventSortField sortField = EventSortUnsorted,
895  SortDirection sortDirection = SortDirectionAscending ) const = 0;
896 
897  // Todo Specific Methods //
898 
908  virtual bool addTodo( const Todo::Ptr &todo ) = 0;
909 
919  virtual bool deleteTodo( const Todo::Ptr &todo ) = 0;
920 
926  virtual bool deleteTodoInstances( const Todo::Ptr &todo ) = 0;
927 
932  virtual void deleteAllTodos() = 0;
933 
943  static Todo::List sortTodos( const Todo::List &todoList,
944  TodoSortField sortField,
945  SortDirection sortDirection );
946 
955  virtual Todo::List todos( TodoSortField sortField = TodoSortUnsorted,
956  SortDirection sortDirection = SortDirectionAscending ) const;
957 
965  virtual Todo::List todos( const QDate &date ) const;
966 
980  virtual Todo::List todos( const QDate &start, const QDate &end,
981  const KDateTime::Spec &timespec = KDateTime::Spec(),
982  bool inclusive = false ) const;
983 
992  virtual Todo::List rawTodos(
993  TodoSortField sortField = TodoSortUnsorted,
994  SortDirection sortDirection = SortDirectionAscending ) const = 0;
995 
1003  virtual Todo::List rawTodosForDate( const QDate &date ) const = 0;
1004 
1018  virtual Todo::List rawTodos( const QDate &start, const QDate &end,
1019  const KDateTime::Spec &timespec = KDateTime::Spec(),
1020  bool inclusive = false ) const = 0;
1021 
1031  virtual Todo::Ptr todo( const QString &uid,
1032  const KDateTime &recurrenceId = KDateTime() ) const = 0;
1033 
1043  virtual Todo::Ptr deletedTodo( const QString &uid,
1044  const KDateTime &recurrenceId = KDateTime() ) const = 0;
1045 
1054  virtual Todo::List deletedTodos(
1055  TodoSortField sortField = TodoSortUnsorted,
1056  SortDirection sortDirection = SortDirectionAscending ) const = 0;
1057 
1067  virtual Todo::List todoInstances(
1068  const Incidence::Ptr &todo,
1069  TodoSortField sortField = TodoSortUnsorted,
1070  SortDirection sortDirection = SortDirectionAscending ) const = 0;
1071 
1072  // Journal Specific Methods //
1073 
1083  virtual bool addJournal( const Journal::Ptr &journal ) = 0;
1084 
1094  virtual bool deleteJournal( const Journal::Ptr &journal ) = 0;
1095 
1102  virtual bool deleteJournalInstances( const Journal::Ptr &journal ) = 0;
1103 
1108  virtual void deleteAllJournals() = 0;
1109 
1119  static Journal::List sortJournals( const Journal::List &journalList,
1120  JournalSortField sortField,
1121  SortDirection sortDirection );
1130  virtual Journal::List journals(
1131  JournalSortField sortField = JournalSortUnsorted,
1132  SortDirection sortDirection = SortDirectionAscending ) const;
1133 
1141  virtual Journal::List journals( const QDate &date ) const;
1142 
1151  virtual Journal::List rawJournals(
1152  JournalSortField sortField = JournalSortUnsorted,
1153  SortDirection sortDirection = SortDirectionAscending ) const = 0;
1154 
1162  virtual Journal::List rawJournalsForDate( const QDate &date ) const = 0;
1163 
1173  virtual Journal::Ptr journal( const QString &uid,
1174  const KDateTime &recurrenceId = KDateTime() ) const = 0;
1175 
1185  virtual Journal::Ptr deletedJournal( const QString &uid,
1186  const KDateTime &recurrenceId = KDateTime() ) const = 0;
1187 
1196  virtual Journal::List deletedJournals(
1197  JournalSortField sortField = JournalSortUnsorted,
1198  SortDirection sortDirection = SortDirectionAscending ) const = 0;
1199 
1209  virtual Journal::List journalInstances(
1210  const Incidence::Ptr &journal,
1211  JournalSortField sortField = JournalSortUnsorted,
1212  SortDirection sortDirection = SortDirectionAscending ) const = 0;
1213 
1214  // Relations Specific Methods //
1215 
1220  virtual void setupRelations( const Incidence::Ptr &incidence );
1221 
1227  virtual void removeRelations( const Incidence::Ptr &incidence );
1228 
1235  bool isAncestorOf( const Incidence::Ptr &ancestor,
1236  const Incidence::Ptr &incidence ) const;
1237 
1244  Incidence::List relations( const QString &uid ) const;
1245 
1246  // Filter Specific Methods //
1247 
1257  void setFilter( CalFilter *filter );
1258 
1267  CalFilter *filter() const;
1268 
1269  // Alarm Specific Methods //
1270 
1279  virtual Alarm::List alarms( const KDateTime &from, const KDateTime &to ) const = 0;
1280 
1281  // Observer Specific Methods //
1282 
1288  class KCALCORE_EXPORT CalendarObserver //krazy:exclude=dpointer
1289  {
1290  public:
1294  virtual ~CalendarObserver();
1295 
1303  virtual void calendarModified( bool modified, Calendar *calendar );
1304 
1309  virtual void calendarIncidenceAdded( const Incidence::Ptr &incidence );
1310 
1315  virtual void calendarIncidenceChanged( const Incidence::Ptr &incidence );
1316 
1321  virtual void calendarIncidenceDeleted( const Incidence::Ptr &incidence );
1322 
1327  virtual void calendarIncidenceAdditionCanceled( const Incidence::Ptr &incidence );
1328  };
1329 
1338  void registerObserver( CalendarObserver *observer );
1339 
1348  void unregisterObserver( CalendarObserver *observer );
1349 
1350  using QObject::event; // prevent warning about hidden virtual method
1351 
1352  protected:
1358  void incidenceUpdated( const QString &uid, const KDateTime &recurrenceId );
1359 
1365  virtual void doSetTimeSpec( const KDateTime::Spec &timeSpec );
1366 
1371  void notifyIncidenceAdded( const Incidence::Ptr &incidence );
1372 
1377  void notifyIncidenceChanged( const Incidence::Ptr &incidence );
1378 
1383  void notifyIncidenceDeleted( const Incidence::Ptr &incidence );
1384 
1389  void notifyIncidenceAdditionCanceled( const Incidence::Ptr &incidence );
1390 
1395  virtual void customPropertyUpdated();
1396 
1403  void setObserversEnabled( bool enabled );
1404 
1414  void appendAlarms( Alarm::List &alarms, const Incidence::Ptr &incidence,
1415  const KDateTime &from, const KDateTime &to ) const;
1416 
1426  void appendRecurringAlarms( Alarm::List &alarms, const Incidence::Ptr &incidence,
1427  const KDateTime &from, const KDateTime &to ) const;
1428 
1433  virtual void virtual_hook( int id, void *data );
1434 
1435  private:
1436  //@cond PRIVATE
1437  class Private;
1438  Private *const d;
1439  //@endcond
1440 
1441  Q_DISABLE_COPY( Calendar )
1442 };
1443 
1444 }
1445 
1446 #endif
KCalCore::JournalSortField
JournalSortField
Calendar Journal sort keys.
Definition: calendar.h:100
KCalCore::Journal::List
QVector< Ptr > List
List of journals.
Definition: journal.h:54
KCalCore::TodoSortStartDate
Sort Todos chronologically, by start date.
Definition: calendar.h:89
customproperties.h
This file is part of the API for handling calendar data and defines the CustomProperties class...
KCalCore::TodoSortPriority
Sort Todos by priority.
Definition: calendar.h:91
KCalCore::Event::Ptr
QSharedPointer< Event > Ptr
A shared pointer to an Event object.
Definition: event.h:55
KCalCore::JournalSortDate
Sort Journals chronologically by date.
Definition: calendar.h:102
KCalCore::Alarm::List
QVector< Ptr > List
List of alarms.
Definition: alarm.h:81
KCalCore::EventSortField
EventSortField
Calendar Event sort keys.
Definition: calendar.h:77
KCalCore::Incidence::Ptr
QSharedPointer< Incidence > Ptr
A shared pointer to an Incidence.
Definition: incidence.h:112
KCalCore::EventSortUnsorted
Do not sort Events.
Definition: calendar.h:78
KCalCore::Event::List
QVector< Ptr > List
List of events.
Definition: event.h:60
KCalCore::EventSortEndDate
Sort Events chronologically, by end date.
Definition: calendar.h:80
KCalCore::TodoSortDueDate
Sort Todos chronologically, by due date.
Definition: calendar.h:90
KCalCore::SortDirection
SortDirection
Calendar Incidence sort directions.
Definition: calendar.h:69
todo.h
This file is part of the API for handling calendar data and defines the Todo class.
KCalCore::JournalSortUnsorted
Do not sort Journals.
Definition: calendar.h:101
KCalCore::SortDirectionAscending
Sort in ascending order (first to last)
Definition: calendar.h:70
KCalCore::TodoSortField
TodoSortField
Calendar Todo sort keys.
Definition: calendar.h:87
journal.h
This file is part of the API for handling calendar data and defines the Journal class.
KCalCore::Calendar::Ptr
QSharedPointer< Calendar > Ptr
A shared pointer to a Calendar.
Definition: calendar.h:138
KCalCore::JournalSortSummary
Sort Journals alphabetically, by summary.
Definition: calendar.h:103
KCalCore::Todo::List
QVector< Ptr > List
List of to-dos.
Definition: todo.h:55
KCalCore::Person::Ptr
QSharedPointer< Person > Ptr
A shared pointer to a Person object.
Definition: person.h:56
KCalCore::CustomProperties
A class to manage custom calendar properties.
Definition: customproperties.h:51
KCalCore::Calendar::CalendarObserver
The CalendarObserver class.
Definition: calendar.h:1288
event.h
This file is part of the API for handling calendar data and defines the Event class.
incidence.h
This file is part of the API for handling calendar data and defines the Incidence class...
KCalCore::Incidence::List
QVector< Ptr > List
List of incidences.
Definition: incidence.h:117
KCalCore::ICalTimeZones
The ICalTimeZones class represents a time zone database which consists of a collection of individual ...
Definition: icaltimezones.h:65
KCalCore::EventSortSummary
Sort Events alphabetically, by summary.
Definition: calendar.h:81
KCalCore::Calendar
Represents the main calendar class.
Definition: calendar.h:128
KCalCore::IncidenceBase::IncidenceObserver
The IncidenceObserver class.
Definition: incidencebase.h:193
KCalCore::SortDirectionDescending
Sort in descending order (last to first)
Definition: calendar.h:71
KCalCore::Todo::Ptr
QSharedPointer< Todo > Ptr
A shared pointer to a Todo object.
Definition: todo.h:50
KCalCore::TodoSortSummary
Sort Todos alphabetically, by summary.
Definition: calendar.h:93
KCalCore::TodoSortUnsorted
Do not sort Todos.
Definition: calendar.h:88
KCalCore::Journal::Ptr
QSharedPointer< Journal > Ptr
A shared pointer to a Journal object.
Definition: journal.h:49
KCalCore::CalFilter
Provides a filter for calendars.
Definition: calfilter.h:55
KCalCore::TodoSortPercentComplete
Sort Todos by percentage completed.
Definition: calendar.h:92
KCalCore::EventSortStartDate
Sort Events chronologically, by start date.
Definition: calendar.h:79
KCalCore::TodoSortCreated
Sort Todos chronologically, by creation date.
Definition: calendar.h:94
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Nov 20 2015 11:44:27 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • 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