-rw-r--r-- | libkcal/phoneformat.cpp | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 6df639f..ef69bce 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -130,5 +130,8 @@ ulong PhoneFormat::getCsumTodo( Todo* todo ) | |||
130 | completedString = "yes"; | 130 | completedString = "yes"; |
131 | attList << completedString; | 131 | attList << completedString; |
132 | attList << QString::number( todo->priority() ); | 132 | int prio = todo->priority(); |
133 | if( prio == 2 ) prio = 1; | ||
134 | if (prio == 4 ) prio = 5 ; | ||
135 | attList << QString::number( prio ); | ||
133 | QString alarmString = "na"; | 136 | QString alarmString = "na"; |
134 | Alarm *alarm; | 137 | Alarm *alarm; |
@@ -255,9 +258,9 @@ ulong PhoneFormat::getCsumEvent( Event* event ) | |||
255 | ulong PhoneFormat::getCsum( const QStringList & attList) | 258 | ulong PhoneFormat::getCsum( const QStringList & attList) |
256 | { | 259 | { |
257 | int max = attList.count() -1; | 260 | int max = attList.count(); |
258 | ulong cSum = 0; | 261 | ulong cSum = 0; |
259 | int j,k,i; | 262 | int j,k,i; |
260 | int add; | 263 | int add; |
261 | for ( i = 1; i < max ; ++i ) { | 264 | for ( i = 0; i < max ; ++i ) { |
262 | QString s = attList[i]; | 265 | QString s = attList[i]; |
263 | if ( ! s.isEmpty() ){ | 266 | if ( ! s.isEmpty() ){ |
@@ -268,11 +271,15 @@ ulong PhoneFormat::getCsum( const QStringList & attList) | |||
268 | if ( k < 16 ) | 271 | if ( k < 16 ) |
269 | mul = mul * mul; | 272 | mul = mul * mul; |
270 | add = add * mul *i*i*i; | 273 | int ii = i+1; |
274 | add = add * mul *ii*ii*ii; | ||
271 | cSum += add; | 275 | cSum += add; |
272 | } | 276 | } |
273 | } | 277 | } |
278 | if ( i == 0 ) | ||
279 | qDebug("csum: i == 0 %d ", cSum); | ||
280 | |||
274 | } | 281 | } |
275 | //QString dump = attList.join(","); | 282 | QString dump = attList.join(","); |
276 | //qDebug("csum: %s", dump.latin1()); | 283 | qDebug("csum: %d %s", cSum,dump.latin1()); |
277 | 284 | ||
278 | return cSum; | 285 | return cSum; |
@@ -291,6 +298,5 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
291 | fileName = "/tmp/kdepimtemp.vcs"; | 298 | fileName = "/tmp/kdepimtemp.vcs"; |
292 | #endif | 299 | #endif |
293 | QString command ="./kammu --backup " + fileName + " -yes -C" + | 300 | QString command ="./kammu --backup " + fileName + " -yes" ; |
294 | mConnection +" -D" + mDevice +" -M" + mModel; | ||
295 | int ret = system ( command.latin1() ); | 301 | int ret = system ( command.latin1() ); |
296 | if ( ret != 0 ) { | 302 | if ( ret != 0 ) { |
@@ -345,4 +351,6 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | |||
345 | event = existingCal->todo( mProfileName ,QString::number( id ) ); | 351 | event = existingCal->todo( mProfileName ,QString::number( id ) ); |
346 | if ( event ) { | 352 | if ( event ) { |
353 | qDebug("copy todo %s ", event->summary().latin1()); | ||
354 | |||
347 | event = (Todo*)event->clone(); | 355 | event = (Todo*)event->clone(); |
348 | copyTodo( event, ev ); | 356 | copyTodo( event, ev ); |
@@ -376,5 +384,6 @@ void PhoneFormat::copyEvent( Event* to, Event* from ) | |||
376 | 384 | ||
377 | QPtrListIterator<Alarm> it( from->alarms() ); | 385 | QPtrListIterator<Alarm> it( from->alarms() ); |
378 | to->clearAlarms(); | 386 | if ( it.current() ) |
387 | to->clearAlarms(); | ||
379 | const Alarm *a; | 388 | const Alarm *a; |
380 | while( (a = it.current()) ) { | 389 | while( (a = it.current()) ) { |
@@ -415,5 +424,6 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from ) | |||
415 | 424 | ||
416 | QPtrListIterator<Alarm> it( from->alarms() ); | 425 | QPtrListIterator<Alarm> it( from->alarms() ); |
417 | to->clearAlarms(); | 426 | if ( it.current() ) |
427 | to->clearAlarms(); | ||
418 | const Alarm *a; | 428 | const Alarm *a; |
419 | while( (a = it.current()) ) { | 429 | while( (a = it.current()) ) { |
@@ -444,5 +454,10 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from ) | |||
444 | to->setPercentComplete(from->percentComplete()); | 454 | to->setPercentComplete(from->percentComplete()); |
445 | } | 455 | } |
446 | to->setPriority(from->priority()); | 456 | if( to->priority() == 2 && from->priority() == 1 ) |
457 | ; //skip | ||
458 | else if (to->priority() == 4 && from->priority() == 5 ) | ||
459 | ; | ||
460 | else | ||
461 | to->setPriority(from->priority()); | ||
447 | 462 | ||
448 | } | 463 | } |
@@ -453,4 +468,5 @@ void PhoneFormat::afterSave( Incidence* inc) | |||
453 | uint csum; | 468 | uint csum; |
454 | inc->removeID( mProfileName ); | 469 | inc->removeID( mProfileName ); |
470 | #if 0 | ||
455 | if ( inc->type() == "Event") | 471 | if ( inc->type() == "Event") |
456 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); | 472 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); |
@@ -458,4 +474,5 @@ void PhoneFormat::afterSave( Incidence* inc) | |||
458 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); | 474 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); |
459 | inc->setCsum( mProfileName, QString::number( csum )); | 475 | inc->setCsum( mProfileName, QString::number( csum )); |
476 | #endif | ||
460 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 477 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
461 | 478 | ||
@@ -507,6 +524,5 @@ bool PhoneFormat::save( Calendar *calendar) | |||
507 | return false; | 524 | return false; |
508 | // 4 call kammu | 525 | // 4 call kammu |
509 | QString command ="./kammu --restore " + fileName + " -C" + | 526 | QString command ="./kammu --restore " + fileName ; |
510 | mConnection +" -D" + mDevice +" -M" + mModel; | ||
511 | int ret; | 527 | int ret; |
512 | while ( (ret = system ( command.latin1())) != 0 ) { | 528 | while ( (ret = system ( command.latin1())) != 0 ) { |