summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-09-12 22:05:14 (UTC)
committer zautrix <zautrix>2004-09-12 22:05:14 (UTC)
commit483c6ac49ea1764bdd154e33e220b7945a6ab754 (patch) (unidiff)
tree29d5cb00ff3a36595c2fb0e1125d3e2b8ec246a6 /libkcal
parent185e2f4a2b10c65d8186dad63fe6cc3acd6b84f1 (diff)
downloadkdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.zip
kdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.tar.gz
kdepimpi-483c6ac49ea1764bdd154e33e220b7945a6ab754.tar.bz2
fix for Z
Diffstat (limited to 'libkcal') (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
@@ -363,49 +363,53 @@ ulong PhoneFormat::getCsum( const QStringList & attList)
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();
@@ -594,49 +598,53 @@ bool PhoneFormat::save( Calendar *calendar)
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();