KCalendarCore
todo.cpp
Go to the documentation of this file.
40 // Due date of the to-do or its first recurrence if it recurs; invalid() <=> no defined due date.
189 && hasStartDate() == t->hasStartDate() && ((completed() == t->completed()) || (!completed().isValid() && !t->completed().isValid()))
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.";
470 return Incidence::recursOn(date, timeZone) && !(date < today && d->dtRecurrence().date() < today && d->dtRecurrence() > recurrence()->startDateTime());
479 const bool inPast = allDay() ? dtDue().date() < QDate::currentDate() : dtDue() < QDateTime::currentDateTimeUtc();
502 if ((r->duration() == -1 || (nextOccurrenceDateTime.isValid() && recurrenceEndDateTime.isValid() && nextOccurrenceDateTime <= recurrenceEndDateTime))) {
504 const auto rightNow = QDateTime::currentDateTimeUtc().toTimeZone(nextOccurrenceDateTime.timeZone());
513 while (!todo->recursAt(nextOccurrenceDateTime) || (!isDateOnly && nextOccurrenceDateTime <= rightNow)
515 if (!nextOccurrenceDateTime.isValid() || (nextOccurrenceDateTime > recurrenceEndDateTime && r->duration() != -1)) {
619 const bool usesCompletedTaskPixmap = isCompleted() || (recurs() && recurrenceId.isValid() && (recurrenceId < dtStart(/*first=*/false)));
void setPercentComplete(int percent)
Sets what percentage of the to-do is completed.
Definition: todo.cpp:349
QByteArray typeStr() const override
Prints the type of incidence as a string.
void serialize(QDataStream &out) const override
Sub-type specific serialization.
Definition: incidence.cpp:1207
void virtual_hook(VirtualHook id, void *data) override
Standard trick to add virtuals later.
Definition: todo.cpp:601
void setDtDue(const QDateTime &dtDue, bool first=false)
Sets due date and time.
QTimeZone timeZone() const const
@ RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd.
Definition: incidencebase.h:141
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
QDateTime dateTime(DateTimeRole role) const override
Returns a date/time corresponding to the specified DateTimeRole.
Definition: todo.cpp:538
@ RoleStartTimeZone
Role for determining an incidence's starting timezone.
Definition: incidencebase.h:136
Recurrence * recurrence() const
Returns the recurrence rule associated with this incidence.
Definition: incidence.cpp:576
@ FieldPercentComplete
Field representing the PERCENT-COMPLETE component.
Definition: incidencebase.h:166
static QLatin1String todoMimeType()
Returns the Akonadi specific sub MIME type of a KCalendarCore::Todo.
Definition: todo.cpp:612
QDateTime endDateTime() const
Returns the date/time of the last recurrence.
Definition: recurrence.cpp:420
QCA_EXPORT void init()
QDateTime addDays(qint64 ndays) const const
void update()
Call this to notify the observers after the IncidenceBase object will be changed.
Definition: incidencebase.cpp:523
int percentComplete() const
Returns what percentage of the to-do is completed.
Definition: todo.cpp:343
KCALENDARCORE_EXPORT bool identical(QDateTime, QDateTime)
Compare two QDateTimes for extended equality.
Definition: incidencebase.cpp:618
bool equals(const IncidenceBase &todo) const override
Compare this with todo for equality.
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 setDateTime(const QDateTime &dateTime, DateTimeRole role) override
Sets the date/time corresponding to the specified DateTimeRole.
Definition: todo.cpp:587
@ RoleAlarmStartOffset
Role for an incidence alarm's starting offset date/time.
Definition: incidencebase.h:132
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
QDateTime currentDateTimeUtc()
void startUpdates()
Call this when a group of updates is going to be made.
Definition: incidencebase.cpp:546
Provides the abstract base class common to non-FreeBusy (Events, To-dos, Journals) calendar component...
Definition: incidence.h:59
void setAllDay(bool allDay) override
Definition: incidence.cpp:323
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
void setDtRecurrence(const QDateTime &dt)
Identify the earliest uncompleted occurrence of a recurring Todo.
Definition: todo.cpp:447
AKONADI_CALENDAR_EXPORT KCalendarCore::Incidence::Ptr incidence(const Akonadi::Item &item)
void setStatus(Status status)
Sets the incidence status to a standard Status value.
Definition: incidence.cpp:820
bool isOpenEnded() const
Returns true, if the to-do is open-ended (no due date); false otherwise.
Definition: todo.cpp:397
QDateTime toTimeZone(const QTimeZone &timeZone) const const
An abstract class that provides a common base for all calendar incidence classes.
Definition: incidencebase.h:98
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: incidence.cpp:385
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
Q_SCRIPTABLE Q_NOREPLY void start()
void updated()
Call this to notify the observers after the IncidenceBase object has changed.
Definition: incidencebase.cpp:534
QDateTime recurrenceId() const override
Returns the incidence recurrenceId.
Definition: incidence.cpp:1127
const T & at(int i) const const
bool equals(const IncidenceBase &incidence) const override
Compares this with Incidence incidence for equality.
Definition: incidence.cpp:198
QLatin1String iconName(const QDateTime &recurrenceId={}) const override
Returns the name of the icon that best represents this incidence.
Definition: todo.cpp:617
void deserialize(QDataStream &in) override
Sub-type specific deserialization.
Definition: incidence.cpp:1235
Q_SCRIPTABLE CaptureState status()
@ RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
Definition: incidencebase.h:150
QDate currentDate()
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
This class provides the interface for a visitor of calendar components.
Definition: visitor.h:30
QDateTime startDateTime(const QVariant &elem)
QDateTime toUTC() const const
QLatin1String mimeType() const override
Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,...
Definition: todo.cpp:607
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid QDateTime if the incidence does not...
Definition: incidencebase.h:139
void setDtStart(const QDateTime &dt) override
Sets the incidence starting date/time.
Definition: incidence.cpp:376
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:486
bool isValid(QStringView ifopt)
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:76
@ RoleEndTimeZone
Role for determining an incidence's ending timezone.
Definition: incidencebase.h:137
QDate date() const const
bool isValid() const const
@ RoleRecurrenceStart
Role for determining the start of the recurrence.
Definition: incidencebase.h:145
bool hasCompletedDate() const
Returns if the to-do has a completion datetime.
Definition: todo.cpp:337
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
Definition: incidence.cpp:184
QDateTime startDateTime() const
Return the start date/time of the recurrence (Time for all-day recurrences will be 0:00).
Definition: recurrence.cpp:171
void endUpdates()
Call this when a group of updates is complete, to notify observers that the instance has changed.
Definition: incidencebase.cpp:552
@ RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
Definition: incidencebase.h:133
bool supportsGroupwareCommunication() const override
Definition: todo.cpp:653
void setFieldDirty(IncidenceBase::Field field)
Marks Field field as dirty.
Definition: incidencebase.cpp:587
void setTimeZone(const QTimeZone &toZone)
AKONADI_CALENDAR_EXPORT KCalendarCore::Todo::Ptr todo(const Akonadi::Item &item)
Duration duration() const
Returns the length of the incidence duration.
Definition: incidencebase.cpp:483
void setTime(const QTime &time)
QDateTime getNextDateTime(const QDateTime &preDateTime) const
Returns the start date/time of the earliest recurrence with a start date/time after the specified dat...
Definition: recurrence.cpp:1116
QDateTime dtRecurrence() const
Returns an identifier for the earliest uncompleted occurrence of a recurring Todo.
Definition: todo.cpp:453
virtual bool recursOn(const QDate &date, const QTimeZone &timeZone) const
Returns true if the date specified is one on which the event will recur.
Definition: incidence.cpp:617
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 28 2023 03:53:12 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 28 2023 03:53:12 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.