author | zautrix <zautrix> | 2005-06-08 10:34:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-08 10:34:22 (UTC) |
commit | 793d117812b4da36c9c11d90cccba347cbc6e208 (patch) (unidiff) | |
tree | 5bc77e2b7a32a541c2a3b3c3d6d50f873216deef /libkcal/calendarlocal.cpp | |
parent | 39d84e2fc3099bd5d7596e8be5dc6783826cec01 (diff) | |
download | kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.zip kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.gz kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.bz2 |
changed incidence type to a faster access method
-rw-r--r-- | libkcal/calendarlocal.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index bc76c0b..fe74052 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -445,64 +445,60 @@ QDateTime CalendarLocal::nextAlarm( int daysTo ) | |||
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
448 | if ( mNextAlarmIncidence ) { | 448 | if ( mNextAlarmIncidence ) { |
449 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 449 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
450 | mNextAlarmDateTime = nextA; | 450 | mNextAlarmDateTime = nextA; |
451 | } | 451 | } |
452 | return nextA; | 452 | return nextA; |
453 | } | 453 | } |
454 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | 454 | Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) |
455 | { | 455 | { |
456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); | 456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); |
457 | } | 457 | } |
458 | 458 | ||
459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
460 | { | 460 | { |
461 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " | 461 | |
462 | << to.toString() << ")\n"; | ||
463 | |||
464 | Alarm::List alarms; | 462 | Alarm::List alarms; |
465 | 463 | ||
466 | Event *e; | 464 | Event *e; |
467 | 465 | ||
468 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 466 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
469 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 467 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
470 | else appendAlarms( alarms, e, from, to ); | 468 | else appendAlarms( alarms, e, from, to ); |
471 | } | 469 | } |
472 | 470 | ||
473 | Todo *t; | 471 | Todo *t; |
474 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 472 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
475 | appendAlarms( alarms, t, from, to ); | 473 | appendAlarms( alarms, t, from, to ); |
476 | } | 474 | } |
477 | 475 | ||
478 | return alarms; | 476 | return alarms; |
479 | } | 477 | } |
480 | 478 | ||
481 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | 479 | void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, |
482 | const QDateTime &from, const QDateTime &to ) | 480 | const QDateTime &from, const QDateTime &to ) |
483 | { | 481 | { |
484 | QPtrList<Alarm> alarmList = incidence->alarms(); | 482 | QPtrList<Alarm> alarmList = incidence->alarms(); |
485 | Alarm *alarm; | 483 | Alarm *alarm; |
486 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 484 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
487 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() | 485 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() |
488 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 486 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
489 | if ( alarm->enabled() ) { | 487 | if ( alarm->enabled() ) { |
490 | if ( alarm->time() >= from && alarm->time() <= to ) { | 488 | if ( alarm->time() >= from && alarm->time() <= to ) { |
491 | kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() | ||
492 | << "': " << alarm->time().toString() << endl; | ||
493 | alarms.append( alarm ); | 489 | alarms.append( alarm ); |
494 | } | 490 | } |
495 | } | 491 | } |
496 | } | 492 | } |
497 | } | 493 | } |
498 | 494 | ||
499 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, | 495 | void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms, |
500 | Incidence *incidence, | 496 | Incidence *incidence, |
501 | const QDateTime &from, | 497 | const QDateTime &from, |
502 | const QDateTime &to ) | 498 | const QDateTime &to ) |
503 | { | 499 | { |
504 | 500 | ||
505 | QPtrList<Alarm> alarmList = incidence->alarms(); | 501 | QPtrList<Alarm> alarmList = incidence->alarms(); |
506 | Alarm *alarm; | 502 | Alarm *alarm; |
507 | QDateTime qdt; | 503 | QDateTime qdt; |
508 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 504 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |