KCalendarCore

todo.cpp
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5 SPDX-FileCopyrightText: 2009 Allen Winter <winter@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9/**
10 @file
11 This file is part of the API for handling calendar data and
12 defines the Todo class.
13
14 @brief
15 Provides a To-do in the sense of RFC2445.
16
17 @author Cornelius Schumacher <schumacher@kde.org>
18 @author Allen Winter <winter@kde.org>
19*/
20
21#include "incidence_p.h"
22#include "todo.h"
23#include "recurrence.h"
24#include "utils_p.h"
25#include "visitor.h"
26
27#include "kcalendarcore_debug.h"
28
29#include <QTime>
30
31using namespace KCalendarCore;
32
33/**
34 Private class that helps to provide binary compatibility between releases.
35 @internal
36*/
37//@cond PRIVATE
38class KCalendarCore::TodoPrivate : public IncidencePrivate
39{
40 // Due date of the to-do or its first recurrence if it recurs; invalid() <=> no defined due date.
41 QDateTime mDtDue;
42 QDateTime mDtRecurrence; // next occurrence (for recurring to-dos)
43 QDateTime mCompleted; // to-do completion date (if it has been completed)
44 int mPercentComplete = 0; // to-do percent complete [0,100]
45
46public:
47
48 TodoPrivate() = default;
49 TodoPrivate(const TodoPrivate &other) = default;
50
51 // Copy IncidencePrivate and IncidenceBasePrivate members,
52 // but default-initialize TodoPrivate members.
53 TodoPrivate(const Incidence &other)
54 : IncidencePrivate(other)
55 {
56 }
57
58 void init(const TodoPrivate &other);
59
60 void setDtDue(const QDateTime dd);
61 QDateTime dtDue() const
62 {
63 return mDtDue;
64 }
65
66 void setDtRecurrence(const QDateTime dr);
67 QDateTime dtRecurrence() const
68 {
69 return mDtRecurrence;
70 }
71
72 void setCompleted(const QDateTime dc);
73 QDateTime completed() const
74 {
75 return mCompleted;
76 }
77
78 void setPercentComplete(const int pc);
79 int percentComplete() const
80 {
81 return mPercentComplete;
82 }
83
84 /**
85 Returns true if the todo got a new date, else false will be returned.
86 */
87 bool recurTodo(Todo *todo);
88
89 void deserialize(QDataStream &in);
90
91 bool validStatus(Incidence::Status) override;
92};
93
94void TodoPrivate::setDtDue(const QDateTime dd)
95{
96 if (!identical(dd, mDtDue)) {
97 mDtDue = dd;
98 mDirtyFields.insert(IncidenceBase::FieldDtDue);
99 }
100}
101
102void TodoPrivate::setDtRecurrence(const QDateTime dr)
103{
104 if (!identical(dr, mDtRecurrence)) {
105 mDtRecurrence = dr;
106 mDirtyFields.insert(IncidenceBase::FieldRecurrenceId);
107 }
108}
109
110void TodoPrivate::setCompleted(const QDateTime dc)
111{
112 if (dc != mCompleted) {
113 mCompleted = dc.toUTC();
114 mDirtyFields.insert(IncidenceBase::FieldCompleted);
115 }
116}
117
118void TodoPrivate::setPercentComplete(const int pc)
119{
120 if (pc != mPercentComplete) {
121 mPercentComplete = pc;
122 mDirtyFields.insert(IncidenceBase::FieldPercentComplete);
123 }
124}
125
126void TodoPrivate::init(const TodoPrivate &other)
127{
128 mDtDue = other.mDtDue;
129 mDtRecurrence = other.mDtRecurrence;
130 mCompleted = other.mCompleted;
131 mPercentComplete = other.mPercentComplete;
132}
133
134bool TodoPrivate::validStatus(Incidence::Status status)
135{
136 constexpr unsigned validSet
142 return validSet & (1u << status);
143}
144
145//@endcond
146
148 : Incidence(new TodoPrivate())
149{
150}
151
152Todo::Todo(const Todo &other)
153 : Incidence(other, new TodoPrivate(*(other.d_func())))
154{
155}
156
157Todo::Todo(const Incidence &other)
158 : Incidence(other, new TodoPrivate(other))
159{
160}
161
162Todo::~Todo() = default;
163
164Todo *Todo::clone() const
165{
166 return new Todo(*this);
167}
168
170{
171 Q_D(Todo);
172 if (&other != this) {
173 Incidence::assign(other);
174 const Todo *t = static_cast<const Todo *>(&other);
175 d->init(*(t->d_func()));
176 }
177 return *this;
178}
179
180bool Todo::equals(const IncidenceBase &todo) const
181{
182 if (!Incidence::equals(todo)) {
183 return false;
184 } else {
185 // If they weren't the same type IncidenceBase::equals would had returned false already
186 const Todo *t = static_cast<const Todo *>(&todo);
187 return identical(dtDue(), t->dtDue())
188 && hasDueDate() == t->hasDueDate()
189 && hasStartDate() == t->hasStartDate() && ((completed() == t->completed()) || (!completed().isValid() && !t->completed().isValid()))
191 }
192}
193
195{
196 return TypeTodo;
197}
198
200{
201 return QByteArrayLiteral("Todo");
202}
203
204void Todo::setDtDue(const QDateTime &dtDue, bool first)
205{
206 startUpdates();
207
208 // int diffsecs = d->mDtDue.secsTo(dtDue);
209
210 /*if (mReadOnly) return;
211 const Alarm::List& alarms = alarms();
212 for (Alarm *alarm = alarms.first(); alarm; alarm = alarms.next()) {
213 if (alarm->enabled()) {
214 alarm->setTime(alarm->time().addSecs(diffsecs));
215 }
216 }*/
217
219 if (recurs() && !first) {
220 d->setDtRecurrence(dtDue);
221 } else {
222 d->setDtDue(dtDue);
223 }
224
225 if (recurs() && dtDue.isValid() && (!dtStart().isValid() || dtDue < recurrence()->startDateTime())) {
226 qCDebug(KCALCORE_LOG) << "To-do recurrences are now calculated against DTSTART. Fixing legacy to-do.";
228 }
229
230 /*const Alarm::List& alarms = alarms();
231 for (Alarm *alarm = alarms.first(); alarm; alarm = alarms.next())
232 alarm->setAlarmStart(d->mDtDue);*/
233 endUpdates();
234}
235
236QDateTime Todo::dtDue(bool first) const
237{
238 if (!hasDueDate()) {
239 return QDateTime();
240 }
241
242 Q_D(const Todo);
243 const QDateTime start = IncidenceBase::dtStart();
244 if (recurs() && !first && d->dtRecurrence().isValid()) {
245 if (start.isValid()) {
246 // This is the normal case, recurring to-dos have a valid DTSTART.
247 const qint64 duration = start.daysTo(d->dtDue());
248 QDateTime dt = d->dtRecurrence().addDays(duration);
249 dt.setTime(d->dtDue().time());
250 return dt;
251 } else {
252 // This is a legacy case, where recurrence was calculated against DTDUE
253 return d->dtRecurrence();
254 }
255 }
256
257 return d->dtDue();
258}
259
261{
262 Q_D(const Todo);
263 return d->dtDue().isValid();
264}
265
267{
268 return IncidenceBase::dtStart().isValid();
269}
270
272{
273 return dtStart(/*first=*/false);
274}
275
276QDateTime Todo::dtStart(bool first) const
277{
278 if (!hasStartDate()) {
279 return QDateTime();
280 }
281
282 Q_D(const Todo);
283 if (recurs() && !first && d->dtRecurrence().isValid()) {
284 return d->dtRecurrence();
285 } else {
286 return IncidenceBase::dtStart();
287 }
288}
289
291{
292 Q_D(const Todo);
293 return d->percentComplete() == 100 || status() == StatusCompleted || hasCompletedDate();
294}
295
296void Todo::setCompleted(bool completed)
297{
298 update();
299 Q_D(Todo);
300 if (completed) {
301 d->setPercentComplete(100);
302 } else {
303 d->setPercentComplete(0);
304 if (hasCompletedDate()) {
305 d->setCompleted(QDateTime());
306 }
307 }
308 updated();
309
310 setStatus(completed ? StatusCompleted : StatusNone); // Calls update()/updated().
311}
312
314{
315 Q_D(const Todo);
316 if (hasCompletedDate()) {
317 return d->completed();
318 } else {
319 return QDateTime();
320 }
321}
322
323void Todo::setCompleted(const QDateTime &completed)
324{
325 Q_D(Todo);
326 if (!d->recurTodo(this)) { // May indirectly call update()/updated().
327 update();
328 d->setPercentComplete(100);
329 d->setCompleted(completed);
330 updated();
331 }
332 if (status() != StatusNone) {
333 setStatus(StatusCompleted); // Calls update()/updated()
334 }
335}
336
338{
339 Q_D(const Todo);
340 return d->completed().isValid();
341}
342
344{
345 Q_D(const Todo);
346 return d->percentComplete();
347}
348
350{
351 if (percent > 100) {
352 percent = 100;
353 } else if (percent < 0) {
354 percent = 0;
355 }
356
357 update();
358 Q_D(Todo);
359 d->setPercentComplete(percent);
360 if (percent != 100) {
361 d->setCompleted(QDateTime());
362 }
363 updated();
364 if (percent != 100 && status() == Incidence::StatusCompleted) {
365 setStatus(Incidence::StatusNone); // Calls update()/updated().
366 }
367}
368
369bool Todo::isInProgress(bool first) const
370{
371 if (isOverdue()) {
372 return false;
373 }
374
375 Q_D(const Todo);
376 if (d->percentComplete() > 0) {
377 return true;
378 }
379
380 if (hasStartDate() && hasDueDate()) {
381 if (allDay()) {
382 QDate currDate = QDate::currentDate();
383 if (dtStart(first).date() <= currDate && currDate < dtDue(first).date()) {
384 return true;
385 }
386 } else {
388 if (dtStart(first) <= currDate && currDate < dtDue(first)) {
389 return true;
390 }
391 }
392 }
393
394 return false;
395}
396
398{
399 if (!hasDueDate() && !isCompleted()) {
400 return true;
401 }
402 return false;
403}
404
405bool Todo::isNotStarted(bool first) const
406{
407 Q_D(const Todo);
408 if (d->percentComplete() > 0) {
409 return false;
410 }
411
412 if (!hasStartDate()) {
413 return false;
414 }
415
416 if (allDay()) {
417 if (dtStart(first).date() >= QDate::currentDate()) {
418 return false;
419 }
420 } else {
421 if (dtStart(first) >= QDateTime::currentDateTimeUtc()) {
422 return false;
423 }
424 }
425 return true;
426}
427
428void Todo::shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone)
429{
430 Q_D(Todo);
431 Incidence::shiftTimes(oldZone, newZone);
432 auto dt = d->dtDue().toTimeZone(oldZone);
433 dt.setTimeZone(newZone);
434 d->setDtDue(dt);
435 if (recurs()) {
436 auto dr = d->dtRecurrence().toTimeZone(oldZone);
437 dr.setTimeZone(newZone);
438 d->setDtRecurrence(dr);
439 }
440 if (hasCompletedDate()) {
441 auto dc = d->completed().toTimeZone(oldZone);
442 dc.setTimeZone(newZone);
443 d->setCompleted(dc);
444 }
445}
446
448{
449 Q_D(Todo);
450 d->setDtRecurrence(dt);
451}
452
454{
455 Q_D(const Todo);
456 auto dt = d->dtRecurrence();
457 if (!dt.isValid()) {
458 dt = IncidenceBase::dtStart();
459 }
460 if (!dt.isValid()) {
461 dt = d->dtDue();
462 }
463 return dt;
464}
465
466bool Todo::recursOn(const QDate &date, const QTimeZone &timeZone) const
467{
468 Q_D(const Todo);
469 QDate today = QDate::currentDate();
470 return Incidence::recursOn(date, timeZone) && !(date < today && d->dtRecurrence().date() < today && d->dtRecurrence() > recurrence()->startDateTime());
471}
472
473bool Todo::isOverdue() const
474{
475 if (!dtDue().isValid()) {
476 return false; // if it's never due, it can't be overdue
477 }
478
479 const bool inPast = allDay() ? dtDue().date() < QDate::currentDate() : dtDue() < QDateTime::currentDateTimeUtc();
480
481 return inPast && !isCompleted();
482}
483
484void Todo::setAllDay(bool allday)
485{
486 if (allday != allDay() && !mReadOnly) {
487 if (hasDueDate()) {
489 }
490 Incidence::setAllDay(allday);
491 }
492}
493
494//@cond PRIVATE
495bool TodoPrivate::recurTodo(Todo *todo)
496{
497 if (todo && todo->recurs()) {
498 Recurrence *r = todo->recurrence();
499 const QDateTime recurrenceEndDateTime = r->endDateTime();
500 QDateTime nextOccurrenceDateTime = todo->dtStart().isValid() ? r->getNextDateTime(todo->dtStart()) : r->getNextDateTime(QDateTime::currentDateTime());
501
502 if ((r->duration() == -1 || (nextOccurrenceDateTime.isValid() && recurrenceEndDateTime.isValid() && nextOccurrenceDateTime <= recurrenceEndDateTime))) {
503 // We convert to the same timeSpec so we get the correct .date()
504 const auto rightNow = QDateTime::currentDateTimeUtc().toTimeZone(nextOccurrenceDateTime.timeZone());
505 const bool isDateOnly = todo->allDay();
506
507 /* Now we search for the occurrence that's _after_ the currentUtcDateTime, or
508 * if it's dateOnly, the occurrrence that's _during or after today_.
509 * The reason we use "<" for date only, but "<=" for occurrences with time is that
510 * if it's date only, the user can still complete that occurrence today, so that's
511 * the current occurrence that needs completing.
512 */
513 while (!todo->recursAt(nextOccurrenceDateTime) || (!isDateOnly && nextOccurrenceDateTime <= rightNow)
514 || (isDateOnly && nextOccurrenceDateTime.date() < rightNow.date())) {
515 if (!nextOccurrenceDateTime.isValid() || (nextOccurrenceDateTime > recurrenceEndDateTime && r->duration() != -1)) {
516 return false;
517 }
518 nextOccurrenceDateTime = r->getNextDateTime(nextOccurrenceDateTime);
519 }
520
521 todo->setDtRecurrence(nextOccurrenceDateTime);
522 todo->setCompleted(false);
523 todo->setRevision(todo->revision() + 1);
524
525 return true;
526 }
527 }
528
529 return false;
530}
531//@endcond
532
533bool Todo::accept(Visitor &v, const IncidenceBase::Ptr &incidence)
534{
535 return v.visit(incidence.staticCast<Todo>());
536}
537
539{
540 switch (role) {
542 return dtStart();
544 return dtDue();
545 case RoleSort:
546 // Sorting to-dos first compares dtDue, then dtStart if
547 // dtDue doesn't exist
548 return hasDueDate() ? dtDue() : dtStart();
550 return dtDue();
552 return dtStart();
553 case RoleEndTimeZone:
554 return dtDue();
555 case RoleEndRecurrenceBase:
556 return dtDue();
557 case RoleDisplayStart:
558 case RoleDisplayEnd:
559 return dtDue().isValid() ? dtDue() : dtStart();
560 case RoleAlarm:
561 if (alarms().isEmpty()) {
562 return QDateTime();
563 } else {
564 Alarm::Ptr alarm = alarms().at(0);
565 if (alarm->hasStartOffset() && hasStartDate()) {
566 return dtStart();
567 } else if (alarm->hasEndOffset() && hasDueDate()) {
568 return dtDue();
569 } else {
570 // The application shouldn't add alarms on to-dos without dates.
571 return QDateTime();
572 }
573 }
575 if (dtStart().isValid()) {
576 return dtStart();
577 }
578 return dtDue(); // For the sake of backwards compatibility
579 // where we calculated recurrences based on dtDue
580 case RoleEnd:
581 return dtDue();
582 default:
583 return QDateTime();
584 }
585}
586
587void Todo::setDateTime(const QDateTime &dateTime, DateTimeRole role)
588{
589 switch (role) {
590 case RoleDnD:
592 break;
593 case RoleEnd:
594 setDtDue(dateTime, true);
595 break;
596 default:
597 qCDebug(KCALCORE_LOG) << "Unhandled role" << role;
598 }
599}
600
601void Todo::virtual_hook(VirtualHook id, void *data)
602{
603 Q_UNUSED(id);
604 Q_UNUSED(data);
605}
606
608{
609 return Todo::todoMimeType();
610}
611
613{
614 return QLatin1String("application/x-vnd.akonadi.calendar.todo");
615}
616
617QLatin1String Todo::iconName(const QDateTime &recurrenceId) const
618{
619 const bool usesCompletedTaskPixmap = isCompleted() || (recurs() && recurrenceId.isValid() && (recurrenceId < dtStart(/*first=*/false)));
620
621 if (usesCompletedTaskPixmap) {
622 return QLatin1String("task-complete");
623 } else {
624 return QLatin1String("view-calendar-tasks");
625 }
626}
627
628void Todo::serialize(QDataStream &out) const
629{
630 Q_D(const Todo);
632 serializeQDateTimeAsKDateTime(out, d->dtDue());
633 serializeQDateTimeAsKDateTime(out, d->dtRecurrence());
634 serializeQDateTimeAsKDateTime(out, d->completed());
635 out << d->percentComplete();
636}
637
638void TodoPrivate::deserialize(QDataStream &in)
639{
640 deserializeKDateTimeAsQDateTime(in, mDtDue);
641 deserializeKDateTimeAsQDateTime(in, mDtRecurrence);
642 deserializeKDateTimeAsQDateTime(in, mCompleted);
643 in >> mPercentComplete;
644}
645
646void Todo::deserialize(QDataStream &in)
647{
648 Q_D(Todo);
650 d->deserialize(in);
651}
652
654{
655 return true;
656}
An abstract class that provides a common base for all calendar incidence classes.
void updated()
Call this to notify the observers after the IncidenceBase object has changed.
bool mReadOnly
Identifies a read-only incidence.
IncidenceType
The different types of incidences, per RFC2445.
Duration duration() const
Returns the length of the incidence duration.
void startUpdates()
Call this when a group of updates is going to be made.
void update()
Call this to notify the observers after the IncidenceBase object will be changed.
@ FieldCompleted
Field representing the COMPLETED component.
@ FieldRecurrenceId
Field representing the RECURRENCE-ID component.
@ FieldDtDue
Field representing the DUE component.
@ FieldPercentComplete
Field representing the PERCENT-COMPLETE component.
void endUpdates()
Call this when a group of updates is complete, to notify observers that the instance has changed.
void setFieldDirty(IncidenceBase::Field field)
Marks Field field as dirty.
DateTimeRole
The different types of incidence date/times roles.
@ RoleAlarmStartOffset
Role for an incidence alarm's starting offset date/time.
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
@ RoleCalendarHashing
Role for looking up an incidence in a Calendar.
@ RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd.
@ RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
@ RoleSort
Role for an incidence's date/time used when sorting.
@ RoleStartTimeZone
Role for determining an incidence's starting timezone.
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid QDateTime if the incidence does not...
@ RoleDnD
Role for determining new start and end dates after a DnD.
@ RoleRecurrenceStart
Role for determining the start of the recurrence.
@ RoleAlarm
Role for determining the date/time of the first alarm.
@ RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition incidence.h:60
virtual bool recursOn(const QDate &date, const QTimeZone &timeZone) const
Returns true if the date specified is one on which the event will recur.
Status
The different types of overall incidence status or confirmation.
Definition incidence.h:80
@ StatusCanceled
event or to-do canceled; journal removed
Definition incidence.h:86
@ StatusNeedsAction
to-do needs action
Definition incidence.h:85
@ StatusCompleted
to-do completed
Definition incidence.h:84
@ StatusInProcess
to-do in process
Definition incidence.h:87
Alarm::List alarms() const
Returns a list of all incidence alarms.
void setStatus(Status status)
Sets the incidence status to a standard Status value.
bool recurs() const
Returns whether the event recurs at all.
void setAllDay(bool allDay) override
Sets whether the incidence is all-day, i.e.
void serialize(QDataStream &out) const override
Sub-type specific serialization.
void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override
Shift the times of the incidence so that they appear at the same clock time as before but in a new ti...
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
bool equals(const IncidenceBase &incidence) const override
Compares this with Incidence incidence for equality.
QDateTime recurrenceId() const override
Returns the incidence recurrenceId.
Recurrence * recurrence() const
Returns the recurrence rule associated with this incidence.
void setDtStart(const QDateTime &dt) override
Sets the incidence starting date/time.
void deserialize(QDataStream &in) override
Sub-type specific deserialization.
This class represents a recurrence rule for a calendar incidence.
Definition recurrence.h:77
QDateTime getNextDateTime(const QDateTime &preDateTime) const
Returns the start date/time of the earliest recurrence with a start date/time after the specified dat...
QDateTime endDateTime() const
Returns the date/time of the last recurrence.
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
Provides a To-do in the sense of RFC2445.
Definition todo.h:34
void setPercentComplete(int percent)
Sets what percentage of the to-do is completed.
Definition todo.cpp:349
void virtual_hook(VirtualHook id, void *data) override
Standard trick to add virtuals later.
Definition todo.cpp:601
bool hasDueDate() const
Returns if the todo has a due datetime.
Definition todo.cpp:260
QDateTime dtRecurrence() const
Returns an identifier for the earliest uncompleted occurrence of a recurring Todo.
Definition todo.cpp:453
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
Todo * clone() const override
Returns an exact copy of this todo.
IncidenceType type() const override
Returns the incidence type.
bool isCompleted() const
Returns whether the todo is completed or not.
Definition todo.cpp:290
bool recursOn(const QDate &date, const QTimeZone &timeZone) const override
Returns true if the date specified is one on which the to-do will recur.
Definition todo.cpp:466
bool supportsGroupwareCommunication() const override
Definition todo.cpp:653
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:405
QByteArray typeStr() const override
Prints the type of incidence as a string.
static QLatin1String todoMimeType()
Returns the Akonadi specific sub MIME type of a KCalendarCore::Todo.
Definition todo.cpp:612
bool hasStartDate() const
Returns if the todo has a start datetime.
Definition todo.cpp:266
QDateTime dateTime(DateTimeRole role) const override
Returns a date/time corresponding to the specified DateTimeRole.
Definition todo.cpp:538
void setCompleted(bool completed)
Sets completion percentage and status.
Definition todo.cpp:296
bool equals(const IncidenceBase &todo) const override
Compare this with todo for equality.
bool isOverdue() const
Returns true if this todo is overdue (e.g.
Definition todo.cpp:473
bool isOpenEnded() const
Returns true, if the to-do is open-ended (no due date); false otherwise.
Definition todo.cpp:397
Todo()
Constructs an empty to-do.
void setDtRecurrence(const QDateTime &dt)
Identify the earliest uncompleted occurrence of a recurring Todo.
Definition todo.cpp:447
QLatin1String iconName(const QDateTime &recurrenceId={}) const override
Returns the name of the icon that best represents this incidence.
Definition todo.cpp:617
bool isInProgress(bool first) const
Returns true, if the to-do is in-progress (started, or >0% completed); otherwise return false.
Definition todo.cpp:369
QDateTime dtDue(bool first=false) const
Returns the todo due datetime.
Definition todo.cpp:236
QLatin1String mimeType() const override
Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,...
Definition todo.cpp:607
~Todo() override
Destroys a to-do.
QDateTime dtStart() const override
Definition todo.cpp:271
int percentComplete() const
Returns what percentage of the to-do is completed.
Definition todo.cpp:343
void setAllDay(bool allDay) override
Sets whether the incidence is all-day, i.e.
Definition todo.cpp:484
bool hasCompletedDate() const
Returns if the to-do has a completion datetime.
Definition todo.cpp:337
QDateTime completed() const
Returns the to-do was completion datetime.
Definition todo.cpp:313
void setDateTime(const QDateTime &dateTime, DateTimeRole role) override
Sets the date/time corresponding to the specified DateTimeRole.
Definition todo.cpp:587
void shiftTimes(const QTimeZone &oldZone, const QTimeZone &newZone) override
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:428
void setDtDue(const QDateTime &dtDue, bool first=false)
Sets due date and time.
This class provides the interface for a visitor of calendar components.
Definition visitor.h:31
virtual bool visit(const Event::Ptr &event)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
Definition visitor.cpp:25
Q_SCRIPTABLE CaptureState status()
Q_SCRIPTABLE Q_NOREPLY void start()
AKONADI_CALENDAR_EXPORT KCalendarCore::Incidence::Ptr incidence(const Akonadi::Item &item)
AKONADI_CALENDAR_EXPORT KCalendarCore::Todo::Ptr todo(const Akonadi::Item &item)
Namespace for all KCalendarCore types.
Definition alarm.h:37
KCALENDARCORE_EXPORT bool identical(const QDateTime &dt1, const QDateTime &dt2)
Compare two QDateTimes for extended equality.
QDateTime startDateTime(const QVariant &elem)
bool isValid(QStringView ifopt)
QCA_EXPORT void init()
QDate currentDate()
QDateTime addDays(qint64 ndays) const const
QDateTime currentDateTime()
QDateTime currentDateTimeUtc()
QDate date() const const
bool isValid() const const
void setTime(QTime time)
void setTimeZone(const QTimeZone &toZone)
QTimeZone timeZone() const const
QDateTime toTimeZone(const QTimeZone &timeZone) const const
QDateTime toUTC() const const
const_reference at(qsizetype i) const const
QSharedPointer< X > staticCast() const const
Q_D(Todo)
Private class that helps to provide binary compatibility between releases.
This file is part of the API for handling calendar data and defines the Todo class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.