summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-09-12 09:56:56 (UTC)
committer zautrix <zautrix>2004-09-12 09:56:56 (UTC)
commit31fab1d7e531b492d1075964ddcbebe7a563a41a (patch) (unidiff)
tree91fe6d49f28003106cba1adc9aed816a9019888d /libkcal
parent8d822fd4d97fbb38ab2c4f3f3f64f175ef143cff (diff)
downloadkdepimpi-31fab1d7e531b492d1075964ddcbebe7a563a41a.zip
kdepimpi-31fab1d7e531b492d1075964ddcbebe7a563a41a.tar.gz
kdepimpi-31fab1d7e531b492d1075964ddcbebe7a563a41a.tar.bz2
Kammu fixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 0bc9125..2ad1b5a 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -159,423 +159,425 @@ ulong PhoneFormat::getCsumEvent( Event* event )
159 } 159 }
160 } 160 }
161 attList << alarmString; 161 attList << alarmString;
162 Recurrence* rec = event->recurrence(); 162 Recurrence* rec = event->recurrence();
163 QStringList list; 163 QStringList list;
164 bool writeEndDate = false; 164 bool writeEndDate = false;
165 switch ( rec->doesRecur() ) 165 switch ( rec->doesRecur() )
166 { 166 {
167 case Recurrence::rDaily: // 0 167 case Recurrence::rDaily: // 0
168 list.append( "0" ); 168 list.append( "0" );
169 list.append( QString::number( rec->frequency() ));//12 169 list.append( QString::number( rec->frequency() ));//12
170 list.append( "0" ); 170 list.append( "0" );
171 list.append( "0" ); 171 list.append( "0" );
172 writeEndDate = true; 172 writeEndDate = true;
173 break; 173 break;
174 case Recurrence::rWeekly:// 1 174 case Recurrence::rWeekly:// 1
175 list.append( "1" ); 175 list.append( "1" );
176 list.append( QString::number( rec->frequency()) );//12 176 list.append( QString::number( rec->frequency()) );//12
177 list.append( "0" ); 177 list.append( "0" );
178 { 178 {
179 int days = 0; 179 int days = 0;
180 QBitArray weekDays = rec->days(); 180 QBitArray weekDays = rec->days();
181 int i; 181 int i;
182 for( i = 1; i <= 7; ++i ) { 182 for( i = 1; i <= 7; ++i ) {
183 if ( weekDays[i-1] ) { 183 if ( weekDays[i-1] ) {
184 days += 1 << (i-1); 184 days += 1 << (i-1);
185 } 185 }
186 } 186 }
187 list.append( QString::number( days ) ); 187 list.append( QString::number( days ) );
188 } 188 }
189 //pending weekdays 189 //pending weekdays
190 writeEndDate = true; 190 writeEndDate = true;
191 191
192 break; 192 break;
193 case Recurrence::rMonthlyPos:// 2 193 case Recurrence::rMonthlyPos:// 2
194 list.append( "2" ); 194 list.append( "2" );
195 list.append( QString::number( rec->frequency()) );//12 195 list.append( QString::number( rec->frequency()) );//12
196 196
197 writeEndDate = true; 197 writeEndDate = true;
198 { 198 {
199 int count = 1; 199 int count = 1;
200 QPtrList<Recurrence::rMonthPos> rmp; 200 QPtrList<Recurrence::rMonthPos> rmp;
201 rmp = rec->monthPositions(); 201 rmp = rec->monthPositions();
202 if ( rmp.first()->negative ) 202 if ( rmp.first()->negative )
203 count = 5 - rmp.first()->rPos - 1; 203 count = 5 - rmp.first()->rPos - 1;
204 else 204 else
205 count = rmp.first()->rPos - 1; 205 count = rmp.first()->rPos - 1;
206 list.append( QString::number( count ) ); 206 list.append( QString::number( count ) );
207 207
208 } 208 }
209 209
210 list.append( "0" ); 210 list.append( "0" );
211 break; 211 break;
212 case Recurrence::rMonthlyDay:// 3 212 case Recurrence::rMonthlyDay:// 3
213 list.append( "3" ); 213 list.append( "3" );
214 list.append( QString::number( rec->frequency()) );//12 214 list.append( QString::number( rec->frequency()) );//12
215 list.append( "0" ); 215 list.append( "0" );
216 list.append( "0" ); 216 list.append( "0" );
217 writeEndDate = true; 217 writeEndDate = true;
218 break; 218 break;
219 case Recurrence::rYearlyMonth://4 219 case Recurrence::rYearlyMonth://4
220 list.append( "4" ); 220 list.append( "4" );
221 list.append( QString::number( rec->frequency()) );//12 221 list.append( QString::number( rec->frequency()) );//12
222 list.append( "0" ); 222 list.append( "0" );
223 list.append( "0" ); 223 list.append( "0" );
224 writeEndDate = true; 224 writeEndDate = true;
225 break; 225 break;
226 226
227 default: 227 default:
228 list.append( "255" ); 228 list.append( "255" );
229 list.append( QString() ); 229 list.append( QString() );
230 list.append( "0" ); 230 list.append( "0" );
231 list.append( QString() ); 231 list.append( QString() );
232 list.append( "0" ); 232 list.append( "0" );
233 list.append( "20991231T000000" ); 233 list.append( "20991231T000000" );
234 break; 234 break;
235 } 235 }
236 if ( writeEndDate ) { 236 if ( writeEndDate ) {
237 237
238 if ( rec->endDate().isValid() ) { // 15 + 16 238 if ( rec->endDate().isValid() ) { // 15 + 16
239 list.append( "1" ); 239 list.append( "1" );
240 list.append( PhoneParser::dtToString( rec->endDate()) ); 240 list.append( PhoneParser::dtToString( rec->endDate()) );
241 } else { 241 } else {
242 list.append( "0" ); 242 list.append( "0" );
243 list.append( "20991231T000000" ); 243 list.append( "20991231T000000" );
244 } 244 }
245 245
246 } 246 }
247 attList << list.join(""); 247 attList << list.join("");
248 attList << event->categoriesStr(); 248 attList << event->categoriesStr();
249 attList << event->secrecyStr(); 249 attList << event->secrecyStr();
250 return PhoneFormat::getCsum(attList ); 250 return PhoneFormat::getCsum(attList );
251} 251}
252ulong PhoneFormat::getCsum( const QStringList & attList) 252ulong PhoneFormat::getCsum( const QStringList & attList)
253{ 253{
254 int max = attList.count() -1; 254 int max = attList.count() -1;
255 ulong cSum = 0; 255 ulong cSum = 0;
256 int j,k,i; 256 int j,k,i;
257 int add; 257 int add;
258 for ( i = 1; i < max ; ++i ) { 258 for ( i = 1; i < max ; ++i ) {
259 QString s = attList[i]; 259 QString s = attList[i];
260 if ( ! s.isEmpty() ){ 260 if ( ! s.isEmpty() ){
261 j = s.length(); 261 j = s.length();
262 for ( k = 0; k < j; ++k ) { 262 for ( k = 0; k < j; ++k ) {
263 int mul = k +1; 263 int mul = k +1;
264 add = s[k].unicode (); 264 add = s[k].unicode ();
265 if ( k < 16 ) 265 if ( k < 16 )
266 mul = mul * mul; 266 mul = mul * mul;
267 add = add * mul *i*i*i; 267 add = add * mul *i*i*i;
268 cSum += add; 268 cSum += add;
269 } 269 }
270 } 270 }
271 } 271 }
272 return cSum; 272 return cSum;
273 273
274} 274}
275//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 275//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
276#include <stdlib.h> 276#include <stdlib.h>
277#define DEBUGMODE false 277#define DEBUGMODE false
278bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) 278bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
279{ 279{
280 280
281 QString fileName; 281 QString fileName;
282#ifdef _WIN32_ 282#ifdef _WIN32_
283 fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; 283 fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs";
284#else 284#else
285 fileName = "/tmp/kdepimtemp.vcs"; 285 fileName = "/tmp/kdepimtemp.vcs";
286#endif 286#endif
287 QString command ="./kammu --backup " + fileName + " -yes"; 287 QString command ="./kammu --backup " + fileName + " -yes -C" +
288 mConnection +" -D" + mDevice +" -M" + mModel;
288 int ret = system ( command.latin1() ); 289 int ret = system ( command.latin1() );
289 if ( ret != 0 ) 290 if ( ret != 0 )
290 return false; 291 return false;
291 VCalFormat vfload; 292 VCalFormat vfload;
292 vfload.setLocalTime ( true ); 293 vfload.setLocalTime ( true );
293 if ( ! vfload.load( calendar, fileName ) ) 294 if ( ! vfload.load( calendar, fileName ) )
294 return false; 295 return false;
295 QPtrList<Event> er = calendar->rawEvents(); 296 QPtrList<Event> er = calendar->rawEvents();
296 Event* ev = er.first(); 297 Event* ev = er.first();
297 while ( ev ) { 298 while ( ev ) {
298 int id = ev->pilotId(); 299 int id = ev->pilotId();
299 Event *event; 300 Event *event;
300 event = existingCal->event( mProfileName ,QString::number( id ) ); 301 event = existingCal->event( mProfileName ,QString::number( id ) );
301 if ( event ) { 302 if ( event ) {
302 event = (Event*)event->clone(); 303 event = (Event*)event->clone();
303 copyEvent( event, ev ); 304 copyEvent( event, ev );
304 calendar->deleteEvent( ev ); 305 calendar->deleteEvent( ev );
305 calendar->addEvent( event); 306 calendar->addEvent( event);
306 } 307 }
307 else 308 else
308 event = ev; 309 event = ev;
309 uint cSum; 310 uint cSum;
310 cSum = PhoneFormat::getCsumEvent( event ); 311 cSum = PhoneFormat::getCsumEvent( event );
311 event->setCsum( mProfileName, QString::number( cSum )); 312 event->setCsum( mProfileName, QString::number( cSum ));
312 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 313 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
313 event->setID( mProfileName,QString::number( id ) ); 314 event->setID( mProfileName,QString::number( id ) );
314 ev = er.next(); 315 ev = er.next();
315 } 316 }
316 { 317 {
317 QPtrList<Todo> tr = calendar->rawTodos(); 318 QPtrList<Todo> tr = calendar->rawTodos();
318 Todo* ev = tr.first(); 319 Todo* ev = tr.first();
319 while ( ev ) { 320 while ( ev ) {
320 321
321 QStringList cat = ev->categories(); 322 QStringList cat = ev->categories();
322 if ( cat.contains( "MeetingDEF" )) { 323 if ( cat.contains( "MeetingDEF" )) {
323 ev->setCategories( QStringList() ); 324 ev->setCategories( QStringList() );
324 } 325 }
325 int id = ev->pilotId(); 326 int id = ev->pilotId();
326 Todo *event; 327 Todo *event;
327 event = existingCal->todo( mProfileName ,QString::number( id ) ); 328 event = existingCal->todo( mProfileName ,QString::number( id ) );
328 if ( event ) { 329 if ( event ) {
329 event = (Todo*)event->clone(); 330 event = (Todo*)event->clone();
330 copyTodo( event, ev ); 331 copyTodo( event, ev );
331 calendar->deleteTodo( ev ); 332 calendar->deleteTodo( ev );
332 calendar->addTodo( event); 333 calendar->addTodo( event);
333 } 334 }
334 else 335 else
335 event = ev; 336 event = ev;
336 uint cSum; 337 uint cSum;
337 cSum = PhoneFormat::getCsumTodo( event ); 338 cSum = PhoneFormat::getCsumTodo( event );
338 event->setCsum( mProfileName, QString::number( cSum )); 339 event->setCsum( mProfileName, QString::number( cSum ));
339 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 340 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
340 event->setID( mProfileName,QString::number( id ) ); 341 event->setID( mProfileName,QString::number( id ) );
341 ev = tr.next(); 342 ev = tr.next();
342 } 343 }
343 } 344 }
344 return true; 345 return true;
345} 346}
346void PhoneFormat::copyEvent( Event* to, Event* from ) 347void PhoneFormat::copyEvent( Event* to, Event* from )
347{ 348{
348 if ( from->dtStart().isValid() ) 349 if ( from->dtStart().isValid() )
349 to->setDtStart( from->dtStart() ); 350 to->setDtStart( from->dtStart() );
350 if ( from->dtEnd().isValid() ) 351 if ( from->dtEnd().isValid() )
351 to->setDtEnd( from->dtEnd() ); 352 to->setDtEnd( from->dtEnd() );
352 if ( !from->location().isEmpty() ) 353 if ( !from->location().isEmpty() )
353 to->setLocation( from->location() ); 354 to->setLocation( from->location() );
354 if ( !from->description().isEmpty() ) 355 if ( !from->description().isEmpty() )
355 to->setDescription( from->description() ); 356 to->setDescription( from->description() );
356 if ( !from->summary().isEmpty() ) 357 if ( !from->summary().isEmpty() )
357 to->setSummary( from->summary() ); 358 to->setSummary( from->summary() );
358 359
359 QPtrListIterator<Alarm> it( from->alarms() ); 360 QPtrListIterator<Alarm> it( from->alarms() );
360 to->clearAlarms(); 361 to->clearAlarms();
361 const Alarm *a; 362 const Alarm *a;
362 while( (a = it.current()) ) { 363 while( (a = it.current()) ) {
363 Alarm *b = new Alarm( *a ); 364 Alarm *b = new Alarm( *a );
364 b->setParent( to ); 365 b->setParent( to );
365 to->addAlarm( b ); 366 to->addAlarm( b );
366 ++it; 367 ++it;
367 } 368 }
368 QStringList cat = to->categories(); 369 QStringList cat = to->categories();
369 QStringList catFrom = from->categories(); 370 QStringList catFrom = from->categories();
370 QString nCat; 371 QString nCat;
371 int iii; 372 int iii;
372 for ( iii = 0; iii < catFrom.count();++iii ) { 373 for ( iii = 0; iii < catFrom.count();++iii ) {
373 nCat = catFrom[iii]; 374 nCat = catFrom[iii];
374 if ( !nCat.isEmpty() ) 375 if ( !nCat.isEmpty() )
375 if ( !cat.contains( nCat )) { 376 if ( !cat.contains( nCat )) {
376 cat << nCat; 377 cat << nCat;
377 } 378 }
378 } 379 }
379 to->setCategories( cat ); 380 to->setCategories( cat );
380 Recurrence * r = new Recurrence( *from->recurrence(),to); 381 Recurrence * r = new Recurrence( *from->recurrence(),to);
381 to->setRecurrence( r ) ; 382 to->setRecurrence( r ) ;
382 383
383 384
384} 385}
385void PhoneFormat::copyTodo( Todo* to, Todo* from ) 386void PhoneFormat::copyTodo( Todo* to, Todo* from )
386{ 387{
387 if ( from->dtStart().isValid() ) 388 if ( from->dtStart().isValid() )
388 to->setDtStart( from->dtStart() ); 389 to->setDtStart( from->dtStart() );
389 if ( from->dtDue().isValid() ) 390 if ( from->dtDue().isValid() )
390 to->setDtDue( from->dtDue() ); 391 to->setDtDue( from->dtDue() );
391 if ( !from->location().isEmpty() ) 392 if ( !from->location().isEmpty() )
392 to->setLocation( from->location() ); 393 to->setLocation( from->location() );
393 if ( !from->description().isEmpty() ) 394 if ( !from->description().isEmpty() )
394 to->setDescription( from->description() ); 395 to->setDescription( from->description() );
395 if ( !from->summary().isEmpty() ) 396 if ( !from->summary().isEmpty() )
396 to->setSummary( from->summary() ); 397 to->setSummary( from->summary() );
397 398
398 QPtrListIterator<Alarm> it( from->alarms() ); 399 QPtrListIterator<Alarm> it( from->alarms() );
399 to->clearAlarms(); 400 to->clearAlarms();
400 const Alarm *a; 401 const Alarm *a;
401 while( (a = it.current()) ) { 402 while( (a = it.current()) ) {
402 Alarm *b = new Alarm( *a ); 403 Alarm *b = new Alarm( *a );
403 b->setParent( to ); 404 b->setParent( to );
404 to->addAlarm( b ); 405 to->addAlarm( b );
405 ++it; 406 ++it;
406 } 407 }
407 QStringList cat = to->categories(); 408 QStringList cat = to->categories();
408 QStringList catFrom = from->categories(); 409 QStringList catFrom = from->categories();
409 QString nCat; 410 QString nCat;
410 int iii; 411 int iii;
411 for ( iii = 0; iii < catFrom.count();++iii ) { 412 for ( iii = 0; iii < catFrom.count();++iii ) {
412 nCat = catFrom[iii]; 413 nCat = catFrom[iii];
413 if ( !nCat.isEmpty() ) 414 if ( !nCat.isEmpty() )
414 if ( !cat.contains( nCat )) { 415 if ( !cat.contains( nCat )) {
415 cat << nCat; 416 cat << nCat;
416 } 417 }
417 } 418 }
418 to->setCategories( cat ); 419 to->setCategories( cat );
419 if ( from->isCompleted() ) { 420 if ( from->isCompleted() ) {
420 to->setCompleted( true ); 421 to->setCompleted( true );
421 if( from->completed().isValid() ) 422 if( from->completed().isValid() )
422 to->setCompleted( from->completed() ); 423 to->setCompleted( from->completed() );
423 } else { 424 } else {
424 // set percentcomplete only, if to->isCompleted() 425 // set percentcomplete only, if to->isCompleted()
425 if ( to->isCompleted() ) 426 if ( to->isCompleted() )
426 to->setPercentComplete(from->percentComplete()); 427 to->setPercentComplete(from->percentComplete());
427 } 428 }
428 to->setPriority(from->priority()); 429 to->setPriority(from->priority());
429 430
430} 431}
431#include <qcstring.h> 432#include <qcstring.h>
432 433
433void PhoneFormat::afterSave( Incidence* inc) 434void PhoneFormat::afterSave( Incidence* inc)
434{ 435{
435 uint csum; 436 uint csum;
436 inc->removeID( mProfileName ); 437 inc->removeID( mProfileName );
437 if ( inc->type() == "Event") 438 if ( inc->type() == "Event")
438 csum = PhoneFormat::getCsumEvent( (Event*) inc ); 439 csum = PhoneFormat::getCsumEvent( (Event*) inc );
439 else 440 else
440 csum = PhoneFormat::getCsumTodo( (Todo*) inc ); 441 csum = PhoneFormat::getCsumTodo( (Todo*) inc );
441 inc->setCsum( mProfileName, QString::number( csum )); 442 inc->setCsum( mProfileName, QString::number( csum ));
442 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 443 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
443 444
444} 445}
445bool PhoneFormat::save( Calendar *calendar) 446bool PhoneFormat::save( Calendar *calendar)
446{ 447{
447 QLabel status ( i18n(" Opening device ..."), 0 ); 448 QLabel status ( i18n(" Opening device ..."), 0 );
448 int w = status.sizeHint().width()+20 ; 449 int w = status.sizeHint().width()+20 ;
449 if ( w < 200 ) w = 230; 450 if ( w < 200 ) w = 230;
450 int h = status.sizeHint().height()+20 ; 451 int h = status.sizeHint().height()+20 ;
451 int dw = QApplication::desktop()->width(); 452 int dw = QApplication::desktop()->width();
452 int dh = QApplication::desktop()->height(); 453 int dh = QApplication::desktop()->height();
453 status.setCaption(i18n("Writing to phone...") ); 454 status.setCaption(i18n("Writing to phone...") );
454 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 455 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
455 status.show(); 456 status.show();
456 status.raise(); 457 status.raise();
457 qApp->processEvents(); 458 qApp->processEvents();
458 QString message; 459 QString message;
459#ifdef _WIN32_ 460#ifdef _WIN32_
460 QString fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; 461 QString fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs";
461#else 462#else
462 QString fileName = "/tmp/kdepimtemp.vcs"; 463 QString fileName = "/tmp/kdepimtemp.vcs";
463#endif 464#endif
464 465
465 // 1 remove events which should be deleted 466 // 1 remove events which should be deleted
466 QPtrList<Event> er = calendar->rawEvents(); 467 QPtrList<Event> er = calendar->rawEvents();
467 Event* ev = er.first(); 468 Event* ev = er.first();
468 while ( ev ) { 469 while ( ev ) {
469 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 470 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
470 calendar->deleteEvent( ev ); 471 calendar->deleteEvent( ev );
471 } else { 472 } else {
472 473
473 } 474 }
474 ev = er.next(); 475 ev = er.next();
475 } 476 }
476 // 2 remove todos which should be deleted 477 // 2 remove todos which should be deleted
477 QPtrList<Todo> tl = calendar->rawTodos(); 478 QPtrList<Todo> tl = calendar->rawTodos();
478 Todo* to = tl.first(); 479 Todo* to = tl.first();
479 while ( to ) { 480 while ( to ) {
480 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 481 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
481 calendar->deleteTodo( to ); 482 calendar->deleteTodo( to );
482 } 483 }
483 to = tl.next(); 484 to = tl.next();
484 } 485 }
485 // 3 save file 486 // 3 save file
486 VCalFormat vfsave; 487 VCalFormat vfsave;
487 vfsave.setLocalTime ( true ); 488 vfsave.setLocalTime ( true );
488 if ( ! vfsave.save( calendar, fileName ) ) 489 if ( ! vfsave.save( calendar, fileName ) )
489 return false; 490 return false;
490 // 4 call kammu 491 // 4 call kammu
491 QString command ="./kammu --restore " + fileName ; 492 QString command ="./kammu --restore " + fileName + " -C" +
493 mConnection +" -D" + mDevice +" -M" + mModel;;
492 int ret = system ( command.latin1() ); 494 int ret = system ( command.latin1() );
493 if ( ret != 0 ) 495 if ( ret != 0 )
494 return false; 496 return false;
495 // 5 reread data 497 // 5 reread data
496 message = i18n(" Rereading all data ... "); 498 message = i18n(" Rereading all data ... ");
497 status.setText ( message ); 499 status.setText ( message );
498 qApp->processEvents(); 500 qApp->processEvents();
499 CalendarLocal* calendarTemp = new CalendarLocal(); 501 CalendarLocal* calendarTemp = new CalendarLocal();
500 calendarTemp->setTimeZoneId( calendar->timeZoneId()); 502 calendarTemp->setTimeZoneId( calendar->timeZoneId());
501 if ( ! load( calendarTemp,calendar) ){ 503 if ( ! load( calendarTemp,calendar) ){
502 qDebug("error reloading calendar "); 504 qDebug("error reloading calendar ");
503 delete calendarTemp; 505 delete calendarTemp;
504 return false; 506 return false;
505 } 507 }
506 // 6 compare data 508 // 6 compare data
507 509
508//algo 6 compare event 510//algo 6 compare event
509 er = calendar->rawEvents(); 511 er = calendar->rawEvents();
510 ev = er.first(); 512 ev = er.first();
511 message = i18n(" Comparing event # "); 513 message = i18n(" Comparing event # ");
512 QPtrList<Event> er1 = calendarTemp->rawEvents(); 514 QPtrList<Event> er1 = calendarTemp->rawEvents();
513 Event* ev1; 515 Event* ev1;
514 int procCount = 0; 516 int procCount = 0;
515 while ( ev ) { 517 while ( ev ) {
516 qDebug("event new ID "); 518 qDebug("event new ID ");
517 status.setText ( message + QString::number ( ++procCount ) ); 519 status.setText ( message + QString::number ( ++procCount ) );
518 qApp->processEvents(); 520 qApp->processEvents();
519 QString cSum = ev->getCsum(mProfileName); 521 QString cSum = ev->getCsum(mProfileName);
520 ev1 = er1.first(); 522 ev1 = er1.first();
521 while ( ev1 ) { 523 while ( ev1 ) {
522 if ( ev1->getCsum( mProfileName ) == cSum ) { 524 if ( ev1->getCsum( mProfileName ) == cSum ) {
523 er1.remove( ev1 ); 525 er1.remove( ev1 );
524 afterSave( ev ); 526 afterSave( ev );
525 ev->setID(mProfileName, ev1->getID(mProfileName) ); 527 ev->setID(mProfileName, ev1->getID(mProfileName) );
526 break; 528 break;
527 } 529 }
528 ev1 = er1.next(); 530 ev1 = er1.next();
529 } 531 }
530 if ( ! ev1 ) { 532 if ( ! ev1 ) {
531 ev->removeID(mProfileName); 533 ev->removeID(mProfileName);
532 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); 534 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
533 } 535 }
534 536
535 537
536 ev = er.next(); 538 ev = er.next();
537 } 539 }
538 //algo 6 compare todo 540 //algo 6 compare todo
539 to = tl.first(); 541 to = tl.first();
540 procCount = 0; 542 procCount = 0;
541 QPtrList<Todo> tl1 = calendarTemp->rawTodos(); 543 QPtrList<Todo> tl1 = calendarTemp->rawTodos();
542 Todo* to1 ; 544 Todo* to1 ;
543 message = i18n(" Comparing todo # "); 545 message = i18n(" Comparing todo # ");
544 while ( to ) { 546 while ( to ) {
545 qDebug("todo2 %d ", procCount); 547 qDebug("todo2 %d ", procCount);
546 status.setText ( message + QString::number ( ++procCount ) ); 548 status.setText ( message + QString::number ( ++procCount ) );
547 qApp->processEvents(); 549 qApp->processEvents();
548 QString cSum = to->getCsum(mProfileName); 550 QString cSum = to->getCsum(mProfileName);
549 Todo* to1 = tl1.first(); 551 Todo* to1 = tl1.first();
550 while ( to1 ) { 552 while ( to1 ) {
551 if ( to1->getCsum( mProfileName ) == cSum ) { 553 if ( to1->getCsum( mProfileName ) == cSum ) {
552 tl1.remove( to1 ); 554 tl1.remove( to1 );
553 afterSave( to ); 555 afterSave( to );
554 to->setID(mProfileName, to1->getID(mProfileName) ); 556 to->setID(mProfileName, to1->getID(mProfileName) );
555 break; 557 break;
556 } 558 }
557 to1 = tl1.next(); 559 to1 = tl1.next();
558 } 560 }
559 if ( ! to1 ) { 561 if ( ! to1 ) {
560 to->removeID(mProfileName); 562 to->removeID(mProfileName);
561 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1()); 563 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1());
562 } 564 }
563 565
564 to = tl.next(); 566 to = tl.next();
565 } 567 }
566 delete calendarTemp; 568 delete calendarTemp;
567 return true; 569 return true;
568 570
569 571
570 572
571} 573}
572 574
573 575
574QString PhoneFormat::toString( Calendar * ) 576QString PhoneFormat::toString( Calendar * )
575{ 577{
576 return QString::null; 578 return QString::null;
577} 579}
578bool PhoneFormat::fromString( Calendar *calendar, const QString & text) 580bool PhoneFormat::fromString( Calendar *calendar, const QString & text)
579{ 581{
580 return false; 582 return false;
581} 583}