-rw-r--r-- | korganizer/komonthview.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 004ff50..cb69832 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1255,19 +1255,22 @@ void KOMonthView::updateView() | |||
1255 | QPtrList<Event> events = calendar()->events(); | 1255 | QPtrList<Event> events = calendar()->events(); |
1256 | Event *event; | 1256 | Event *event; |
1257 | QDateTime dt; | 1257 | QDateTime dt; |
1258 | bool ok; | 1258 | bool ok; |
1259 | QDate endDate = mStartDate.addDays( timeSpan ); | 1259 | QDate endDate = mStartDate.addDays( timeSpan ); |
1260 | for( event = events.first(); event; event = events.next() ) { // for event | 1260 | for( event = events.first(); event; event = events.next() ) { // for event |
1261 | if ( event->doesRecur() ) { | 1261 | if ( event->doesRecur() ) { |
1262 | bool last; | 1262 | bool last; |
1263 | qDebug("********************************************** "); | ||
1264 | qDebug("Event summary: %s ", event->summary().latin1()); | ||
1263 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1265 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1264 | QDateTime incidenceEnd; | 1266 | QDateTime incidenceEnd; |
1265 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1267 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1268 | qDebug("eventlen %d ", eventlen); | ||
1266 | bool invalid = false; | 1269 | bool invalid = false; |
1267 | while( true ) { | 1270 | while( true ) { |
1268 | if ( incidenceStart.isValid() ) { | 1271 | if ( incidenceStart.isValid() ) { |
1269 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1272 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1270 | int st = incidenceStart.date().daysTo( endDate ); | 1273 | int st = incidenceStart.date().daysTo( endDate ); |
1271 | if ( st >= 0 ) { // start before timeend | 1274 | if ( st >= 0 ) { // start before timeend |
1272 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1275 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1273 | if ( end >= 0 ) { // end after timestart --- got one! | 1276 | if ( end >= 0 ) { // end after timestart --- got one! |
@@ -1280,27 +1283,33 @@ void KOMonthView::updateView() | |||
1280 | for ( iii = st;iii<= end;++iii) | 1283 | for ( iii = st;iii<= end;++iii) |
1281 | (*cells)[iii]->insertEvent( event ); | 1284 | (*cells)[iii]->insertEvent( event ); |
1282 | } | 1285 | } |
1283 | } | 1286 | } |
1284 | } else { | 1287 | } else { |
1285 | if ( invalid ) | 1288 | if ( invalid ) |
1286 | break; | 1289 | break; |
1287 | invalid = true; | 1290 | invalid = true; |
1288 | //qDebug("invalid %s", event->summary().latin1()); | 1291 | qDebug("invalid %s", event->summary().latin1()); |
1289 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1292 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1290 | } | 1293 | } |
1291 | if ( last ) | 1294 | if ( last ) |
1292 | break; | 1295 | break; |
1293 | bool ok; | 1296 | bool ok; |
1297 | qDebug("TRY next occurence %s ", incidenceStart.toString().latin1()); | ||
1294 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1298 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1295 | if ( ! ok ) | 1299 | if ( ! ok ) { |
1300 | qDebug("NOT OK "); | ||
1296 | break; | 1301 | break; |
1297 | if ( incidenceStart.date() > endDate ) | 1302 | } |
1303 | if ( incidenceStart.date() > endDate ) { | ||
1304 | qDebug("incidenceStart.date() > endDate "); | ||
1298 | break; | 1305 | break; |
1306 | } | ||
1307 | qDebug("next occurence %s ", incidenceStart.toString().latin1()); | ||
1299 | } | 1308 | } |
1300 | } else { // no recur | 1309 | } else { // no recur |
1301 | int st = event->dtStart().date().daysTo( endDate ); | 1310 | int st = event->dtStart().date().daysTo( endDate ); |
1302 | if ( st >= 0 ) { // start before timeend | 1311 | if ( st >= 0 ) { // start before timeend |
1303 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1312 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1304 | if ( end >= 0 ) { // end after timestart --- got one! | 1313 | if ( end >= 0 ) { // end after timestart --- got one! |
1305 | //normalize | 1314 | //normalize |
1306 | st = timeSpan - st; | 1315 | st = timeSpan - st; |