summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
Unidiff
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp63
1 files changed, 47 insertions, 16 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index e4bcc5e..4643a3a 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -12,109 +12,113 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27#include "incidence.h" 27#include "incidence.h"
28#include "todo.h" 28#include "todo.h"
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32Incidence::Incidence() : 32Incidence::Incidence() :
33 IncidenceBase(), 33 IncidenceBase(),
34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) 34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
35{ 35{
36 mRecurrence = new Recurrence(this); 36 mRecurrence = 0;//new Recurrence(this);
37 mCancelled = false; 37 mCancelled = false;
38 recreate(); 38 recreate();
39 mHasStartDate = true; 39 mHasStartDate = true;
40 mAlarms.setAutoDelete(true); 40 mAlarms.setAutoDelete(true);
41 mAttachments.setAutoDelete(true); 41 mAttachments.setAutoDelete(true);
42 mHasRecurrenceID = false; 42 mHasRecurrenceID = false;
43 mHoliday = false; 43 mHoliday = false;
44 mBirthday = false; 44 mBirthday = false;
45 mAnniversary = false; 45 mAnniversary = false;
46 46
47} 47}
48 48
49Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) 49Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
50{ 50{
51// TODO: reenable attributes currently commented out. 51// TODO: reenable attributes currently commented out.
52 mRevision = i.mRevision; 52 mRevision = i.mRevision;
53 mCreated = i.mCreated; 53 mCreated = i.mCreated;
54 mDescription = i.mDescription; 54 mDescription = i.mDescription;
55 mSummary = i.mSummary; 55 mSummary = i.mSummary;
56 mCategories = i.mCategories; 56 mCategories = i.mCategories;
57// Incidence *mRelatedTo; Incidence *mRelatedTo; 57// Incidence *mRelatedTo; Incidence *mRelatedTo;
58 mRelatedTo = 0; 58 mRelatedTo = 0;
59 mRelatedToUid = i.mRelatedToUid; 59 mRelatedToUid = i.mRelatedToUid;
60// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; 60// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations;
61 mExDates = i.mExDates; 61 mExDates = i.mExDates;
62 mAttachments = i.mAttachments; 62 mAttachments = i.mAttachments;
63 mResources = i.mResources; 63 mResources = i.mResources;
64 mSecrecy = i.mSecrecy; 64 mSecrecy = i.mSecrecy;
65 mPriority = i.mPriority; 65 mPriority = i.mPriority;
66 mLocation = i.mLocation; 66 mLocation = i.mLocation;
67 mCancelled = i.mCancelled; 67 mCancelled = i.mCancelled;
68 mHasStartDate = i.mHasStartDate; 68 mHasStartDate = i.mHasStartDate;
69 QPtrListIterator<Alarm> it( i.mAlarms ); 69 QPtrListIterator<Alarm> it( i.mAlarms );
70 const Alarm *a; 70 const Alarm *a;
71 while( (a = it.current()) ) { 71 while( (a = it.current()) ) {
72 Alarm *b = new Alarm( *a ); 72 Alarm *b = new Alarm( *a );
73 b->setParent( this ); 73 b->setParent( this );
74 mAlarms.append( b ); 74 mAlarms.append( b );
75 75
76 ++it; 76 ++it;
77 } 77 }
78 mAlarms.setAutoDelete(true); 78 mAlarms.setAutoDelete(true);
79 mHasRecurrenceID = i.mHasRecurrenceID; 79 mHasRecurrenceID = i.mHasRecurrenceID;
80 mRecurrenceID = i.mRecurrenceID; 80 mRecurrenceID = i.mRecurrenceID;
81 mRecurrence = new Recurrence( *(i.mRecurrence), this ); 81 if ( i.mRecurrence )
82 mRecurrence = new Recurrence( *(i.mRecurrence), this );
83 else
84 mRecurrence = 0;
82 mHoliday = i.mHoliday ; 85 mHoliday = i.mHoliday ;
83 mBirthday = i.mBirthday; 86 mBirthday = i.mBirthday;
84 mAnniversary = i.mAnniversary; 87 mAnniversary = i.mAnniversary;
85} 88}
86 89
87Incidence::~Incidence() 90Incidence::~Incidence()
88{ 91{
89 92
90 Incidence *ev; 93 Incidence *ev;
91 QPtrList<Incidence> Relations = relations(); 94 QPtrList<Incidence> Relations = relations();
92 for (ev=Relations.first();ev;ev=Relations.next()) { 95 for (ev=Relations.first();ev;ev=Relations.next()) {
93 if (ev->relatedTo() == this) ev->setRelatedTo(0); 96 if (ev->relatedTo() == this) ev->setRelatedTo(0);
94 } 97 }
95 if (relatedTo()) relatedTo()->removeRelation(this); 98 if (relatedTo()) relatedTo()->removeRelation(this);
96 delete mRecurrence; 99 if ( mRecurrence )
100 delete mRecurrence;
97 101
98} 102}
99 103
100bool Incidence::isHoliday() const 104bool Incidence::isHoliday() const
101{ 105{
102 return mHoliday; 106 return mHoliday;
103} 107}
104bool Incidence::isBirthday() const 108bool Incidence::isBirthday() const
105{ 109{
106 110
107 return mBirthday ; 111 return mBirthday ;
108} 112}
109bool Incidence::isAnniversary() const 113bool Incidence::isAnniversary() const
110{ 114{
111 return mAnniversary ; 115 return mAnniversary ;
112 116
113} 117}
114 118
115bool Incidence::hasRecurrenceID() const 119bool Incidence::hasRecurrenceID() const
116{ 120{
117 return mHasRecurrenceID; 121 return mHasRecurrenceID;
118} 122}
119 123
120void Incidence::setHasRecurrenceID( bool b ) 124void Incidence::setHasRecurrenceID( bool b )
@@ -187,52 +191,66 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
187 } 191 }
188 } 192 }
189#endif 193#endif
190 194
191 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { 195 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
192 if ( i1.hasRecurrenceID() ) { 196 if ( i1.hasRecurrenceID() ) {
193 if ( i1.recurrenceID() != i2.recurrenceID() ) 197 if ( i1.recurrenceID() != i2.recurrenceID() )
194 return false; 198 return false;
195 } 199 }
196 200
197 } else { 201 } else {
198 return false; 202 return false;
199 } 203 }
200 204
201 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) 205 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
202 return false; 206 return false;
203 if ( i1.hasStartDate() == i2.hasStartDate() ) { 207 if ( i1.hasStartDate() == i2.hasStartDate() ) {
204 if ( i1.hasStartDate() ) { 208 if ( i1.hasStartDate() ) {
205 if ( i1.dtStart() != i2.dtStart() ) 209 if ( i1.dtStart() != i2.dtStart() )
206 return false; 210 return false;
207 } 211 }
208 } else { 212 } else {
209 return false; 213 return false;
210 } 214 }
211 if (!( *i1.recurrence() == *i2.recurrence()) ) { 215 if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) {
212 qDebug("recurrence is NOT equal "); 216 if (!( *i1.mRecurrence == *i2.mRecurrence) ) {
213 return false; 217 //qDebug("recurrence is NOT equal ");
218 return false;
219 }
220 } else {
221 // one ( or both ) recurrence is 0
222 if ( i1.mRecurrence == 0 ) {
223 if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone )
224 return false;
225 } else {
226 // i1.mRecurrence != 0
227 // i2.mRecurrence == 0
228 if ( i1.mRecurrence->doesRecur() != Recurrence::rNone )
229 return false;
230 }
214 } 231 }
232
215 return 233 return
216 // i1.created() == i2.created() && 234 // i1.created() == i2.created() &&
217 stringCompare( i1.description(), i2.description() ) && 235 stringCompare( i1.description(), i2.description() ) &&
218 stringCompare( i1.summary(), i2.summary() ) && 236 stringCompare( i1.summary(), i2.summary() ) &&
219 i1.categories() == i2.categories() && 237 i1.categories() == i2.categories() &&
220 // no need to compare mRelatedTo 238 // no need to compare mRelatedTo
221 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 239 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
222 // i1.relations() == i2.relations() && 240 // i1.relations() == i2.relations() &&
223 i1.exDates() == i2.exDates() && 241 i1.exDates() == i2.exDates() &&
224 i1.attachments() == i2.attachments() && 242 i1.attachments() == i2.attachments() &&
225 i1.resources() == i2.resources() && 243 i1.resources() == i2.resources() &&
226 i1.secrecy() == i2.secrecy() && 244 i1.secrecy() == i2.secrecy() &&
227 i1.priority() == i2.priority() && 245 i1.priority() == i2.priority() &&
228 i1.cancelled() == i2.cancelled() && 246 i1.cancelled() == i2.cancelled() &&
229 stringCompare( i1.location(), i2.location() ); 247 stringCompare( i1.location(), i2.location() );
230} 248}
231 249
232Incidence* Incidence::recreateCloneException( QDate d ) 250Incidence* Incidence::recreateCloneException( QDate d )
233{ 251{
234 Incidence* newInc = clone(); 252 Incidence* newInc = clone();
235 newInc->recreate(); 253 newInc->recreate();
236 if ( doesRecur() ) { 254 if ( doesRecur() ) {
237 addExDate( d ); 255 addExDate( d );
238 newInc->recurrence()->unsetRecurs(); 256 newInc->recurrence()->unsetRecurs();
@@ -258,49 +276,50 @@ void Incidence::recreate()
258 setCreated(QDateTime::currentDateTime()); 276 setCreated(QDateTime::currentDateTime());
259 277
260 setUid(CalFormat::createUniqueId()); 278 setUid(CalFormat::createUniqueId());
261 279
262 setRevision(0); 280 setRevision(0);
263 setIDStr( ":" ); 281 setIDStr( ":" );
264 setLastModified(QDateTime::currentDateTime()); 282 setLastModified(QDateTime::currentDateTime());
265} 283}
266void Incidence::cloneRelations( Incidence * newInc ) 284void Incidence::cloneRelations( Incidence * newInc )
267{ 285{
268 // newInc is already a clone of this incidence 286 // newInc is already a clone of this incidence
269 Incidence * inc; 287 Incidence * inc;
270 Incidence * cloneInc; 288 Incidence * cloneInc;
271 QPtrList<Incidence> Relations = relations(); 289 QPtrList<Incidence> Relations = relations();
272 for (inc=Relations.first();inc;inc=Relations.next()) { 290 for (inc=Relations.first();inc;inc=Relations.next()) {
273 cloneInc = inc->clone(); 291 cloneInc = inc->clone();
274 cloneInc->recreate(); 292 cloneInc->recreate();
275 cloneInc->setRelatedTo( newInc ); 293 cloneInc->setRelatedTo( newInc );
276 inc->cloneRelations( cloneInc ); 294 inc->cloneRelations( cloneInc );
277 } 295 }
278} 296}
279void Incidence::setReadOnly( bool readOnly ) 297void Incidence::setReadOnly( bool readOnly )
280{ 298{
281 IncidenceBase::setReadOnly( readOnly ); 299 IncidenceBase::setReadOnly( readOnly );
282 recurrence()->setRecurReadOnly( readOnly); 300 if ( mRecurrence )
301 mRecurrence->setRecurReadOnly( readOnly);
283} 302}
284void Incidence::setLastModifiedSubInvalid() 303void Incidence::setLastModifiedSubInvalid()
285{ 304{
286 mLastModifiedSub = QDateTime(); 305 mLastModifiedSub = QDateTime();
287 if ( mRelatedTo ) 306 if ( mRelatedTo )
288 mRelatedTo->setLastModifiedSubInvalid(); 307 mRelatedTo->setLastModifiedSubInvalid();
289} 308}
290QDateTime Incidence::lastModifiedSub() 309QDateTime Incidence::lastModifiedSub()
291{ 310{
292 if ( !mRelations.count() ) 311 if ( !mRelations.count() )
293 return lastModified(); 312 return lastModified();
294 if ( mLastModifiedSub.isValid() ) 313 if ( mLastModifiedSub.isValid() )
295 return mLastModifiedSub; 314 return mLastModifiedSub;
296 mLastModifiedSub = lastModified(); 315 mLastModifiedSub = lastModified();
297 Incidence * inc; 316 Incidence * inc;
298 QPtrList<Incidence> Relations = relations(); 317 QPtrList<Incidence> Relations = relations();
299 for (inc=Relations.first();inc;inc=Relations.next()) { 318 for (inc=Relations.first();inc;inc=Relations.next()) {
300 if ( inc->lastModifiedSub() > mLastModifiedSub ) 319 if ( inc->lastModifiedSub() > mLastModifiedSub )
301 mLastModifiedSub = inc->lastModifiedSub(); 320 mLastModifiedSub = inc->lastModifiedSub();
302 } 321 }
303 return mLastModifiedSub; 322 return mLastModifiedSub;
304} 323}
305void Incidence::setCreated(QDateTime created) 324void Incidence::setCreated(QDateTime created)
306{ 325{
@@ -309,49 +328,51 @@ void Incidence::setCreated(QDateTime created)
309} 328}
310 329
311QDateTime Incidence::created() const 330QDateTime Incidence::created() const
312{ 331{
313 return mCreated; 332 return mCreated;
314} 333}
315 334
316void Incidence::setRevision(int rev) 335void Incidence::setRevision(int rev)
317{ 336{
318 if (mReadOnly) return; 337 if (mReadOnly) return;
319 mRevision = rev; 338 mRevision = rev;
320 339
321 updated(); 340 updated();
322} 341}
323 342
324int Incidence::revision() const 343int Incidence::revision() const
325{ 344{
326 return mRevision; 345 return mRevision;
327} 346}
328 347
329void Incidence::setDtStart(const QDateTime &dtStart) 348void Incidence::setDtStart(const QDateTime &dtStart)
330{ 349{
331 350
332 QDateTime dt = getEvenTime(dtStart); 351 QDateTime dt = getEvenTime(dtStart);
333 recurrence()->setRecurStart( dt); 352
353 if ( mRecurrence )
354 mRecurrence->setRecurStart( dt);
334 IncidenceBase::setDtStart( dt ); 355 IncidenceBase::setDtStart( dt );
335} 356}
336 357
337void Incidence::setDescription(const QString &description) 358void Incidence::setDescription(const QString &description)
338{ 359{
339 if (mReadOnly) return; 360 if (mReadOnly) return;
340 mDescription = description; 361 mDescription = description;
341 updated(); 362 updated();
342} 363}
343 364
344QString Incidence::description() const 365QString Incidence::description() const
345{ 366{
346 return mDescription; 367 return mDescription;
347} 368}
348 369
349 370
350void Incidence::setSummary(const QString &summary) 371void Incidence::setSummary(const QString &summary)
351{ 372{
352 if (mReadOnly) return; 373 if (mReadOnly) return;
353 mSummary = summary; 374 mSummary = summary;
354 updated(); 375 updated();
355} 376}
356 377
357QString Incidence::summary() const 378QString Incidence::summary() const
@@ -483,57 +504,56 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
483 inc->addRelationsToList( rel ); 504 inc->addRelationsToList( rel );
484 } 505 }
485 if ( rel->findRef( this ) == -1 ) 506 if ( rel->findRef( this ) == -1 )
486 rel->append( this ); 507 rel->append( this );
487} 508}
488 509
489void Incidence::addRelation(Incidence *event) 510void Incidence::addRelation(Incidence *event)
490{ 511{
491 setLastModifiedSubInvalid(); 512 setLastModifiedSubInvalid();
492 if( mRelations.findRef( event ) == -1 ) { 513 if( mRelations.findRef( event ) == -1 ) {
493 mRelations.append(event); 514 mRelations.append(event);
494 //updated(); 515 //updated();
495 } 516 }
496} 517}
497 518
498void Incidence::removeRelation(Incidence *event) 519void Incidence::removeRelation(Incidence *event)
499{ 520{
500 setLastModifiedSubInvalid(); 521 setLastModifiedSubInvalid();
501 mRelations.removeRef(event); 522 mRelations.removeRef(event);
502// if (event->getRelatedTo() == this) event->setRelatedTo(0); 523// if (event->getRelatedTo() == this) event->setRelatedTo(0);
503} 524}
504 525
505bool Incidence::recursOn(const QDate &qd) const 526bool Incidence::recursOn(const QDate &qd) const
506{ 527{
507 if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; 528 if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true;
508 else return false; 529 else return false;
509} 530}
510 531
511void Incidence::setExDates(const DateList &exDates) 532void Incidence::setExDates(const DateList &exDates)
512{ 533{
513 if (mReadOnly) return; 534 if (mReadOnly) return;
514 mExDates = exDates; 535 mExDates = exDates;
515
516 recurrence()->setRecurExDatesCount(mExDates.count()); 536 recurrence()->setRecurExDatesCount(mExDates.count());
517 537
518 updated(); 538 updated();
519} 539}
520 540
521void Incidence::addExDate(const QDate &date) 541void Incidence::addExDate(const QDate &date)
522{ 542{
523 if (mReadOnly) return; 543 if (mReadOnly) return;
524 mExDates.append(date); 544 mExDates.append(date);
525 545
526 recurrence()->setRecurExDatesCount(mExDates.count()); 546 recurrence()->setRecurExDatesCount(mExDates.count());
527 547
528 updated(); 548 updated();
529} 549}
530 550
531DateList Incidence::exDates() const 551DateList Incidence::exDates() const
532{ 552{
533 return mExDates; 553 return mExDates;
534} 554}
535 555
536bool Incidence::isException(const QDate &date) const 556bool Incidence::isException(const QDate &date) const
537{ 557{
538 DateList::ConstIterator it; 558 DateList::ConstIterator it;
539 for( it = mExDates.begin(); it != mExDates.end(); ++it ) { 559 for( it = mExDates.begin(); it != mExDates.end(); ++it ) {
@@ -677,89 +697,100 @@ void Incidence::addAlarm(Alarm *alarm)
677 updated(); 697 updated();
678} 698}
679 699
680void Incidence::removeAlarm(Alarm *alarm) 700void Incidence::removeAlarm(Alarm *alarm)
681{ 701{
682 mAlarms.removeRef(alarm); 702 mAlarms.removeRef(alarm);
683 updated(); 703 updated();
684} 704}
685 705
686void Incidence::clearAlarms() 706void Incidence::clearAlarms()
687{ 707{
688 mAlarms.clear(); 708 mAlarms.clear();
689 updated(); 709 updated();
690} 710}
691 711
692bool Incidence::isAlarmEnabled() const 712bool Incidence::isAlarmEnabled() const
693{ 713{
694 Alarm* alarm; 714 Alarm* alarm;
695 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 715 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
696 if (alarm->enabled()) 716 if (alarm->enabled())
697 return true; 717 return true;
698 } 718 }
699 return false; 719 return false;
700} 720}
701 721#include <stdlib.h>
702Recurrence *Incidence::recurrence() const 722Recurrence *Incidence::recurrence()
703{ 723{
724 if ( ! mRecurrence ) {
725 mRecurrence = new Recurrence(this);
726 qDebug("creating new recurence ");
727 //abort();
728 }
704 return mRecurrence; 729 return mRecurrence;
705} 730}
706void Incidence::setRecurrence( Recurrence * r) 731void Incidence::setRecurrence( Recurrence * r)
707{ 732{
708 delete mRecurrence; 733 if ( mRecurrence )
709 mRecurrence = r; 734 delete mRecurrence;
735 mRecurrence = r;
710} 736}
711 737
712void Incidence::setLocation(const QString &location) 738void Incidence::setLocation(const QString &location)
713{ 739{
714 if (mReadOnly) return; 740 if (mReadOnly) return;
715 mLocation = location; 741 mLocation = location;
716 updated(); 742 updated();
717} 743}
718 744
719QString Incidence::location() const 745QString Incidence::location() const
720{ 746{
721 return mLocation; 747 return mLocation;
722} 748}
749QString Incidence::recurrenceText() const
750{
751 if ( mRecurrence ) return mRecurrence->recurrenceText();
752 return i18n("No");
753}
723 754
724ushort Incidence::doesRecur() const 755ushort Incidence::doesRecur() const
725{ 756{
726 if ( mRecurrence ) return mRecurrence->doesRecur(); 757 if ( mRecurrence ) return mRecurrence->doesRecur();
727 else return Recurrence::rNone; 758 else return Recurrence::rNone;
728} 759}
729 760
730QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const 761QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
731{ 762{
732 QDateTime incidenceStart = dt; 763 QDateTime incidenceStart = dt;
733 *ok = false; 764 *ok = false;
734 if ( doesRecur() ) { 765 if ( doesRecur() ) {
735 bool last; 766 bool last;
736 recurrence()->getPreviousDateTime( incidenceStart , &last ); 767 mRecurrence->getPreviousDateTime( incidenceStart , &last );
737 int count = 0; 768 int count = 0;
738 if ( !last ) { 769 if ( !last ) {
739 while ( !last ) { 770 while ( !last ) {
740 ++count; 771 ++count;
741 incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); 772 incidenceStart = mRecurrence->getNextDateTime( incidenceStart, &last );
742 if ( recursOn( incidenceStart.date() ) ) { 773 if ( recursOn( incidenceStart.date() ) ) {
743 last = true; // exit while llop 774 last = true; // exit while llop
744 } else { 775 } else {
745 if ( last ) { // no alarm on last recurrence 776 if ( last ) { // no alarm on last recurrence
746 return QDateTime (); 777 return QDateTime ();
747 } 778 }
748 int year = incidenceStart.date().year(); 779 int year = incidenceStart.date().year();
749 // workaround for bug in recurrence 780 // workaround for bug in recurrence
750 if ( count == 100 || year < 1000 || year > 5000 ) { 781 if ( count == 100 || year < 1000 || year > 5000 ) {
751 return QDateTime (); 782 return QDateTime ();
752 } 783 }
753 incidenceStart = incidenceStart.addSecs( 1 ); 784 incidenceStart = incidenceStart.addSecs( 1 );
754 } 785 }
755 } 786 }
756 } else { 787 } else {
757 return QDateTime (); 788 return QDateTime ();
758 } 789 }
759 } else { 790 } else {
760 if ( hasStartDate () ) { 791 if ( hasStartDate () ) {
761 incidenceStart = dtStart(); 792 incidenceStart = dtStart();
762 } 793 }
763 if ( typeID() == todoID ) { 794 if ( typeID() == todoID ) {
764 if ( ((Todo*)this)->hasDueDate() ) 795 if ( ((Todo*)this)->hasDueDate() )
765 incidenceStart = ((Todo*)this)->dtDue(); 796 incidenceStart = ((Todo*)this)->dtDue();