-rw-r--r-- | libkcal/incidence.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 28402ae..f9e1e9e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -563,55 +563,54 @@ void Incidence::setLocation(const QString &location) | |||
563 | 563 | ||
564 | QString Incidence::location() const | 564 | QString Incidence::location() const |
565 | { | 565 | { |
566 | return mLocation; | 566 | return mLocation; |
567 | } | 567 | } |
568 | 568 | ||
569 | ushort Incidence::doesRecur() const | 569 | ushort Incidence::doesRecur() const |
570 | { | 570 | { |
571 | if ( mRecurrence ) return mRecurrence->doesRecur(); | 571 | if ( mRecurrence ) return mRecurrence->doesRecur(); |
572 | else return Recurrence::rNone; | 572 | else return Recurrence::rNone; |
573 | } | 573 | } |
574 | 574 | ||
575 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | 575 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const |
576 | { | 576 | { |
577 | QDateTime incidenceStart = dt; | 577 | QDateTime incidenceStart = dt; |
578 | *ok = false; | 578 | *ok = false; |
579 | if ( doesRecur() ) { | 579 | if ( doesRecur() ) { |
580 | bool last; | 580 | bool last; |
581 | recurrence()->getPreviousDateTime( incidenceStart , &last ); | 581 | recurrence()->getPreviousDateTime( incidenceStart , &last ); |
582 | int count = 0; | 582 | int count = 0; |
583 | if ( !last ) { | 583 | if ( !last ) { |
584 | while ( !last ) { | 584 | while ( !last ) { |
585 | ++count; | 585 | ++count; |
586 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); | 586 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); |
587 | if ( recursOn( incidenceStart.date() ) ) { | 587 | if ( recursOn( incidenceStart.date() ) ) { |
588 | last = true; // exit while llop | 588 | last = true; // exit while llop |
589 | } else { | 589 | } else { |
590 | if ( last ) { // no alarm on last recurrence | 590 | if ( last ) { // no alarm on last recurrence |
591 | return QDateTime (); | 591 | return QDateTime (); |
592 | } | 592 | } |
593 | int year = incidenceStart.date().year(); | 593 | int year = incidenceStart.date().year(); |
594 | // workaround for bug in recurrence | 594 | // workaround for bug in recurrence |
595 | if ( count == 100 || year < 1980 || year > 5000 ) { | 595 | if ( count == 100 || year < 1000 || year > 5000 ) { |
596 | return QDateTime (); | 596 | return QDateTime (); |
597 | } | 597 | } |
598 | incidenceStart = incidenceStart.addSecs( 1 ); | 598 | incidenceStart = incidenceStart.addSecs( 1 ); |
599 | } | 599 | } |
600 | } | 600 | } |
601 | } else { | 601 | } else { |
602 | return QDateTime (); | 602 | return QDateTime (); |
603 | } | 603 | } |
604 | } else { | 604 | } else { |
605 | if ( hasStartDate () ) { | 605 | if ( hasStartDate () ) { |
606 | incidenceStart = dtStart(); | 606 | incidenceStart = dtStart(); |
607 | } | 607 | } |
608 | if ( type() =="Todo" ) { | 608 | if ( type() =="Todo" ) { |
609 | if ( ((Todo*)this)->hasDueDate() ) | 609 | if ( ((Todo*)this)->hasDueDate() ) |
610 | incidenceStart = ((Todo*)this)->dtDue(); | 610 | incidenceStart = ((Todo*)this)->dtDue(); |
611 | |||
612 | } | 611 | } |
613 | } | 612 | } |
614 | if ( incidenceStart > dt ) | 613 | if ( incidenceStart > dt ) |
615 | *ok = true; | 614 | *ok = true; |
616 | return incidenceStart; | 615 | return incidenceStart; |
617 | } | 616 | } |