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);
245 d->mTimeSpec = timeSpec;
247 setViewTimeSpec(timeSpec);
249 doSetTimeSpec(d->mTimeSpec);
259 d->mTimeSpec = d->timeZoneIdSpec(timeZoneId,
false);
260 d->mViewTimeSpec = d->mTimeSpec;
261 d->mBuiltInViewTimeZone = d->mBuiltInTimeZone;
263 doSetTimeSpec(d->mTimeSpec);
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();
304 d->mViewTimeSpec = timeSpec;
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;
344 setTimeSpec(newSpec);
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;
370 emit filterChanged();
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)) {
399 return mergeIncidenceList(events(date), todos(date), journals(date));
404 return mergeIncidenceList(events(), todos(), journals());
409 return mergeIncidenceList(rawEvents(), rawTodos(), rawJournals());
420 elist = eventInstances(incidence);
422 tlist = todoInstances(incidence);
424 jlist = journalInstances(incidence);
426 return mergeIncidenceList(elist, tlist, jlist);
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)) {
456 d->mNotebooks.insert(notebook, isVisible);
463 if (!d->mNotebooks.contains(notebook)) {
466 d->mNotebooks.insert(notebook, isVisible);
473 if (!d->mNotebooks.contains(notebook)) {
476 return d->mNotebooks.remove(notebook);
482 if (!d->mNotebooks.contains(notebook)) {
485 d->mDefaultNotebook = notebook;
492 return d->mDefaultNotebook;
497 return d->mNotebooks.contains(notebook);
502 if (d->mIncidenceVisibility.contains(incidence)) {
503 return d->mIncidenceVisibility[incidence];
505 const QString nuid = notebook(incidence);
507 if (d->mNotebooks.contains(nuid)) {
508 rv = d->mNotebooks.value(nuid);
513 d->mIncidenceVisibility[incidence] = rv;
519 d->mNotebookIncidences.clear();
520 d->mUidToNotebook.clear();
521 d->mIncidenceVisibility.clear();
530 if (!notebook.isEmpty() &&
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);
550 notifyIncidenceChanged(inc);
552 d->mNotebookIncidences.remove(old, inc);
555 if (!notebook.isEmpty()) {
556 d->mUidToNotebook.insert(inc->uid(), notebook);
557 d->mNotebookIncidences.insert(notebook, inc);
558 kDebug() <<
"setting notebook" << notebook <<
"for" << inc->uid();
559 notifyIncidenceChanged(inc);
568 return d->mUidToNotebook.value(incidence->uid());
576 return d->mUidToNotebook.value(uid);
581 return d->mNotebookIncidences.uniqueKeys();
586 if (notebook.isEmpty()) {
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,
646 Event::List el = rawEventsForDate(date, timeSpec, sortField, sortDirection);
647 d->mFilter->apply(&el);
654 d->mFilter->apply(&el);
659 const KDateTime::Spec &timeSpec,
660 bool inclusive)
const 662 Event::List el = rawEvents(start, end, timeSpec, inclusive);
663 d->mFilter->apply(&el);
670 Event::List el = rawEvents(sortField, sortDirection);
671 d->mFilter->apply(&el);
681 AddVisitor<Calendar> v(
this);
682 return incidence->accept(v, incidence);
691 if (beginChange(incidence)) {
692 DeleteVisitor<Calendar> v(
this);
693 const bool result = incidence->accept(v, incidence);
694 endChange(incidence);
702 const KDateTime &recurrenceId,
705 Q_ASSERT(recurrenceId.isValid());
706 if (!incidence || !incidence->recurs() || !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);
724 if (incidence->dtStart().isDateOnly()) {
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,
744 if (!incidence || !incidence->recurs()) {
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);
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));
800 recur = incidence->recurrence();
803 recur->addExDate(date);
814 const KDateTime &recurrenceId)
const 821 i = todo(uid, recurrenceId);
826 i = journal(uid, recurrenceId);
837 i = deletedTodo(uid, recurrenceId);
842 i = deletedJournal(uid, recurrenceId);
850 Incidence::List::const_iterator it = incidences.begin();
851 for (; it != incidences.end(); ++it) {
852 if ((*it)->schedulingID() == sid) {
862 Incidence::List::const_iterator it = incidences.begin();
863 for (; it != incidences.end(); ++it) {
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;
949 Todo::List tl = rawTodos(sortField, sortDirection);
950 d->mFilter->apply(&tl);
957 d->mFilter->apply(&el);
962 const KDateTime::Spec ×pec,
bool inclusive)
const 964 Todo::List tl = rawTodos(start, end, timespec, inclusive);
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()) {
1046 if (isAncestorOf(forincidence, parent)) {
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";
1071 const QString uid = incidence->uid();
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);
1122 if (i != incidence) {
1127 for (Incidence::List::Iterator incit = tempList.begin();
1128 incit != tempList.end(); ++incit) {
1129 d->mOrphans.insert(*uidit, *incit);
1150 if (!incidence || incidence->relatedTo().isEmpty()) {
1152 }
else if (incidence->relatedTo() == ancestor->uid()) {
1155 return isAncestorOf(ancestor, this->incidence(incidence->relatedTo()));
1161 return d->mIncidenceRelations[
uid];
1176 Q_UNUSED(incidence);
1181 Q_UNUSED(incidence);
1186 Q_UNUSED(incidence);
1192 Q_UNUSED(incidence);
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());
1262 notifyIncidenceChanged(inc);
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) {
1356 incidences.append(events[i]);
1359 for (i = 0, end = todos.count(); i < end; ++i) {
1360 incidences.append(todos[i]);
1363 for (i = 0, end = journals.count(); i < end; ++i) {
1364 incidences.append(journals[i]);
1372 Q_UNUSED(incidence);
1378 Q_UNUSED(incidence);
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) {
1434 endOffset =
Duration(incidence->dtStart(),
1436 endOffsetValid =
true;
1441 KDateTime alarmStart =
1443 incidence->dtStart());
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;
virtual bool deleteIncidence(const Incidence::Ptr &incidence)
Removes an Incidence from the calendar.
virtual bool reload()
Loads the calendar contents from storage.
virtual void virtual_hook(int id, void *data)
void setViewTimeZoneId(const QString &timeZoneId) const
Notes the time zone Id which the client application intends to use for viewing the incidences in this...
JournalSortField
Calendar Journal sort keys.
void setOwner(const Person::Ptr &owner)
Sets the owner of the calendar to owner.
bool isModified() const
Determine the calendar's modification status.
QVector< Ptr > List
List of journals.
Sort Todos chronologically, by start date.
void setTimeSpec(const KDateTime::Spec &timeSpec)
Sets the default time specification (time zone, etc.) used for creating or modifying incidences in th...
Represents a person, by name and email address.
virtual void calendarIncidenceAdded(const Incidence::Ptr &incidence)
Notify the Observer that an Incidence has been inserted.
void setDeletionTracking(bool enable)
Enables or disabled deletion tracking.
Represents a span of time measured in seconds or days.
QSharedPointer< Alarm > Ptr
A shared pointer to an Alarm object.
void setDuration(int duration)
Sets the total number of times the event is to occur, including both the first and last...
QSharedPointer< Event > Ptr
A shared pointer to an Event object.
void notifyIncidenceAdditionCanceled(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they canceled addition of an Incidence.
Sort Journals chronologically by date.
A class which reads and parses iCalendar VTIMEZONE components, and accesses libical time zone data...
bool isDaily() const
Returns whether the duration is specified in terms of days rather than seconds.
This class provides the interface for a visitor of calendar components.
virtual void startBatchAdding()
Call this to tell the calendar that you're adding a batch of incidences.
Person::Ptr owner() const
Returns the owner of the calendar.
Role for determining an incidence's dtEnd, will return an invalid KDateTime if the incidence does not...
KDateTime::Spec timeSpec() const
Get the time specification (time zone etc.) used for creating or modifying incidences in the Calendar...
QVector< Ptr > List
List of alarms.
EventSortField
Calendar Event sort keys.
int durationTo(const KDateTime &dt) const
Returns the number of recurrences up to and including the date/time specified.
QSharedPointer< Incidence > Ptr
A shared pointer to an Incidence.
void notifyIncidenceDeleted(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they removed 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 Incidence::List rawIncidences() const
Returns an unfiltered list of all Incidences for this Calendar.
virtual Incidence::Ptr incidenceFromSchedulingID(const QString &sid) const
Returns the Incidence associated with the given scheduling identifier.
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...
static Event::List sortEvents(const Event::List &eventList, EventSortField sortField, SortDirection sortDirection)
Sort a list of Events.
void incidenceUpdated(const QString &uid, const KDateTime &recurrenceId)
The Observer interface.
Incidence::Ptr incidence(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const
Returns the Incidence associated with the given unique identifier.
virtual void endBatchAdding()
Tells the Calendar that you stoped adding a batch of incidences.
virtual ~Calendar()
Destroys the calendar.
virtual void removeRelations(const Incidence::Ptr &incidence)
Removes all Relations from an Incidence.
bool isAncestorOf(const Incidence::Ptr &ancestor, const Incidence::Ptr &incidence) const
Checks if ancestor is an ancestor of incidence.
QVector< Ptr > List
List of events.
virtual void setDtStart(const KDateTime &dt)
Sets the incidence starting date/time.
void setViewTimeSpec(const KDateTime::Spec &timeSpec) const
Notes the time specification which the client application intends to use for viewing the incidences i...
bool setDefaultNotebook(const QString ¬ebook)
set DefaultNotebook information to calendar.
Sort Events chronologically, by end date.
QStringList categories() const
Returns a list of all categories used by Incidences in this Calendar.
virtual Incidence::List incidencesFromSchedulingID(const QString &sid) const
Searches all events and todos for an incidence with this scheduling identifier.
Sort Todos chronologically, by due date.
Incidence::List relations(const QString &uid) const
Returns a list of incidences that have a relation of RELTYPE parent to incidence uid.
virtual void setupRelations(const Incidence::Ptr &incidence)
Setup Relations for an Incidence.
This class represents a recurrence rule for a calendar incidence.
virtual bool save()
Syncs changes in memory to persistent storage.
virtual QString notebook(const Incidence::Ptr &incidence) const
Get incidence's notebook.
static Journal::List sortJournals(const Journal::List &journalList, JournalSortField sortField, SortDirection sortDirection)
Sort a list of Journals.
SortDirection
Calendar Incidence sort directions.
bool addNotebook(const QString ¬ebook, bool isVisible)
Add notebook information into calendar.
virtual Incidence::List instances(const Incidence::Ptr &incidence) const
Returns an unfiltered list of all exceptions of this recurring incidence.
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.
bool isVisible(const Incidence::Ptr &incidence) const
Check if incidence is visible.
void setEndDate(const QDate &endDate)
Sets the date of the last recurrence.
virtual QStringList notebooks() const
List all uids of notebooks currently in the memory.
virtual Event::List events(EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const
Returns a sorted, filtered list of all Events for this Calendar.
This file is part of the API for handling calendar data and defines the Calendar class.
virtual void calendarIncidenceAdditionCanceled(const Incidence::Ptr &incidence)
Notify the Observer that an addition of Incidence has been canceled.
virtual bool addIncidence(const Incidence::Ptr &incidence)
Inserts an Incidence into the calendar.
ICalTimeZone parse(icalcomponent *vtimezone)
Creates an ICalTimeZone instance containing the detailed information parsed from an iCalendar VTIMEZO...
virtual Todo::List todos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const
Returns a sorted, filtered list of all Todos for this Calendar.
virtual void calendarIncidenceChanged(const Incidence::Ptr &incidence)
Notify the Observer that an Incidence has been modified.
void setModified(bool modified)
Sets if the calendar has been modified.
QString uid() const
Returns the UID of the attendee.
Sort in ascending order (first to last)
void notifyIncidenceChanged(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they modified an Incidence.
QString timeZoneId() const
Returns the time zone ID used for creating or modifying incidences in the calendar.
bool hasValidNotebook(const QString ¬ebook) const
Check if calendar knows about the given notebook.
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 ...
void registerObserver(CalendarObserver *observer)
Registers an Observer for this Calendar.
void clear()
Removes all recurrence and exception rules and dates.
TodoSortField
Calendar Todo sort keys.
virtual void customPropertyUpdated()
void setTimeZones(ICalTimeZones *zones)
Set the time zone collection used by the calendar.
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
bool deleteNotebook(const QString ¬ebook)
Delete notebook information from calendar.
KDateTime::Spec viewTimeSpec() const
Returns the time specification used for viewing the incidences in this calendar.
bool deletionTracking() const
Returns if deletion tracking is enabled.
void setTimeZoneId(const QString &timeZoneId)
Sets the time zone ID used for creating or modifying incidences in the Calendar.
QString defaultNotebook() const
Get uid of default notebook.
void setFilter(CalFilter *filter)
Sets the calendar filter.
Role for an incidence alarm's ending offset date/time.
virtual void clearNotebookAssociations()
Clears notebook associations from hash-tables for incidences.
Incidence::Ptr deleted(const QString &uid, const KDateTime &recurrenceId=KDateTime()) const
Returns the deleted Incidence associated with the given unique identifier.
virtual bool endChange(const Incidence::Ptr &incidence)
Flag that a change to a Calendar Incidence has completed.
int value() const
Returns the length of the duration in seconds or days.
Sort Journals alphabetically, by summary.
QVector< Ptr > List
List of to-dos.
QString productId() const
Returns the calendar's Product ID.
virtual ~CalendarObserver()
Destructor.
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.
QSharedPointer< Person > Ptr
A shared pointer to a Person object.
void setDtDue(const KDateTime &dtDue, bool first=false)
Sets due date and time.
The CalendarObserver class.
Provides a To-do in the sense of RFC2445.
QSharedPointer< FreeBusy > Ptr
A shared pointer to a FreeBusy object.
QVector< Ptr > List
List of incidences.
This class provides an Event in the sense of RFC2445.
static Incidence::Ptr createException(const Incidence::Ptr &incidence, const KDateTime &recurrenceId, bool thisAndFuture=false)
Creates an exception for an occurrence from a recurring Incidence.
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending) const
Returns a sorted, filtered list of all Journals for this Calendar.
virtual void doSetTimeSpec(const KDateTime::Spec &timeSpec)
Let Calendar subclasses set the time specification.
void notifyIncidenceAdded(const Incidence::Ptr &incidence)
Let Calendar subclasses notify that they inserted an Incidence.
The ICalTimeZones class represents a time zone database which consists of a collection of individual ...
virtual bool beginChange(const Incidence::Ptr &incidence)
Flag that a change to a Calendar Incidence is starting.
virtual Incidence::List duplicates(const Incidence::Ptr &incidence)
List all possible duplicate incidences.
void setProductId(const QString &id)
Sets the calendar Product ID to id.
int asDays() const
Returns the length of the duration in days.
Sort Events alphabetically, by summary.
virtual bool setNotebook(const Incidence::Ptr &incidence, const QString ¬ebook)
Associate notebook for an incidence.
Represents the main calendar class.
virtual Incidence::List incidences() const
Returns a filtered list of all Incidences for this Calendar.
The ICalTimeZone class represents an iCalendar VTIMEZONE component.
virtual void calendarModified(bool modified, Calendar *calendar)
Notify the Observer that a Calendar has been modified.
void unregisterObserver(CalendarObserver *observer)
Unregisters an Observer for this Calendar.
QString viewTimeZoneId() const
Returns the time zone Id used for viewing the incidences in this calendar.
int asSeconds() const
Returns the length of the duration in seconds.
bool updateNotebook(const QString ¬ebook, bool isVisible)
Update notebook information in calendar.
This file is part of the API for handling calendar data and defines the CalFilter class...
virtual void calendarIncidenceDeleted(const Incidence::Ptr &incidence)
Notify the Observer that an Incidence has been removed.
ICalTimeZones * timeZones() const
Returns the time zone collection used by the calendar.
QSharedPointer< Todo > Ptr
A shared pointer to a Todo object.
virtual bool isSaving() const
Determine if the calendar is currently being saved.
Calendar(const KDateTime::Spec &timeSpec)
Constructs a calendar with a specified time zone timeZoneid.
Sort Todos alphabetically, by summary.
static Todo::List sortTodos(const Todo::List &todoList, TodoSortField sortField, SortDirection sortDirection)
Sort a list of Todos.
QSharedPointer< Journal > Ptr
A shared pointer to a Journal object.
Provides a filter for calendars.
void setObserversEnabled(bool enabled)
Let Calendar subclasses notify that they enabled an Observer.
CalFilter * filter() const
Returns the calendar filter.
Sort Todos by percentage completed.
Sort Events chronologically, by start date.
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.
Sort Todos chronologically, by creation date.