summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp15
-rw-r--r--libkcal/recurrence.cpp34
2 files changed, 14 insertions, 35 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()
1262 bool last; 1262 bool last;
1263 qDebug("********************************************** ");
1264 qDebug("Event summary: %s ", event->summary().latin1());
1265 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1263 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
@@ -1267,3 +1265,2 @@ void KOMonthView::updateView()
1267 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1265 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1268 qDebug("eventlen %d ", eventlen);
1269 bool invalid = false; 1266 bool invalid = false;
@@ -1290,3 +1287,3 @@ void KOMonthView::updateView()
1290 invalid = true; 1287 invalid = true;
1291 qDebug("invalid %s", event->summary().latin1()); 1288 //qDebug("invalid %s", event->summary().latin1());
1292 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1289 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
@@ -1296,13 +1293,7 @@ void KOMonthView::updateView()
1296 bool ok; 1293 bool ok;
1297 qDebug("TRY next occurence %s ", incidenceStart.toString().latin1());
1298 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1294 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1299 if ( ! ok ) { 1295 if ( ! ok )
1300 qDebug("NOT OK ");
1301 break; 1296 break;
1302 } 1297 if ( incidenceStart.date() > endDate )
1303 if ( incidenceStart.date() > endDate ) {
1304 qDebug("incidenceStart.date() > endDate ");
1305 break; 1298 break;
1306 }
1307 qDebug("next occurence %s ", incidenceStart.toString().latin1());
1308 } 1299 }
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
978 return true; // the event recurs at least once each day 978 return true; // the event recurs at least once each day
979 int after = mRecurStart.secsTo(QDateTime(qd)); 979 int after = mRecurStart.secsTo(QDateTime(qd)) - 1;
980 if (after / secondFreq != (after + 24*3600) / secondFreq) 980 if (after / secondFreq != (after + 24*3600) / secondFreq)
@@ -1190,3 +1190,3 @@ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1190 case rWeekly: { 1190 case rWeekly: {
1191 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart 1191 QDate start = dStart.addDays(-((dStart.dayOfWeek() - rWeekStart + 7)%7)); // start of week for dStart
1192 int earliestDayOfWeek = earliestDate.dayOfWeek(); 1192 int earliestDayOfWeek = earliestDate.dayOfWeek();
@@ -1200,6 +1200,5 @@ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1200 // Check for a day in the next scheduled week 1200 // Check for a day in the next scheduled week
1201 if (!weekday && earliestDayOfWeek > 1) 1201 if (!weekday )
1202 weekday = getFirstDayInWeek(rWeekStart) + rFreq*7; 1202 weekday = getFirstDayInWeek(rWeekStart) + rFreq*7;
1203 if (weekday) 1203 nextDate = start.addDays(weeksAhead*7 + weekday - 1);
1204 nextDate = start.addDays(weeksAhead*7 + weekday - 1);
1205 break; 1204 break;
@@ -1217,3 +1216,3 @@ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1217 nextDate = getFirstDateInMonth(earliestDate); 1216 nextDate = getFirstDateInMonth(earliestDate);
1218 if (!nextDate.isValid() && earliestDate.day() > 1) { 1217 if (!nextDate.isValid() ) {
1219 // Check for a day in the next scheduled month 1218 // Check for a day in the next scheduled month
@@ -1274,4 +1273,4 @@ QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) cons
1274 case rWeekly: { 1273 case rWeekly: {
1275 QDate start = dStart.addDays(1 - dStart.dayOfWeek()); // start of week for dStart 1274 QDate start = dStart.addDays(-((dStart.dayOfWeek() - rWeekStart + 7)%7)); // start of week for dStart
1276 int latestDayOfWeek = latestDate.dayOfWeek(); 1275 int latestDayOfWeek = latestDate.dayOfWeek();
1277 int weeksAhead = start.daysTo(latestDate) / 7; 1276 int weeksAhead = start.daysTo(latestDate) / 7;
@@ -1285,8 +1284,6 @@ QDate Recurrence::getPreviousDateNoTime(const QDate &afterDate, bool *last) cons
1285 if (!weekday) { 1284 if (!weekday) {
1285 if (!notThisWeek)
1286 weeksAhead -= rFreq;
1286 int weekEnd = (rWeekStart + 5)%7 + 1; 1287 int weekEnd = (rWeekStart + 5)%7 + 1;
1287 if (latestDayOfWeek < weekEnd) { 1288 weekday = getLastDayInWeek(weekEnd);
1288 if (!notThisWeek)
1289 weeksAhead -= rFreq;
1290 weekday = getLastDayInWeek(weekEnd);
1291 }
1292 } 1289 }
@@ -3402,12 +3399,3 @@ void Recurrence::dump() const
3402{ 3399{
3403 kdDebug() << "Recurrence::dump():" << endl; 3400 ;
3404
3405 kdDebug() << " type: " << recurs << endl;
3406
3407 kdDebug() << " rDays: " << endl;
3408 int i;
3409 for( i = 0; i < 7; ++i ) {
3410 kdDebug() << " " << i << ": "
3411 << ( rDays.testBit( i ) ? "true" : "false" ) << endl;
3412 }
3413} 3401}