summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 980663f..8a5a76f 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -70,432 +70,441 @@ CalendarLocal::~CalendarLocal()
70 close(); 70 close();
71} 71}
72bool CalendarLocal::mergeCalendarFile( QString name ) 72bool CalendarLocal::mergeCalendarFile( QString name )
73{ 73{
74 CalendarLocal calendar( timeZoneId() ); 74 CalendarLocal calendar( timeZoneId() );
75 calendar.setDefaultCalendar( 1 ); 75 calendar.setDefaultCalendar( 1 );
76 if ( calendar.load( name ) ) { 76 if ( calendar.load( name ) ) {
77 mergeCalendar( &calendar ); 77 mergeCalendar( &calendar );
78 return true; 78 return true;
79 } 79 }
80 return false; 80 return false;
81} 81}
82 82
83Todo* CalendarLocal::todoForUid( const QString& uid, bool doNotCheckDuplicates, bool enabledOnly,int * isDup ) 83Todo* CalendarLocal::todoForUid( const QString& uid, bool doNotCheckDuplicates, bool enabledOnly,int * isDup )
84{ 84{
85 85
86 int calID = 0; 86 int calID = 0;
87 if ( isDup && *isDup > 0 ) 87 if ( isDup && *isDup > 0 )
88 calID = *isDup; 88 calID = *isDup;
89 Todo *todo;; 89 Todo *todo;;
90 Todo *retVal = 0; 90 Todo *retVal = 0;
91 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 91 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
92 if ( todo->uid() == uid ) { 92 if ( todo->uid() == uid ) {
93 if( calID ) { 93 if( calID ) {
94 if ( todo->calID() != calID ) 94 if ( todo->calID() != calID )
95 continue; 95 continue;
96 } 96 }
97 else { 97 else {
98 if ( enabledOnly ) { 98 if ( enabledOnly ) {
99 if ( !todo->calEnabled() ) { 99 if ( !todo->calEnabled() ) {
100 if ( isDup ) 100 if ( isDup )
101 *isDup = todo->calID(); 101 *isDup = todo->calID();
102 continue; 102 continue;
103 } 103 }
104 } 104 }
105 } 105 }
106 if ( doNotCheckDuplicates ) return todo; 106 if ( doNotCheckDuplicates ) return todo;
107 if ( retVal ) { 107 if ( retVal ) {
108 if ( retVal->calID() > todo->calID() ) { 108 if ( retVal->calID() > todo->calID() ) {
109 if ( isDup ) 109 if ( isDup )
110 *isDup = retVal->calID(); 110 *isDup = retVal->calID();
111 retVal = todo; 111 retVal = todo;
112 } 112 }
113 } else { 113 } else {
114 retVal = todo; 114 retVal = todo;
115 } 115 }
116 } 116 }
117 } 117 }
118 return retVal; 118 return retVal;
119} 119}
120//if ( isDup) and * isDup == 0: store duplicate found cal id in isDup 120//if ( isDup) and * isDup == 0: store duplicate found cal id in isDup
121//if ( isDup) and * isDup > 0: search only in calendar with ID *isDup, ignore enabledOnly 121//if ( isDup) and * isDup > 0: search only in calendar with ID *isDup, ignore enabledOnly
122 122
123Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates, bool enabledOnly, int * isDup ) 123Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates, bool enabledOnly, int * isDup )
124{ 124{
125 int calID = 0; 125 int calID = 0;
126 if ( isDup && *isDup > 0 ) 126 if ( isDup && *isDup > 0 )
127 calID = *isDup; 127 calID = *isDup;
128 Incidence *retVal = todoForUid( uid , doNotCheckDuplicates,enabledOnly, isDup ); 128 Incidence *retVal = todoForUid( uid , doNotCheckDuplicates,enabledOnly, isDup );
129 if ( retVal ) return retVal; 129 if ( retVal ) return retVal;
130 Event *event; 130 Event *event;
131 for ( event = mEventList.first(); event; event = mEventList.next() ) { 131 for ( event = mEventList.first(); event; event = mEventList.next() ) {
132 if ( event->uid() == uid ) { 132 if ( event->uid() == uid ) {
133 if( calID ) { 133 if( calID ) {
134 if ( event->calID() != calID ) 134 if ( event->calID() != calID )
135 continue; 135 continue;
136 } 136 }
137 else { 137 else {
138 if ( enabledOnly ) { 138 if ( enabledOnly ) {
139 if ( !event->calEnabled() ) { 139 if ( !event->calEnabled() ) {
140 if ( isDup ) 140 if ( isDup )
141 *isDup =event->calID() ; 141 *isDup =event->calID() ;
142 continue; 142 continue;
143 } 143 }
144 } 144 }
145 } 145 }
146 if ( doNotCheckDuplicates ) return event; 146 if ( doNotCheckDuplicates ) return event;
147 if ( retVal ) { 147 if ( retVal ) {
148 if ( retVal->calID() > event->calID() ) { 148 if ( retVal->calID() > event->calID() ) {
149 if ( isDup ) 149 if ( isDup )
150 *isDup = retVal->calID(); 150 *isDup = retVal->calID();
151 retVal = event; 151 retVal = event;
152 } 152 }
153 } else { 153 } else {
154 retVal = event; 154 retVal = event;
155 } 155 }
156 } 156 }
157 } 157 }
158 if ( retVal ) return retVal; 158 if ( retVal ) return retVal;
159 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 159 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
160 if ( it->uid() == uid ) { 160 if ( it->uid() == uid ) {
161 if( calID ) { 161 if( calID ) {
162 if ( event->calID() != calID ) 162 if ( event->calID() != calID )
163 continue; 163 continue;
164 } 164 }
165 else { 165 else {
166 if ( enabledOnly ) { 166 if ( enabledOnly ) {
167 if ( !it->calEnabled() ) { 167 if ( !it->calEnabled() ) {
168 if ( isDup ) 168 if ( isDup )
169 *isDup = it->calID(); 169 *isDup = it->calID();
170 continue; 170 continue;
171 } 171 }
172 } 172 }
173 } 173 }
174 if ( doNotCheckDuplicates ) return it; 174 if ( doNotCheckDuplicates ) return it;
175 if ( retVal ) { 175 if ( retVal ) {
176 if ( retVal->calID() > it->calID() ) { 176 if ( retVal->calID() > it->calID() ) {
177 if ( isDup ) 177 if ( isDup )
178 *isDup = retVal->calID(); 178 *isDup = retVal->calID();
179 retVal = it; 179 retVal = it;
180 } 180 }
181 } else { 181 } else {
182 retVal = it; 182 retVal = it;
183 } 183 }
184 } 184 }
185 return retVal; 185 return retVal;
186} 186}
187 187
188bool CalendarLocal::mergeCalendar( Calendar* remote ) 188bool CalendarLocal::mergeCalendar( Calendar* remote )
189{ 189{
190 // 1 look for raw inc in local 190 // 1 look for raw inc in local
191 // if inc not in remote, delete in local 191 // if inc not in remote, delete in local
192 // 2 look for raw inc in remote 192 // 2 look for raw inc in remote
193 // if inc in local, replace it 193 // if inc in local, replace it
194 // if not in local, add it to default calendar 194 // if not in local, add it to default calendar
195 QPtrList<Incidence> localInc = rawIncidences(); 195 QPtrList<Incidence> localInc = rawIncidences();
196 Incidence* inL = localInc.first(); 196 Incidence* inL = localInc.first();
197 while ( inL ) { 197 while ( inL ) {
198 if ( ! inL->isReadOnly () ) 198 if ( ! inL->isReadOnly () )
199 if ( !remote->incidenceForUid( inL->uid(), true )) 199 if ( !remote->incidenceForUid( inL->uid(), true ))
200 deleteIncidence( inL ); 200 deleteIncidence( inL );
201 inL = localInc.next(); 201 inL = localInc.next();
202 } 202 }
203 QPtrList<Incidence> er = remote->rawIncidences(); 203 QPtrList<Incidence> er = remote->rawIncidences();
204 Incidence* inR = er.first(); 204 Incidence* inR = er.first();
205 while ( inR ) { 205 while ( inR ) {
206 inL = incidenceForUid( inR->uid(),false ); 206 inL = incidenceForUid( inR->uid(),false );
207 if ( inL ) { 207 if ( inL ) {
208 if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) { 208 if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) {
209 int calID = inL->calID(); 209 int calID = inL->calID();
210 deleteIncidence( inL ); 210 deleteIncidence( inL );
211 inL = inR->clone(); 211 inL = inR->clone();
212 inL->setCalID_block( calID ); 212 inL->setCalID_block( calID );
213 addIncidence( inL ); 213 addIncidence( inL );
214 } 214 }
215 } else { 215 } else {
216 inL = inR->clone(); 216 inL = inR->clone();
217 inL->setCalID_block( 0 );// add to default cal 217 inL->setCalID_block( 0 );// add to default cal
218 addIncidence( inL ); 218 addIncidence( inL );
219 } 219 }
220 inR = er.next(); 220 inR = er.next();
221 } 221 }
222 return true; 222 return true;
223} 223}
224 224
225 225
226bool CalendarLocal::addCalendarFile( QString name, int id ) 226bool CalendarLocal::addCalendarFile( QString name, int id )
227{ 227{
228 CalendarLocal calendar( timeZoneId() ); 228 CalendarLocal calendar( timeZoneId() );
229 calendar.setDefaultCalendar( id ); 229 calendar.setDefaultCalendar( id );
230 if ( calendar.load( name ) ) { 230 if ( calendar.load( name ) ) {
231 addCalendar( &calendar ); 231 addCalendar( &calendar );
232 return true; 232 return true;
233 } 233 }
234 return false; 234 return false;
235} 235}
236void CalendarLocal::setSyncEventsEnabled() 236void CalendarLocal::setSyncEventsEnabled()
237{ 237{
238 Event * ev; 238 Event * ev;
239 ev = mEventList.first(); 239 ev = mEventList.first();
240 while ( ev ) { 240 while ( ev ) {
241 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 241 if ( ev->uid().left(15) == QString("last-syncEvent-") )
242 ev->setCalEnabled( true ); 242 ev->setCalEnabled( true );
243 ev = mEventList.next(); 243 ev = mEventList.next();
244 } 244 }
245} 245}
246void CalendarLocal::setSyncEventsReadOnly() 246void CalendarLocal::setSyncEventsReadOnly()
247{ 247{
248 Event * ev; 248 Event * ev;
249 ev = mEventList.first(); 249 ev = mEventList.first();
250 while ( ev ) { 250 while ( ev ) {
251 if ( ev->uid().left(15) == QString("last-syncEvent-") ) { 251 if ( ev->uid().left(15) == QString("last-syncEvent-") ) {
252 ev->setReadOnly( true ); 252 ev->setReadOnly( true );
253 } 253 }
254 ev = mEventList.next(); 254 ev = mEventList.next();
255 } 255 }
256} 256}
257 257
258void CalendarLocal::addCalendar( Calendar* cal ) 258void CalendarLocal::addCalendar( Calendar* cal )
259{ 259{
260 cal->setDontDeleteIncidencesOnClose(); 260 cal->setDontDeleteIncidencesOnClose();
261 setSyncEventsEnabled(); 261 setSyncEventsEnabled();
262 QPtrList<Incidence> incList;
262 { 263 {
263 QPtrList<Event> EventList = cal->rawEvents(); 264 QPtrList<Event> EventList = cal->rawEvents();
264 QPtrList<Event> el;
265 Event * ev = EventList.first(); 265 Event * ev = EventList.first();
266 while ( ev ) { 266 while ( ev ) {
267 if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { 267 if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) {
268 Event * se = event( ev->uid() );
269 if ( se )
270 el.append( se );
271 ev->setCalID_block( 1 ); 268 ev->setCalID_block( 1 );
272 } 269 }
270 Event * se = event( ev->uid() );
271 if ( se )
272 incList.append( se );
273 ev->unRegisterObserver( cal ); 273 ev->unRegisterObserver( cal );
274 ev->registerObserver( this ); 274 ev->registerObserver( this );
275 mEventList.append( ev ); 275 mEventList.append( ev );
276 ev = EventList.next(); 276 ev = EventList.next();
277 } 277 }
278 for ( ev = el.first(); ev; ev = el.next() ) { 278
279 deleteIncidence ( ev );
280 }
281 } 279 }
282 { 280 {
283 281
284 QPtrList<Todo> TodoList = cal->rawTodos(); 282 QPtrList<Todo> TodoList = cal->rawTodos();
285 Todo * ev = TodoList.first(); 283 Todo * ev = TodoList.first();
286 while ( ev ) { 284 while ( ev ) {
287 ev->resetRelatedTo(); 285 ev->resetRelatedTo();
288 ev = TodoList.next(); 286 ev = TodoList.next();
289 } 287 }
290 //TodoList = cal->rawTodos(); 288 //TodoList = cal->rawTodos();
291 ev = TodoList.first(); 289 ev = TodoList.first();
292 while ( ev ) { 290 while ( ev ) {
291 Todo * se = todo( ev->uid() );
292 if ( se )
293 incList.append( se );
293 ev->unRegisterObserver( cal ); 294 ev->unRegisterObserver( cal );
294 ev->registerObserver( this ); 295 ev->registerObserver( this );
295 mTodoList.append( ev ); 296 mTodoList.append( ev );
296 setupRelations( ev ); 297 setupRelations( ev );
297 ev = TodoList.next(); 298 ev = TodoList.next();
298 } 299 }
299 } 300 }
300 { 301 {
301 QPtrList<Journal> JournalList = cal->journals(); 302 QPtrList<Journal> JournalList = cal->journals();
302 Journal * ev = JournalList.first(); 303 Journal * ev = JournalList.first();
303 while ( ev ) { 304 while ( ev ) {
305 Journal * se = journal( ev->uid() );
306 if ( se )
307 incList.append( se );
304 ev->unRegisterObserver( cal ); 308 ev->unRegisterObserver( cal );
305 ev->registerObserver( this ); 309 ev->registerObserver( this );
306 mJournalList.append( ev ); 310 mJournalList.append( ev );
307 ev = JournalList.next(); 311 ev = JournalList.next();
308 } 312 }
309 } 313 }
314 {
315 for (Incidence * ev = incList.first(); ev; ev = incList.next() ) {
316 deleteIncidence ( ev );
317 }
318 }
310 setModified( true ); 319 setModified( true );
311} 320}
312bool CalendarLocal::load( const QString &fileName ) 321bool CalendarLocal::load( const QString &fileName )
313{ 322{
314 FileStorage storage( this, fileName ); 323 FileStorage storage( this, fileName );
315 return storage.load(); 324 return storage.load();
316} 325}
317 326
318bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 327bool CalendarLocal::save( const QString &fileName, CalFormat *format )
319{ 328{
320 FileStorage storage( this, fileName, format ); 329 FileStorage storage( this, fileName, format );
321 return storage.save(); 330 return storage.save();
322} 331}
323 332
324void CalendarLocal::stopAllTodos() 333void CalendarLocal::stopAllTodos()
325{ 334{
326 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 335 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
327 it->setRunning( false ); 336 it->setRunning( false );
328 337
329} 338}
330void CalendarLocal::close() 339void CalendarLocal::close()
331{ 340{
332 341
333 Todo * i; 342 Todo * i;
334 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 343 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
335 344
336 mEventList.setAutoDelete( true ); 345 mEventList.setAutoDelete( true );
337 mTodoList.setAutoDelete( true ); 346 mTodoList.setAutoDelete( true );
338 mJournalList.setAutoDelete( true ); 347 mJournalList.setAutoDelete( true );
339 348
340 mEventList.clear(); 349 mEventList.clear();
341 mTodoList.clear(); 350 mTodoList.clear();
342 mJournalList.clear(); 351 mJournalList.clear();
343 352
344 mEventList.setAutoDelete( false ); 353 mEventList.setAutoDelete( false );
345 mTodoList.setAutoDelete( false ); 354 mTodoList.setAutoDelete( false );
346 mJournalList.setAutoDelete( false ); 355 mJournalList.setAutoDelete( false );
347 356
348 setModified( false ); 357 setModified( false );
349} 358}
350 359
351bool CalendarLocal::addAnniversaryNoDup( Event *event ) 360bool CalendarLocal::addAnniversaryNoDup( Event *event )
352{ 361{
353 QString cat; 362 QString cat;
354 bool isBirthday = true; 363 bool isBirthday = true;
355 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 364 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
356 isBirthday = false; 365 isBirthday = false;
357 cat = i18n( "Anniversary" ); 366 cat = i18n( "Anniversary" );
358 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 367 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
359 isBirthday = true; 368 isBirthday = true;
360 cat = i18n( "Birthday" ); 369 cat = i18n( "Birthday" );
361 } else { 370 } else {
362 qDebug("addAnniversaryNoDup called without fitting category! "); 371 qDebug("addAnniversaryNoDup called without fitting category! ");
363 return false; 372 return false;
364 } 373 }
365 Event * eve; 374 Event * eve;
366 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 375 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
367 if ( !(eve->categories().contains( cat ) )) 376 if ( !(eve->categories().contains( cat ) ))
368 continue; 377 continue;
369 // now we have an event with fitting category 378 // now we have an event with fitting category
370 if ( eve->dtStart().date() != event->dtStart().date() ) 379 if ( eve->dtStart().date() != event->dtStart().date() )
371 continue; 380 continue;
372 // now we have an event with fitting category+date 381 // now we have an event with fitting category+date
373 if ( eve->summary() != event->summary() ) 382 if ( eve->summary() != event->summary() )
374 continue; 383 continue;
375 // now we have an event with fitting category+date+summary 384 // now we have an event with fitting category+date+summary
376 return false; 385 return false;
377 } 386 }
378 return addEvent( event ); 387 return addEvent( event );
379 388
380} 389}
381bool CalendarLocal::addEventNoDup( Event *event ) 390bool CalendarLocal::addEventNoDup( Event *event )
382{ 391{
383 Event * eve; 392 Event * eve;
384 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 393 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
385 if ( *eve == *event ) { 394 if ( *eve == *event ) {
386 //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); 395 //qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
387 return false; 396 return false;
388 } 397 }
389 } 398 }
390 return addEvent( event ); 399 return addEvent( event );
391} 400}
392 401
393bool CalendarLocal::addEvent( Event *event ) 402bool CalendarLocal::addEvent( Event *event )
394{ 403{
395 insertEvent( event ); 404 insertEvent( event );
396 405
397 event->registerObserver( this ); 406 event->registerObserver( this );
398 407
399 setModified( true ); 408 setModified( true );
400 if ( event->calID() == 0 ) 409 if ( event->calID() == 0 )
401 event->setCalID_block( mDefaultCalendar ); 410 event->setCalID_block( mDefaultCalendar );
402 event->setCalEnabled( true ); 411 event->setCalEnabled( true );
403 412
404 return true; 413 return true;
405} 414}
406 415
407void CalendarLocal::deleteEvent( Event *event ) 416void CalendarLocal::deleteEvent( Event *event )
408{ 417{
409 clearUndo(event); 418 clearUndo(event);
410 if ( mEventList.removeRef( event ) ) { 419 if ( mEventList.removeRef( event ) ) {
411 setModified( true ); 420 setModified( true );
412 } 421 }
413} 422}
414 423
415 424
416Event *CalendarLocal::event( const QString &uid ) 425Event *CalendarLocal::event( const QString &uid )
417{ 426{
418 Event *event; 427 Event *event;
419 Event *retVal = 0; 428 Event *retVal = 0;
420 for ( event = mEventList.first(); event; event = mEventList.next() ) { 429 for ( event = mEventList.first(); event; event = mEventList.next() ) {
421 if ( event->calEnabled() && event->uid() == uid ) { 430 if ( event->calEnabled() && event->uid() == uid ) {
422 if ( retVal ) { 431 if ( retVal ) {
423 if ( retVal->calID() > event->calID() ) { 432 if ( retVal->calID() > event->calID() ) {
424 retVal = event; 433 retVal = event;
425 } 434 }
426 } else { 435 } else {
427 retVal = event; 436 retVal = event;
428 } 437 }
429 } 438 }
430 } 439 }
431 return retVal; 440 return retVal;
432} 441}
433bool CalendarLocal::addTodoNoDup( Todo *todo ) 442bool CalendarLocal::addTodoNoDup( Todo *todo )
434{ 443{
435 Todo * eve; 444 Todo * eve;
436 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { 445 for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) {
437 if ( *eve == *todo ) { 446 if ( *eve == *todo ) {
438 //qDebug("duplicate todo found! not inserted! "); 447 //qDebug("duplicate todo found! not inserted! ");
439 return false; 448 return false;
440 } 449 }
441 } 450 }
442 return addTodo( todo ); 451 return addTodo( todo );
443} 452}
444bool CalendarLocal::addTodo( Todo *todo ) 453bool CalendarLocal::addTodo( Todo *todo )
445{ 454{
446 mTodoList.append( todo ); 455 mTodoList.append( todo );
447 456
448 todo->registerObserver( this ); 457 todo->registerObserver( this );
449 458
450 // Set up subtask relations 459 // Set up subtask relations
451 setupRelations( todo ); 460 setupRelations( todo );
452 461
453 setModified( true ); 462 setModified( true );
454 if ( todo->calID() == 0 ) 463 if ( todo->calID() == 0 )
455 todo->setCalID_block( mDefaultCalendar ); 464 todo->setCalID_block( mDefaultCalendar );
456 todo->setCalEnabled( true ); 465 todo->setCalEnabled( true );
457 return true; 466 return true;
458} 467}
459 468
460void CalendarLocal::deleteTodo( Todo *todo ) 469void CalendarLocal::deleteTodo( Todo *todo )
461{ 470{
462 QString uid = todo->uid(); 471 QString uid = todo->uid();
463 // Handle orphaned children 472 // Handle orphaned children
464 removeRelations( todo ); 473 removeRelations( todo );
465 clearUndo(todo); 474 clearUndo(todo);
466 475
467 if ( mTodoList.removeRef( todo ) ) { 476 if ( mTodoList.removeRef( todo ) ) {
468 setModified( true ); 477 setModified( true );
469 } 478 }
470 Todo* dup = todoForUid( uid ); 479 Todo* dup = todoForUid( uid );
471 if ( dup ) 480 if ( dup )
472 setupRelations( dup ); 481 setupRelations( dup );
473} 482}
474 483
475QPtrList<Todo> CalendarLocal::rawTodos() 484QPtrList<Todo> CalendarLocal::rawTodos()
476{ 485{
477 QPtrList<Todo> el; 486 QPtrList<Todo> el;
478 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 487 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
479 if ( it->calEnabled() ) el.append( it ); 488 if ( it->calEnabled() ) el.append( it );
480 return el; 489 return el;
481} 490}
482Todo *CalendarLocal::todo( QString syncProf, QString id ) 491Todo *CalendarLocal::todo( QString syncProf, QString id )
483{ 492{
484 Todo *todo; 493 Todo *todo;
485 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 494 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
486 if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; 495 if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo;
487 } 496 }
488 497
489 return 0; 498 return 0;
490} 499}
491void CalendarLocal::removeSyncInfo( QString syncProfile) 500void CalendarLocal::removeSyncInfo( QString syncProfile)
492{ 501{
493 QPtrList<Incidence> all = rawIncidences() ; 502 QPtrList<Incidence> all = rawIncidences() ;
494 Incidence *inc; 503 Incidence *inc;
495 for ( inc = all.first(); inc; inc = all.next() ) { 504 for ( inc = all.first(); inc; inc = all.next() ) {
496 inc->removeID( syncProfile ); 505 inc->removeID( syncProfile );
497 } 506 }
498 if ( syncProfile.isEmpty() ) { 507 if ( syncProfile.isEmpty() ) {
499 QPtrList<Event> el; 508 QPtrList<Event> el;
500 Event *todo; 509 Event *todo;
501 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 510 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {