summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-09-12 17:18:27 (UTC)
committer zautrix <zautrix>2004-09-12 17:18:27 (UTC)
commitbc4153a99e205f43d0144e2e910730dd1a14d402 (patch) (unidiff)
tree16aeb28cd765539bac6e85e714478f31a7b93bac /libkcal
parenta222c2f7369eeefd19454c973c0cc48300f72bec (diff)
downloadkdepimpi-bc4153a99e205f43d0144e2e910730dd1a14d402.zip
kdepimpi-bc4153a99e205f43d0144e2e910730dd1a14d402.tar.gz
kdepimpi-bc4153a99e205f43d0144e2e910730dd1a14d402.tar.bz2
added missing sync featute
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index ef69bce..6d0da5c 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -272,14 +272,12 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
272 mul = mul * mul; 272 mul = mul * mul;
273 int ii = i+1; 273 int ii = i+1;
274 add = add * mul *ii*ii*ii; 274 add = add * mul *ii*ii*ii;
275 cSum += add; 275 cSum += add;
276 } 276 }
277 } 277 }
278 if ( i == 0 )
279 qDebug("csum: i == 0 %d ", cSum);
280 278
281 } 279 }
282 QString dump = attList.join(","); 280 QString dump = attList.join(",");
283 qDebug("csum: %d %s", cSum,dump.latin1()); 281 qDebug("csum: %d %s", cSum,dump.latin1());
284 282
285 return cSum; 283 return cSum;
@@ -464,19 +462,18 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
464#include <qcstring.h> 462#include <qcstring.h>
465 463
466void PhoneFormat::afterSave( Incidence* inc) 464void PhoneFormat::afterSave( Incidence* inc)
467{ 465{
468 uint csum; 466 uint csum;
469 inc->removeID( mProfileName ); 467 inc->removeID( mProfileName );
470#if 0
471 if ( inc->type() == "Event") 468 if ( inc->type() == "Event")
472 csum = PhoneFormat::getCsumEvent( (Event*) inc ); 469 csum = PhoneFormat::getCsumEvent( (Event*) inc );
473 else 470 else
474 csum = PhoneFormat::getCsumTodo( (Todo*) inc ); 471 csum = PhoneFormat::getCsumTodo( (Todo*) inc );
475 inc->setCsum( mProfileName, QString::number( csum )); 472 inc->setCsum( mProfileName, QString::number( csum ));
476#endif 473
477 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
478 475
479} 476}
480bool PhoneFormat::save( Calendar *calendar) 477bool PhoneFormat::save( Calendar *calendar)
481{ 478{
482 QLabel status ( i18n(" Opening device ..."), 0 ); 479 QLabel status ( i18n(" Opening device ..."), 0 );
@@ -511,13 +508,17 @@ bool PhoneFormat::save( Calendar *calendar)
511 // 2 remove todos which should be deleted 508 // 2 remove todos which should be deleted
512 QPtrList<Todo> tl = calendar->rawTodos(); 509 QPtrList<Todo> tl = calendar->rawTodos();
513 Todo* to = tl.first(); 510 Todo* to = tl.first();
514 while ( to ) { 511 while ( to ) {
515 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 512 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
516 calendar->deleteTodo( to ); 513 calendar->deleteTodo( to );
517 } 514 } else {
515 if ( to->isCompleted()) {
516 calendar->deleteTodo( to );
517 }
518 }
518 to = tl.next(); 519 to = tl.next();
519 } 520 }
520 // 3 save file 521 // 3 save file
521 VCalFormat vfsave; 522 VCalFormat vfsave;
522 vfsave.setLocalTime ( true ); 523 vfsave.setLocalTime ( true );
523 if ( ! vfsave.save( calendar, fileName ) ) 524 if ( ! vfsave.save( calendar, fileName ) )
@@ -560,13 +561,13 @@ bool PhoneFormat::save( Calendar *calendar)
560 //qDebug("event new ID %s",ev->summary().latin1()); 561 //qDebug("event new ID %s",ev->summary().latin1());
561 status.setText ( message + QString::number ( ++procCount ) ); 562 status.setText ( message + QString::number ( ++procCount ) );
562 qApp->processEvents(); 563 qApp->processEvents();
563 uint csum; 564 uint csum;
564 csum = PhoneFormat::getCsumEvent( ev ); 565 csum = PhoneFormat::getCsumEvent( ev );
565 QString cSum = QString::number( csum ); 566 QString cSum = QString::number( csum );
566 ev->setCsum( mProfileName, cSum ); 567 //ev->setCsum( mProfileName, cSum );
567 //qDebug("Event cSum %s ", cSum.latin1()); 568 //qDebug("Event cSum %s ", cSum.latin1());
568 ev1 = er1.first(); 569 ev1 = er1.first();
569 while ( ev1 ) { 570 while ( ev1 ) {
570 if ( ev1->getCsum( mProfileName ) == cSum ) { 571 if ( ev1->getCsum( mProfileName ) == cSum ) {
571 er1.remove( ev1 ); 572 er1.remove( ev1 );
572 afterSave( ev ); 573 afterSave( ev );
@@ -596,13 +597,13 @@ bool PhoneFormat::save( Calendar *calendar)
596 qDebug("todo2 %d ", procCount); 597 qDebug("todo2 %d ", procCount);
597 status.setText ( message + QString::number ( ++procCount ) ); 598 status.setText ( message + QString::number ( ++procCount ) );
598 qApp->processEvents(); 599 qApp->processEvents();
599 uint csum; 600 uint csum;
600 csum = PhoneFormat::getCsumTodo( to ); 601 csum = PhoneFormat::getCsumTodo( to );
601 QString cSum = QString::number( csum ); 602 QString cSum = QString::number( csum );
602 to->setCsum( mProfileName, cSum ); 603 //to->setCsum( mProfileName, cSum );
603 qDebug("Todo cSum %s ", cSum.latin1()); 604 qDebug("Todo cSum %s ", cSum.latin1());
604 Todo* to1 = tl1.first(); 605 Todo* to1 = tl1.first();
605 while ( to1 ) { 606 while ( to1 ) {
606 if ( to1->getCsum( mProfileName ) == cSum ) { 607 if ( to1->getCsum( mProfileName ) == cSum ) {
607 tl1.remove( to1 ); 608 tl1.remove( to1 );
608 afterSave( to ); 609 afterSave( to );