rem: bool               handleEvent(const QString& calendarFile, const QString& eventID)    { return handleEvent(calendarFile, eventID, EVENT_HANDLE); }
add: bool KAlarmApp::handleEvent(const QString& eventID, EventFunc function) { kdDebug(5950) << "KAlarmApp::handleEvent(): " << eventID << ", " << (function==EVENT_TRIGGER?"TRIGGER":function==EVENT_CANCEL?"CANCEL":function==EVENT_HANDLE?"HANDLE":"?") << endl; Event* kcalEvent = AlarmCalendar::activeCalendar()->event(eventID); if (!kcalEvent) { kdError(5950) << "KAlarmApp::handleEvent(): event ID not found: " << eventID << endl; return false; } KAEvent event(*kcalEvent); switch (function) { case EVENT_TRIGGER: {   KAAlarm alarm = event.firstAlarm(); if (alarm.valid()) execAlarm(event, alarm, true); break; } case EVENT_CANCEL: KAlarm::deleteEvent(event, true); break;  case EVENT_HANDLE: { QDateTime now = QDateTime::currentDateTime(); bool updateCalAndDisplay = false; bool displayAlarmValid = false; KAAlarm displayAlarm;   for (KAAlarm alarm = event.firstAlarm();  alarm.valid();  alarm = event.nextAlarm(alarm)) {  int secs = alarm.dateTime().secsTo(now); if (secs < 0) { kdDebug(5950) << "KAlarmApp::handleEvent(): alarm " << alarm.type() << ": not due\n"; continue; } if (alarm.repeatAtLogin()) {     kdDebug(5950) << "KAlarmApp::handleEvent(): REPEAT_AT_LOGIN\n"; if (secs < maxLateness()) continue;    if (displayAlarm.valid()) continue;   alarm.setTime(now); } if (alarm.lateCancel()) {  kdDebug(5950) << "KAlarmApp::handleEvent(): LATE_CANCEL\n"; bool late = false; bool cancel = false; if (alarm.dateTime().isDateOnly()) {  QDateTime limit(alarm.date().addDays(1), Preferences::instance()->startOfDay()); if (now >= limit) {   DateTime next; KAEvent::OccurType type = event.previousOccurrence(now, next); switch (type) { case KAEvent::FIRST_OCCURRENCE: case KAEvent::RECURRENCE_DATE: case KAEvent::RECURRENCE_DATE_TIME: case KAEvent::LAST_OCCURRENCE: limit.setDate(next.date().addDays(1)); limit.setTime(Preferences::instance()->startOfDay()); if (now >= limit) { if (type == KAEvent::LAST_OCCURRENCE) cancel = true; else late = true; } break; case KAEvent::NO_OCCURRENCE: default: late = true; break; } } } else {  int maxlate = maxLateness(); if (secs > maxlate) {   DateTime next; KAEvent::OccurType type = event.previousOccurrence(now, next); switch (type) { case KAEvent::FIRST_OCCURRENCE: case KAEvent::RECURRENCE_DATE: case KAEvent::RECURRENCE_DATE_TIME: case KAEvent::LAST_OCCURRENCE: if (next.dateTime().secsTo(now) > maxlate) { if (type == KAEvent::LAST_OCCURRENCE) cancel = true; else late = true; } break; case KAEvent::NO_OCCURRENCE: default: late = true; break; } } }  if (cancel) {  event.setArchive(); cancelAlarm(event, alarm.type(), false); updateCalAndDisplay = true; continue; } if (late) {  rescheduleAlarm(event, alarm, false); updateCalAndDisplay = true; continue; } } if (!displayAlarmValid) { kdDebug(5950) << "KAlarmApp::handleEvent(): alarm " << alarm.type() << ": display\n"; displayAlarm = alarm; displayAlarmValid = true; } else kdDebug(5950) << "KAlarmApp::handleEvent(): alarm " << alarm.type() << ": skip\n"; }    if (displayAlarm.valid()) execAlarm(event, displayAlarm, true, !displayAlarm.repeatAtLogin()); else if (updateCalAndDisplay) KAlarm::updateEvent(event, 0); else kdDebug(5950) << "KAlarmApp::handleEvent(): no action\n"; break; } } return true; }
context: 		bool               handleEvent(const QString& calendarFile, const QString& eventID)    { return handleEvent(calendarFile, eventID, EVENT_HANDLE); }