-rw-r--r-- | libkcal/phoneformat.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 16c5880..29c1ae6 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -359,49 +359,49 @@ ulong PhoneFormat::getCsum( const QStringList & attList) | |||
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 |
378 | bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) | 378 | bool 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("tmp", "tempfile.vcs") | 383 | fileName = locateLocal("tmp", "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 | #ifdef DESKTOP_VERSION |
388 | QString command ="./kammu --backup " + fileName + " -yes" ; | 388 | QString command ="./kammu --backup " + fileName + " -yes" ; |
389 | #else | 389 | #else |
390 | QString command ="kammu --backup " + fileName + " -yes" ; | 390 | QString command ="kammu --backup " + fileName + " -yes" ; |
391 | #endif | 391 | #endif |
392 | int ret = system ( command.latin1() ); | 392 | int ret = system ( command.latin1() ); |
393 | if ( ret != 0 ) { | 393 | if ( ret != 0 ) { |
394 | qDebug("Error::command returned %d", ret); | 394 | qDebug("Error::command returned %d", ret); |
395 | return false; | 395 | return false; |
396 | } | 396 | } |
397 | VCalFormat vfload; | 397 | VCalFormat vfload; |
398 | vfload.setLocalTime ( true ); | 398 | vfload.setLocalTime ( true ); |
399 | qDebug("loading file ..."); | 399 | qDebug("loading file ..."); |
400 | 400 | ||
401 | if ( ! vfload.load( calendar, fileName ) ) | 401 | if ( ! vfload.load( calendar, fileName ) ) |
402 | return false; | 402 | return false; |
403 | QPtrList<Event> er = calendar->rawEvents(); | 403 | QPtrList<Event> er = calendar->rawEvents(); |
404 | Event* ev = er.first(); | 404 | Event* ev = er.first(); |
405 | qDebug("reading events... "); | 405 | qDebug("reading events... "); |
406 | while ( ev ) { | 406 | while ( ev ) { |
407 | QStringList cat = ev->categories(); | 407 | QStringList cat = ev->categories(); |
@@ -563,49 +563,49 @@ void PhoneFormat::afterSave( Incidence* inc) | |||
563 | if ( inc->type() == "Event") | 563 | if ( inc->type() == "Event") |
564 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); | 564 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); |
565 | else | 565 | else |
566 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); | 566 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); |
567 | inc->setCsum( mProfileName, QString::number( csum )); | 567 | inc->setCsum( mProfileName, QString::number( csum )); |
568 | 568 | ||
569 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 569 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
570 | 570 | ||
571 | } | 571 | } |
572 | bool PhoneFormat::save( Calendar *calendar) | 572 | bool PhoneFormat::save( Calendar *calendar) |
573 | { | 573 | { |
574 | QLabel status ( i18n(" Opening device ..."), 0 ); | 574 | QLabel status ( i18n(" Opening device ..."), 0 ); |
575 | int w = status.sizeHint().width()+20 ; | 575 | int w = status.sizeHint().width()+20 ; |
576 | if ( w < 200 ) w = 230; | 576 | if ( w < 200 ) w = 230; |
577 | int h = status.sizeHint().height()+20 ; | 577 | int h = status.sizeHint().height()+20 ; |
578 | int dw = QApplication::desktop()->width(); | 578 | int dw = QApplication::desktop()->width(); |
579 | int dh = QApplication::desktop()->height(); | 579 | int dh = QApplication::desktop()->height(); |
580 | status.setCaption(i18n("Writing to phone...") ); | 580 | status.setCaption(i18n("Writing to phone...") ); |
581 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 581 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
582 | status.show(); | 582 | status.show(); |
583 | status.raise(); | 583 | status.raise(); |
584 | qApp->processEvents(); | 584 | qApp->processEvents(); |
585 | QString message; | 585 | QString message; |
586 | #ifdef _WIN32_ | 586 | #ifdef _WIN32_ |
587 | QString fileName = locateLocal("tmp", "tempfile.vcs") | 587 | QString fileName = locateLocal("tmp", "tempfile.vcs"); |
588 | #else | 588 | #else |
589 | QString fileName = "/tmp/kdepimtemp.vcs"; | 589 | QString fileName = "/tmp/kdepimtemp.vcs"; |
590 | #endif | 590 | #endif |
591 | 591 | ||
592 | // 1 remove events which should be deleted | 592 | // 1 remove events which should be deleted |
593 | QPtrList<Event> er = calendar->rawEvents(); | 593 | QPtrList<Event> er = calendar->rawEvents(); |
594 | Event* ev = er.first(); | 594 | Event* ev = er.first(); |
595 | while ( ev ) { | 595 | while ( ev ) { |
596 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 596 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
597 | calendar->deleteEvent( ev ); | 597 | calendar->deleteEvent( ev ); |
598 | } else { | 598 | } else { |
599 | 599 | ||
600 | } | 600 | } |
601 | ev = er.next(); | 601 | ev = er.next(); |
602 | } | 602 | } |
603 | // 2 remove todos which should be deleted | 603 | // 2 remove todos which should be deleted |
604 | QPtrList<Todo> tl = calendar->rawTodos(); | 604 | QPtrList<Todo> tl = calendar->rawTodos(); |
605 | Todo* to = tl.first(); | 605 | Todo* to = tl.first(); |
606 | while ( to ) { | 606 | while ( to ) { |
607 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 607 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
608 | calendar->deleteTodo( to ); | 608 | calendar->deleteTodo( to ); |
609 | } else { | 609 | } else { |
610 | if ( to->isCompleted()) { | 610 | if ( to->isCompleted()) { |
611 | calendar->deleteTodo( to ); | 611 | calendar->deleteTodo( to ); |