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();
500 QDateTime nextOccurrenceDateTime = todo->dtStart().isValid() ? r->getNextDateTime(todo->dtStart()) : r->getNextDateTime(QDateTime::currentDateTime());
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)));
An abstract class that provides a common base for all calendar incidence classes.
Definition incidencebase.h:99
void updated()
Call this to notify the observers after the IncidenceBase object has changed.
Definition incidencebase.cpp:518
Duration duration() const
Returns the length of the incidence duration.
Definition incidencebase.cpp:467
void startUpdates()
Call this when a group of updates is going to be made.
Definition incidencebase.cpp:530
void update()
Call this to notify the observers after the IncidenceBase object will be changed.
Definition incidencebase.cpp:507
@ FieldPercentComplete
Field representing the PERCENT-COMPLETE component.
Definition incidencebase.h:166
void endUpdates()
Call this when a group of updates is complete, to notify observers that the instance has changed.
Definition incidencebase.cpp:536
void setFieldDirty(IncidenceBase::Field field)
Marks Field field as dirty.
Definition incidencebase.cpp:571
@ RoleAlarmStartOffset
Role for an incidence alarm's starting offset date/time.
Definition incidencebase.h:132
@ RoleDisplayEnd
Role used for display purposes, represents the end boundary if an incidence supports dtEnd.
Definition incidencebase.h:141
@ RoleAlarmEndOffset
Role for an incidence alarm's ending offset date/time.
Definition incidencebase.h:133
@ RoleStartTimeZone
Role for determining an incidence's starting timezone.
Definition incidencebase.h:136
@ RoleEnd
Role for determining an incidence's dtEnd, will return an invalid QDateTime if the incidence does not...
Definition incidencebase.h:139
@ RoleRecurrenceStart
Role for determining the start of the recurrence.
Definition incidencebase.h:145
@ RoleDisplayStart
Role for display purposes, represents the start boundary of an incidence.
Definition incidencebase.h:150
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.
Definition incidence.cpp:599
void setStatus(Status status)
Sets the incidence status to a standard Status value.
Definition incidence.cpp:810
void setAllDay(bool allDay) override
Sets whether the incidence is all-day, i.e.
Definition incidence.cpp:305
void serialize(QDataStream &out) const override
Sub-type specific serialization.
Definition incidence.cpp:1179
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:367
IncidenceBase & assign(const IncidenceBase &other) override
Provides polymorfic assignment.
Definition incidence.cpp:166
bool equals(const IncidenceBase &incidence) const override
Compares this with Incidence incidence for equality.
Definition incidence.cpp:180
QDateTime recurrenceId() const override
Returns the incidence recurrenceId.
Definition incidence.cpp:1099
Recurrence * recurrence() const
Returns the recurrence rule associated with this incidence.
Definition incidence.cpp:558
void setDtStart(const QDateTime &dt) override
Sets the incidence starting date/time.
Definition incidence.cpp:358
void deserialize(QDataStream &in) override
Sub-type specific deserialization.
Definition incidence.cpp:1207
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...
Definition recurrence.cpp:1098
QDateTime endDateTime() const
Returns the date/time of the last recurrence.
Definition recurrence.cpp:402
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:468
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
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.
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
QDateTime dateTime(DateTimeRole role) const override
Returns a date/time corresponding to the specified DateTimeRole.
Definition todo.cpp:538
bool equals(const IncidenceBase &todo) const override
Compare this with todo for equality.
bool isOpenEnded() const
Returns true, if the to-do is open-ended (no due date); false otherwise.
Definition todo.cpp:397
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
QLatin1String mimeType() const override
Returns the Akonadi specific sub MIME type of a KCalendarCore::IncidenceBase item,...
Definition todo.cpp:607
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
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)
KCALENDARCORE_EXPORT bool identical(const QDateTime &dt1, const QDateTime &dt2)
Compare two QDateTimes for extended equality.
Definition incidencebase.cpp:608
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
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 Mon Nov 18 2024 12:08:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.