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

KCalCore Library

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

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