summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-03-15 12:34:42 (UTC)
committer zautrix <zautrix>2005-03-15 12:34:42 (UTC)
commit2a92f30dbb2a2bfcee223d949a1672060b76f6ab (patch) (unidiff)
tree893e0cbbff72a9ec5af40925d2c38397bbf2177a /libkcal
parent93d18021da7aa07f055b800def773b31e54a98a9 (diff)
downloadkdepimpi-2a92f30dbb2a2bfcee223d949a1672060b76f6ab.zip
kdepimpi-2a92f30dbb2a2bfcee223d949a1672060b76f6ab.tar.gz
kdepimpi-2a92f30dbb2a2bfcee223d949a1672060b76f6ab.tar.bz2
crash fix when removing sync info
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 0eba6a9..52c298b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -221,49 +221,50 @@ Todo *CalendarLocal::todo( QString syncProf, QString id )
221 if ( todo->getID( syncProf ) == id ) return todo; 221 if ( todo->getID( syncProf ) == id ) return todo;
222 } 222 }
223 223
224 return 0; 224 return 0;
225} 225}
226void CalendarLocal::removeSyncInfo( QString syncProfile) 226void CalendarLocal::removeSyncInfo( QString syncProfile)
227{ 227{
228 QPtrList<Incidence> all = rawIncidences() ; 228 QPtrList<Incidence> all = rawIncidences() ;
229 Incidence *inc; 229 Incidence *inc;
230 for ( inc = all.first(); inc; inc = all.next() ) { 230 for ( inc = all.first(); inc; inc = all.next() ) {
231 inc->removeID( syncProfile ); 231 inc->removeID( syncProfile );
232 } 232 }
233 if ( syncProfile.isEmpty() ) { 233 if ( syncProfile.isEmpty() ) {
234 QPtrList<Event> el; 234 QPtrList<Event> el;
235 Event *todo; 235 Event *todo;
236 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 236 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
237 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 237 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
238 el.append( todo ); 238 el.append( todo );
239 } 239 }
240 for ( todo = el.first(); todo; todo = el.next() ) { 240 for ( todo = el.first(); todo; todo = el.next() ) {
241 deleteIncidence ( todo ); 241 deleteIncidence ( todo );
242 } 242 }
243 } else { 243 } else {
244 Event *lse = event( "last-syncEvent-"+ syncProfile); 244 Event *lse = event( "last-syncEvent-"+ syncProfile);
245 deleteIncidence ( lse ); 245 if ( lse )
246 deleteIncidence ( lse );
246 } 247 }
247} 248}
248QPtrList<Event> CalendarLocal::getExternLastSyncEvents() 249QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
249{ 250{
250 QPtrList<Event> el; 251 QPtrList<Event> el;
251 Event *todo; 252 Event *todo;
252 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 253 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
253 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 254 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
254 if ( todo->summary().left(3) == "E: " ) 255 if ( todo->summary().left(3) == "E: " )
255 el.append( todo ); 256 el.append( todo );
256 } 257 }
257 258
258 return el; 259 return el;
259 260
260} 261}
261Event *CalendarLocal::event( QString syncProf, QString id ) 262Event *CalendarLocal::event( QString syncProf, QString id )
262{ 263{
263 Event *todo; 264 Event *todo;
264 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 265 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
265 if ( todo->getID( syncProf ) == id ) return todo; 266 if ( todo->getID( syncProf ) == id ) return todo;
266 } 267 }
267 268
268 return 0; 269 return 0;
269} 270}