summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.cpp
Unidiff
Diffstat (limited to 'libkcal/calendarlocal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 5c889c3..00a43e5 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -277,49 +277,48 @@ Todo *CalendarLocal::todo( const QString &uid )
277 277
278 return 0; 278 return 0;
279} 279}
280QString CalendarLocal::nextSummary() const 280QString CalendarLocal::nextSummary() const
281{ 281{
282 return mNextSummary; 282 return mNextSummary;
283} 283}
284QDateTime CalendarLocal::nextAlarmEventDateTime() const 284QDateTime CalendarLocal::nextAlarmEventDateTime() const
285{ 285{
286 return mNextAlarmEventDateTime; 286 return mNextAlarmEventDateTime;
287} 287}
288void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) 288void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
289{ 289{
290 //mNextAlarmIncidence 290 //mNextAlarmIncidence
291 //mNextAlarmDateTime 291 //mNextAlarmDateTime
292 //return mNextSummary; 292 //return mNextSummary;
293 //return mNextAlarmEventDateTime; 293 //return mNextAlarmEventDateTime;
294 bool newNextAlarm = false; 294 bool newNextAlarm = false;
295 bool computeNextAlarm = false; 295 bool computeNextAlarm = false;
296 bool ok; 296 bool ok;
297 int offset; 297 int offset;
298 QDateTime nextA; 298 QDateTime nextA;
299 // QString nextSum; 299 // QString nextSum;
300 //QDateTime nextEvent; 300 //QDateTime nextEvent;
301 mNextAlarmEventDateTime = QDateTime();
302 if ( mNextAlarmIncidence == 0 || incidence == 0 ) { 301 if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
303 computeNextAlarm = true; 302 computeNextAlarm = true;
304 } else { 303 } else {
305 if ( ! deleted ) { 304 if ( ! deleted ) {
306 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 305 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ;
307 if ( ok ) { 306 if ( ok ) {
308 if ( nextA < mNextAlarmDateTime ) { 307 if ( nextA < mNextAlarmDateTime ) {
309 deRegisterAlarm(); 308 deRegisterAlarm();
310 mNextAlarmDateTime = nextA; 309 mNextAlarmDateTime = nextA;
311 mNextSummary = incidence->summary(); 310 mNextSummary = incidence->summary();
312 mNextAlarmEventDateTime = nextA.addSecs(offset ) ; 311 mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
313 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 312 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
314 newNextAlarm = true; 313 newNextAlarm = true;
315 mNextAlarmIncidence = incidence; 314 mNextAlarmIncidence = incidence;
316 } else { 315 } else {
317 if ( incidence == mNextAlarmIncidence ) { 316 if ( incidence == mNextAlarmIncidence ) {
318 computeNextAlarm = true; 317 computeNextAlarm = true;
319 } 318 }
320 } 319 }
321 } else { 320 } else {
322 if ( mNextAlarmIncidence == incidence ) { 321 if ( mNextAlarmIncidence == incidence ) {
323 computeNextAlarm = true; 322 computeNextAlarm = true;
324 } 323 }
325 } 324 }
@@ -353,48 +352,49 @@ QString CalendarLocal:: getAlarmNotification()
353 ret = "audio_alarm" +alarm->audioFile() +"+++"; 352 ret = "audio_alarm" +alarm->audioFile() +"+++";
354 } 353 }
355 ret += "cal_alarm"+ mNextSummary.left( 25 ); 354 ret += "cal_alarm"+ mNextSummary.left( 25 );
356 if ( mNextSummary.length() > 25 ) 355 if ( mNextSummary.length() > 25 )
357 ret += "\n" + mNextSummary.mid(25, 25 ); 356 ret += "\n" + mNextSummary.mid(25, 25 );
358 ret+= "\n"+mNextAlarmEventDateTimeString; 357 ret+= "\n"+mNextAlarmEventDateTimeString;
359 return ret; 358 return ret;
360} 359}
361void CalendarLocal::registerAlarm() 360void CalendarLocal::registerAlarm()
362{ 361{
363 mLastAlarmNotificationString = getAlarmNotification(); 362 mLastAlarmNotificationString = getAlarmNotification();
364 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() ); 363 // qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
365 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 364 emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
366// #ifndef DESKTOP_VERSION 365// #ifndef DESKTOP_VERSION
367// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() ); 366// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
368// #endif 367// #endif
369} 368}
370void CalendarLocal::deRegisterAlarm() 369void CalendarLocal::deRegisterAlarm()
371{ 370{
372 if ( mLastAlarmNotificationString.isNull() ) 371 if ( mLastAlarmNotificationString.isNull() )
373 return; 372 return;
374 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() ); 373 //qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
375 374
376 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString ); 375 emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
376 mNextAlarmEventDateTime = QDateTime();
377// #ifndef DESKTOP_VERSION 377// #ifndef DESKTOP_VERSION
378// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() ); 378// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
379// #endif 379// #endif
380} 380}
381 381
382QPtrList<Todo> CalendarLocal::todos( const QDate &date ) 382QPtrList<Todo> CalendarLocal::todos( const QDate &date )
383{ 383{
384 QPtrList<Todo> todos; 384 QPtrList<Todo> todos;
385 385
386 Todo *todo; 386 Todo *todo;
387 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 387 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
388 if ( todo->hasDueDate() && todo->dtDue().date() == date ) { 388 if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
389 todos.append( todo ); 389 todos.append( todo );
390 } 390 }
391 } 391 }
392 392
393 filter()->apply( &todos ); 393 filter()->apply( &todos );
394 return todos; 394 return todos;
395} 395}
396void CalendarLocal::reInitAlarmSettings() 396void CalendarLocal::reInitAlarmSettings()
397{ 397{
398 if ( !mNextAlarmIncidence ) { 398 if ( !mNextAlarmIncidence ) {
399 nextAlarm( 1000 ); 399 nextAlarm( 1000 );
400 } 400 }