summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.cpp
Unidiff
Diffstat (limited to 'libkcal/calendar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index ed39ddb..7e8e2c5 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -308,101 +308,101 @@ QPtrList<Incidence> Calendar::rawIncidences()
308} 308}
309 309
310QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) 310QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
311{ 311{
312 QPtrList<Event> el = rawEventsForDate(date,sorted); 312 QPtrList<Event> el = rawEventsForDate(date,sorted);
313 mFilter->apply(&el); 313 mFilter->apply(&el);
314 return el; 314 return el;
315} 315}
316 316
317QPtrList<Event> Calendar::events( const QDateTime &qdt ) 317QPtrList<Event> Calendar::events( const QDateTime &qdt )
318{ 318{
319 QPtrList<Event> el = rawEventsForDate(qdt); 319 QPtrList<Event> el = rawEventsForDate(qdt);
320 mFilter->apply(&el); 320 mFilter->apply(&el);
321 return el; 321 return el;
322} 322}
323 323
324QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, 324QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
325 bool inclusive) 325 bool inclusive)
326{ 326{
327 QPtrList<Event> el = rawEvents(start,end,inclusive); 327 QPtrList<Event> el = rawEvents(start,end,inclusive);
328 mFilter->apply(&el); 328 mFilter->apply(&el);
329 return el; 329 return el;
330} 330}
331 331
332QPtrList<Event> Calendar::events() 332QPtrList<Event> Calendar::events()
333{ 333{
334 QPtrList<Event> el = rawEvents(); 334 QPtrList<Event> el = rawEvents();
335 mFilter->apply(&el); 335 mFilter->apply(&el);
336 return el; 336 return el;
337} 337}
338void Calendar::addIncidenceBranch(Incidence *i) 338void Calendar::addIncidenceBranch(Incidence *i)
339{ 339{
340 addIncidence( i ); 340 addIncidence( i );
341 Incidence * inc; 341 Incidence * inc;
342 QPtrList<Incidence> Relations = i->relations(); 342 QPtrList<Incidence> Relations = i->relations();
343 for (inc=Relations.first();inc;inc=Relations.next()) { 343 for (inc=Relations.first();inc;inc=Relations.next()) {
344 addIncidenceBranch( inc ); 344 addIncidenceBranch( inc );
345 } 345 }
346} 346}
347 347
348bool Calendar::addIncidence(Incidence *i) 348bool Calendar::addIncidence(Incidence *i)
349{ 349{
350 Incidence::AddVisitor<Calendar> v(this); 350 Incidence::AddVisitor<Calendar> v(this);
351 351
352 return i->accept(v); 352 return i->accept(v);
353} 353}
354void Calendar::deleteIncidence(Incidence *in) 354void Calendar::deleteIncidence(Incidence *in)
355{ 355{
356 if ( in->type() == "Event" ) 356 if ( in->typeID() == eventID )
357 deleteEvent( (Event*) in ); 357 deleteEvent( (Event*) in );
358 else if ( in->type() =="Todo" ) 358 else if ( in->typeID() == todoID )
359 deleteTodo( (Todo*) in); 359 deleteTodo( (Todo*) in);
360 else if ( in->type() =="Journal" ) 360 else if ( in->typeID() == journalID )
361 deleteJournal( (Journal*) in ); 361 deleteJournal( (Journal*) in );
362} 362}
363 363
364Incidence* Calendar::incidence( const QString& uid ) 364Incidence* Calendar::incidence( const QString& uid )
365{ 365{
366 Incidence* i; 366 Incidence* i;
367 367
368 if( (i = todo( uid )) != 0 ) 368 if( (i = todo( uid )) != 0 )
369 return i; 369 return i;
370 if( (i = event( uid )) != 0 ) 370 if( (i = event( uid )) != 0 )
371 return i; 371 return i;
372 if( (i = journal( uid )) != 0 ) 372 if( (i = journal( uid )) != 0 )
373 return i; 373 return i;
374 374
375 return 0; 375 return 0;
376} 376}
377 377
378QPtrList<Todo> Calendar::todos() 378QPtrList<Todo> Calendar::todos()
379{ 379{
380 QPtrList<Todo> tl = rawTodos(); 380 QPtrList<Todo> tl = rawTodos();
381 mFilter->apply( &tl ); 381 mFilter->apply( &tl );
382 return tl; 382 return tl;
383} 383}
384 384
385// When this is called, the todo have already been added to the calendar. 385// When this is called, the todo have already been added to the calendar.
386// This method is only about linking related todos 386// This method is only about linking related todos
387void Calendar::setupRelations( Incidence *incidence ) 387void Calendar::setupRelations( Incidence *incidence )
388{ 388{
389 QString uid = incidence->uid(); 389 QString uid = incidence->uid();
390 //qDebug("Calendar::setupRelations "); 390 //qDebug("Calendar::setupRelations ");
391 // First, go over the list of orphans and see if this is their parent 391 // First, go over the list of orphans and see if this is their parent
392 while( Incidence* i = mOrphans[ uid ] ) { 392 while( Incidence* i = mOrphans[ uid ] ) {
393 mOrphans.remove( uid ); 393 mOrphans.remove( uid );
394 i->setRelatedTo( incidence ); 394 i->setRelatedTo( incidence );
395 incidence->addRelation( i ); 395 incidence->addRelation( i );
396 mOrphanUids.remove( i->uid() ); 396 mOrphanUids.remove( i->uid() );
397 } 397 }
398 398
399 // Now see about this incidences parent 399 // Now see about this incidences parent
400 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { 400 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) {
401 // This incidence has a uid it is related to, but is not registered to it yet 401 // This incidence has a uid it is related to, but is not registered to it yet
402 // Try to find it 402 // Try to find it
403 Incidence* parent = this->incidence( incidence->relatedToUid() ); 403 Incidence* parent = this->incidence( incidence->relatedToUid() );
404 if( parent ) { 404 if( parent ) {
405 // Found it 405 // Found it
406 incidence->setRelatedTo( parent ); 406 incidence->setRelatedTo( parent );
407 parent->addRelation( incidence ); 407 parent->addRelation( incidence );
408 } else { 408 } else {