author | zautrix <zautrix> | 2004-06-29 12:52:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-29 12:52:18 (UTC) |
commit | 275e70532bb26ed78ce2d3bebf980dd745368ec2 (patch) (unidiff) | |
tree | c9252a9ec50856c86cc1165007f841c50d5cdc51 /libkcal/calendar.cpp | |
parent | 7b2b9f2b05809b9577837551ad864d88b9b355ef (diff) | |
download | kdepimpi-275e70532bb26ed78ce2d3bebf980dd745368ec2.zip kdepimpi-275e70532bb26ed78ce2d3bebf980dd745368ec2.tar.gz kdepimpi-275e70532bb26ed78ce2d3bebf980dd745368ec2.tar.bz2 |
Removed the include moc on KO dir
-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 dc198bd..32aac7a 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -298,129 +298,129 @@ QPtrList<Event> Calendar::events() | |||
298 | 298 | ||
299 | bool Calendar::addIncidence(Incidence *i) | 299 | bool Calendar::addIncidence(Incidence *i) |
300 | { | 300 | { |
301 | Incidence::AddVisitor<Calendar> v(this); | 301 | Incidence::AddVisitor<Calendar> v(this); |
302 | 302 | ||
303 | return i->accept(v); | 303 | return i->accept(v); |
304 | } | 304 | } |
305 | void Calendar::deleteIncidence(Incidence *in) | 305 | void Calendar::deleteIncidence(Incidence *in) |
306 | { | 306 | { |
307 | if ( in->type() == "Event" ) | 307 | if ( in->type() == "Event" ) |
308 | deleteEvent( (Event*) in ); | 308 | deleteEvent( (Event*) in ); |
309 | else if ( in->type() =="Todo" ) | 309 | else if ( in->type() =="Todo" ) |
310 | deleteTodo( (Todo*) in); | 310 | deleteTodo( (Todo*) in); |
311 | else if ( in->type() =="Journal" ) | 311 | else if ( in->type() =="Journal" ) |
312 | deleteJournal( (Journal*) in ); | 312 | deleteJournal( (Journal*) in ); |
313 | } | 313 | } |
314 | 314 | ||
315 | Incidence* Calendar::incidence( const QString& uid ) | 315 | Incidence* Calendar::incidence( const QString& uid ) |
316 | { | 316 | { |
317 | Incidence* i; | 317 | Incidence* i; |
318 | 318 | ||
319 | if( (i = todo( uid )) != 0 ) | 319 | if( (i = todo( uid )) != 0 ) |
320 | return i; | 320 | return i; |
321 | if( (i = event( uid )) != 0 ) | 321 | if( (i = event( uid )) != 0 ) |
322 | return i; | 322 | return i; |
323 | if( (i = journal( uid )) != 0 ) | 323 | if( (i = journal( uid )) != 0 ) |
324 | return i; | 324 | return i; |
325 | 325 | ||
326 | return 0; | 326 | return 0; |
327 | } | 327 | } |
328 | 328 | ||
329 | QPtrList<Todo> Calendar::todos() | 329 | QPtrList<Todo> Calendar::todos() |
330 | { | 330 | { |
331 | QPtrList<Todo> tl = rawTodos(); | 331 | QPtrList<Todo> tl = rawTodos(); |
332 | mFilter->apply( &tl ); | 332 | mFilter->apply( &tl ); |
333 | return tl; | 333 | return tl; |
334 | } | 334 | } |
335 | 335 | ||
336 | // When this is called, the todo have already been added to the calendar. | 336 | // When this is called, the todo have already been added to the calendar. |
337 | // This method is only about linking related todos | 337 | // This method is only about linking related todos |
338 | void Calendar::setupRelations( Incidence *incidence ) | 338 | void Calendar::setupRelations( Incidence *incidence ) |
339 | { | 339 | { |
340 | QString uid = incidence->uid(); | 340 | QString uid = incidence->uid(); |
341 | //qDebug("Calendar::setupRelations "); | 341 | //qDebug("Calendar::setupRelations "); |
342 | // First, go over the list of orphans and see if this is their parent | 342 | // First, go over the list of orphans and see if this is their parent |
343 | while( Incidence* i = mOrphans[ uid ] ) { | 343 | while( Incidence* i = mOrphans[ uid ] ) { |
344 | mOrphans.remove( uid ); | 344 | mOrphans.remove( uid ); |
345 | i->setRelatedTo( incidence ); | 345 | i->setRelatedTo( incidence ); |
346 | incidence->addRelation( i ); | 346 | incidence->addRelation( i ); |
347 | mOrphanUids.remove( i->uid() ); | 347 | mOrphanUids.remove( i->uid() ); |
348 | } | 348 | } |
349 | 349 | ||
350 | // Now see about this incidences parent | 350 | // Now see about this incidences parent |
351 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { | 351 | if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { |
352 | // This incidence has a uid it is related to, but is not registered to it yet | 352 | // This incidence has a uid it is related to, but is not registered to it yet |
353 | // Try to find it | 353 | // Try to find it |
354 | Incidence* parent = this->incidence( incidence->relatedToUid() ); | 354 | Incidence* parent = this->incidence( incidence->relatedToUid() ); |
355 | if( parent ) { | 355 | if( parent ) { |
356 | // Found it | 356 | // Found it |
357 | incidence->setRelatedTo( parent ); | 357 | incidence->setRelatedTo( parent ); |
358 | parent->addRelation( incidence ); | 358 | parent->addRelation( incidence ); |
359 | } else { | 359 | } else { |
360 | // Not found, put this in the mOrphans list | 360 | // Not found, put this in the mOrphans list |
361 | mOrphans.insert( incidence->relatedToUid(), incidence ); | 361 | mOrphans.insert( incidence->relatedToUid(), incidence ); |
362 | mOrphanUids.insert( incidence->uid(), incidence ); | 362 | mOrphanUids.insert( incidence->uid(), incidence ); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | // If a task with subtasks is deleted, move it's subtasks to the orphans list | 367 | // If a task with subtasks is deleted, move it's subtasks to the orphans list |
368 | void Calendar::removeRelations( Incidence *incidence ) | 368 | void Calendar::removeRelations( Incidence *incidence ) |
369 | { | 369 | { |
370 | // qDebug("Calendar::removeRelations "); | 370 | // qDebug("Calendar::removeRelations "); |
371 | QString uid = incidence->uid(); | 371 | QString uid = incidence->uid(); |
372 | 372 | ||
373 | QPtrList<Incidence> relations = incidence->relations(); | 373 | QPtrList<Incidence> relations = incidence->relations(); |
374 | for( Incidence* i = relations.first(); i; i = relations.next() ) | 374 | for( Incidence* i = relations.first(); i; i = relations.next() ) |
375 | if( !mOrphanUids.find( i->uid() ) ) { | 375 | if( !mOrphanUids.find( i->uid() ) ) { |
376 | mOrphans.insert( uid, i ); | 376 | mOrphans.insert( uid, i ); |
377 | mOrphanUids.insert( i->uid(), i ); | 377 | mOrphanUids.insert( i->uid(), i ); |
378 | i->setRelatedTo( 0 ); | 378 | i->setRelatedTo( 0 ); |
379 | i->setRelatedToUid( uid ); | 379 | i->setRelatedToUid( uid ); |
380 | } | 380 | } |
381 | 381 | ||
382 | // If this incidence is related to something else, tell that about it | 382 | // If this incidence is related to something else, tell that about it |
383 | if( incidence->relatedTo() ) | 383 | if( incidence->relatedTo() ) |
384 | incidence->relatedTo()->removeRelation( incidence ); | 384 | incidence->relatedTo()->removeRelation( incidence ); |
385 | 385 | ||
386 | // Remove this one from the orphans list | 386 | // Remove this one from the orphans list |
387 | if( mOrphanUids.remove( uid ) ) | 387 | if( mOrphanUids.remove( uid ) ) |
388 | // This incidence is located in the orphans list - it should be removed | 388 | // This incidence is located in the orphans list - it should be removed |
389 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { | 389 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { |
390 | // Removing wasn't that easy | 390 | // Removing wasn't that easy |
391 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { | 391 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { |
392 | if( it.current()->uid() == uid ) { | 392 | if( it.current()->uid() == uid ) { |
393 | mOrphans.remove( it.currentKey() ); | 393 | mOrphans.remove( it.currentKey() ); |
394 | break; | 394 | break; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | void Calendar::registerObserver( Observer *observer ) | 400 | void Calendar::registerObserver( Observer *observer ) |
401 | { | 401 | { |
402 | mObserver = observer; | 402 | mObserver = observer; |
403 | mNewObserver = true; | 403 | mNewObserver = true; |
404 | } | 404 | } |
405 | 405 | ||
406 | void Calendar::setModified( bool modified ) | 406 | void Calendar::setModified( bool modified ) |
407 | { | 407 | { |
408 | if ( mObserver ) mObserver->calendarModified( modified, this ); | 408 | if ( mObserver ) mObserver->calendarModified( modified, this ); |
409 | if ( modified != mModified || mNewObserver ) { | 409 | if ( modified != mModified || mNewObserver ) { |
410 | mNewObserver = false; | 410 | mNewObserver = false; |
411 | // if ( mObserver ) mObserver->calendarModified( modified, this ); | 411 | // if ( mObserver ) mObserver->calendarModified( modified, this ); |
412 | mModified = modified; | 412 | mModified = modified; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | 415 | ||
416 | void Calendar::setLoadedProductId( const QString &id ) | 416 | void Calendar::setLoadedProductId( const QString &id ) |
417 | { | 417 | { |
418 | mLoadedProductId = id; | 418 | mLoadedProductId = id; |
419 | } | 419 | } |
420 | 420 | ||
421 | QString Calendar::loadedProductId() | 421 | QString Calendar::loadedProductId() |
422 | { | 422 | { |
423 | return mLoadedProductId; | 423 | return mLoadedProductId; |
424 | } | 424 | } |
425 | 425 | ||
426 | #include "calendar.moc" | 426 | //#include "calendar.moc" |