-rw-r--r-- | libkcal/phoneformat.cpp | 79 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 14 |
2 files changed, 49 insertions, 44 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index f78730d..fa18683 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -60,8 +60,8 @@ using namespace KCal; | |||
60 | //MDAY | 60 | //MDAY |
61 | 61 | ||
62 | class SharpParser : public QObject | 62 | class PhoneParser : public QObject |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | SharpParser( Calendar *calendar ) : mCalendar( calendar ) { | 65 | PhoneParser( Calendar *calendar ) : mCalendar( calendar ) { |
66 | oldCategories = 0; | 66 | oldCategories = 0; |
67 | } | 67 | } |
@@ -81,16 +81,16 @@ class SharpParser : public QObject | |||
81 | if ( skip ) | 81 | if ( skip ) |
82 | return false; | 82 | return false; |
83 | ulong cSum = SharpFormat::getCsum(attList ); | 83 | ulong cSum = PhoneFormat::getCsum(attList ); |
84 | 84 | ||
85 | if ( qName == "Event" ) { | 85 | if ( qName == "Event" ) { |
86 | Event *event; | 86 | Event *event; |
87 | event = existingCalendar->event( attList[0].toInt() ); | 87 | event = existingCalendar->event( attList[0] ); |
88 | if ( event ) | 88 | if ( event ) |
89 | event = (Event*)event->clone(); | 89 | event = (Event*)event->clone(); |
90 | else | 90 | else |
91 | event = new Event; | 91 | event = new Event; |
92 | event->setZaurusId( attList[0].toInt() ); | 92 | // event->setZaurusId( attList[0].toInt() ); |
93 | event->setZaurusUid( cSum ); | 93 | //event->setZaurusUid( cSum ); |
94 | event->setZaurusStat( -2 ); | 94 | //event->setZaurusStat( -2 ); |
95 | 95 | ||
96 | event->setSummary( attList[2] ); | 96 | event->setSummary( attList[2] ); |
@@ -189,5 +189,5 @@ class SharpParser : public QObject | |||
189 | Todo *todo; | 189 | Todo *todo; |
190 | 190 | ||
191 | todo = existingCalendar->todo( attList[0].toInt() ); | 191 | todo = existingCalendar->todo( attList[0] ); |
192 | if (todo ) | 192 | if (todo ) |
193 | todo = (Todo*)todo->clone(); | 193 | todo = (Todo*)todo->clone(); |
@@ -201,7 +201,7 @@ class SharpParser : public QObject | |||
201 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes | 201 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes |
202 | 202 | ||
203 | todo->setZaurusId( attList[0].toInt() ); | 203 | //todo->setZaurusId( attList[0] ); |
204 | todo->setZaurusUid( cSum ); | 204 | //todo->setZaurusUid( cSum ); |
205 | todo->setZaurusStat( -2 ); | 205 | //todo->setZaurusStat( -2 ); |
206 | 206 | ||
207 | todo->setSummary( attList[7] ); | 207 | todo->setSummary( attList[7] ); |
@@ -324,15 +324,15 @@ class SharpParser : public QObject | |||
324 | }; | 324 | }; |
325 | 325 | ||
326 | QMap<QString,QString> SharpParser::mCategoriesMap; | 326 | QMap<QString,QString> PhoneParser::mCategoriesMap; |
327 | 327 | ||
328 | SharpFormat::SharpFormat() | 328 | PhoneFormat::PhoneFormat() |
329 | { | 329 | { |
330 | mCategories = 0; | 330 | mCategories = 0; |
331 | } | 331 | } |
332 | 332 | ||
333 | SharpFormat::~SharpFormat() | 333 | PhoneFormat::~PhoneFormat() |
334 | { | 334 | { |
335 | } | 335 | } |
336 | ulong SharpFormat::getCsum( const QStringList & attList) | 336 | ulong PhoneFormat::getCsum( const QStringList & attList) |
337 | { | 337 | { |
338 | int max = attList.count() -1; | 338 | int max = attList.count() -1; |
@@ -360,5 +360,5 @@ ulong SharpFormat::getCsum( const QStringList & attList) | |||
360 | #include <stdlib.h> | 360 | #include <stdlib.h> |
361 | #define DEBUGMODE false | 361 | #define DEBUGMODE false |
362 | bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) | 362 | bool PhoneFormat::load( Calendar *calendar, Calendar *existngCal ) |
363 | { | 363 | { |
364 | 364 | ||
@@ -489,5 +489,5 @@ static char *cp; | |||
489 | return true; | 489 | return true; |
490 | } | 490 | } |
491 | int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | 491 | int PhoneFormat::getNumFromRecord( QString answer, Incidence* inc ) |
492 | { | 492 | { |
493 | int retval = -1; | 493 | int retval = -1; |
@@ -530,7 +530,7 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | |||
530 | if ( ok && newnum > 0) { | 530 | if ( ok && newnum > 0) { |
531 | retval = newnum; | 531 | retval = newnum; |
532 | inc->setZaurusId( newnum ); | 532 | //inc->setZaurusId( newnum ); |
533 | inc->setZaurusUid( getCsum( templist ) ); | 533 | //inc->setZaurusUid( getCsum( templist ) ); |
534 | inc->setZaurusStat( -4 ); | 534 | //inc->setZaurusStat( -4 ); |
535 | } | 535 | } |
536 | } | 536 | } |
@@ -539,5 +539,5 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | |||
539 | return retval; | 539 | return retval; |
540 | } | 540 | } |
541 | bool SharpFormat::save( Calendar *calendar) | 541 | bool PhoneFormat::save( Calendar *calendar) |
542 | { | 542 | { |
543 | 543 | ||
@@ -571,9 +571,9 @@ bool SharpFormat::save( Calendar *calendar) | |||
571 | while ( ev ) { | 571 | while ( ev ) { |
572 | //qDebug("i %d ", ++i); | 572 | //qDebug("i %d ", ++i); |
573 | if ( ev->zaurusStat() != -2 ) { | 573 | if ( true /*ev->zaurusStat() != -2*/ ) { |
574 | status.setText ( message + QString::number ( ++procCount ) ); | 574 | status.setText ( message + QString::number ( ++procCount ) ); |
575 | qApp->processEvents(); | 575 | qApp->processEvents(); |
576 | QString eString = getEventString( ev ); | 576 | QString eString = getEventString( ev ); |
577 | if ( ev->zaurusStat() == -3 ) { // delete | 577 | if (/* ev->zaurusStat() == -3 */ true) { // delete |
578 | // deleting empty strings does not work. | 578 | // deleting empty strings does not work. |
579 | // we write first and x and then delete the record with the x | 579 | // we write first and x and then delete the record with the x |
@@ -584,5 +584,5 @@ bool SharpFormat::save( Calendar *calendar) | |||
584 | changeEnt = true; | 584 | changeEnt = true; |
585 | } | 585 | } |
586 | else if ( ev->zaurusId() == -1 ) { // add new | 586 | else if ( /*ev->zaurusId() == -1*/true ) { // add new |
587 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 587 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
588 | system ( command.utf8() ); | 588 | system ( command.utf8() ); |
@@ -657,9 +657,9 @@ bool SharpFormat::save( Calendar *calendar) | |||
657 | procCount = 0; | 657 | procCount = 0; |
658 | while ( to ) { | 658 | while ( to ) { |
659 | if ( to->zaurusStat() != -2 ) { | 659 | if ( true /*to->zaurusStat() != -2 */) { |
660 | status.setText ( message + QString::number ( ++procCount ) ); | 660 | status.setText ( message + QString::number ( ++procCount ) ); |
661 | qApp->processEvents(); | 661 | qApp->processEvents(); |
662 | QString eString = getTodoString( to ); | 662 | QString eString = getTodoString( to ); |
663 | if ( to->zaurusStat() == -3 ) { // delete | 663 | if ( /*to->zaurusStat() == -3*/true ) { // delete |
664 | // deleting empty strings does not work. | 664 | // deleting empty strings does not work. |
665 | // we write first and x and then delete the record with the x | 665 | // we write first and x and then delete the record with the x |
@@ -670,5 +670,5 @@ bool SharpFormat::save( Calendar *calendar) | |||
670 | changeEnt = true; | 670 | changeEnt = true; |
671 | } | 671 | } |
672 | else if ( to->zaurusId() == -1 ) { // add new | 672 | else if ( true /*to->zaurusId() == -1*/ ) { // add new |
673 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; | 673 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; |
674 | system ( command.utf8() ); | 674 | system ( command.utf8() ); |
@@ -735,5 +735,5 @@ bool SharpFormat::save( Calendar *calendar) | |||
735 | return true; | 735 | return true; |
736 | } | 736 | } |
737 | QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) | 737 | QString PhoneFormat::dtToString( const QDateTime& dti, bool useTZ ) |
738 | { | 738 | { |
739 | QString datestr; | 739 | QString datestr; |
@@ -757,6 +757,7 @@ QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) | |||
757 | return datestr + timestr; | 757 | return datestr + timestr; |
758 | } | 758 | } |
759 | QString SharpFormat::getEventString( Event* event ) | 759 | QString PhoneFormat::getEventString( Event* event ) |
760 | { | 760 | { |
761 | #if 0 | ||
761 | QStringList list; | 762 | QStringList list; |
762 | list.append( QString::number(event->zaurusId() ) ); | 763 | list.append( QString::number(event->zaurusId() ) ); |
@@ -918,9 +919,11 @@ QString SharpFormat::getEventString( Event* event ) | |||
918 | } | 919 | } |
919 | return list.join(","); | 920 | return list.join(","); |
920 | 921 | #endif | |
922 | return QString(); | ||
921 | 923 | ||
922 | } | 924 | } |
923 | QString SharpFormat::getTodoString( Todo* todo ) | 925 | QString PhoneFormat::getTodoString( Todo* todo ) |
924 | { | 926 | { |
927 | #if 0 | ||
925 | QStringList list; | 928 | QStringList list; |
926 | list.append( QString::number( todo->zaurusId() ) ); | 929 | list.append( QString::number( todo->zaurusId() ) ); |
@@ -970,6 +973,8 @@ QString SharpFormat::getTodoString( Todo* todo ) | |||
970 | } | 973 | } |
971 | return list.join(","); | 974 | return list.join(","); |
975 | #endif | ||
976 | return QString(); | ||
972 | } | 977 | } |
973 | QString SharpFormat::getPart( const QString & text, bool &ok, int &start ) | 978 | QString PhoneFormat::getPart( const QString & text, bool &ok, int &start ) |
974 | { | 979 | { |
975 | //qDebug("start %d ", start); | 980 | //qDebug("start %d ", start); |
@@ -1029,9 +1034,9 @@ QString SharpFormat::getPart( const QString & text, bool &ok, int &start ) | |||
1029 | } | 1034 | } |
1030 | } | 1035 | } |
1031 | bool SharpFormat::fromString( Calendar *calendar, const QString & text) | 1036 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) |
1032 | { | 1037 | { |
1033 | return false; | 1038 | return false; |
1034 | } | 1039 | } |
1035 | bool SharpFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, GSM_StateMachine*s, const QString & type) | 1040 | bool PhoneFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, GSM_StateMachine*s, const QString & type) |
1036 | { | 1041 | { |
1037 | GSM_Phone_Functions*Phone; | 1042 | GSM_Phone_Functions*Phone; |
@@ -1043,5 +1048,5 @@ bool SharpFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, | |||
1043 | Phone=s->Phone.Functions; | 1048 | Phone=s->Phone.Functions; |
1044 | bool gshutdown = false; | 1049 | bool gshutdown = false; |
1045 | SharpParser handler( calendar ); | 1050 | PhoneParser handler( calendar ); |
1046 | //handler.setCategoriesList( mCategories ); | 1051 | //handler.setCategoriesList( mCategories ); |
1047 | QStringList templist; | 1052 | QStringList templist; |
@@ -1331,5 +1336,5 @@ typedef struct { | |||
1331 | bool ok = true; | 1336 | bool ok = true; |
1332 | start = end; | 1337 | start = end; |
1333 | SharpParser handler( calendar ); | 1338 | PhoneParser handler( calendar ); |
1334 | handler.setCategoriesList( mCategories ); | 1339 | handler.setCategoriesList( mCategories ); |
1335 | while ( start > 0 ) { | 1340 | while ( start > 0 ) { |
@@ -1354,5 +1359,5 @@ typedef struct { | |||
1354 | } | 1359 | } |
1355 | 1360 | ||
1356 | QString SharpFormat::toString( Calendar * ) | 1361 | QString PhoneFormat::toString( Calendar * ) |
1357 | { | 1362 | { |
1358 | return QString::null; | 1363 | return QString::null; |
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index f4cb52c..4ddf6f0 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h | |||
@@ -19,6 +19,6 @@ | |||
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #ifndef SHARPFORMAT_H | 21 | #ifndef PHONEFORMAT_H |
22 | #define SHARPAFORMAT_H | 22 | #define PHONEFORMAT_H |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
@@ -28,5 +28,5 @@ | |||
28 | #include "calformat.h" | 28 | #include "calformat.h" |
29 | extern "C" { | 29 | extern "C" { |
30 | #include "gammu.h" | 30 | #include "../gammu/emb/common/gammu.h" |
31 | } | 31 | } |
32 | 32 | ||
@@ -34,12 +34,12 @@ namespace KCal { | |||
34 | 34 | ||
35 | /** | 35 | /** |
36 | This class implements the calendar format used by Sharp. | 36 | This class implements the calendar format used by Phone. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | class SharpFormat : public QObject { | 39 | class PhoneFormat : public QObject { |
40 | public: | 40 | public: |
41 | /** Create new iCalendar format. */ | 41 | /** Create new iCalendar format. */ |
42 | SharpFormat(); | 42 | PhoneFormat(); |
43 | virtual ~SharpFormat(); | 43 | virtual ~PhoneFormat(); |
44 | 44 | ||
45 | bool load( Calendar * ,Calendar *); | 45 | bool load( Calendar * ,Calendar *); |