-rw-r--r-- | libkcal/calendar.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index b1806ee..8535191 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -319,129 +319,129 @@ void Calendar::resetTempSyncStat() | |||
319 | 319 | ||
320 | QPtrList<Journal> j = journals(); | 320 | QPtrList<Journal> j = journals(); |
321 | for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 321 | for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
322 | } | 322 | } |
323 | QPtrList<Incidence> Calendar::rawIncidences() | 323 | QPtrList<Incidence> Calendar::rawIncidences() |
324 | { | 324 | { |
325 | QPtrList<Incidence> incidences; | 325 | QPtrList<Incidence> incidences; |
326 | 326 | ||
327 | Incidence *i; | 327 | Incidence *i; |
328 | 328 | ||
329 | QPtrList<Event> e = rawEvents(); | 329 | QPtrList<Event> e = rawEvents(); |
330 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); | 330 | for( i = e.first(); i; i = e.next() ) incidences.append( i ); |
331 | 331 | ||
332 | QPtrList<Todo> t = rawTodos(); | 332 | QPtrList<Todo> t = rawTodos(); |
333 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); | 333 | for( i = t.first(); i; i = t.next() ) incidences.append( i ); |
334 | 334 | ||
335 | QPtrList<Journal> j = journals(); | 335 | QPtrList<Journal> j = journals(); |
336 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); | 336 | for( i = j.first(); i; i = j.next() ) incidences.append( i ); |
337 | 337 | ||
338 | return incidences; | 338 | return incidences; |
339 | } | 339 | } |
340 | 340 | ||
341 | QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) | 341 | QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) |
342 | { | 342 | { |
343 | QPtrList<Event> el = rawEventsForDate(date,sorted); | 343 | QPtrList<Event> el = rawEventsForDate(date,sorted); |
344 | mFilter->apply(&el); | 344 | mFilter->apply(&el); |
345 | return el; | 345 | return el; |
346 | } | 346 | } |
347 | 347 | ||
348 | QPtrList<Event> Calendar::events( const QDateTime &qdt ) | 348 | QPtrList<Event> Calendar::events( const QDateTime &qdt ) |
349 | { | 349 | { |
350 | QPtrList<Event> el = rawEventsForDate(qdt); | 350 | QPtrList<Event> el = rawEventsForDate(qdt); |
351 | mFilter->apply(&el); | 351 | mFilter->apply(&el); |
352 | return el; | 352 | return el; |
353 | } | 353 | } |
354 | 354 | ||
355 | QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, | 355 | QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, |
356 | bool inclusive) | 356 | bool inclusive) |
357 | { | 357 | { |
358 | QPtrList<Event> el = rawEvents(start,end,inclusive); | 358 | QPtrList<Event> el = rawEvents(start,end,inclusive); |
359 | mFilter->apply(&el); | 359 | mFilter->apply(&el); |
360 | return el; | 360 | return el; |
361 | } | 361 | } |
362 | 362 | ||
363 | QPtrList<Event> Calendar::events() | 363 | QPtrList<Event> Calendar::events() |
364 | { | 364 | { |
365 | QPtrList<Event> el = rawEvents(); | 365 | QPtrList<Event> el = rawEvents(); |
366 | mFilter->apply(&el); | 366 | mFilter->apply(&el); |
367 | return el; | 367 | return el; |
368 | } | 368 | } |
369 | void Calendar::addIncidenceBranch(Incidence *i) | 369 | void Calendar::addIncidenceBranch(Incidence *i) |
370 | { | 370 | { |
371 | addIncidence( i ); | 371 | addIncidence( i ); |
372 | Incidence * inc; | 372 | Incidence * inc; |
373 | QPtrList<Incidence> Relations = i->relations(); | 373 | QPtrList<Incidence> Relations = i->relations(); |
374 | for (inc=Relations.first();inc;inc=Relations.next()) { | 374 | for (inc=Relations.first();inc;inc=Relations.next()) { |
375 | addIncidenceBranch( inc ); | 375 | addIncidenceBranch( inc ); |
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | bool Calendar::addIncidence(Incidence *i) | 379 | bool Calendar::addIncidence(Incidence *i) |
380 | { | 380 | { |
381 | Incidence::AddVisitor<Calendar> v(this); | 381 | Incidence::AddVisitor<Calendar> v(this); |
382 | if ( i->calID() == 0 ) | 382 | if ( i->calID() == 0 ) |
383 | i->setCalID( mDefaultCalendar ); | 383 | i->setCalID_block( mDefaultCalendar ); |
384 | i->setCalEnabled( true ); | 384 | i->setCalEnabled( true ); |
385 | return i->accept(v); | 385 | return i->accept(v); |
386 | } | 386 | } |
387 | void Calendar::deleteIncidence(Incidence *in) | 387 | void Calendar::deleteIncidence(Incidence *in) |
388 | { | 388 | { |
389 | if ( in->typeID() == eventID ) | 389 | if ( in->typeID() == eventID ) |
390 | deleteEvent( (Event*) in ); | 390 | deleteEvent( (Event*) in ); |
391 | else if ( in->typeID() == todoID ) | 391 | else if ( in->typeID() == todoID ) |
392 | deleteTodo( (Todo*) in); | 392 | deleteTodo( (Todo*) in); |
393 | else if ( in->typeID() == journalID ) | 393 | else if ( in->typeID() == journalID ) |
394 | deleteJournal( (Journal*) in ); | 394 | deleteJournal( (Journal*) in ); |
395 | } | 395 | } |
396 | 396 | ||
397 | Incidence* Calendar::incidence( const QString& uid ) | 397 | Incidence* Calendar::incidence( const QString& uid ) |
398 | { | 398 | { |
399 | Incidence* i; | 399 | Incidence* i; |
400 | 400 | ||
401 | if( (i = todo( uid )) != 0 ) | 401 | if( (i = todo( uid )) != 0 ) |
402 | return i; | 402 | return i; |
403 | if( (i = event( uid )) != 0 ) | 403 | if( (i = event( uid )) != 0 ) |
404 | return i; | 404 | return i; |
405 | if( (i = journal( uid )) != 0 ) | 405 | if( (i = journal( uid )) != 0 ) |
406 | return i; | 406 | return i; |
407 | 407 | ||
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
411 | QPtrList<Todo> Calendar::todos() | 411 | QPtrList<Todo> Calendar::todos() |
412 | { | 412 | { |
413 | QPtrList<Todo> tl = rawTodos(); | 413 | QPtrList<Todo> tl = rawTodos(); |
414 | mFilter->apply( &tl ); | 414 | mFilter->apply( &tl ); |
415 | return tl; | 415 | return tl; |
416 | } | 416 | } |
417 | 417 | ||
418 | // When this is called, the todo have already been added to the calendar. | 418 | // When this is called, the todo have already been added to the calendar. |
419 | // This method is only about linking related todos | 419 | // This method is only about linking related todos |
420 | void Calendar::setupRelations( Incidence *incidence ) | 420 | void Calendar::setupRelations( Incidence *incidence ) |
421 | { | 421 | { |
422 | QString uid = incidence->uid(); | 422 | QString uid = incidence->uid(); |
423 | //qDebug("Calendar::setupRelations "); | 423 | //qDebug("Calendar::setupRelations "); |
424 | // First, go over the list of orphans and see if this is their parent | 424 | // First, go over the list of orphans and see if this is their parent |
425 | while( Incidence* i = mOrphans[ uid ] ) { | 425 | while( Incidence* i = mOrphans[ uid ] ) { |
426 | mOrphans.remove( uid ); | 426 | mOrphans.remove( uid ); |
427 | i->setRelatedTo( incidence ); | 427 | i->setRelatedTo( incidence ); |
428 | incidence->addRelation( i ); | 428 | incidence->addRelation( i ); |
429 | mOrphanUids.remove( i->uid() ); | 429 | mOrphanUids.remove( i->uid() ); |
430 | } | 430 | } |
431 | 431 | ||
432 | // Now see about this incidences parent | 432 | // Now see about this incidences parent |
433 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { | 433 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { |
434 | // This incidence has a uid it is related to, but is not registered to it yet | 434 | // This incidence has a uid it is related to, but is not registered to it yet |
435 | // Try to find it | 435 | // Try to find it |
436 | Incidence* parent = this->incidence( incidence->relatedToUid() ); | 436 | Incidence* parent = this->incidence( incidence->relatedToUid() ); |
437 | if( parent ) { | 437 | if( parent ) { |
438 | // Found it | 438 | // Found it |
439 | incidence->setRelatedTo( parent ); | 439 | incidence->setRelatedTo( parent ); |
440 | parent->addRelation( incidence ); | 440 | parent->addRelation( incidence ); |
441 | } else { | 441 | } else { |
442 | // Not found, put this in the mOrphans list | 442 | // Not found, put this in the mOrphans list |
443 | mOrphans.insert( incidence->relatedToUid(), incidence ); | 443 | mOrphans.insert( incidence->relatedToUid(), incidence ); |
444 | mOrphanUids.insert( incidence->uid(), incidence ); | 444 | mOrphanUids.insert( incidence->uid(), incidence ); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |