-rw-r--r-- | korganizer/komonthview.cpp | 15 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 26 |
2 files changed, 10 insertions, 31 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index cb69832..004ff50 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1262,4 +1262,2 @@ void KOMonthView::updateView() bool last; - qDebug("********************************************** "); - qDebug("Event summary: %s ", event->summary().latin1()); QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); @@ -1267,3 +1265,2 @@ void KOMonthView::updateView() int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); - qDebug("eventlen %d ", eventlen); bool invalid = false; @@ -1290,3 +1287,3 @@ void KOMonthView::updateView() invalid = true; - qDebug("invalid %s", event->summary().latin1()); + //qDebug("invalid %s", event->summary().latin1()); incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; @@ -1296,14 +1293,8 @@ void KOMonthView::updateView() bool ok; - qDebug("TRY next occurence %s ", incidenceStart.toString().latin1()); incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); - if ( ! ok ) { - qDebug("NOT OK "); + if ( ! ok ) break; - } - if ( incidenceStart.date() > endDate ) { - qDebug("incidenceStart.date() > endDate "); + if ( incidenceStart.date() > endDate ) break; } - qDebug("next occurence %s ", incidenceStart.toString().latin1()); - } } else { // no recur diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index 8a175c9..6ee5499 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp @@ -978,3 +978,3 @@ bool Recurrence::recursSecondly(const QDate &qd, int secondFreq) const return true; // the event recurs at least once each day - int after = mRecurStart.secsTo(QDateTime(qd)); + int after = mRecurStart.secsTo(QDateTime(qd)) - 1; if (after / secondFreq != (after + 24*3600) / secondFreq) @@ -1190,3 +1190,3 @@ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const case rWeekly: { - QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart + QDate start = dStart.addDays(-((dStart.dayOfWeek() - rWeekStart + 7)%7)); // start of week for dStart int earliestDayOfWeek = earliestDate.dayOfWeek(); @@ -1200,5 +1200,4 @@ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const // Check for a day in the next scheduled week - if (!weekday && earliestDayOfWeek > 1) + if (!weekday ) weekday = getFirstDayInWeek(rWeekStart) + rFreq*7; - if (weekday) nextDate = start.addDays(weeksAhead*7 + weekday - 1); @@ -1217,3 +1216,3 @@ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const nextDate = getFirstDateInMonth(earliestDate); - if (!nextDate.isValid() && earliestDate.day() > 1) { + if (!nextDate.isValid() ) { // Check for a day in the next scheduled month @@ -1274,3 +1273,3 @@ QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) cons case rWeekly: { - QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart + QDate start = dStart.addDays(-((dStart.dayOfWeek() - rWeekStart + 7)%7)); // start of week for dStart int latestDayOfWeek = latestDate.dayOfWeek(); @@ -1285,9 +1284,7 @@ QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) cons if (!weekday) { - int weekEnd = (rWeekStart + 5)%7 + 1; - if (latestDayOfWeek < weekEnd) { if (!notThisWeek) weeksAhead -= rFreq; + int weekEnd = (rWeekStart + 5)%7 + 1; weekday = getLastDayInWeek(weekEnd); } - } if (weekday) @@ -3402,12 +3399,3 @@ void Recurrence::dump() const { - kdDebug() << "Recurrence::dump():" << endl; - - kdDebug() << " type: " << recurs << endl; - - kdDebug() << " rDays: " << endl; - int i; - for( i = 0; i < 7; ++i ) { - kdDebug() << " " << i << ": " - << ( rDays.testBit( i ) ? "true" : "false" ) << endl; - } + ; } |