summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-12 22:05:14 (UTC)
committer zautrix <zautrix>2004-09-12 22:05:14 (UTC)
commit483c6ac49ea1764bdd154e33e220b7945a6ab754 (patch) (unidiff)
tree29d5cb00ff3a36595c2fb0e1125d3e2b8ec246a6
parent185e2f4a2b10c65d8186dad63fe6cc3acd6b84f1 (diff)
downloadkdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.zip
kdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.tar.gz
kdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.tar.bz2
fix for Z
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 99d6a06..c67dc6a 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -291,193 +291,197 @@ ulong PhoneFormat::getCsumEvent( Event* event )
291 { 291 {
292 int count = 1; 292 int count = 1;
293 QPtrList<Recurrence::rMonthPos> rmp; 293 QPtrList<Recurrence::rMonthPos> rmp;
294 rmp = rec->monthPositions(); 294 rmp = rec->monthPositions();
295 if ( rmp.first()->negative ) 295 if ( rmp.first()->negative )
296 count = 5 - rmp.first()->rPos - 1; 296 count = 5 - rmp.first()->rPos - 1;
297 else 297 else
298 count = rmp.first()->rPos - 1; 298 count = rmp.first()->rPos - 1;
299 list.append( QString::number( count ) ); 299 list.append( QString::number( count ) );
300 300
301 } 301 }
302 302
303 list.append( "0" ); 303 list.append( "0" );
304 break; 304 break;
305 case Recurrence::rMonthlyDay:// 3 305 case Recurrence::rMonthlyDay:// 3
306 list.append( "3" ); 306 list.append( "3" );
307 list.append( QString::number( rec->frequency()) );//12 307 list.append( QString::number( rec->frequency()) );//12
308 list.append( "0" ); 308 list.append( "0" );
309 list.append( "0" ); 309 list.append( "0" );
310 writeEndDate = true; 310 writeEndDate = true;
311 break; 311 break;
312 case Recurrence::rYearlyMonth://4 312 case Recurrence::rYearlyMonth://4
313 list.append( "4" ); 313 list.append( "4" );
314 list.append( QString::number( rec->frequency()) );//12 314 list.append( QString::number( rec->frequency()) );//12
315 list.append( "0" ); 315 list.append( "0" );
316 list.append( "0" ); 316 list.append( "0" );
317 writeEndDate = true; 317 writeEndDate = true;
318 break; 318 break;
319 319
320 default: 320 default:
321 list.append( "255" ); 321 list.append( "255" );
322 list.append( QString() ); 322 list.append( QString() );
323 list.append( "0" ); 323 list.append( "0" );
324 list.append( QString() ); 324 list.append( QString() );
325 list.append( "0" ); 325 list.append( "0" );
326 list.append( "20991231T000000" ); 326 list.append( "20991231T000000" );
327 break; 327 break;
328 } 328 }
329 if ( writeEndDate ) { 329 if ( writeEndDate ) {
330 330
331 if ( rec->endDate().isValid() ) { // 15 + 16 331 if ( rec->endDate().isValid() ) { // 15 + 16
332 list.append( "1" ); 332 list.append( "1" );
333 list.append( PhoneParser::dtToString( rec->endDate()) ); 333 list.append( PhoneParser::dtToString( rec->endDate()) );
334 } else { 334 } else {
335 list.append( "0" ); 335 list.append( "0" );
336 list.append( "20991231T000000" ); 336 list.append( "20991231T000000" );
337 } 337 }
338 338
339 } 339 }
340 attList << list.join(""); 340 attList << list.join("");
341 attList << event->categoriesStr(); 341 attList << event->categoriesStr();
342 //qDebug("csum cat %s", event->categoriesStr().latin1()); 342 //qDebug("csum cat %s", event->categoriesStr().latin1());
343 343
344 attList << event->secrecyStr(); 344 attList << event->secrecyStr();
345 return PhoneFormat::getCsum(attList ); 345 return PhoneFormat::getCsum(attList );
346} 346}
347ulong PhoneFormat::getCsum( const QStringList & attList) 347ulong PhoneFormat::getCsum( const QStringList & attList)
348{ 348{
349 int max = attList.count(); 349 int max = attList.count();
350 ulong cSum = 0; 350 ulong cSum = 0;
351 int j,k,i; 351 int j,k,i;
352 int add; 352 int add;
353 for ( i = 0; i < max ; ++i ) { 353 for ( i = 0; i < max ; ++i ) {
354 QString s = attList[i]; 354 QString s = attList[i];
355 if ( ! s.isEmpty() ){ 355 if ( ! s.isEmpty() ){
356 j = s.length(); 356 j = s.length();
357 for ( k = 0; k < j; ++k ) { 357 for ( k = 0; k < j; ++k ) {
358 int mul = k +1; 358 int mul = k +1;
359 add = s[k].unicode (); 359 add = s[k].unicode ();
360 if ( k < 16 ) 360 if ( k < 16 )
361 mul = mul * mul; 361 mul = mul * mul;
362 int ii = i+1; 362 int ii = i+1;
363 add = add * mul *ii*ii*ii; 363 add = add * mul *ii*ii*ii;
364 cSum += add; 364 cSum += add;
365 } 365 }
366 } 366 }
367 367
368 } 368 }
369 //QString dump = attList.join(","); 369 //QString dump = attList.join(",");
370 //qDebug("csum: %d %s", cSum,dump.latin1()); 370 //qDebug("csum: %d %s", cSum,dump.latin1());
371 371
372 return cSum; 372 return cSum;
373 373
374} 374}
375//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 375//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
376#include <stdlib.h> 376#include <stdlib.h>
377#define DEBUGMODE false 377#define DEBUGMODE false
378bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) 378bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
379{ 379{
380 380
381 QString fileName; 381 QString fileName;
382#ifdef _WIN32_ 382#ifdef _WIN32_
383 fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; 383 fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs";
384#else 384#else
385 fileName = "/tmp/kdepimtemp.vcs"; 385 fileName = "/tmp/kdepimtemp.vcs";
386#endif 386#endif
387#ifdef DESKTOP_VERSION
387 QString command ="./kammu --backup " + fileName + " -yes" ; 388 QString command ="./kammu --backup " + fileName + " -yes" ;
389#else
390 QString command ="kammu --backup " + fileName + " -yes" ;
391#endif
388 int ret = system ( command.latin1() ); 392 int ret = system ( command.latin1() );
389 if ( ret != 0 ) { 393 if ( ret != 0 ) {
390 qDebug("Error::command returned %d", ret); 394 qDebug("Error::command returned %d", ret);
391 return false; 395 return false;
392 } 396 }
393 VCalFormat vfload; 397 VCalFormat vfload;
394 vfload.setLocalTime ( true ); 398 vfload.setLocalTime ( true );
395 qDebug("loading file ..."); 399 qDebug("loading file ...");
396 400
397 if ( ! vfload.load( calendar, fileName ) ) 401 if ( ! vfload.load( calendar, fileName ) )
398 return false; 402 return false;
399 QPtrList<Event> er = calendar->rawEvents(); 403 QPtrList<Event> er = calendar->rawEvents();
400 Event* ev = er.first(); 404 Event* ev = er.first();
401 qDebug("reading events... "); 405 qDebug("reading events... ");
402 while ( ev ) { 406 while ( ev ) {
403 QStringList cat = ev->categories(); 407 QStringList cat = ev->categories();
404 if ( cat.contains( "MeetingDEF" )) { 408 if ( cat.contains( "MeetingDEF" )) {
405 ev->setCategories( QStringList() ); 409 ev->setCategories( QStringList() );
406 } 410 }
407 int id = ev->pilotId(); 411 int id = ev->pilotId();
408 Event *event; 412 Event *event;
409 event = existingCal->event( mProfileName ,QString::number( id ) ); 413 event = existingCal->event( mProfileName ,QString::number( id ) );
410 if ( event ) { 414 if ( event ) {
411 event = (Event*)event->clone(); 415 event = (Event*)event->clone();
412 copyEvent( event, ev ); 416 copyEvent( event, ev );
413 calendar->deleteEvent( ev ); 417 calendar->deleteEvent( ev );
414 calendar->addEvent( event); 418 calendar->addEvent( event);
415 } 419 }
416 else 420 else
417 event = ev; 421 event = ev;
418 uint cSum; 422 uint cSum;
419 cSum = PhoneFormat::getCsumEvent( event ); 423 cSum = PhoneFormat::getCsumEvent( event );
420 event->setCsum( mProfileName, QString::number( cSum )); 424 event->setCsum( mProfileName, QString::number( cSum ));
421 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 425 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
422 event->setID( mProfileName,QString::number( id ) ); 426 event->setID( mProfileName,QString::number( id ) );
423 ev = er.next(); 427 ev = er.next();
424 } 428 }
425 { 429 {
426 qDebug("reading todos... "); 430 qDebug("reading todos... ");
427 QPtrList<Todo> tr = calendar->rawTodos(); 431 QPtrList<Todo> tr = calendar->rawTodos();
428 Todo* ev = tr.first(); 432 Todo* ev = tr.first();
429 while ( ev ) { 433 while ( ev ) {
430 434
431 QStringList cat = ev->categories(); 435 QStringList cat = ev->categories();
432 if ( cat.contains( "MeetingDEF" )) { 436 if ( cat.contains( "MeetingDEF" )) {
433 ev->setCategories( QStringList() ); 437 ev->setCategories( QStringList() );
434 } 438 }
435 int id = ev->pilotId(); 439 int id = ev->pilotId();
436 Todo *event; 440 Todo *event;
437 event = existingCal->todo( mProfileName ,QString::number( id ) ); 441 event = existingCal->todo( mProfileName ,QString::number( id ) );
438 if ( event ) { 442 if ( event ) {
439 //qDebug("copy todo %s ", event->summary().latin1()); 443 //qDebug("copy todo %s ", event->summary().latin1());
440 444
441 event = (Todo*)event->clone(); 445 event = (Todo*)event->clone();
442 copyTodo( event, ev ); 446 copyTodo( event, ev );
443 calendar->deleteTodo( ev ); 447 calendar->deleteTodo( ev );
444 calendar->addTodo( event); 448 calendar->addTodo( event);
445 } 449 }
446 else 450 else
447 event = ev; 451 event = ev;
448 uint cSum; 452 uint cSum;
449 cSum = PhoneFormat::getCsumTodo( event ); 453 cSum = PhoneFormat::getCsumTodo( event );
450 event->setCsum( mProfileName, QString::number( cSum )); 454 event->setCsum( mProfileName, QString::number( cSum ));
451 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 455 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
452 event->setID( mProfileName,QString::number( id ) ); 456 event->setID( mProfileName,QString::number( id ) );
453 ev = tr.next(); 457 ev = tr.next();
454 } 458 }
455 } 459 }
456 return true; 460 return true;
457} 461}
458void PhoneFormat::copyEvent( Event* to, Event* from ) 462void PhoneFormat::copyEvent( Event* to, Event* from )
459{ 463{
460 if ( from->dtStart().isValid() ) 464 if ( from->dtStart().isValid() )
461 to->setDtStart( from->dtStart() ); 465 to->setDtStart( from->dtStart() );
462 if ( from->dtEnd().isValid() ) 466 if ( from->dtEnd().isValid() )
463 to->setDtEnd( from->dtEnd() ); 467 to->setDtEnd( from->dtEnd() );
464 if ( !from->location().isEmpty() ) 468 if ( !from->location().isEmpty() )
465 to->setLocation( from->location() ); 469 to->setLocation( from->location() );
466 if ( !from->description().isEmpty() ) 470 if ( !from->description().isEmpty() )
467 to->setDescription( from->description() ); 471 to->setDescription( from->description() );
468 if ( !from->summary().isEmpty() ) 472 if ( !from->summary().isEmpty() )
469 to->setSummary( from->summary() ); 473 to->setSummary( from->summary() );
470 474
471 if ( from->alarms().count() ) { 475 if ( from->alarms().count() ) {
472 to->clearAlarms(); 476 to->clearAlarms();
473 Alarm *a = from->alarms().first(); 477 Alarm *a = from->alarms().first();
474 Alarm *b = to->newAlarm( ); 478 Alarm *b = to->newAlarm( );
475 b->setEnabled( a->enabled() ); 479 b->setEnabled( a->enabled() );
476 if ( a->hasStartOffset() ) { 480 if ( a->hasStartOffset() ) {
477 b->setStartOffset( a->startOffset() ); 481 b->setStartOffset( a->startOffset() );
478 } 482 }
479 if ( a->hasTime() ) 483 if ( a->hasTime() )
480 b->setTime( a->time() ); 484 b->setTime( a->time() );
481 485
482 } 486 }
483 QStringList cat = to->categories(); 487 QStringList cat = to->categories();
@@ -522,193 +526,197 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
522 } 526 }
523 527
524 QStringList cat = to->categories(); 528 QStringList cat = to->categories();
525 QStringList catFrom = from->categories(); 529 QStringList catFrom = from->categories();
526 QString nCat; 530 QString nCat;
527 int iii; 531 int iii;
528 for ( iii = 0; iii < catFrom.count();++iii ) { 532 for ( iii = 0; iii < catFrom.count();++iii ) {
529 nCat = catFrom[iii]; 533 nCat = catFrom[iii];
530 if ( !nCat.isEmpty() ) 534 if ( !nCat.isEmpty() )
531 if ( !cat.contains( nCat )) { 535 if ( !cat.contains( nCat )) {
532 cat << nCat; 536 cat << nCat;
533 } 537 }
534 } 538 }
535 to->setCategories( cat ); 539 to->setCategories( cat );
536 if ( from->isCompleted() ) { 540 if ( from->isCompleted() ) {
537 to->setCompleted( true ); 541 to->setCompleted( true );
538 if( from->completed().isValid() ) 542 if( from->completed().isValid() )
539 to->setCompleted( from->completed() ); 543 to->setCompleted( from->completed() );
540 } else { 544 } else {
541 // set percentcomplete only, if to->isCompleted() 545 // set percentcomplete only, if to->isCompleted()
542 if ( to->isCompleted() ) 546 if ( to->isCompleted() )
543 to->setPercentComplete(from->percentComplete()); 547 to->setPercentComplete(from->percentComplete());
544 } 548 }
545 if( to->priority() == 2 && from->priority() == 1 ) 549 if( to->priority() == 2 && from->priority() == 1 )
546 ; //skip 550 ; //skip
547 else if (to->priority() == 4 && from->priority() == 5 ) 551 else if (to->priority() == 4 && from->priority() == 5 )
548 ; 552 ;
549 else 553 else
550 to->setPriority(from->priority()); 554 to->setPriority(from->priority());
551 555
552} 556}
553#include <qcstring.h> 557#include <qcstring.h>
554 558
555void PhoneFormat::afterSave( Incidence* inc) 559void PhoneFormat::afterSave( Incidence* inc)
556{ 560{
557 uint csum; 561 uint csum;
558 inc->removeID( mProfileName ); 562 inc->removeID( mProfileName );
559 if ( inc->type() == "Event") 563 if ( inc->type() == "Event")
560 csum = PhoneFormat::getCsumEvent( (Event*) inc ); 564 csum = PhoneFormat::getCsumEvent( (Event*) inc );
561 else 565 else
562 csum = PhoneFormat::getCsumTodo( (Todo*) inc ); 566 csum = PhoneFormat::getCsumTodo( (Todo*) inc );
563 inc->setCsum( mProfileName, QString::number( csum )); 567 inc->setCsum( mProfileName, QString::number( csum ));
564 568
565 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 569 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
566 570
567} 571}
568bool PhoneFormat::save( Calendar *calendar) 572bool PhoneFormat::save( Calendar *calendar)
569{ 573{
570 QLabel status ( i18n(" Opening device ..."), 0 ); 574 QLabel status ( i18n(" Opening device ..."), 0 );
571 int w = status.sizeHint().width()+20 ; 575 int w = status.sizeHint().width()+20 ;
572 if ( w < 200 ) w = 230; 576 if ( w < 200 ) w = 230;
573 int h = status.sizeHint().height()+20 ; 577 int h = status.sizeHint().height()+20 ;
574 int dw = QApplication::desktop()->width(); 578 int dw = QApplication::desktop()->width();
575 int dh = QApplication::desktop()->height(); 579 int dh = QApplication::desktop()->height();
576 status.setCaption(i18n("Writing to phone...") ); 580 status.setCaption(i18n("Writing to phone...") );
577 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 581 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
578 status.show(); 582 status.show();
579 status.raise(); 583 status.raise();
580 qApp->processEvents(); 584 qApp->processEvents();
581 QString message; 585 QString message;
582#ifdef _WIN32_ 586#ifdef _WIN32_
583 QString fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs"; 587 QString fileName = locateLocal("data", "korganizer") + "\\tempfile.vcs";
584#else 588#else
585 QString fileName = "/tmp/kdepimtemp.vcs"; 589 QString fileName = "/tmp/kdepimtemp.vcs";
586#endif 590#endif
587 591
588 // 1 remove events which should be deleted 592 // 1 remove events which should be deleted
589 QPtrList<Event> er = calendar->rawEvents(); 593 QPtrList<Event> er = calendar->rawEvents();
590 Event* ev = er.first(); 594 Event* ev = er.first();
591 while ( ev ) { 595 while ( ev ) {
592 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 596 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
593 calendar->deleteEvent( ev ); 597 calendar->deleteEvent( ev );
594 } else { 598 } else {
595 599
596 } 600 }
597 ev = er.next(); 601 ev = er.next();
598 } 602 }
599 // 2 remove todos which should be deleted 603 // 2 remove todos which should be deleted
600 QPtrList<Todo> tl = calendar->rawTodos(); 604 QPtrList<Todo> tl = calendar->rawTodos();
601 Todo* to = tl.first(); 605 Todo* to = tl.first();
602 while ( to ) { 606 while ( to ) {
603 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 607 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
604 calendar->deleteTodo( to ); 608 calendar->deleteTodo( to );
605 } else { 609 } else {
606 if ( to->isCompleted()) { 610 if ( to->isCompleted()) {
607 calendar->deleteTodo( to ); 611 calendar->deleteTodo( to );
608 } 612 }
609 } 613 }
610 to = tl.next(); 614 to = tl.next();
611 } 615 }
612 // 3 save file 616 // 3 save file
613 VCalFormat vfsave; 617 VCalFormat vfsave;
614 vfsave.setLocalTime ( true ); 618 vfsave.setLocalTime ( true );
615 if ( ! vfsave.save( calendar, fileName ) ) 619 if ( ! vfsave.save( calendar, fileName ) )
616 return false; 620 return false;
617 // 4 call kammu 621 // 4 call kammu
622#ifdef DESKTOP_VERSION
618 QString command ="./kammu --restore " + fileName ; 623 QString command ="./kammu --restore " + fileName ;
624#else
625 QString command ="kammu --restore " + fileName ;
626#endif
619 int ret; 627 int ret;
620 while ( (ret = system ( command.latin1())) != 0 ) { 628 while ( (ret = system ( command.latin1())) != 0 ) {
621 qDebug("Error S::command returned %d. asking users", ret); 629 qDebug("Error S::command returned %d. asking users", ret);
622 int retval = KMessageBox::warningContinueCancel(0, 630 int retval = KMessageBox::warningContinueCancel(0,
623 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel")); 631 i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone sync"),i18n("Retry"),i18n("Cancel"));
624 if ( retval != KMessageBox::Continue ) 632 if ( retval != KMessageBox::Continue )
625 return false; 633 return false;
626 } 634 }
627 635
628 // 5 reread data 636 // 5 reread data
629 message = i18n(" Rereading all data ... "); 637 message = i18n(" Rereading all data ... ");
630 status.setText ( message ); 638 status.setText ( message );
631 qApp->processEvents(); 639 qApp->processEvents();
632 CalendarLocal* calendarTemp = new CalendarLocal(); 640 CalendarLocal* calendarTemp = new CalendarLocal();
633 calendarTemp->setTimeZoneId( calendar->timeZoneId()); 641 calendarTemp->setTimeZoneId( calendar->timeZoneId());
634 if ( ! load( calendarTemp,calendar) ){ 642 if ( ! load( calendarTemp,calendar) ){
635 qDebug("error reloading calendar "); 643 qDebug("error reloading calendar ");
636 delete calendarTemp; 644 delete calendarTemp;
637 return false; 645 return false;
638 } 646 }
639 // 6 compare data 647 // 6 compare data
640 648
641//algo 6 compare event 649//algo 6 compare event
642 er = calendar->rawEvents(); 650 er = calendar->rawEvents();
643 ev = er.first(); 651 ev = er.first();
644 message = i18n(" Comparing event # "); 652 message = i18n(" Comparing event # ");
645 QPtrList<Event> er1 = calendarTemp->rawEvents(); 653 QPtrList<Event> er1 = calendarTemp->rawEvents();
646 Event* ev1; 654 Event* ev1;
647 int procCount = 0; 655 int procCount = 0;
648 while ( ev ) { 656 while ( ev ) {
649 //qDebug("event new ID %s",ev->summary().latin1()); 657 //qDebug("event new ID %s",ev->summary().latin1());
650 status.setText ( message + QString::number ( ++procCount ) ); 658 status.setText ( message + QString::number ( ++procCount ) );
651 qApp->processEvents(); 659 qApp->processEvents();
652 uint csum; 660 uint csum;
653 csum = PhoneFormat::getCsumEvent( ev ); 661 csum = PhoneFormat::getCsumEvent( ev );
654 QString cSum = QString::number( csum ); 662 QString cSum = QString::number( csum );
655 //ev->setCsum( mProfileName, cSum ); 663 //ev->setCsum( mProfileName, cSum );
656 //qDebug("Event cSum %s ", cSum.latin1()); 664 //qDebug("Event cSum %s ", cSum.latin1());
657 ev1 = er1.first(); 665 ev1 = er1.first();
658 while ( ev1 ) { 666 while ( ev1 ) {
659 if ( ev1->getCsum( mProfileName ) == cSum ) { 667 if ( ev1->getCsum( mProfileName ) == cSum ) {
660 er1.remove( ev1 ); 668 er1.remove( ev1 );
661 afterSave( ev ); 669 afterSave( ev );
662 ev->setID(mProfileName, ev1->getID(mProfileName) ); 670 ev->setID(mProfileName, ev1->getID(mProfileName) );
663 //qDebug("Event found on phone for %s ", ev->summary().latin1()); 671 //qDebug("Event found on phone for %s ", ev->summary().latin1());
664 672
665 break; 673 break;
666 } 674 }
667 ev1 = er1.next(); 675 ev1 = er1.next();
668 } 676 }
669 if ( ! ev1 ) { 677 if ( ! ev1 ) {
670 // ev->removeID(mProfileName); 678 // ev->removeID(mProfileName);
671 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); 679 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
672 } 680 }
673 681
674 682
675 ev = er.next(); 683 ev = er.next();
676 } 684 }
677 //algo 6 compare todo 685 //algo 6 compare todo
678 tl = calendar->rawTodos(); 686 tl = calendar->rawTodos();
679 to = tl.first(); 687 to = tl.first();
680 procCount = 0; 688 procCount = 0;
681 QPtrList<Todo> tl1 = calendarTemp->rawTodos(); 689 QPtrList<Todo> tl1 = calendarTemp->rawTodos();
682 Todo* to1 ; 690 Todo* to1 ;
683 message = i18n(" Comparing todo # "); 691 message = i18n(" Comparing todo # ");
684 while ( to ) { 692 while ( to ) {
685 status.setText ( message + QString::number ( ++procCount ) ); 693 status.setText ( message + QString::number ( ++procCount ) );
686 qApp->processEvents(); 694 qApp->processEvents();
687 uint csum; 695 uint csum;
688 csum = PhoneFormat::getCsumTodo( to ); 696 csum = PhoneFormat::getCsumTodo( to );
689 QString cSum = QString::number( csum ); 697 QString cSum = QString::number( csum );
690 //to->setCsum( mProfileName, cSum ); 698 //to->setCsum( mProfileName, cSum );
691 //qDebug("Todo cSum %s ", cSum.latin1()); 699 //qDebug("Todo cSum %s ", cSum.latin1());
692 Todo* to1 = tl1.first(); 700 Todo* to1 = tl1.first();
693 while ( to1 ) { 701 while ( to1 ) {
694 if ( to1->getCsum( mProfileName ) == cSum ) { 702 if ( to1->getCsum( mProfileName ) == cSum ) {
695 tl1.remove( to1 ); 703 tl1.remove( to1 );
696 afterSave( to ); 704 afterSave( to );
697 to->setID(mProfileName, to1->getID(mProfileName) ); 705 to->setID(mProfileName, to1->getID(mProfileName) );
698 break; 706 break;
699 } 707 }
700 to1 = tl1.next(); 708 to1 = tl1.next();
701 } 709 }
702 if ( ! to1 ) { 710 if ( ! to1 ) {
703 //to->removeID(mProfileName); 711 //to->removeID(mProfileName);
704 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1()); 712 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1());
705 } 713 }
706 714
707 to = tl.next(); 715 to = tl.next();
708 } 716 }
709 delete calendarTemp; 717 delete calendarTemp;
710 return true; 718 return true;
711 719
712 720
713 721
714} 722}