-rw-r--r-- | libkcal/calendar.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 1350f6d..9b38d3f 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -398,71 +398,71 @@ Incidence* Calendar::incidence( const QString& uid ) | |||
398 | Incidence* i; | 398 | Incidence* i; |
399 | 399 | ||
400 | if( (i = todo( uid )) != 0 ) | 400 | if( (i = todo( uid )) != 0 ) |
401 | return i; | 401 | return i; |
402 | if( (i = event( uid )) != 0 ) | 402 | if( (i = event( uid )) != 0 ) |
403 | return i; | 403 | return i; |
404 | if( (i = journal( uid )) != 0 ) | 404 | if( (i = journal( uid )) != 0 ) |
405 | return i; | 405 | return i; |
406 | 406 | ||
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | QPtrList<Todo> Calendar::todos() | 410 | QPtrList<Todo> Calendar::todos() |
411 | { | 411 | { |
412 | QPtrList<Todo> tl = rawTodos(); | 412 | QPtrList<Todo> tl = rawTodos(); |
413 | mFilter->apply( &tl ); | 413 | mFilter->apply( &tl ); |
414 | return tl; | 414 | return tl; |
415 | } | 415 | } |
416 | 416 | ||
417 | // When this is called, the todo have already been added to the calendar. | 417 | // When this is called, the todo have already been added to the calendar. |
418 | // This method is only about linking related todos | 418 | // This method is only about linking related todos |
419 | void Calendar::setupRelations( Incidence *incidence ) | 419 | void Calendar::setupRelations( Incidence *incidence ) |
420 | { | 420 | { |
421 | QString uid = incidence->uid(); | 421 | QString uid = incidence->uid(); |
422 | //qDebug("Calendar::setupRelations %s", incidence->summary().latin1()); | 422 | qDebug("Calendar::setupRelations %s", incidence->summary().latin1()); |
423 | // First, go over the list of orphans and see if this is their parent | 423 | // First, go over the list of orphans and see if this is their parent |
424 | while( Incidence* i = mOrphans[ uid ] ) { | 424 | while( Incidence* i = mOrphans[ uid ] ) { |
425 | mOrphans.remove( uid ); | 425 | mOrphans.remove( uid ); |
426 | i->setRelatedTo( incidence ); | 426 | i->setRelatedTo( incidence ); |
427 | //qDebug("Add child %s ti inc %s", i->summary().latin1(),incidence->summary().latin1()); | 427 | qDebug("Add child %s ti inc %s", i->summary().latin1(),incidence->summary().latin1()); |
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 | //qDebug("Test parent for %s", incidence->summary().latin1()); | 436 | qDebug("Test parent for %s", incidence->summary().latin1()); |
437 | Incidence* parent = this->incidenceForUid( incidence->relatedToUid(), true ); | 437 | Incidence* parent = this->incidenceForUid( incidence->relatedToUid(), true ); |
438 | if( parent ) { | 438 | if( parent ) { |
439 | // Found it | 439 | // Found it |
440 | // qDebug("parent found for for %s", incidence->summary().latin1()); | 440 | qDebug("parent found for for %s", incidence->summary().latin1()); |
441 | incidence->setRelatedTo( parent ); | 441 | incidence->setRelatedTo( parent ); |
442 | parent->addRelation( incidence ); | 442 | parent->addRelation( incidence ); |
443 | } else { | 443 | } else { |
444 | // qDebug("NO parent found for for %s", incidence->summary().latin1()); | 444 | qDebug("NO parent found for for %s", incidence->summary().latin1()); |
445 | // Not found, put this in the mOrphans list | 445 | // Not found, put this in the mOrphans list |
446 | mOrphans.insert( incidence->relatedToUid(), incidence ); | 446 | mOrphans.insert( incidence->relatedToUid(), incidence ); |
447 | mOrphanUids.insert( incidence->uid(), incidence ); | 447 | mOrphanUids.insert( incidence->uid(), incidence ); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | // If a task with subtasks is deleted, move it's subtasks to the orphans list | 452 | // If a task with subtasks is deleted, move it's subtasks to the orphans list |
453 | void Calendar::removeRelations( Incidence *incidence ) | 453 | void Calendar::removeRelations( Incidence *incidence ) |
454 | { | 454 | { |
455 | // qDebug("Calendar::removeRelations "); | 455 | // qDebug("Calendar::removeRelations "); |
456 | QString uid = incidence->uid(); | 456 | QString uid = incidence->uid(); |
457 | 457 | ||
458 | QPtrList<Incidence> relations = incidence->relations(); | 458 | QPtrList<Incidence> relations = incidence->relations(); |
459 | for( Incidence* i = relations.first(); i; i = relations.next() ) | 459 | for( Incidence* i = relations.first(); i; i = relations.next() ) |
460 | if( !mOrphanUids.find( i->uid() ) ) { | 460 | if( !mOrphanUids.find( i->uid() ) ) { |
461 | mOrphans.insert( uid, i ); | 461 | mOrphans.insert( uid, i ); |
462 | mOrphanUids.insert( i->uid(), i ); | 462 | mOrphanUids.insert( i->uid(), i ); |
463 | i->setRelatedTo( 0 ); | 463 | i->setRelatedTo( 0 ); |
464 | i->setRelatedToUid( uid ); | 464 | i->setRelatedToUid( uid ); |
465 | } | 465 | } |
466 | 466 | ||
467 | // If this incidence is related to something else, tell that about it | 467 | // If this incidence is related to something else, tell that about it |
468 | if( incidence->relatedTo() ) | 468 | if( incidence->relatedTo() ) |