summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp4
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
@@ -351,65 +351,65 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
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("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();
408 if ( cat.contains( "MeetingDEF" )) { 408 if ( cat.contains( "MeetingDEF" )) {
409 ev->setCategories( QStringList() ); 409 ev->setCategories( QStringList() );
410 } 410 }
411 int id = ev->pilotId(); 411 int id = ev->pilotId();
412 Event *event; 412 Event *event;
413 event = existingCal->event( mProfileName ,QString::number( id ) ); 413 event = existingCal->event( mProfileName ,QString::number( id ) );
414 if ( event ) { 414 if ( event ) {
415 event = (Event*)event->clone(); 415 event = (Event*)event->clone();
@@ -555,65 +555,65 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
555 555
556} 556}
557#include <qcstring.h> 557#include <qcstring.h>
558 558
559void PhoneFormat::afterSave( Incidence* inc) 559void PhoneFormat::afterSave( Incidence* inc)
560{ 560{
561 uint csum; 561 uint csum;
562 inc->removeID( mProfileName ); 562 inc->removeID( mProfileName );
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}
572bool PhoneFormat::save( Calendar *calendar) 572bool 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 );
612 } 612 }
613 } 613 }
614 to = tl.next(); 614 to = tl.next();
615 } 615 }
616 // 3 save file 616 // 3 save file
617 VCalFormat vfsave; 617 VCalFormat vfsave;
618 vfsave.setLocalTime ( true ); 618 vfsave.setLocalTime ( true );
619 if ( ! vfsave.save( calendar, fileName ) ) 619 if ( ! vfsave.save( calendar, fileName ) )