summaryrefslogtreecommitdiffabout
path: root/libkcal/event.cpp
Unidiff
Diffstat (limited to 'libkcal/event.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/event.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index fdf5657..060df81 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -339,86 +339,86 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime*
339 break; 339 break;
340 incidenceStart = getNextOccurence( incidenceStart.addSecs( 60 ), &ok ); 340 incidenceStart = getNextOccurence( incidenceStart.addSecs( 60 ), &ok );
341 } 341 }
342 else { 342 else {
343 if ( testStop ) 343 if ( testStop )
344 if ( incidenceStart > stopSearch ) 344 if ( incidenceStart > stopSearch )
345 break; 345 break;
346 testincidenceStart = testEvent->getNextOccurence( testincidenceStart.addSecs( 60 ), &ok ); 346 testincidenceStart = testEvent->getNextOccurence( testincidenceStart.addSecs( 60 ), &ok );
347 } 347 }
348 if ( ok ) { 348 if ( ok ) {
349 if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) { 349 if ( incidenceStart < testincidenceStart.addSecs( testduration ) && testincidenceStart < incidenceStart.addSecs( duration ) ) {
350 if ( incidenceStart < testincidenceStart ) 350 if ( incidenceStart < testincidenceStart )
351 *overlapDT = testincidenceStart; 351 *overlapDT = testincidenceStart;
352 else 352 else
353 *overlapDT = incidenceStart; 353 *overlapDT = incidenceStart;
354 if ( startDT ) { 354 if ( startDT ) {
355 if ( *overlapDT >= *startDT ) 355 if ( *overlapDT >= *startDT )
356 return true; 356 return true;
357 } else 357 } else
358 return true; 358 return true;
359 } 359 }
360 computeThis = ( incidenceStart < testincidenceStart ); 360 computeThis = ( incidenceStart < testincidenceStart );
361 } 361 }
362 362
363 } 363 }
364 //qDebug("%d rec counter stopped at %d - %s %s", ok ,count, summary().latin1(),testEvent->summary().latin1() ); 364 //qDebug("%d rec counter stopped at %d - %s %s", ok ,count, summary().latin1(),testEvent->summary().latin1() );
365 return false; 365 return false;
366} 366}
367QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const 367QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
368{ 368{
369 *ok = false; 369 *ok = false;
370 if ( !alarmEnabled() ) 370 if ( !alarmEnabled() )
371 return QDateTime (); 371 return QDateTime ();
372 bool yes; 372 bool yes;
373 QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); 373 QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
374 if ( ! yes || cancelled() ) { 374 if ( ! yes || cancelled() ) {
375 *ok = false; 375 *ok = false;
376 return QDateTime (); 376 return QDateTime ();
377 } 377 }
378 378
379 bool enabled = false; 379 bool enabled = false;
380 Alarm* alarm; 380 Alarm* alarm;
381 int off = 0; 381 int off = 0;
382 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 382 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
383 // if ( QDateTime::currentDateTime() > incidenceStart ){ 383 // if ( QDateTime::currentDateTime() > incidenceStart ){
384// *ok = false; 384// *ok = false;
385// return incidenceStart; 385// return incidenceStart;
386// } 386// }
387 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 387 for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
388 if (alarm->enabled()) { 388 if (alarm->enabled()) {
389 if ( alarm->hasTime () ) { 389 if ( alarm->hasTime () ) {
390 if ( alarm->time() < alarmStart ) { 390 if ( alarm->time() < alarmStart ) {
391 alarmStart = alarm->time(); 391 alarmStart = alarm->time();
392 enabled = true; 392 enabled = true;
393 off = alarmStart.secsTo( incidenceStart ); 393 off = alarmStart.secsTo( incidenceStart );
394 } 394 }
395 395
396 } else { 396 } else {
397 int secs = alarm->startOffset().asSeconds(); 397 int secs = alarm->startOffset().asSeconds();
398 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 398 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
399 alarmStart = incidenceStart.addSecs( secs ); 399 alarmStart = incidenceStart.addSecs( secs );
400 enabled = true; 400 enabled = true;
401 off = -secs; 401 off = -secs;
402 } 402 }
403 } 403 }
404 } 404 }
405 } 405 }
406 if ( enabled ) { 406 if ( enabled ) {
407 if ( alarmStart > start_dt ) { 407 if ( alarmStart > start_dt ) {
408 *ok = true; 408 *ok = true;
409 * offset = off; 409 * offset = off;
410 return alarmStart; 410 return alarmStart;
411 } 411 }
412 } 412 }
413 *ok = false; 413 *ok = false;
414 return QDateTime (); 414 return QDateTime ();
415 415
416} 416}
417 417
418QString Event::durationText() 418QString Event::durationText()
419{ 419{
420 int sec = mDtStart.secsTo( mDtEnd ); 420 int sec = mDtStart.secsTo( mDtEnd );
421 if ( doesFloat() ) 421 if ( doesFloat() )
422 sec += 86400; 422 sec += 86400;
423 return durationText4Time( sec ); 423 return durationText4Time( sec );
424} 424}