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

KCalCore Library

  • sources
  • kde-4.14
  • kdepimlibs
  • kcalcore
todo.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2009 Allen Winter <winter@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
34 #include "todo.h"
35 #include "visitor.h"
36 #include "recurrence.h"
37 
38 #include <KDebug>
39 
40 #include <QTime>
41 
42 using namespace KCalCore;
43 
48 //@cond PRIVATE
49 class KCalCore::Todo::Private
50 {
51 public:
52  Private()
53  : mPercentComplete(0)
54  {}
55  Private(const KCalCore::Todo::Private &other)
56  {
57  init(other);
58  }
59 
60  void init(const KCalCore::Todo::Private &other);
61 
62  KDateTime mDtDue; // to-do due date (if there is one)
63  // ALSO the first occurrence of a recurring to-do
64  KDateTime mDtRecurrence; // next occurrence (for recurring to-dos)
65  KDateTime mCompleted; // to-do completion date (if it has been completed)
66  int mPercentComplete; // to-do percent complete [0,100]
67 
71  bool recurTodo(Todo *todo);
72 };
73 
74 void KCalCore::Todo::Private::init(const KCalCore::Todo::Private &other)
75 {
76  mDtDue = other.mDtDue;
77  mDtRecurrence = other.mDtRecurrence;
78  mCompleted = other.mCompleted;
79  mPercentComplete = other.mPercentComplete;
80 }
81 
82 //@endcond
83 
84 Todo::Todo()
85  : d(new KCalCore::Todo::Private)
86 {
87 }
88 
89 Todo::Todo(const Todo &other)
90  : Incidence(other),
91  d(new KCalCore::Todo::Private(*other.d))
92 {
93 }
94 
95 Todo::Todo(const Incidence &other)
96  : Incidence(other)
97  , d(new KCalCore::Todo::Private)
98 {
99 }
100 
101 Todo::~Todo()
102 {
103  delete d;
104 }
105 
106 Todo *Todo::clone() const
107 {
108  return new Todo(*this);
109 }
110 
111 IncidenceBase &Todo::assign(const IncidenceBase &other)
112 {
113  if (&other != this) {
114  Incidence::assign(other);
115  const Todo *t = static_cast<const Todo*>(&other);
116  d->init(*(t->d));
117  }
118  return *this;
119 }
120 
121 bool Todo::equals(const IncidenceBase &todo) const
122 {
123  if (!Incidence::equals(todo)) {
124  return false;
125  } else {
126  // If they weren't the same type IncidenceBase::equals would had returned false already
127  const Todo *t = static_cast<const Todo*>(&todo);
128  return ((dtDue() == t->dtDue()) ||
129  (!dtDue().isValid() && !t->dtDue().isValid())) &&
130  hasDueDate() == t->hasDueDate() &&
131  hasStartDate() == t->hasStartDate() &&
132  ((completed() == t->completed()) ||
133  (!completed().isValid() && !t->completed().isValid())) &&
134  hasCompletedDate() == t->hasCompletedDate() &&
135  percentComplete() == t->percentComplete();
136  }
137 }
138 
139 Incidence::IncidenceType Todo::type() const
140 {
141  return TypeTodo;
142 }
143 
144 QByteArray Todo::typeStr() const
145 {
146  return "Todo";
147 }
148 void Todo::setDtDue(const KDateTime &dtDue, bool first)
149 {
150  startUpdates();
151 
152  //int diffsecs = d->mDtDue.secsTo(dtDue);
153 
154  /*if (mReadOnly) return;
155  const Alarm::List& alarms = alarms();
156  for (Alarm *alarm = alarms.first(); alarm; alarm = alarms.next()) {
157  if (alarm->enabled()) {
158  alarm->setTime(alarm->time().addSecs(diffsecs));
159  }
160  }*/
161 
162  if (recurs() && !first) {
163  d->mDtRecurrence = dtDue;
164  } else {
165  d->mDtDue = dtDue;
166  }
167 
168  if (recurs() && dtDue.isValid() && (!dtStart().isValid() || dtDue < recurrence()->startDateTime())) {
169  kDebug() << "To-do recurrences are now calculated against DTSTART. Fixing legacy to-do.";
170  setDtStart(dtDue);
171  }
172 
173  /*const Alarm::List& alarms = alarms();
174  for (Alarm *alarm = alarms.first(); alarm; alarm = alarms.next())
175  alarm->setAlarmStart(d->mDtDue);*/
176  setFieldDirty(FieldDtDue);
177  endUpdates();
178 }
179 
180 KDateTime Todo::dtDue(bool first) const
181 {
182  if (!hasDueDate()) {
183  return KDateTime();
184  }
185 
186  const KDateTime start = IncidenceBase::dtStart();
187  if (recurs() && !first && d->mDtRecurrence.isValid()) {
188  if (start.isValid()) {
189  // This is the normal case, recurring to-dos have a valid DTSTART.
190  const int duration = start.daysTo(d->mDtDue);
191  KDateTime dt = d->mDtRecurrence.addDays(duration);
192  dt.setTime(d->mDtDue.time());
193  return dt;
194  } else {
195  // This is a legacy case, where recurrence was calculated against DTDUE
196  return d->mDtRecurrence;
197  }
198  }
199 
200  return d->mDtDue;
201 }
202 
203 bool Todo::hasDueDate() const
204 {
205  return d->mDtDue.isValid();
206 }
207 
208 void Todo::setHasDueDate(bool has)
209 {
210  if (mReadOnly) {
211  return;
212  }
213  update();
214  if (!has) {
215  d->mDtDue = KDateTime();
216 
217  if (!dtStart().isValid()) {
218  // Recurrence is only calculated against dtdue if dtstart is invalid
219  d->mDtRecurrence = KDateTime();
220  }
221  }
222 
223  setFieldDirty(FieldDtDue);
224  updated();
225 }
226 
227 bool Todo::hasStartDate() const
228 {
229  return IncidenceBase::dtStart().isValid();
230 }
231 
232 void Todo::setHasStartDate(bool has)
233 {
234  if (mReadOnly) {
235  return;
236  }
237 
238  update();
239  if (recurs() && !has) {
240  if (!comments().filter(QLatin1String("NoStartDate")).count()) {
241  addComment(QLatin1String("NoStartDate")); //TODO: --> custom flag?
242  }
243  } else {
244  QString s(QLatin1String("NoStartDate"));
245  removeComment(s);
246  }
247 
248  if (!has) {
249  if (dtStart().isValid() && d->mDtDue.isValid()) {
250  // If dtstart is invalid then recurrence is calculated against dtdue, so don't clear it.
251  d->mDtRecurrence = KDateTime();
252  }
253  setDtStart(KDateTime());
254  }
255 
256  setFieldDirty(FieldDtStart);
257  updated();
258 }
259 
260 KDateTime Todo::dtStart() const
261 {
262  return dtStart(/*first=*/false);
263 }
264 
265 KDateTime Todo::dtStart(bool first) const
266 {
267  if (!hasStartDate()) {
268  return KDateTime();
269  }
270 
271  if (recurs() && !first && d->mDtRecurrence.isValid()) {
272  return d->mDtRecurrence;
273  } else {
274  return IncidenceBase::dtStart();
275  }
276 }
277 
278 void Todo::setDtStart(const KDateTime &dtStart)
279 {
280  Incidence::setDtStart(dtStart);
281 }
282 
283 bool Todo::isCompleted() const
284 {
285  return d->mPercentComplete == 100;
286 }
287 
288 void Todo::setCompleted(bool completed)
289 {
290  update();
291  if (completed) {
292  d->mPercentComplete = 100;
293  } else {
294  d->mPercentComplete = 0;
295  d->mCompleted = KDateTime();
296  }
297  setFieldDirty(FieldCompleted);
298  updated();
299 }
300 
301 KDateTime Todo::completed() const
302 {
303  if (hasCompletedDate()) {
304  return d->mCompleted;
305  } else {
306  return KDateTime();
307  }
308 }
309 
310 void Todo::setCompleted(const KDateTime &completed)
311 {
312  update();
313  if (!d->recurTodo(this)) {
314  d->mPercentComplete = 100;
315  d->mCompleted = completed.toUtc();
316  setFieldDirty(FieldCompleted);
317  }
318  updated();
319 }
320 
321 bool Todo::hasCompletedDate() const
322 {
323  return d->mCompleted.isValid();
324 }
325 
326 int Todo::percentComplete() const
327 {
328  return d->mPercentComplete;
329 }
330 
331 void Todo::setPercentComplete(int percent)
332 {
333  if (percent > 100) {
334  percent = 100;
335  } else if (percent < 0) {
336  percent = 0;
337  }
338 
339  update();
340  d->mPercentComplete = percent;
341  if (percent != 100) {
342  d->mCompleted = KDateTime();
343  }
344  setFieldDirty(FieldPercentComplete);
345  updated();
346 }
347 
348 bool Todo::isInProgress(bool first) const
349 {
350  if (isOverdue()) {
351  return false;
352  }
353 
354  if (d->mPercentComplete > 0) {
355  return true;
356  }
357 
358  if (hasStartDate() && hasDueDate()) {
359  if (allDay()) {
360  QDate currDate = QDate::currentDate();
361  if (dtStart(first).date() <= currDate && currDate < dtDue(first).date()) {
362  return true;
363  }
364  } else {
365  KDateTime currDate = KDateTime::currentUtcDateTime();
366  if (dtStart(first) <= currDate && currDate < dtDue(first)) {
367  return true;
368  }
369  }
370  }
371 
372  return false;
373 }
374 
375 bool Todo::isOpenEnded() const
376 {
377  if (!hasDueDate() && !isCompleted()) {
378  return true;
379  }
380  return false;
381 
382 }
383 
384 bool Todo::isNotStarted(bool first) const
385 {
386  if (d->mPercentComplete > 0) {
387  return false;
388  }
389 
390  if (!hasStartDate()) {
391  return false;
392  }
393 
394  if (allDay()) {
395  if (dtStart(first).date() >= QDate::currentDate()) {
396  return false;
397  }
398  } else {
399  if (dtStart(first) >= KDateTime::currentUtcDateTime()) {
400  return false;
401  }
402  }
403  return true;
404 }
405 
406 void Todo::shiftTimes(const KDateTime::Spec &oldSpec,
407  const KDateTime::Spec &newSpec)
408 {
409  Incidence::shiftTimes(oldSpec, newSpec);
410  d->mDtDue = d->mDtDue.toTimeSpec(oldSpec);
411  d->mDtDue.setTimeSpec(newSpec);
412  if (recurs()) {
413  d->mDtRecurrence = d->mDtRecurrence.toTimeSpec(oldSpec);
414  d->mDtRecurrence.setTimeSpec(newSpec);
415  }
416  if (hasCompletedDate()) {
417  d->mCompleted = d->mCompleted.toTimeSpec(oldSpec);
418  d->mCompleted.setTimeSpec(newSpec);
419  }
420 }
421 
422 void Todo::setDtRecurrence(const KDateTime &dt)
423 {
424  d->mDtRecurrence = dt;
425  setFieldDirty(FieldRecurrence);
426 }
427 
428 KDateTime Todo::dtRecurrence() const
429 {
430  return d->mDtRecurrence.isValid() ? d->mDtRecurrence : d->mDtDue;
431 }
432 
433 bool Todo::recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const
434 {
435  QDate today = QDate::currentDate();
436  return
437  Incidence::recursOn(date, timeSpec) &&
438  !(date < today && d->mDtRecurrence.date() < today &&
439  d->mDtRecurrence > recurrence()->startDateTime());
440 }
441 
442 bool Todo::isOverdue() const
443 {
444  if (!dtDue().isValid()) {
445  return false; // if it's never due, it can't be overdue
446  }
447 
448  const bool inPast = allDay() ? dtDue().date() < QDate::currentDate()
449  : dtDue() < KDateTime::currentUtcDateTime();
450 
451  return inPast && !isCompleted();
452 }
453 
454 void Todo::setAllDay(bool allday)
455 {
456  if (allday != allDay() && !mReadOnly) {
457  if (hasDueDate()) {
458  setFieldDirty(FieldDtDue);
459  }
460  Incidence::setAllDay(allday);
461  }
462 }
463 
464 //@cond PRIVATE
465 bool Todo::Private::recurTodo(Todo *todo)
466 {
467  if (todo && todo->recurs()) {
468  Recurrence *r = todo->recurrence();
469  const KDateTime recurrenceEndDateTime = r->endDateTime();
470  KDateTime nextOccurrenceDateTime = r->getNextDateTime(todo->dtStart());
471 
472  if ((r->duration() == -1 ||
473  (nextOccurrenceDateTime.isValid() && recurrenceEndDateTime.isValid() &&
474  nextOccurrenceDateTime <= recurrenceEndDateTime))) {
475  // We convert to the same timeSpec so we get the correct .date()
476  const KDateTime rightNow =
477  KDateTime::currentUtcDateTime().toTimeSpec(nextOccurrenceDateTime.timeSpec());
478  const bool isDateOnly = todo->allDay();
479 
480  /* Now we search for the occurrence that's _after_ the currentUtcDateTime, or
481  * if it's dateOnly, the occurrrence that's _during or after today_.
482  * The reason we use "<" for date only, but "<=" for ocurrences with time is that
483  * if it's date only, the user can still complete that ocurrence today, so that's
484  * the current ocurrence that needs completing.
485  */
486  while (!todo->recursAt(nextOccurrenceDateTime) ||
487  (!isDateOnly && nextOccurrenceDateTime <= rightNow) ||
488  (isDateOnly && nextOccurrenceDateTime.date() < rightNow.date())) {
489 
490  if (!nextOccurrenceDateTime.isValid() ||
491  (nextOccurrenceDateTime > recurrenceEndDateTime && r->duration() != -1)) {
492  return false;
493  }
494  nextOccurrenceDateTime = r->getNextDateTime(nextOccurrenceDateTime);
495  }
496 
497  todo->setDtRecurrence(nextOccurrenceDateTime);
498  todo->setCompleted(false);
499  todo->setRevision(todo->revision() + 1);
500 
501  return true;
502  }
503  }
504 
505  return false;
506 }
507 //@endcond
508 
509 bool Todo::accept(Visitor &v, IncidenceBase::Ptr incidence)
510 {
511  return v.visit(incidence.staticCast<Todo>());
512 }
513 
514 KDateTime Todo::dateTime(DateTimeRole role) const
515 {
516  switch (role) {
517  case RoleAlarmStartOffset:
518  return dtStart();
519  case RoleAlarmEndOffset:
520  return dtDue();
521  case RoleSort:
522  // Sorting to-dos first compares dtDue, then dtStart if
523  // dtDue doesn't exist
524  return hasDueDate() ? dtDue() : dtStart();
525  case RoleCalendarHashing:
526  return dtDue();
527  case RoleStartTimeZone:
528  return dtStart();
529  case RoleEndTimeZone:
530  return dtDue();
531  case RoleEndRecurrenceBase:
532  return dtDue();
533  case RoleDisplayStart:
534  case RoleDisplayEnd:
535  return dtDue().isValid() ? dtDue() : dtStart();
536  case RoleAlarm:
537  if (alarms().isEmpty()) {
538  return KDateTime();
539  } else {
540  Alarm::Ptr alarm = alarms().first();
541  if (alarm->hasStartOffset() && hasStartDate()) {
542  return dtStart();
543  } else if (alarm->hasEndOffset() && hasDueDate()) {
544  return dtDue();
545  } else {
546  // The application shouldn't add alarms on to-dos without dates.
547  return KDateTime();
548  }
549  }
550  case RoleRecurrenceStart:
551  if (dtStart().isValid()) {
552  return dtStart();
553  }
554  return dtDue(); //For the sake of backwards compatibility
555  //where we calculated recurrences based on dtDue
556  case RoleEnd:
557  return dtDue();
558  default:
559  return KDateTime();
560  }
561 }
562 
563 void Todo::setDateTime(const KDateTime &dateTime, DateTimeRole role)
564 {
565  switch (role) {
566  case RoleDnD:
567  setDtDue(dateTime);
568  break;
569  case RoleEnd:
570  setDtDue(dateTime, true);
571  break;
572  default:
573  kDebug() << "Unhandled role" << role;
574  }
575 }
576 
577 void Todo::virtual_hook(int id, void *data)
578 {
579  switch (static_cast<IncidenceBase::VirtualHook>(id)) {
580  case IncidenceBase::SerializerHook:
581  serialize(*reinterpret_cast<QDataStream*>(data));
582  break;
583  case IncidenceBase::DeserializerHook:
584  deserialize(*reinterpret_cast<QDataStream*>(data));
585  break;
586  default:
587  Q_ASSERT(false);
588  }
589 }
590 
591 QLatin1String Todo::mimeType() const
592 {
593  return Todo::todoMimeType();
594 }
595 
596 QLatin1String Todo::todoMimeType()
597 {
598  return QLatin1String("application/x-vnd.akonadi.calendar.todo");
599 }
600 
601 QLatin1String Todo::iconName(const KDateTime &recurrenceId) const
602 {
603  KDateTime occurrenceDT = recurrenceId;
604 
605  if (recurs() && occurrenceDT.isDateOnly()) {
606  occurrenceDT.setTime(QTime(0, 0));
607  }
608 
609  const bool usesCompletedTaskPixmap = isCompleted() ||
610  (recurs() && occurrenceDT.isValid() &&
611  occurrenceDT < dtDue(false));
612 
613  if (usesCompletedTaskPixmap) {
614  return QLatin1String("task-complete");
615  } else {
616  return QLatin1String("view-calendar-tasks");
617  }
618 }
619 
620 void Todo::serialize(QDataStream &out)
621 {
622  Incidence::serialize(out);
623  out << d->mDtDue << d->mDtRecurrence << d->mCompleted << d->mPercentComplete;
624 }
625 
626 void Todo::deserialize(QDataStream &in)
627 {
628  Incidence::deserialize(in);
629  in >> d->mDtDue >> d->mDtRecurrence >> d->mCompleted >> d->mPercentComplete;
630 }
KCalCore::Incidence::equals
virtual bool equals(const IncidenceBase &incidence) const
Compares this with Incidence incidence for equality.
Definition: incidence.cpp:231
KCalCore::Todo::setAllDay
void setAllDay(bool allDay)
Definition: todo.cpp:454
KCalCore::Todo::type
IncidenceType type() const
Returns the incidence type.
KCalCore::Todo::dtStart
virtual KDateTime dtStart() const
Returns an incidence's starting date/time as a KDateTime.
Definition: todo.cpp:260
KCalCore::IncidenceBase::addComment
void addComment(const QString &comment)
Adds a comment to the incidence.
Definition: incidencebase.cpp:355
KCalCore::IncidenceBase::duration
Duration duration() const
Returns the length of the incidence duration.
Definition: incidencebase.cpp:555
KCalCore::Todo::setHasDueDate
KCALCORE_DEPRECATED void setHasDueDate(bool hasDueDate)
Sets if the todo has a due datetime.
Definition: todo.cpp:208
KCalCore::Todo::typeStr
QByteArray typeStr() const
Prints the type of incidence as a string.
KCalCore::IncidenceBase::RoleCalendarHashing
Role for looking up an incidence in a Calendar.
Definition: incidencebase.h:137
QByteArray
KCalCore::IncidenceBase::TypeTodo
Type is a to-do.
Definition: incidencebase.h:123
KCalCore::IncidenceBase::RoleAlarm
Role for determining the date/time of the first alarm.
Definition: incidencebase.h:145
KCalCore::Incidence::setAllDay
void setAllDay(bool allDay)
Definition: incidence.cpp:346
QDataStream
KCalCore::Visitor::visit
virtual bool visit(Event::Ptr event)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition: visitor.cpp:42
KCalCore::Todo::setCompleted
void setCompleted(bool completed)
Sets completed state.
Definition: todo.cpp:288
KCalCore::IncidenceBase::FieldCompleted
Field representing the LOCATION component.
Definition: incidencebase.h:167
KCalCore::Todo::isInProgress
bool isInProgress(bool first) const
Returns true, if the to-do is in-progress (started, or >0% completed); otherwise return false...
Definition: todo.cpp:348
KCalCore::IncidenceBase
An abstract class that provides a common base for all calendar incidence classes. ...
Definition: incidencebase.h:109
KCalCore::IncidenceBase::RoleEndTimeZone
Role for determining an incidence's ending timezone.
Definition: incidencebase.h:139
KCalCore::Todo::virtual_hook
virtual void virtual_hook(int id, void *data)
Standard trick to add virtuals later.
Definition: todo.cpp:577
KCalCore::Incidence::recurrence
Recurrence * recurrence() const
Returns the recurrence rule associated with this incidence.
Definition: incidence.cpp:551
KCalCore::Visitor
This class provides the interface for a visitor of calendar components.
Definition: visitor.h:43
KCalCore::IncidenceBase::update
void update()
Call this to notify the observers after the IncidenceBase object will be changed. ...
Definition: incidencebase.cpp:593
KCalCore::IncidenceBase::RoleEnd
Role for determining an incidence's dtEnd, will return an invalid KDateTime if the incidence does not...
Definition: incidencebase.h:141
QVector::first
T & first()
KCalCore::Todo::dtRecurrence
KDateTime dtRecurrence() const
Returns the due date/time of the current occurrence if recurrent.
Definition: todo.cpp:428
KCalCore::IncidenceBase::IncidenceType
IncidenceType
The different types of incidences, per RFC2445.
Definition: incidencebase.h:121
QTime
KCalCore::Incidence::setRevision
void setRevision(int rev)
Sets the number of revisions this incidence has seen.
Definition: incidence.cpp:375
KCalCore::Todo::hasDueDate
bool hasDueDate() const
Returns if the todo has a due datetime.
Definition: todo.cpp:203
KCalCore::IncidenceBase::RoleDnD
Role for determining new start and end dates after a DnD.
Definition: incidencebase.h:154
KCalCore::IncidenceBase::FieldRecurrence
Field representing the RELATED-TO component.
Definition: incidencebase.h:172
KCalCore::IncidenceBase::RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd...
Definition: incidencebase.h:143
KCalCore::Todo::mimeType
QLatin1String mimeType() const
Returns the Akonadi specific sub MIME type of a KCalCore::IncidenceBase item, e.g.
Definition: todo.cpp:591
KCalCore::Incidence::alarms
Alarm::List alarms() const
Returns a list of all incidence alarms.
Definition: incidence.cpp:876
KCalCore::IncidenceBase::updated
void updated()
Call this to notify the observers after the IncidenceBase object has changed.
Definition: incidencebase.cpp:604
QSharedPointer
KCalCore::Recurrence
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:87
KCalCore::IncidenceBase::removeComment
bool removeComment(const QString &comment)
Removes a comment from the incidence.
Definition: incidencebase.cpp:360
KCalCore::Todo::~Todo
~Todo()
Destroys a to-do.
KCalCore::Todo::equals
virtual bool equals(const IncidenceBase &todo) const
Compare this with todo for equality.
todo.h
This file is part of the API for handling calendar data and defines the Todo class.
KCalCore::Todo::recursOn
virtual bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const
Returns true if the date specified is one on which the to-do will recur.
Definition: todo.cpp:433
KCalCore::Todo::dateTime
KDateTime dateTime(DateTimeRole role) const
Returns a date/time corresponding to the specified DateTimeRole.
Definition: todo.cpp:514
KCalCore::Todo::Todo
Todo()
Constructs an empty to-do.
QDate
KCalCore::Todo::clone
Todo * clone() const
Returns an exact copy of this todo.
KCalCore::Incidence::setDtStart
virtual void setDtStart(const KDateTime &dt)
Sets the incidence starting date/time.
Definition: incidence.cpp:393
KCalCore::IncidenceBase::FieldPercentComplete
Field representing the COMPLETED component.
Definition: incidencebase.h:168
KCalCore::IncidenceBase::allDay
bool allDay() const
Returns true or false depending on whether the incidence is all-day.
Definition: incidencebase.cpp:326
QString
KCalCore::IncidenceBase::setFieldDirty
void setFieldDirty(IncidenceBase::Field field)
Marks Field field as dirty.
Definition: incidencebase.cpp:657
KCalCore::Todo::iconName
QLatin1String iconName(const KDateTime &recurrenceId=KDateTime()) const
Returns the name of the icon that best represents this incidence.
Definition: todo.cpp:601
KCalCore::IncidenceBase::RoleSort
Role for an incidence's date/time used when sorting.
Definition: incidencebase.h:136
KCalCore::IncidenceBase::endUpdates
void endUpdates()
Call this when a group of updates is complete, to notify observers that the instance has changed...
Definition: incidencebase.cpp:622
KCalCore::Incidence::shiftTimes
virtual void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Shift the times of the incidence so that they appear at the same clock time as before but in a new ti...
Definition: incidence.cpp:401
KCalCore::Recurrence::duration
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
Definition: recurrence.cpp:481
KCalCore::IncidenceBase::startUpdates
void startUpdates()
Call this when a group of updates is going to be made.
Definition: incidencebase.cpp:616
KCalCore::Todo::setDateTime
void setDateTime(const KDateTime &dateTime, DateTimeRole role)
Sets the date/time corresponding to the specified DateTimeRole.
Definition: todo.cpp:563
KCalCore::IncidenceBase::DateTimeRole
DateTimeRole
The different types of incidence date/times roles.
Definition: incidencebase.h:133
KCalCore::IncidenceBase::RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
Definition: incidencebase.h:135
KCalCore::Todo::setDtRecurrence
void setDtRecurrence(const KDateTime &dt)
Sets the due date/time of the current occurrence if recurrent.
Definition: todo.cpp:422
KCalCore::Incidence::assign
virtual IncidenceBase & assign(const IncidenceBase &other)
Provides polymorfic assignment.
Definition: incidence.cpp:218
KCalCore::IncidenceBase::FieldDtDue
Field representing the PERCENT-COMPLETE component.
Definition: incidencebase.h:169
KCalCore::Incidence::revision
int revision() const
Returns the number of revisions this incidence has seen.
Definition: incidence.cpp:388
KCalCore::IncidenceBase::RoleStartTimeZone
Role for determining an incidence's starting timezone.
Definition: incidencebase.h:138
KCalCore::Todo::isOpenEnded
bool isOpenEnded() const
Returns true, if the to-do is open-ended (no due date); false otherwise.
Definition: todo.cpp:375
KCalCore::Todo::isOverdue
bool isOverdue() const
Returns true if this todo is overdue (e.g.
Definition: todo.cpp:442
KCalCore::Incidence::recursOn
virtual bool recursOn(const QDate &date, const KDateTime::Spec &timeSpec) const
Returns true if the date specified is one on which the event will recur.
Definition: incidence.cpp:588
KCalCore::Incidence::recurrenceId
KDateTime recurrenceId() const
Returns the incidence recurrenceId.
Definition: incidence.cpp:1039
KCalCore::Todo::setHasStartDate
KCALCORE_DEPRECATED void setHasStartDate(bool hasStartDate)
Sets if the todo has a start datetime.
Definition: todo.cpp:232
KCalCore::Todo::setDtDue
void setDtDue(const KDateTime &dtDue, bool first=false)
Sets due date and time.
KCalCore::Todo::setDtStart
void setDtStart(const KDateTime &dtStart)
Sets the start datetime of the todo.
Definition: todo.cpp:278
QLatin1String
KCalCore::Todo::todoMimeType
static QLatin1String todoMimeType()
Returns the Akonadi specific sub MIME type of a KCalCore::Todo.
Definition: todo.cpp:596
KCalCore::Todo
Provides a To-do in the sense of RFC2445.
Definition: todo.h:44
QDate::currentDate
QDate currentDate()
KCalCore::Recurrence::getNextDateTime
KDateTime getNextDateTime(const KDateTime &preDateTime) const
Returns the date and time of the next recurrence, after the specified date/time.
Definition: recurrence.cpp:1018
KCalCore::IncidenceBase::comments
QStringList comments() const
Returns all incidence comments as a list of strings.
Definition: incidencebase.cpp:385
KCalCore::Todo::hasStartDate
bool hasStartDate() const
Returns if the todo has a start datetime.
Definition: todo.cpp:227
KCalCore::Incidence::recurs
bool recurs() const
Returns whether the event recurs at all.
Definition: incidence.cpp:579
KCalCore::Todo::completed
KDateTime completed() const
Returns the to-do was completion datetime.
Definition: todo.cpp:301
KCalCore::IncidenceBase::mReadOnly
bool mReadOnly
Identifies a read-only incidence.
Definition: incidencebase.h:746
KCalCore::Todo::isCompleted
bool isCompleted() const
Returns if the todo is 100% completed.
Definition: todo.cpp:283
KCalCore::Todo::hasCompletedDate
bool hasCompletedDate() const
Returns if the to-do has a completion datetime.
Definition: todo.cpp:321
KCalCore::Todo::assign
virtual IncidenceBase & assign(const IncidenceBase &other)
Provides polymorfic assignment.
QSharedPointer::staticCast
QSharedPointer< X > staticCast() const
KCalCore::Recurrence::startDateTime
KDateTime startDateTime() const
Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00)...
Definition: recurrence.cpp:171
KCalCore::Todo::dtDue
KDateTime dtDue(bool first=false) const
Returns the todo due datetime.
Definition: todo.cpp:180
KCalCore::Recurrence::endDateTime
KDateTime endDateTime() const
Returns the date/time of the last recurrence.
Definition: recurrence.cpp:428
KCalCore::IncidenceBase::RoleAlarmStartOffset
Role for an incidence alarm's starting offset date/time.
Definition: incidencebase.h:134
KCalCore::Incidence::recursAt
bool recursAt(const KDateTime &dt) const
Returns true if the date/time specified is one at which the event will recur.
Definition: incidence.cpp:594
KCalCore::Todo::percentComplete
int percentComplete() const
Returns what percentage of the to-do is completed.
Definition: todo.cpp:326
KCalCore::Todo::shiftTimes
virtual void shiftTimes(const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Shift the times of the incidence so that they appear at the same clock time as before but in a new ti...
Definition: todo.cpp:406
KCalCore::Todo::isNotStarted
bool isNotStarted(bool first) const
Returns true, if the to-do has yet to be started (no start date and 0% completed); otherwise return f...
Definition: todo.cpp:384
KCalCore::Incidence
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:68
KCalCore::IncidenceBase::dtStart
virtual KDateTime dtStart() const
Returns an incidence's starting date/time as a KDateTime.
Definition: incidencebase.cpp:321
KCalCore::IncidenceBase::RoleRecurrenceStart
Role for determining the start of the recurrence.
Definition: incidencebase.h:147
KCalCore::Todo::setPercentComplete
void setPercentComplete(int percent)
Sets what percentage of the to-do is completed.
Definition: todo.cpp:331
KCalCore::IncidenceBase::RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
Definition: incidencebase.h:152
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:36:53 by doxygen 1.8.7 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 API Reference

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

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal