author | zautrix <zautrix> | 2004-08-20 04:35:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-20 04:35:46 (UTC) |
commit | b42c4af4200c67802ee0cc57e10e1464903736b7 (patch) (unidiff) | |
tree | 59f35319f3223892e2353bb8a2c72cb9e87ca0f9 | |
parent | 93decd4185adc7197008e8397cf753a5ab674d99 (diff) | |
download | kdepimpi-b42c4af4200c67802ee0cc57e10e1464903736b7.zip kdepimpi-b42c4af4200c67802ee0cc57e10e1464903736b7.tar.gz kdepimpi-b42c4af4200c67802ee0cc57e10e1464903736b7.tar.bz2 |
change reverted
-rw-r--r-- | libkcal/sharpformat.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index 820d068..defdb09 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -462,97 +462,97 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | |||
462 | tempString = getPart( answer, ok, start ); | 462 | tempString = getPart( answer, ok, start ); |
463 | if ( start >= len || start == 0 ) { | 463 | if ( start >= len || start == 0 ) { |
464 | start = 0; | 464 | start = 0; |
465 | ok = false; | 465 | ok = false; |
466 | } | 466 | } |
467 | if ( tempString.right(1) =="\n" ) | 467 | if ( tempString.right(1) =="\n" ) |
468 | tempString = tempString.left( tempString.length()-1); | 468 | tempString = tempString.left( tempString.length()-1); |
469 | 469 | ||
470 | templist.append( tempString ); | 470 | templist.append( tempString ); |
471 | } | 471 | } |
472 | ++ccc; | 472 | ++ccc; |
473 | if ( ccc == 2 && loopCount < 25 ) { | 473 | if ( ccc == 2 && loopCount < 25 ) { |
474 | start = 0; | 474 | start = 0; |
475 | bool ok; | 475 | bool ok; |
476 | int newnum = templist[0].toInt( &ok ); | 476 | int newnum = templist[0].toInt( &ok ); |
477 | if ( ok && newnum > 0) { | 477 | if ( ok && newnum > 0) { |
478 | retval = newnum; | 478 | retval = newnum; |
479 | inc->setID( "Sharp_DTM",templist[0] ); | 479 | inc->setID( "Sharp_DTM",templist[0] ); |
480 | inc->setCsum( "Sharp_DTM", QString::number( getCsum( templist ) )); | 480 | inc->setCsum( "Sharp_DTM", QString::number( getCsum( templist ) )); |
481 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 481 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
482 | } | 482 | } |
483 | } | 483 | } |
484 | } | 484 | } |
485 | //qDebug("getNumFromRecord returning : %d ", retval); | 485 | //qDebug("getNumFromRecord returning : %d ", retval); |
486 | return retval; | 486 | return retval; |
487 | } | 487 | } |
488 | bool SharpFormat::save( Calendar *calendar) | 488 | bool SharpFormat::save( Calendar *calendar) |
489 | { | 489 | { |
490 | 490 | ||
491 | QLabel status ( i18n("Processing/adding events ..."), 0 ); | 491 | QLabel status ( i18n("Processing/adding events ..."), 0 ); |
492 | int w = status.sizeHint().width()+20 ; | 492 | int w = status.sizeHint().width()+20 ; |
493 | if ( w < 200 ) w = 200; | 493 | if ( w < 200 ) w = 200; |
494 | int h = status.sizeHint().height()+20 ; | 494 | int h = status.sizeHint().height()+20 ; |
495 | int dw = QApplication::desktop()->width(); | 495 | int dw = QApplication::desktop()->width(); |
496 | int dh = QApplication::desktop()->height(); | 496 | int dh = QApplication::desktop()->height(); |
497 | status.setCaption(i18n("Writing DTM Data") ); | 497 | status.setCaption(i18n("Writing DTM Data") ); |
498 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 498 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
499 | status.show(); | 499 | status.show(); |
500 | status.raise(); | 500 | status.raise(); |
501 | qApp->processEvents(); | 501 | qApp->processEvents(); |
502 | bool debug = DEBUGMODE; | 502 | bool debug = DEBUGMODE; |
503 | QString codec = "utf8"; | 503 | QString codec = "utf8"; |
504 | QString answer; | 504 | QString answer; |
505 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; | 505 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; |
506 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; | 506 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; |
507 | QString command; | 507 | QString command; |
508 | QPtrList<Event> er = calendar->rawEvents(); | 508 | QPtrList<Event> er = calendar->rawEvents(); |
509 | Event* ev = er.first(); | 509 | Event* ev = er.first(); |
510 | QString fileName = "/tmp/kdepimtempfile"; | 510 | QString fileName = "/tmp/kopitempout"; |
511 | int i = 0; | 511 | int i = 0; |
512 | QString changeString = ePrefix; | 512 | QString changeString = ePrefix; |
513 | QString deleteString = ePrefix; | 513 | QString deleteString = ePrefix; |
514 | bool deleteEnt = false; | 514 | bool deleteEnt = false; |
515 | bool changeEnt = false; | 515 | bool changeEnt = false; |
516 | QString message = i18n("Processing event # "); | 516 | QString message = i18n("Processing event # "); |
517 | int procCount = 0; | 517 | int procCount = 0; |
518 | while ( ev ) { | 518 | while ( ev ) { |
519 | //qDebug("i %d ", ++i); | 519 | //qDebug("i %d ", ++i); |
520 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 520 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
521 | status.setText ( message + QString::number ( ++procCount ) ); | 521 | status.setText ( message + QString::number ( ++procCount ) ); |
522 | qApp->processEvents(); | 522 | qApp->processEvents(); |
523 | QString eString = getEventString( ev ); | 523 | QString eString = getEventString( ev ); |
524 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete | 524 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete |
525 | // deleting empty strings does not work. | 525 | // deleting empty strings does not work. |
526 | // we write first and x and then delete the record with the x | 526 | // we write first and x and then delete the record with the x |
527 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 527 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
528 | changeString += eString + "\n"; | 528 | changeString += eString + "\n"; |
529 | deleteString += eString + "\n"; | 529 | deleteString += eString + "\n"; |
530 | deleteEnt = true; | 530 | deleteEnt = true; |
531 | changeEnt = true; | 531 | changeEnt = true; |
532 | } | 532 | } |
533 | else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new | 533 | else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new |
534 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 534 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
535 | system ( command.utf8() ); | 535 | system ( command.utf8() ); |
536 | QFile file( fileName ); | 536 | QFile file( fileName ); |
537 | if (!file.open( IO_ReadOnly ) ) { | 537 | if (!file.open( IO_ReadOnly ) ) { |
538 | return false; | 538 | return false; |
539 | 539 | ||
540 | } | 540 | } |
541 | QTextStream ts( &file ); | 541 | QTextStream ts( &file ); |
542 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 542 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
543 | answer = ts.read(); | 543 | answer = ts.read(); |
544 | file.close(); | 544 | file.close(); |
545 | //qDebug("answer \n%s ", answer.latin1()); | 545 | //qDebug("answer \n%s ", answer.latin1()); |
546 | getNumFromRecord( answer, ev ) ; | 546 | getNumFromRecord( answer, ev ) ; |
547 | 547 | ||
548 | } | 548 | } |
549 | else { // change existing | 549 | else { // change existing |
550 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); | 550 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); |
551 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 551 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
552 | changeString += eString + "\n"; | 552 | changeString += eString + "\n"; |
553 | changeEnt = true; | 553 | changeEnt = true; |
554 | 554 | ||
555 | } | 555 | } |
556 | } | 556 | } |
557 | ev = er.next(); | 557 | ev = er.next(); |
558 | } | 558 | } |