-rw-r--r-- | libkcal/phoneformat.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 238b0ef..1a9ccbc 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -95,8 +95,10 @@ public: | |||
95 | GSM_Category Category; | 95 | GSM_Category Category; |
96 | int error; | 96 | int error; |
97 | QString completedString = "no"; | 97 | QString completedString = "no"; |
98 | for (j=0;j<ToDo->EntriesNum;j++) { | 98 | for (j=0;j<ToDo->EntriesNum;j++) { |
99 | |||
100 | //qDebug(" for todo %d",ToDo->Location ); | ||
99 | switch (ToDo->Entries[j].EntryType) { | 101 | switch (ToDo->Entries[j].EntryType) { |
100 | case TODO_END_DATETIME: | 102 | case TODO_END_DATETIME: |
101 | dtp = &ToDo->Entries[j].Date ; | 103 | dtp = &ToDo->Entries[j].Date ; |
102 | todo->setDtDue (fromGSM ( dtp )); | 104 | todo->setDtDue (fromGSM ( dtp )); |
@@ -120,9 +122,10 @@ public: | |||
120 | alarm = true; | 122 | alarm = true; |
121 | alarmDt = fromGSM ( dtp ); | 123 | alarmDt = fromGSM ( dtp ); |
122 | break; | 124 | break; |
123 | case TODO_TEXT: | 125 | case TODO_TEXT: |
124 | todo->setSummary( QString ( (const char*) ToDo->Entries[j].Text )); | 126 | //qDebug(" text *%s* ", (const char*) DecodeUnicodeConsole(ToDo->Entries[j].Text )); |
127 | todo->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole(ToDo->Entries[j].Text ))); | ||
125 | break; | 128 | break; |
126 | case TODO_PRIVATE: | 129 | case TODO_PRIVATE: |
127 | if ( ToDo->Entries[j].Number == 1 ) | 130 | if ( ToDo->Entries[j].Number == 1 ) |
128 | todo->setSecrecy( Incidence::SecrecyPrivate ); | 131 | todo->setSecrecy( Incidence::SecrecyPrivate ); |
@@ -233,9 +236,9 @@ public: | |||
233 | repeat_startdate.Day= 0; | 236 | repeat_startdate.Day= 0; |
234 | repeat_stopdate.Day = 0; | 237 | repeat_stopdate.Day = 0; |
235 | for (i=0;i<Note->EntriesNum;i++) { | 238 | for (i=0;i<Note->EntriesNum;i++) { |
236 | 239 | ||
237 | qDebug(" for "); | 240 | //qDebug(" for ev"); |
238 | switch (Note->Entries[i].EntryType) { | 241 | switch (Note->Entries[i].EntryType) { |
239 | case CAL_START_DATETIME: | 242 | case CAL_START_DATETIME: |
240 | dtp = &Note->Entries[i].Date ; | 243 | dtp = &Note->Entries[i].Date ; |
241 | if ( dtp->Hour > 24 ) { | 244 | if ( dtp->Hour > 24 ) { |
@@ -269,12 +272,13 @@ public: | |||
269 | rec_type = Note->Entries[i].Number; | 272 | rec_type = Note->Entries[i].Number; |
270 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); | 273 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); |
271 | break; | 274 | break; |
272 | case CAL_TEXT: | 275 | case CAL_TEXT: |
273 | event->setSummary( QString ( (const char*) Note->Entries[i].Text )); | 276 | //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); |
277 | event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); | ||
274 | break; | 278 | break; |
275 | case CAL_LOCATION: | 279 | case CAL_LOCATION: |
276 | event->setLocation(QString ((const char*) Note->Entries[i].Text )); | 280 | event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); |
277 | break; | 281 | break; |
278 | case CAL_PHONE: | 282 | case CAL_PHONE: |
279 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | 283 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); |
280 | break; | 284 | break; |
@@ -611,8 +615,9 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profi | |||
611 | qDebug(" load "); | 615 | qDebug(" load "); |
612 | s.opened = false; | 616 | s.opened = false; |
613 | s.msg = NULL; | 617 | s.msg = NULL; |
614 | s.ConfigNum = 0; | 618 | s.ConfigNum = 0; |
619 | #if 0 | ||
615 | static char*cp; | 620 | static char*cp; |
616 | static INI_Section *cfg = NULL; | 621 | static INI_Section *cfg = NULL; |
617 | cfg=GSM_FindGammuRC(); | 622 | cfg=GSM_FindGammuRC(); |
618 | int i; | 623 | int i; |
@@ -652,29 +657,55 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profi | |||
652 | /* We wanted to read just user specified configuration. */ | 657 | /* We wanted to read just user specified configuration. */ |
653 | {break;} | 658 | {break;} |
654 | } | 659 | } |
655 | 660 | ||
661 | #endif | ||
662 | setlocale(LC_ALL, ""); | ||
663 | GSM_ReadConfig(NULL, &s.Config[0], 0); | ||
664 | s.ConfigNum = 1; | ||
665 | GSM_Config *cfg = &s.Config[0]; | ||
666 | di.coding = "utf8"; | ||
667 | if ( ! connection.isEmpty() ) { | ||
668 | cfg->Connection = strdup(connection.latin1()); | ||
669 | cfg->DefaultConnection = false; | ||
670 | qDebug("Connection set %s ", cfg->Connection ); | ||
671 | |||
672 | } | ||
673 | if ( ! device.isEmpty() ) { | ||
674 | cfg->Device = strdup(device.latin1()); | ||
675 | cfg->DefaultDevice = false; | ||
676 | qDebug("Device set %s ", cfg->Device); | ||
677 | |||
678 | } | ||
679 | if ( ! model.isEmpty() ) { | ||
680 | strcpy(cfg->Model,model.latin1() ); | ||
681 | cfg->DefaultModel = false; | ||
682 | qDebug("Model set %s ",cfg->Model ); | ||
683 | |||
684 | |||
685 | } | ||
656 | int error=GSM_InitConnection(&s,3); | 686 | int error=GSM_InitConnection(&s,3); |
657 | qDebug(" init %d %d", error, ERR_NONE); | 687 | qDebug(" init %d %d", error, ERR_NONE); |
658 | if ( error != ERR_NONE ) | 688 | if ( error != ERR_NONE ) |
659 | return false; | 689 | return false; |
660 | // fromString2Cal( calendar, existngCal, &s, "Event" ); | 690 | // fromString2Cal( calendar, existngCal, &s, "Event" ); |
661 | GSM_Phone_Functions*Phone; | 691 | GSM_Phone_Functions*Phone; |
662 | GSM_CalendarEntrynote; | 692 | GSM_CalendarEntrynote; |
663 | bool refresh= true; | 693 | bool start = true; |
664 | Phone=s.Phone.Functions; | 694 | Phone=s.Phone.Functions; |
665 | bool gshutdown = false; | 695 | bool gshutdown = false; |
666 | PhoneParser handler( calendar, profileName ); | 696 | PhoneParser handler( calendar, profileName ); |
667 | int ccc = 0; | 697 | int ccc = 0; |
668 | while (!gshutdown && ccc++ < 10 ) { | 698 | while (!gshutdown && ccc++ < 3) { |
669 | 699 | ||
670 | qDebug("readEvent %d ", ccc); | 700 | qDebug("readEvent %d ", ccc); |
671 | error=Phone->GetNextCalendar(&s,¬e,refresh); | 701 | error=Phone->GetNextCalendar(&s,¬e,start); |
672 | if (error == ERR_EMPTY) break; | 702 | if (error == ERR_EMPTY) break; |
703 | start = false; | ||
673 | handler.readEvent( existingCal, ¬e ); | 704 | handler.readEvent( existingCal, ¬e ); |
674 | } | 705 | } |
675 | 706 | ||
676 | bool start = true; | 707 | start = true; |
677 | GSM_ToDoEntry ToDo; | 708 | GSM_ToDoEntry ToDo; |
678 | ccc = 0; | 709 | ccc = 0; |
679 | while (!gshutdown) { | 710 | while (!gshutdown) { |
680 | error = Phone->GetNextToDo(&s, &ToDo, start); | 711 | error = Phone->GetNextToDo(&s, &ToDo, start); |