author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/sharpformat.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | libkcal/sharpformat.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index 9b757f7..b8c2aa7 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -9,38 +9,38 @@ | |||
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <q3textstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | #include <qxml.h> | 32 | #include <qxml.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | 34 | ||
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | 38 | ||
39 | #include "calendar.h" | 39 | #include "calendar.h" |
40 | #include "alarm.h" | 40 | #include "alarm.h" |
41 | #include "recurrence.h" | 41 | #include "recurrence.h" |
42 | #include "calendarlocal.h" | 42 | #include "calendarlocal.h" |
43 | 43 | ||
44 | #include "sharpformat.h" | 44 | #include "sharpformat.h" |
45 | #include "syncdefines.h" | 45 | #include "syncdefines.h" |
46 | 46 | ||
@@ -353,55 +353,55 @@ bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) | |||
353 | int dh = QApplication::desktop()->height(); | 353 | int dh = QApplication::desktop()->height(); |
354 | status.setCaption(i18n("Reading DTM Data") ); | 354 | status.setCaption(i18n("Reading DTM Data") ); |
355 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 355 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
356 | status.show(); | 356 | status.show(); |
357 | status.raise(); | 357 | status.raise(); |
358 | qApp->processEvents(); | 358 | qApp->processEvents(); |
359 | QString fileName; | 359 | QString fileName; |
360 | if ( ! debug ) { | 360 | if ( ! debug ) { |
361 | fileName = "/tmp/kopitempout"; | 361 | fileName = "/tmp/kopitempout"; |
362 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; | 362 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; |
363 | system ( command.latin1() ); | 363 | system ( command.latin1() ); |
364 | } else { | 364 | } else { |
365 | fileName = "/tmp/events.txt"; | 365 | fileName = "/tmp/events.txt"; |
366 | 366 | ||
367 | } | 367 | } |
368 | QFile file( fileName ); | 368 | QFile file( fileName ); |
369 | if (!file.open( IO_ReadOnly ) ) { | 369 | if (!file.open( QIODevice::ReadOnly ) ) { |
370 | return false; | 370 | return false; |
371 | 371 | ||
372 | } | 372 | } |
373 | QTextStream ts( &file ); | 373 | Q3TextStream ts( &file ); |
374 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 374 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
375 | text = ts.read(); | 375 | text = ts.read(); |
376 | file.close(); | 376 | file.close(); |
377 | status.setText( i18n("Processing events ...") ); | 377 | status.setText( i18n("Processing events ...") ); |
378 | status.raise(); | 378 | status.raise(); |
379 | qApp->processEvents(); | 379 | qApp->processEvents(); |
380 | fromString2Cal( calendar, existngCal, text, "Event" ); | 380 | fromString2Cal( calendar, existngCal, text, "Event" ); |
381 | status.setText( i18n("Reading todos ...") ); | 381 | status.setText( i18n("Reading todos ...") ); |
382 | qApp->processEvents(); | 382 | qApp->processEvents(); |
383 | if ( ! debug ) { | 383 | if ( ! debug ) { |
384 | fileName = "/tmp/kopitempout"; | 384 | fileName = "/tmp/kopitempout"; |
385 | QString command = "db2file todo -r -c " + codec+ " > " + fileName; | 385 | QString command = "db2file todo -r -c " + codec+ " > " + fileName; |
386 | system ( command.latin1() ); | 386 | system ( command.latin1() ); |
387 | } else { | 387 | } else { |
388 | fileName = "/tmp/todo.txt"; | 388 | fileName = "/tmp/todo.txt"; |
389 | } | 389 | } |
390 | file.setName( fileName ); | 390 | file.setName( fileName ); |
391 | if (!file.open( IO_ReadOnly ) ) { | 391 | if (!file.open( QIODevice::ReadOnly ) ) { |
392 | return false; | 392 | return false; |
393 | 393 | ||
394 | } | 394 | } |
395 | ts.setDevice( &file ); | 395 | ts.setDevice( &file ); |
396 | text = ts.read(); | 396 | text = ts.read(); |
397 | file.close(); | 397 | file.close(); |
398 | 398 | ||
399 | status.setText( i18n("Processing todos ...") ); | 399 | status.setText( i18n("Processing todos ...") ); |
400 | status.raise(); | 400 | status.raise(); |
401 | qApp->processEvents(); | 401 | qApp->processEvents(); |
402 | fromString2Cal( calendar, existngCal, text, "Todo" ); | 402 | fromString2Cal( calendar, existngCal, text, "Todo" ); |
403 | return true; | 403 | return true; |
404 | } | 404 | } |
405 | int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | 405 | int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) |
406 | { | 406 | { |
407 | int retval = -1; | 407 | int retval = -1; |
@@ -462,222 +462,222 @@ bool SharpFormat::save( Calendar *calendar) | |||
462 | int w = status.sizeHint().width()+20 ; | 462 | int w = status.sizeHint().width()+20 ; |
463 | if ( w < 200 ) w = 200; | 463 | if ( w < 200 ) w = 200; |
464 | int h = status.sizeHint().height()+20 ; | 464 | int h = status.sizeHint().height()+20 ; |
465 | int dw = QApplication::desktop()->width(); | 465 | int dw = QApplication::desktop()->width(); |
466 | int dh = QApplication::desktop()->height(); | 466 | int dh = QApplication::desktop()->height(); |
467 | status.setCaption(i18n("Writing DTM Data") ); | 467 | status.setCaption(i18n("Writing DTM Data") ); |
468 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 468 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
469 | status.show(); | 469 | status.show(); |
470 | status.raise(); | 470 | status.raise(); |
471 | qApp->processEvents(); | 471 | qApp->processEvents(); |
472 | bool debug = DEBUGMODE; | 472 | bool debug = DEBUGMODE; |
473 | QString codec = "utf8"; | 473 | QString codec = "utf8"; |
474 | QString answer; | 474 | QString answer; |
475 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; | 475 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; |
476 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; | 476 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; |
477 | QString command; | 477 | QString command; |
478 | QPtrList<Event> er = calendar->rawEvents(); | 478 | Q3PtrList<Event> er = calendar->rawEvents(); |
479 | Event* ev = er.first(); | 479 | Event* ev = er.first(); |
480 | QString fileName = "/tmp/kopitempout"; | 480 | QString fileName = "/tmp/kopitempout"; |
481 | int i = 0; | 481 | int i = 0; |
482 | QString changeString = ePrefix; | 482 | QString changeString = ePrefix; |
483 | QString deleteString = ePrefix; | 483 | QString deleteString = ePrefix; |
484 | bool deleteEnt = false; | 484 | bool deleteEnt = false; |
485 | bool changeEnt = false; | 485 | bool changeEnt = false; |
486 | QString message = i18n("Processing event # "); | 486 | QString message = i18n("Processing event # "); |
487 | int procCount = 0; | 487 | int procCount = 0; |
488 | while ( ev ) { | 488 | while ( ev ) { |
489 | //qDebug("i %d ", ++i); | 489 | //qDebug("i %d ", ++i); |
490 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 490 | if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
491 | status.setText ( message + QString::number ( ++procCount ) ); | 491 | status.setText ( message + QString::number ( ++procCount ) ); |
492 | qApp->processEvents(); | 492 | qApp->processEvents(); |
493 | QString eString = getEventString( ev ); | 493 | QString eString = getEventString( ev ); |
494 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete | 494 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete |
495 | // deleting empty strings does not work. | 495 | // deleting empty strings does not work. |
496 | // we write first and x and then delete the record with the x | 496 | // we write first and x and then delete the record with the x |
497 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 497 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
498 | changeString += eString + "\n"; | 498 | changeString += eString + "\n"; |
499 | deleteString += eString + "\n"; | 499 | deleteString += eString + "\n"; |
500 | deleteEnt = true; | 500 | deleteEnt = true; |
501 | changeEnt = true; | 501 | changeEnt = true; |
502 | } | 502 | } |
503 | else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new | 503 | else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new |
504 | QString fileNameIn = "/tmp/kopitempin"; | 504 | QString fileNameIn = "/tmp/kopitempin"; |
505 | QFile fileIn( fileNameIn ); | 505 | QFile fileIn( fileNameIn ); |
506 | if (!fileIn.open( IO_WriteOnly ) ) { | 506 | if (!fileIn.open( QIODevice::WriteOnly ) ) { |
507 | return false; | 507 | return false; |
508 | } | 508 | } |
509 | QTextStream tsIn( &fileIn ); | 509 | Q3TextStream tsIn( &fileIn ); |
510 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 510 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
511 | tsIn << ePrefix << eString ; | 511 | tsIn << ePrefix << eString ; |
512 | fileIn.close(); | 512 | fileIn.close(); |
513 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 513 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
514 | command = "(cat /tmp/kopitempin | db2file datebook -w -g -c " + codec+ ") > "+ fileName; | 514 | command = "(cat /tmp/kopitempin | db2file datebook -w -g -c " + codec+ ") > "+ fileName; |
515 | //qDebug("command ++++++++ "); | 515 | //qDebug("command ++++++++ "); |
516 | //qDebug("%s ",command.latin1()); | 516 | //qDebug("%s ",command.latin1()); |
517 | //qDebug("command -------- "); | 517 | //qDebug("command -------- "); |
518 | system ( command.utf8() ); | 518 | system ( command.utf8() ); |
519 | QFile file( fileName ); | 519 | QFile file( fileName ); |
520 | if (!file.open( IO_ReadOnly ) ) { | 520 | if (!file.open( QIODevice::ReadOnly ) ) { |
521 | return false; | 521 | return false; |
522 | 522 | ||
523 | } | 523 | } |
524 | QTextStream ts( &file ); | 524 | Q3TextStream ts( &file ); |
525 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 525 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
526 | answer = ts.read(); | 526 | answer = ts.read(); |
527 | file.close(); | 527 | file.close(); |
528 | //qDebug("answer \n%s ", answer.latin1()); | 528 | //qDebug("answer \n%s ", answer.latin1()); |
529 | getNumFromRecord( answer, ev ) ; | 529 | getNumFromRecord( answer, ev ) ; |
530 | 530 | ||
531 | } | 531 | } |
532 | else { // change existing | 532 | else { // change existing |
533 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); | 533 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); |
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 | changeString += eString + "\n"; | 535 | changeString += eString + "\n"; |
536 | changeEnt = true; | 536 | changeEnt = true; |
537 | 537 | ||
538 | } | 538 | } |
539 | } | 539 | } |
540 | ev = er.next(); | 540 | ev = er.next(); |
541 | } | 541 | } |
542 | status.setText ( i18n("Changing events ...") ); | 542 | status.setText ( i18n("Changing events ...") ); |
543 | qApp->processEvents(); | 543 | qApp->processEvents(); |
544 | //qDebug("changing... "); | 544 | //qDebug("changing... "); |
545 | if ( changeEnt ) { | 545 | if ( changeEnt ) { |
546 | QFile file( fileName ); | 546 | QFile file( fileName ); |
547 | if (!file.open( IO_WriteOnly ) ) { | 547 | if (!file.open( QIODevice::WriteOnly ) ) { |
548 | return false; | 548 | return false; |
549 | 549 | ||
550 | } | 550 | } |
551 | QTextStream ts( &file ); | 551 | Q3TextStream ts( &file ); |
552 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 552 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
553 | ts << changeString ; | 553 | ts << changeString ; |
554 | file.close(); | 554 | file.close(); |
555 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; | 555 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; |
556 | system ( command.latin1() ); | 556 | system ( command.latin1() ); |
557 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 557 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
558 | 558 | ||
559 | } | 559 | } |
560 | status.setText ( i18n("Deleting events ...") ); | 560 | status.setText ( i18n("Deleting events ...") ); |
561 | qApp->processEvents(); | 561 | qApp->processEvents(); |
562 | //qDebug("deleting... "); | 562 | //qDebug("deleting... "); |
563 | if ( deleteEnt ) { | 563 | if ( deleteEnt ) { |
564 | QFile file( fileName ); | 564 | QFile file( fileName ); |
565 | if (!file.open( IO_WriteOnly ) ) { | 565 | if (!file.open( QIODevice::WriteOnly ) ) { |
566 | return false; | 566 | return false; |
567 | 567 | ||
568 | } | 568 | } |
569 | QTextStream ts( &file ); | 569 | Q3TextStream ts( &file ); |
570 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 570 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
571 | ts << deleteString; | 571 | ts << deleteString; |
572 | file.close(); | 572 | file.close(); |
573 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; | 573 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; |
574 | system ( command.latin1() ); | 574 | system ( command.latin1() ); |
575 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 575 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
576 | } | 576 | } |
577 | 577 | ||
578 | 578 | ||
579 | changeString = tPrefix; | 579 | changeString = tPrefix; |
580 | deleteString = tPrefix; | 580 | deleteString = tPrefix; |
581 | status.setText ( i18n("Processing todos ...") ); | 581 | status.setText ( i18n("Processing todos ...") ); |
582 | qApp->processEvents(); | 582 | qApp->processEvents(); |
583 | QPtrList<Todo> tl = calendar->rawTodos(); | 583 | Q3PtrList<Todo> tl = calendar->rawTodos(); |
584 | Todo* to = tl.first(); | 584 | Todo* to = tl.first(); |
585 | i = 0; | 585 | i = 0; |
586 | message = i18n("Processing todo # "); | 586 | message = i18n("Processing todo # "); |
587 | procCount = 0; | 587 | procCount = 0; |
588 | while ( to ) { | 588 | while ( to ) { |
589 | if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { | 589 | if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { |
590 | status.setText ( message + QString::number ( ++procCount ) ); | 590 | status.setText ( message + QString::number ( ++procCount ) ); |
591 | qApp->processEvents(); | 591 | qApp->processEvents(); |
592 | QString eString = getTodoString( to ); | 592 | QString eString = getTodoString( to ); |
593 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete | 593 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete |
594 | // deleting empty strings does not work. | 594 | // deleting empty strings does not work. |
595 | // we write first and x and then delete the record with the x | 595 | // we write first and x and then delete the record with the x |
596 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 596 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
597 | changeString += eString + "\n"; | 597 | changeString += eString + "\n"; |
598 | deleteString += eString + "\n"; | 598 | deleteString += eString + "\n"; |
599 | deleteEnt = true; | 599 | deleteEnt = true; |
600 | changeEnt = true; | 600 | changeEnt = true; |
601 | } | 601 | } |
602 | else if ( to->getID("Sharp_DTM").isEmpty() ) { // add new | 602 | else if ( to->getID("Sharp_DTM").isEmpty() ) { // add new |
603 | 603 | ||
604 | 604 | ||
605 | 605 | ||
606 | QString fileNameIn = "/tmp/kopitempin"; | 606 | QString fileNameIn = "/tmp/kopitempin"; |
607 | QFile fileIn( fileNameIn ); | 607 | QFile fileIn( fileNameIn ); |
608 | if (!fileIn.open( IO_WriteOnly ) ) { | 608 | if (!fileIn.open( QIODevice::WriteOnly ) ) { |
609 | return false; | 609 | return false; |
610 | } | 610 | } |
611 | QTextStream tsIn( &fileIn ); | 611 | Q3TextStream tsIn( &fileIn ); |
612 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 612 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
613 | tsIn << tPrefix << eString ; | 613 | tsIn << tPrefix << eString ; |
614 | fileIn.close(); | 614 | fileIn.close(); |
615 | command = "(cat /tmp/kopitempin | db2file todo -w -g -c " + codec+ ") > "+ fileName; | 615 | command = "(cat /tmp/kopitempin | db2file todo -w -g -c " + codec+ ") > "+ fileName; |
616 | system ( command.utf8() ); | 616 | system ( command.utf8() ); |
617 | QFile file( fileName ); | 617 | QFile file( fileName ); |
618 | if (!file.open( IO_ReadOnly ) ) { | 618 | if (!file.open( QIODevice::ReadOnly ) ) { |
619 | return false; | 619 | return false; |
620 | } | 620 | } |
621 | QTextStream ts( &file ); | 621 | Q3TextStream ts( &file ); |
622 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 622 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
623 | answer = ts.read(); | 623 | answer = ts.read(); |
624 | file.close(); | 624 | file.close(); |
625 | //qDebug("answer \n%s ", answer.latin1()); | 625 | //qDebug("answer \n%s ", answer.latin1()); |
626 | getNumFromRecord( answer, to ) ; | 626 | getNumFromRecord( answer, to ) ; |
627 | 627 | ||
628 | } | 628 | } |
629 | else { // change existing | 629 | else { // change existing |
630 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); | 630 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); |
631 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 631 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
632 | changeString += eString + "\n"; | 632 | changeString += eString + "\n"; |
633 | changeEnt = true; | 633 | changeEnt = true; |
634 | 634 | ||
635 | } | 635 | } |
636 | } | 636 | } |
637 | 637 | ||
638 | to = tl.next(); | 638 | to = tl.next(); |
639 | } | 639 | } |
640 | status.setText ( i18n("Changing todos ...") ); | 640 | status.setText ( i18n("Changing todos ...") ); |
641 | qApp->processEvents(); | 641 | qApp->processEvents(); |
642 | //qDebug("changing... "); | 642 | //qDebug("changing... "); |
643 | if ( changeEnt ) { | 643 | if ( changeEnt ) { |
644 | QFile file( fileName ); | 644 | QFile file( fileName ); |
645 | if (!file.open( IO_WriteOnly ) ) { | 645 | if (!file.open( QIODevice::WriteOnly ) ) { |
646 | return false; | 646 | return false; |
647 | 647 | ||
648 | } | 648 | } |
649 | QTextStream ts( &file ); | 649 | Q3TextStream ts( &file ); |
650 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 650 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
651 | ts << changeString ; | 651 | ts << changeString ; |
652 | file.close(); | 652 | file.close(); |
653 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; | 653 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; |
654 | system ( command.latin1() ); | 654 | system ( command.latin1() ); |
655 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 655 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
656 | 656 | ||
657 | } | 657 | } |
658 | status.setText ( i18n("Deleting todos ...") ); | 658 | status.setText ( i18n("Deleting todos ...") ); |
659 | qApp->processEvents(); | 659 | qApp->processEvents(); |
660 | //qDebug("deleting... "); | 660 | //qDebug("deleting... "); |
661 | if ( deleteEnt ) { | 661 | if ( deleteEnt ) { |
662 | QFile file( fileName ); | 662 | QFile file( fileName ); |
663 | if (!file.open( IO_WriteOnly ) ) { | 663 | if (!file.open( QIODevice::WriteOnly ) ) { |
664 | return false; | 664 | return false; |
665 | 665 | ||
666 | } | 666 | } |
667 | QTextStream ts( &file ); | 667 | Q3TextStream ts( &file ); |
668 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 668 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
669 | ts << deleteString; | 669 | ts << deleteString; |
670 | file.close(); | 670 | file.close(); |
671 | command = "db2file todo -d -c " + codec+ " < "+ fileName; | 671 | command = "db2file todo -d -c " + codec+ " < "+ fileName; |
672 | system ( command.latin1() ); | 672 | system ( command.latin1() ); |
673 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 673 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
674 | } | 674 | } |
675 | 675 | ||
676 | return true; | 676 | return true; |
677 | } | 677 | } |
678 | QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) | 678 | QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) |
679 | { | 679 | { |
680 | QString datestr; | 680 | QString datestr; |
681 | QString timestr; | 681 | QString timestr; |
682 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 682 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
683 | QDateTime dt; | 683 | QDateTime dt; |
@@ -770,33 +770,33 @@ QString SharpFormat::getEventString( Event* event ) | |||
770 | days += 1 << (i-1); | 770 | days += 1 << (i-1); |
771 | } | 771 | } |
772 | } | 772 | } |
773 | list.append( QString::number( days ) ); | 773 | list.append( QString::number( days ) ); |
774 | } | 774 | } |
775 | //pending weekdays | 775 | //pending weekdays |
776 | writeEndDate = true; | 776 | writeEndDate = true; |
777 | 777 | ||
778 | break; | 778 | break; |
779 | case Recurrence::rMonthlyPos:// 2 | 779 | case Recurrence::rMonthlyPos:// 2 |
780 | list.append( "2" ); | 780 | list.append( "2" ); |
781 | list.append( QString::number( rec->frequency()) );//12 | 781 | list.append( QString::number( rec->frequency()) );//12 |
782 | 782 | ||
783 | writeEndDate = true; | 783 | writeEndDate = true; |
784 | { | 784 | { |
785 | int count = 1; | 785 | int count = 1; |
786 | QPtrList<Recurrence::rMonthPos> rmp; | 786 | Q3PtrList<Recurrence::rMonthPos> rmp; |
787 | rmp = rec->monthPositions(); | 787 | rmp = rec->monthPositions(); |
788 | if ( rmp.first()->negative ) | 788 | if ( rmp.first()->negative ) |
789 | count = 5 - rmp.first()->rPos - 1; | 789 | count = 5 - rmp.first()->rPos - 1; |
790 | else | 790 | else |
791 | count = rmp.first()->rPos - 1; | 791 | count = rmp.first()->rPos - 1; |
792 | list.append( QString::number( count ) ); | 792 | list.append( QString::number( count ) ); |
793 | 793 | ||
794 | } | 794 | } |
795 | 795 | ||
796 | list.append( "0" ); | 796 | list.append( "0" ); |
797 | break; | 797 | break; |
798 | case Recurrence::rMonthlyDay:// 3 | 798 | case Recurrence::rMonthlyDay:// 3 |
799 | list.append( "3" ); | 799 | list.append( "3" ); |
800 | list.append( QString::number( rec->frequency()) );//12 | 800 | list.append( QString::number( rec->frequency()) );//12 |
801 | list.append( "0" ); | 801 | list.append( "0" ); |
802 | list.append( "0" ); | 802 | list.append( "0" ); |