KCalCore Library
Go to the documentation of this file.
39 #include "icaltimezones.h"
46 #include <icaltimezone.h>
58 class KCalCore::Calendar::Private
65 mObserversEnabled(true),
67 batchAddingInProgress(false),
68 mDeletionTracking(true)
71 mFilter = mDefaultFilter;
72 mFilter->setEnabled(
false);
75 mOwner->setName(QLatin1String(
"Unknown Name"));
76 mOwner->setEmail(QLatin1String(
"unknown@nowhere"));
83 if (mFilter != mDefaultFilter) {
86 delete mDefaultFilter;
88 KDateTime::Spec timeZoneIdSpec(
const QString &
timeZoneId,
bool view);
95 KDateTime::Spec mTimeSpec;
96 mutable KDateTime::Spec mViewTimeSpec;
99 bool mObserversEnabled;
100 QList<CalendarObserver*> mObservers;
106 QMultiHash<QString, Incidence::Ptr> mOrphans;
107 QMultiHash<QString, Incidence::Ptr> mOrphanUids;
110 QMultiHash<QString, Incidence::Ptr >mNotebookIncidences;
111 QHash<QString, QString>mUidToNotebook;
112 QHash<QString, bool>mNotebooks;
113 QHash<Incidence::Ptr, bool>mIncidenceVisibility;
114 QString mDefaultNotebook;
115 QMap<QString, Incidence::List > mIncidenceRelations;
116 bool batchAddingInProgress;
117 bool mDeletionTracking;
123 template <
typename K,
typename V>
124 QVector<V> values(
const QMultiHash<K,V> &c)
128 for (
typename QMultiHash<K,V>::const_iterator it = c.begin(), end = c.end(); it != end; ++it) {
129 v.push_back(it.value());
134 template <
typename K,
typename V>
135 QVector<V> values(
const QMultiHash<K,V> &c,
const K &x)
138 typename QMultiHash<K,V>::const_iterator it = c.find(x);
139 while (it != c.end() && it.key() == x) {
140 v.push_back(it.value());
151 class AddVisitor :
public Visitor
154 AddVisitor(T *r) : mResource(r) {}
158 return mResource->addEvent(e);
162 return mResource->addTodo(t);
166 return mResource->addJournal(j);
183 class DeleteVisitor :
public Visitor
186 DeleteVisitor(T *r) : mResource(r) {}
190 mResource->deleteEvent(e);
195 mResource->deleteTodo(t);
200 mResource->deleteJournal(j);
216 d->mTimeSpec = timeSpec;
217 d->mViewTimeSpec = timeSpec;
223 setTimeZoneId(timeZoneId);
259 d->mTimeSpec = d->timeZoneIdSpec(
timeZoneId,
false);
260 d->mViewTimeSpec = d->mTimeSpec;
261 d->mBuiltInViewTimeZone = d->mBuiltInTimeZone;
267 KDateTime::Spec Calendar::Private::timeZoneIdSpec(
const QString &timeZoneId,
275 if (timeZoneId == QLatin1String(
"UTC")) {
276 return KDateTime::UTC;
281 tz = tzsrc.
parse(icaltimezone_get_builtin_timezone(timeZoneId.toLatin1()));
283 mBuiltInViewTimeZone = tz;
285 mBuiltInTimeZone = tz;
291 return KDateTime::ClockTime;
298 KTimeZone tz = d->mTimeSpec.timeZone();
299 return tz.isValid() ? tz.name() : QString();
310 d->mViewTimeSpec = d->timeZoneIdSpec(
timeZoneId,
true);
315 return d->mViewTimeSpec;
320 KTimeZone tz = d->mViewTimeSpec.timeZone();
321 return tz.isValid() ? tz.name() : QString();
326 return d->mTimeZones;
335 if (d->mTimeZones && (d->mTimeZones != zones)) {
336 delete d->mTimeZones;
339 d->mTimeZones = zones;
348 for (i = 0, end = ev.count(); i < end; ++i) {
349 ev[i]->shiftTimes(oldSpec, newSpec);
353 for (i = 0, end = to.count(); i < end; ++i) {
354 to[i]->shiftTimes(oldSpec, newSpec);
358 for (i = 0, end = jo.count(); i < end; ++i) {
359 jo[i]->shiftTimes(oldSpec, newSpec);
368 d->mFilter = d->mDefaultFilter;
381 QStringList cats, thisCats;
384 for (Incidence::List::ConstIterator i = rawInc.constBegin();
385 i != rawInc.constEnd(); ++i) {
386 thisCats = (*i)->categories();
387 for (QStringList::ConstIterator si = thisCats.constBegin();
388 si != thisCats.constEnd(); ++si) {
389 if (!cats.contains(*si)) {
437 Incidence::List::const_iterator it;
438 for (it = vals.constBegin(); it != vals.constEnd(); ++it) {
439 if (((
incidence->dtStart() == (*it)->dtStart()) ||
440 (!
incidence->dtStart().isValid() && !(*it)->dtStart().isValid())) &&
441 (
incidence->summary() == (*it)->summary())) {
453 if (d->mNotebooks.contains(
notebook)) {
463 if (!d->mNotebooks.contains(
notebook)) {
473 if (!d->mNotebooks.contains(
notebook)) {
476 return d->mNotebooks.remove(
notebook);
482 if (!d->mNotebooks.contains(
notebook)) {
492 return d->mDefaultNotebook;
497 return d->mNotebooks.contains(
notebook);
502 if (d->mIncidenceVisibility.contains(
incidence)) {
503 return d->mIncidenceVisibility[
incidence];
507 if (d->mNotebooks.contains(nuid)) {
508 rv = d->mNotebooks.value(nuid);
519 d->mNotebookIncidences.clear();
520 d->mUidToNotebook.clear();
521 d->mIncidenceVisibility.clear();
531 !
incidence(inc->uid(), inc->recurrenceId())) {
532 kWarning() <<
"cannot set notebook until incidence has been added";
536 if (d->mUidToNotebook.contains(inc->uid())) {
537 QString old = d->mUidToNotebook.value(inc->uid());
538 if (!old.isEmpty() &&
notebook != old) {
539 if (inc->hasRecurrenceId()) {
540 kWarning() <<
"cannot set notebook for child incidences";
545 Incidence::List::Iterator it;
546 for (it = list.begin(); it != list.end(); ++it) {
547 d->mNotebookIncidences.remove(old, *it);
548 d->mNotebookIncidences.insert(
notebook, *it);
552 d->mNotebookIncidences.remove(old, inc);
556 d->mUidToNotebook.insert(inc->uid(),
notebook);
557 d->mNotebookIncidences.insert(
notebook, inc);
558 kDebug() <<
"setting notebook" <<
notebook <<
"for" << inc->uid();
568 return d->mUidToNotebook.value(
incidence->uid());
576 return d->mUidToNotebook.value(uid);
581 return d->mNotebookIncidences.uniqueKeys();
587 return values(d->mNotebookIncidences);
589 return values(d->mNotebookIncidences,
notebook);
599 if (eventList.isEmpty()) {
607 eventListSorted = eventList;
614 qSort(eventListSorted.begin(), eventListSorted.end(), Events::startDateLessThan);
616 qSort(eventListSorted.begin(), eventListSorted.end(), Events::startDateMoreThan);
622 qSort(eventListSorted.begin(), eventListSorted.end(), Events::endDateLessThan);
624 qSort(eventListSorted.begin(), eventListSorted.end(), Events::endDateMoreThan);
630 qSort(eventListSorted.begin(), eventListSorted.end(), Events::summaryLessThan);
632 qSort(eventListSorted.begin(), eventListSorted.end(), Events::summaryMoreThan);
637 return eventListSorted;
642 const KDateTime::Spec &timeSpec,
647 d->mFilter->apply(&el);
654 d->mFilter->apply(&el);
659 const KDateTime::Spec &timeSpec,
660 bool inclusive)
const
663 d->mFilter->apply(&el);
671 d->mFilter->apply(&el);
681 AddVisitor<Calendar> v(
this);
692 DeleteVisitor<Calendar> v(
this);
702 const KDateTime &recurrenceId,
705 Q_ASSERT(recurrenceId.isValid());
711 newInc->setCreated(KDateTime::currentUtcDateTime());
712 newInc->setRevision(0);
714 newInc->clearRecurrence();
716 newInc->setRecurrenceId(recurrenceId);
717 newInc->setThisAndFuture(thisAndFuture);
718 newInc->setDtStart(recurrenceId);
725 int offset =
incidence->dtStart().daysTo(recurrenceId);
726 end = end.addDays(offset);
728 qint64 offset =
incidence->dtStart().secsTo_long(recurrenceId);
729 end = end.addSecs(offset);
741 const KDateTime::Spec &spec,
764 int doneduration = recur->
durationTo(date.addDays(-1));
765 if (doneduration >= duration) {
766 kDebug() <<
"The dissociated event already occurred more often"
767 <<
"than it was supposed to ever occur. ERROR!";
777 KDateTime start(ev->dtStart());
778 int daysTo = start.toTimeSpec(spec).date().daysTo(date);
779 ev->setDtStart(start.addDays(daysTo));
780 ev->setDtEnd(ev->dtEnd().addDays(daysTo));
783 bool haveOffset =
false;
785 if (td->hasDueDate()) {
786 KDateTime due(td->dtDue());
787 daysTo = due.toTimeSpec(spec).date().daysTo(date);
788 td->setDtDue(due.addDays(daysTo),
true);
791 if (td->hasStartDate()) {
792 KDateTime start(td->dtStart());
794 daysTo = start.toTimeSpec(spec).date().daysTo(date);
796 td->setDtStart(start.addDays(daysTo));
803 recur->addExDate(date);
814 const KDateTime &recurrenceId)
const
821 i =
todo(uid, recurrenceId);
826 i =
journal(uid, recurrenceId);
850 Incidence::List::const_iterator it =
incidences.begin();
852 if ((*it)->schedulingID() == sid) {
862 Incidence::List::const_iterator it =
incidences.begin();
864 if ((*it)->schedulingID() == uid) {
878 if (todoList.isEmpty()) {
889 todoListSorted = todoList;
896 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::startDateLessThan);
898 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::startDateMoreThan);
904 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::dueDateLessThan);
906 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::dueDateMoreThan);
912 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::priorityLessThan);
914 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::priorityMoreThan);
920 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::percentLessThan);
922 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::percentMoreThan);
928 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::summaryLessThan);
930 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::summaryMoreThan);
936 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::createdLessThan);
938 qSort(todoListSorted.begin(), todoListSorted.end(), Todos::createdMoreThan);
943 return todoListSorted;
950 d->mFilter->apply(&tl);
957 d->mFilter->apply(&el);
962 const KDateTime::Spec ×pec,
bool inclusive)
const
965 d->mFilter->apply(&tl);
974 if (journalList.isEmpty()) {
986 qSort(journalListSorted.begin(), journalListSorted.end(), Journals::dateLessThan);
988 qSort(journalListSorted.begin(), journalListSorted.end(), Journals::dateMoreThan);
994 qSort(journalListSorted.begin(), journalListSorted.end(), Journals::summaryLessThan);
996 qSort(journalListSorted.begin(), journalListSorted.end(), Journals::summaryMoreThan);
1001 return journalListSorted;
1008 d->mFilter->apply(&jl);
1015 d->mFilter->apply(&el);
1023 if (!forincidence) {
1027 const QString uid = forincidence->uid();
1031 d->mOrphans.remove(uid);
1032 for (
int i = 0, end = l.count(); i < end; ++i) {
1033 d->mIncidenceRelations[uid].append(l[i]);
1034 d->mOrphanUids.remove(l[i]->uid());
1038 if (forincidence->relatedTo().isEmpty() && !forincidence->relatedTo().isEmpty()) {
1047 forincidence->setRelatedTo(QString());
1048 kWarning() <<
"hierarchy loop beetween " << forincidence->uid() <<
" and " << parent->uid();
1050 d->mIncidenceRelations[parent->uid()].append(forincidence);
1057 d->mOrphans.insert(forincidence->relatedTo(), forincidence);
1058 d->mOrphanUids.insert(forincidence->uid(), forincidence);
1067 kDebug() <<
"Warning: incidence is 0";
1074 if (!d->mOrphanUids.contains(i->uid())) {
1075 d->mOrphans.insert(uid, i);
1076 d->mOrphanUids.insert(i->uid(), i);
1077 i->setRelatedTo(uid);
1081 const QString parentUid =
incidence->relatedTo();
1084 if (!parentUid.isEmpty()) {
1085 d->mIncidenceRelations[parentUid].erase(
1086 std::remove(d->mIncidenceRelations[parentUid].begin(),
1087 d->mIncidenceRelations[parentUid].end(),
incidence),
1088 d->mIncidenceRelations[parentUid].end());
1092 if (d->mOrphanUids.remove(uid)) {
1102 QStringList relatedToUids;
1106 relatedToUids <<
incidence->relatedTo();
1107 for (QMultiHash<QString, Incidence::Ptr>::Iterator it = d->mOrphans.begin();
1108 it != d->mOrphans.end(); ++it) {
1109 if (it.value()->uid() == uid) {
1110 relatedToUids << it.key();
1115 for (QStringList::const_iterator uidit = relatedToUids.constBegin();
1116 uidit != relatedToUids.constEnd(); ++uidit) {
1119 QList<Incidence::Ptr> l = d->mOrphans.values(*uidit);
1120 d->mOrphans.remove(*uidit);
1127 for (Incidence::List::Iterator incit = tempList.begin();
1128 incit != tempList.end(); ++incit) {
1129 d->mOrphans.insert(*uidit, *incit);
1152 }
else if (
incidence->relatedTo() == ancestor->uid()) {
1161 return d->mIncidenceRelations[uid];
1201 if (!d->mObservers.contains(observer)) {
1202 d->mObservers.append(observer);
1204 d->mNewObserver =
true;
1213 d->mObservers.removeAll(observer);
1224 if (modified != d->mModified || d->mNewObserver) {
1225 d->mNewObserver =
false;
1229 d->mModified = modified;
1235 return d->mModified;
1257 inc->setLastModified(KDateTime::currentUtcDateTime());
1278 if (!d->mObserversEnabled) {
1293 if (!d->mObserversEnabled) {
1308 if (!d->mObserversEnabled) {
1323 if (!d->mObserversEnabled) {
1344 return d->mProductId;
1355 for (i = 0, end =
events.count(); i < end; ++i) {
1359 for (i = 0, end =
todos.count(); i < end; ++i) {
1363 for (i = 0, end =
journals.count(); i < end; ++i) {
1384 d->mObserversEnabled = enabled;
1388 const KDateTime &from,
const KDateTime &to)
const
1390 KDateTime preTime = from.addSecs(-1);
1393 for (
int i = 0, iend = alarmlist.count(); i < iend; ++i) {
1394 if (alarmlist[i]->enabled()) {
1395 KDateTime dt = alarmlist[i]->nextRepetition(preTime);
1396 if (dt.isValid() && dt <= to) {
1397 kDebug() <<
incidence->summary() <<
"':" << dt.toString();
1398 alarms.append(alarmlist[i]);
1406 const KDateTime &from,
1407 const KDateTime &to)
const
1410 bool endOffsetValid =
false;
1415 for (
int i = 0, iend = alarmlist.count(); i < iend; ++i) {
1420 dt = a->nextRepetition(from.addSecs(-1));
1421 if (!dt.isValid() || dt > to) {
1429 if (a->hasStartOffset()) {
1430 offset = a->startOffset();
1431 }
else if (a->hasEndOffset()) {
1432 offset = a->endOffset();
1433 if (!endOffsetValid) {
1436 endOffsetValid =
true;
1441 KDateTime alarmStart =
1445 if (alarmStart > to) {
1448 KDateTime baseStart =
incidence->dtStart();
1449 if (from > alarmStart) {
1451 baseStart = (-offset).end((-endOffset).end(alarmStart));
1456 dt =
incidence->recurrence()->getNextDateTime(baseStart.addSecs(-1));
1457 if (!dt.isValid() ||
1458 (dt = endOffset.
end(offset.
end(dt))) > to)
1461 if (!a->repeatCount()) {
1468 Duration alarmDuration = a->duration();
1469 for (KDateTime base = baseStart;
1470 (dt =
incidence->recurrence()->getPreviousDateTime(base)).isValid();
1472 if (a->duration().end(dt) < base) {
1478 int snooze = a->snoozeTime().
value();
1479 if (a->snoozeTime().isDaily()) {
1481 int toFrom = toFromDuration.
asDays();
1482 if (a->snoozeTime().end(from) <= to ||
1483 (toFromDuration.
isDaily() && toFrom % snooze == 0) ||
1484 (toFrom / snooze + 1) * snooze <= toFrom + period.
asDays()) {
1488 dt = offset.
end(dt).addDays(((toFrom - 1) / snooze + 1) * snooze);
1493 int toFrom = dt.secsTo(base);
1495 toFrom % snooze == 0 ||
1496 (toFrom / snooze + 1) * snooze <= toFrom + period.
asSeconds())
1501 dt = offset.
end(dt).addSecs(((toFrom - 1) / snooze + 1) * snooze);
1512 kDebug() <<
incidence->summary() <<
"':" << dt.toString();
1520 d->batchAddingInProgress =
true;
1525 d->batchAddingInProgress =
false;
1530 return d->batchAddingInProgress;
1535 d->mDeletionTracking = enable;
1540 return d->mDeletionTracking;
@ TodoSortPriority
Sort Todos by priority.
@ TypeTodo
Type is a to-do.
void setDeletionTracking(bool enable)
Enables or disabled deletion tracking.
QString viewTimeZoneId() const
Returns the time zone Id used for viewing the incidences in this calendar.
QVector< Ptr > List
List of journals.
@ TodoSortPercentComplete
Sort Todos by percentage completed.
ICalTimeZones * timeZones() const
Returns the time zone collection used by the calendar.
This class represents a recurrence rule for a calendar incidence.
@ EventSortEndDate
Sort Events chronologically, by end date.
bool deletionTracking() const
Returns if deletion tracking is enabled.
QVector< Ptr > List
List of to-dos.
Person::Ptr owner() const
Returns the owner of the calendar.
Incidence::Ptr incidence(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const
Returns the Incidence associated with the given unique identifier.
Provides a To-do in the sense of RFC2445.
KDateTime::Spec viewTimeSpec() const
Returns the time specification used for viewing the incidences in this calendar.
Represents a person, by name and email address.
bool updateNotebook(const QString ¬ebook, bool isVisible)
Update notebook information in calendar.
KDateTime end(const KDateTime &start) const
Computes a duration end time by adding the number of seconds or days in the duration to the specified...
The ICalTimeZones class represents a time zone database which consists of a collection of individual ...
int durationTo(const KDateTime &dt) const
Returns the number of recurrences up to and including the date/time specified.
virtual Alarm::List alarms(const KDateTime &from, const KDateTime &to) const =0
Returns a list of Alarms within a time range for this Calendar.
CalFilter * filter() const
Returns the calendar filter.
Calendar(const KDateTime::Spec &timeSpec)
Constructs a calendar with a specified time zone timeZoneid.
Incidence::Ptr deleted(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const
Returns the deleted Incidence associated with the given unique identifier.
virtual void calendarIncidenceAdditionCanceled(const Incidence::Ptr &incidence)
Notify the Observer that an addition of Incidence has been canceled.
@ EventSortSummary
Sort Events alphabetically, by summary.
@ TypeJournal
Type is a journal.
QSharedPointer< Incidence > Ptr
A shared pointer to an Incidence.
void appendAlarms(Alarm::List &alarms, const Incidence::Ptr &incidence, const KDateTime &from, const KDateTime &to) const
Appends alarms of incidence in interval to list of alarms.
virtual void startBatchAdding()
Call this to tell the calendar that you're adding a batch of incidences.
virtual QString notebook(const Incidence::Ptr &incidence) const
Get incidence's notebook.
virtual void virtual_hook(int id, void *data)
virtual Event::List eventInstances(const Incidence::Ptr &event, EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const =0
Returns a sorted, unfiltered list of all possible instances for this recurring Event.
static Event::List sortEvents(const Event::List &eventList, EventSortField sortField, SortDirection sortDirection)
Sort a list of Events.
int asDays() const
Returns the length of the duration in days.
virtual ~CalendarObserver()
Destructor.
QSharedPointer< Todo > Ptr
A shared pointer to a Todo object.
QSharedPointer< Alarm > Ptr
A shared pointer to an Alarm object.
virtual Incidence::List instances(const Incidence::Ptr &incidence) const
Returns an unfiltered list of all exceptions of this recurring incidence.
virtual void endBatchAdding()
Tells the Calendar that you stoped adding a batch of incidences.
void notifyIncidenceAdditionCanceled(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they canceled addition of an Incidence.
QSharedPointer< Person > Ptr
A shared pointer to a Person object.
This class provides the interface for a visitor of calendar components.
QStringList categories() const
Returns a list of all categories used by Incidences in this Calendar.
QSharedPointer< Event > Ptr
A shared pointer to an Event object.
void setModified(bool modified)
Sets if the calendar has been modified.
@ TodoSortDueDate
Sort Todos chronologically, by due date.
Represents a span of time measured in seconds or days.
virtual Journal::List rawJournals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const =0
Returns a sorted, unfiltered list of all Journals for this Calendar.
static Incidence::List mergeIncidenceList(const Event::List &events, const Todo::List &todos, const Journal::List &journals)
Create a merged list of Events, Todos, and Journals.
QString defaultNotebook() const
Get uid of default notebook.
virtual void removeRelations(const Incidence::Ptr &incidence)
Removes all Relations from an Incidence.
void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Shifts the times of all incidences so that they appear at the same clock time as before but in a new ...
static Journal::List sortJournals(const Journal::List &journalList, JournalSortField sortField, SortDirection sortDirection)
Sort a list of Journals.
bool addNotebook(const QString ¬ebook, bool isVisible)
Add notebook information into calendar.
Represents the main calendar class.
virtual void calendarIncidenceChanged(const Incidence::Ptr &incidence)
Notify the Observer that an Incidence has been modified.
virtual ~Calendar()
Destroys the calendar.
void notifyIncidenceDeleted(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they removed an Incidence.
@ RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
int value() const
Returns the length of the duration in seconds or days.
virtual Todo::List rawTodos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const =0
Returns a sorted, unfiltered list of all Todos for this Calendar.
@ JournalSortUnsorted
Do not sort Journals.
void setDuration(int duration)
Sets the total number of times the event is to occur, including both the first and last.
QVector< Ptr > List
List of alarms.
QVector< Ptr > List
List of events.
QString timeZoneId() const
Returns the time zone ID used for creating or modifying incidences in the calendar.
This class provides an Event in the sense of RFC2445.
ICalTimeZone parse(icalcomponent *vtimezone)
Creates an ICalTimeZone instance containing the detailed information parsed from an iCalendar VTIMEZO...
QString productId() const
Returns the calendar's Product ID.
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const
Returns a sorted, filtered list of all Journals for this Calendar.
virtual Incidence::List rawIncidences() const
Returns an unfiltered list of all Incidences for this Calendar.
virtual bool addIncidence(const Incidence::Ptr &incidence)
Inserts an Incidence into the calendar.
virtual Todo::List rawTodosForDate(const QDate &date) const =0
Returns an unfiltered list of all Todos which due on the specified date.
virtual Event::List events(EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const
Returns a sorted, filtered list of all Events for this Calendar.
QVector< Ptr > List
List of incidences.
void appendRecurringAlarms(Alarm::List &alarms, const Incidence::Ptr &incidence, const KDateTime &from, const KDateTime &to) const
Appends alarms of recurring events in interval to list of alarms.
virtual void setupRelations(const Incidence::Ptr &incidence)
Setup Relations for an Incidence.
QSharedPointer< FreeBusy > Ptr
A shared pointer to a FreeBusy object.
virtual void doSetTimeSpec(const KDateTime::Spec &timeSpec)
Let Calendar subclasses set the time specification.
@ TodoSortUnsorted
Do not sort Todos.
virtual Journal::Ptr journal(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const =0
Returns the Journal associated with the given unique identifier.
void incidenceUpdated(const QString &uid, const KDateTime &recurrenceId)
The Observer interface.
virtual Event::Ptr event(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const =0
Returns the Event associated with the given unique identifier.
JournalSortField
Calendar Journal sort keys.
virtual Event::List rawEventsForDate(const KDateTime &dt) const =0
Returns an unfiltered list of all Events which occur on the given timestamp.
virtual Incidence::List duplicates(const Incidence::Ptr &incidence)
List all possible duplicate incidences.
@ JournalSortSummary
Sort Journals alphabetically, by summary.
bool setDefaultNotebook(const QString ¬ebook)
set DefaultNotebook information to calendar.
void setTimeZones(ICalTimeZones *zones)
Set the time zone collection used by the calendar.
virtual void calendarIncidenceDeleted(const Incidence::Ptr &incidence)
Notify the Observer that an Incidence has been removed.
@ TypeEvent
Type is an event.
virtual Journal::Ptr deletedJournal(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const =0
Returns the deleted Journal associated with the given unique identifier.
void registerObserver(CalendarObserver *observer)
Registers an Observer for this Calendar.
virtual bool save()
Syncs changes in memory to persistent storage.
virtual void calendarIncidenceAdded(const Incidence::Ptr &incidence)
Notify the Observer that an Incidence has been inserted.
Incidence::List relations(const QString &uid) const
Returns a list of incidences that have a relation of RELTYPE parent to incidence uid.
virtual Event::Ptr deletedEvent(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const =0
Returns the deleted Event associated with the given unique identifier.
void notifyIncidenceChanged(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they modified an Incidence.
virtual void calendarModified(bool modified, Calendar *calendar)
Notify the Observer that a Calendar has been modified.
virtual Todo::List todoInstances(const Incidence::Ptr &todo, TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const =0
Returns a sorted, unfiltered list of all possible instances for this recurring Todo.
bool isDaily() const
Returns whether the duration is specified in terms of days rather than seconds.
void setTimeZoneId(const QString &timeZoneId)
Sets the time zone ID used for creating or modifying incidences in the Calendar.
bool isModified() const
Determine the calendar's modification status.
void notifyIncidenceAdded(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they inserted an Incidence.
virtual bool setNotebook(const Incidence::Ptr &incidence, const QString ¬ebook)
Associate notebook for an incidence.
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid KDateTime if the incidence does not...
TodoSortField
Calendar Todo sort keys.
bool deleteNotebook(const QString ¬ebook)
Delete notebook information from calendar.
@ TodoSortStartDate
Sort Todos chronologically, by start date.
virtual void clearNotebookAssociations()
Clears notebook associations from hash-tables for incidences.
virtual bool beginChange(const Incidence::Ptr &incidence)
Flag that a change to a Calendar Incidence is starting.
SortDirection
Calendar Incidence sort directions.
KDateTime::Spec timeSpec() const
Get the time specification (time zone etc.) used for creating or modifying incidences in the Calendar...
virtual Incidence::List incidences() const
Returns a filtered list of all Incidences for this Calendar.
@ EventSortStartDate
Sort Events chronologically, by start date.
virtual Todo::List todos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const
Returns a sorted, filtered list of all Todos for this Calendar.
virtual bool endChange(const Incidence::Ptr &incidence)
Flag that a change to a Calendar Incidence has completed.
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
KCALCORE_DEPRECATED Incidence::Ptr dissociateOccurrence(const Incidence::Ptr &incidence, const QDate &date, const KDateTime::Spec &spec, bool single=true)
Dissociate an Incidence from a recurring Incidence.
virtual bool reload()
Loads the calendar contents from storage.
A class which reads and parses iCalendar VTIMEZONE components, and accesses libical time zone data.
virtual Incidence::List incidencesFromSchedulingID(const QString &sid) const
Searches all events and todos for an incidence with this scheduling identifier.
virtual void customPropertyUpdated()
virtual bool isSaving() const
Determine if the calendar is currently being saved.
void setEndDate(const QDate &endDate)
Sets the date of the last recurrence.
void setObserversEnabled(bool enabled)
Let Calendar subclasses notify that they enabled an Observer.
bool isVisible(const Incidence::Ptr &incidence) const
Check if incidence is visible.
The ICalTimeZone class represents an iCalendar VTIMEZONE component.
@ TodoSortCreated
Sort Todos chronologically, by creation date.
bool isAncestorOf(const Incidence::Ptr &ancestor, const Incidence::Ptr &incidence) const
Checks if ancestor is an ancestor of incidence.
void setFilter(CalFilter *filter)
Sets the calendar filter.
virtual QStringList notebooks() const
List all uids of notebooks currently in the memory.
static Incidence::Ptr createException(const Incidence::Ptr &incidence, const KDateTime &recurrenceId, bool thisAndFuture=false)
Creates an exception for an occurrence from a recurring Incidence.
bool hasValidNotebook(const QString ¬ebook) const
Check if calendar knows about the given notebook.
@ JournalSortDate
Sort Journals chronologically by date.
void filterChanged()
Emitted when setFilter() is called.
QSharedPointer< Journal > Ptr
A shared pointer to a Journal object.
void unregisterObserver(CalendarObserver *observer)
Unregisters an Observer for this Calendar.
Provides a filter for calendars.
virtual bool deleteIncidence(const Incidence::Ptr &incidence)
Removes an Incidence from the calendar.
void setTimeSpec(const KDateTime::Spec &timeSpec)
Sets the default time specification (time zone, etc.) used for creating or modifying incidences in th...
void setViewTimeZoneId(const QString &timeZoneId) const
Notes the time zone Id which the client application intends to use for viewing the incidences in this...
virtual Todo::Ptr deletedTodo(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const =0
Returns the deleted Todo associated with the given unique identifier.
void setViewTimeSpec(const KDateTime::Spec &timeSpec) const
Notes the time specification which the client application intends to use for viewing the incidences i...
@ SortDirectionAscending
Sort in ascending order (first to last)
virtual Event::List rawEvents(EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const =0
Returns a sorted, unfiltered list of all Events for this Calendar.
virtual Journal::List rawJournalsForDate(const QDate &date) const =0
Returns an unfiltered list of all Journals for on the specified date.
void setProductId(const QString &id)
Sets the calendar Product ID to id.
static Todo::List sortTodos(const Todo::List &todoList, TodoSortField sortField, SortDirection sortDirection)
Sort a list of Todos.
void clear()
Removes all recurrence and exception rules and dates.
virtual Incidence::Ptr incidenceFromSchedulingID(const QString &sid) const
Returns the Incidence associated with the given scheduling identifier.
EventSortField
Calendar Event sort keys.
virtual Todo::Ptr todo(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const =0
Returns the Todo associated with the given unique identifier.
int asSeconds() const
Returns the length of the duration in seconds.
void setOwner(const Person::Ptr &owner)
Sets the owner of the calendar to owner.
virtual Journal::List journalInstances(const Incidence::Ptr &journal, JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const =0
Returns a sorted, unfiltered list of all instances for this recurring Journal.
@ EventSortUnsorted
Do not sort Events.
@ TodoSortSummary
Sort Todos alphabetically, by summary.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jan 29 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.