-rw-r--r-- | libkcal/calendarlocal.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e75df70..bc76c0b 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -285,49 +285,49 @@ QString CalendarLocal::nextSummary() const | |||
285 | { | 285 | { |
286 | return mNextSummary; | 286 | return mNextSummary; |
287 | } | 287 | } |
288 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 288 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
289 | { | 289 | { |
290 | return mNextAlarmEventDateTime; | 290 | return mNextAlarmEventDateTime; |
291 | } | 291 | } |
292 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 292 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
293 | { | 293 | { |
294 | //mNextAlarmIncidence | 294 | //mNextAlarmIncidence |
295 | //mNextAlarmDateTime | 295 | //mNextAlarmDateTime |
296 | //return mNextSummary; | 296 | //return mNextSummary; |
297 | //return mNextAlarmEventDateTime; | 297 | //return mNextAlarmEventDateTime; |
298 | bool newNextAlarm = false; | 298 | bool newNextAlarm = false; |
299 | bool computeNextAlarm = false; | 299 | bool computeNextAlarm = false; |
300 | bool ok; | 300 | bool ok; |
301 | int offset; | 301 | int offset; |
302 | QDateTime nextA; | 302 | QDateTime nextA; |
303 | // QString nextSum; | 303 | // QString nextSum; |
304 | //QDateTime nextEvent; | 304 | //QDateTime nextEvent; |
305 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { | 305 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { |
306 | computeNextAlarm = true; | 306 | computeNextAlarm = true; |
307 | } else { | 307 | } else { |
308 | if ( ! deleted ) { | 308 | if ( ! deleted ) { |
309 | nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; | 309 | nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
310 | if ( ok ) { | 310 | if ( ok ) { |
311 | if ( nextA < mNextAlarmDateTime ) { | 311 | if ( nextA < mNextAlarmDateTime ) { |
312 | deRegisterAlarm(); | 312 | deRegisterAlarm(); |
313 | mNextAlarmDateTime = nextA; | 313 | mNextAlarmDateTime = nextA; |
314 | mNextSummary = incidence->summary(); | 314 | mNextSummary = incidence->summary(); |
315 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; | 315 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; |
316 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 316 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
317 | newNextAlarm = true; | 317 | newNextAlarm = true; |
318 | mNextAlarmIncidence = incidence; | 318 | mNextAlarmIncidence = incidence; |
319 | } else { | 319 | } else { |
320 | if ( incidence == mNextAlarmIncidence ) { | 320 | if ( incidence == mNextAlarmIncidence ) { |
321 | computeNextAlarm = true; | 321 | computeNextAlarm = true; |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } else { | 324 | } else { |
325 | if ( mNextAlarmIncidence == incidence ) { | 325 | if ( mNextAlarmIncidence == incidence ) { |
326 | computeNextAlarm = true; | 326 | computeNextAlarm = true; |
327 | } | 327 | } |
328 | } | 328 | } |
329 | } else { // deleted | 329 | } else { // deleted |
330 | if ( incidence == mNextAlarmIncidence ) { | 330 | if ( incidence == mNextAlarmIncidence ) { |
331 | computeNextAlarm = true; | 331 | computeNextAlarm = true; |
332 | } | 332 | } |
333 | } | 333 | } |
@@ -400,62 +400,62 @@ QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | |||
400 | void CalendarLocal::reInitAlarmSettings() | 400 | void CalendarLocal::reInitAlarmSettings() |
401 | { | 401 | { |
402 | if ( !mNextAlarmIncidence ) { | 402 | if ( !mNextAlarmIncidence ) { |
403 | nextAlarm( 1000 ); | 403 | nextAlarm( 1000 ); |
404 | } | 404 | } |
405 | deRegisterAlarm(); | 405 | deRegisterAlarm(); |
406 | mNextAlarmIncidence = 0; | 406 | mNextAlarmIncidence = 0; |
407 | checkAlarmForIncidence( 0, false ); | 407 | checkAlarmForIncidence( 0, false ); |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | QDateTime CalendarLocal::nextAlarm( int daysTo ) | 413 | QDateTime CalendarLocal::nextAlarm( int daysTo ) |
414 | { | 414 | { |
415 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); | 415 | QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); |
416 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); | 416 | QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); |
417 | QDateTime next; | 417 | QDateTime next; |
418 | Event *e; | 418 | Event *e; |
419 | bool ok; | 419 | bool ok; |
420 | bool found = false; | 420 | bool found = false; |
421 | int offset; | 421 | int offset; |
422 | mNextAlarmIncidence = 0; | 422 | mNextAlarmIncidence = 0; |
423 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 423 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
424 | next = e->getNextAlarmDateTime(& ok, &offset ) ; | 424 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
425 | if ( ok ) { | 425 | if ( ok ) { |
426 | if ( next < nextA ) { | 426 | if ( next < nextA ) { |
427 | nextA = next; | 427 | nextA = next; |
428 | found = true; | 428 | found = true; |
429 | mNextSummary = e->summary(); | 429 | mNextSummary = e->summary(); |
430 | mNextAlarmEventDateTime = next.addSecs(offset ) ; | 430 | mNextAlarmEventDateTime = next.addSecs(offset ) ; |
431 | mNextAlarmIncidence = (Incidence *) e; | 431 | mNextAlarmIncidence = (Incidence *) e; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | } | 434 | } |
435 | Todo *t; | 435 | Todo *t; |
436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
437 | next = t->getNextAlarmDateTime(& ok, &offset ) ; | 437 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
438 | if ( ok ) { | 438 | if ( ok ) { |
439 | if ( next < nextA ) { | 439 | if ( next < nextA ) { |
440 | nextA = next; | 440 | nextA = next; |
441 | found = true; | 441 | found = true; |
442 | mNextSummary = t->summary(); | 442 | mNextSummary = t->summary(); |
443 | mNextAlarmEventDateTime = next.addSecs(offset ); | 443 | mNextAlarmEventDateTime = next.addSecs(offset ); |
444 | mNextAlarmIncidence = (Incidence *) t; | 444 | mNextAlarmIncidence = (Incidence *) t; |
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 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " |