From 3a769cd15cfdb8e19e5fec2088c59aadeed4800a Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 08 Aug 2004 20:46:59 +0000 Subject: Fixed reading from phone --- (limited to 'libkcal/phoneformat.cpp') diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 238b0ef..1a9ccbc 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -96,6 +96,8 @@ public: int error; QString completedString = "no"; for (j=0;jEntriesNum;j++) { + + //qDebug(" for todo %d",ToDo->Location ); switch (ToDo->Entries[j].EntryType) { case TODO_END_DATETIME: dtp = &ToDo->Entries[j].Date ; @@ -121,7 +123,8 @@ public: alarmDt = fromGSM ( dtp ); break; case TODO_TEXT: - todo->setSummary( QString ( (const char*) ToDo->Entries[j].Text )); + //qDebug(" text *%s* ", (const char*) DecodeUnicodeConsole(ToDo->Entries[j].Text )); + todo->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole(ToDo->Entries[j].Text ))); break; case TODO_PRIVATE: if ( ToDo->Entries[j].Number == 1 ) @@ -234,7 +237,7 @@ public: repeat_stopdate.Day = 0; for (i=0;iEntriesNum;i++) { - qDebug(" for "); + //qDebug(" for ev"); switch (Note->Entries[i].EntryType) { case CAL_START_DATETIME: dtp = &Note->Entries[i].Date ; @@ -270,10 +273,11 @@ public: //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); break; case CAL_TEXT: - event->setSummary( QString ( (const char*) Note->Entries[i].Text )); + //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); + event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); break; case CAL_LOCATION: - event->setLocation(QString ((const char*) Note->Entries[i].Text )); + event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); break; case CAL_PHONE: //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); @@ -612,6 +616,7 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profi s.opened = false; s.msg = NULL; s.ConfigNum = 0; +#if 0 static char *cp; static INI_Section *cfg = NULL; cfg=GSM_FindGammuRC(); @@ -653,6 +658,31 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profi {break;} } +#endif + setlocale(LC_ALL, ""); + GSM_ReadConfig(NULL, &s.Config[0], 0); + s.ConfigNum = 1; + GSM_Config *cfg = &s.Config[0]; + di.coding = "utf8"; + if ( ! connection.isEmpty() ) { + cfg->Connection = strdup(connection.latin1()); + cfg->DefaultConnection = false; + qDebug("Connection set %s ", cfg->Connection ); + + } + if ( ! device.isEmpty() ) { + cfg->Device = strdup(device.latin1()); + cfg->DefaultDevice = false; + qDebug("Device set %s ", cfg->Device); + + } + if ( ! model.isEmpty() ) { + strcpy(cfg->Model,model.latin1() ); + cfg->DefaultModel = false; + qDebug("Model set %s ",cfg->Model ); + + + } int error=GSM_InitConnection(&s,3); qDebug(" init %d %d", error, ERR_NONE); if ( error != ERR_NONE ) @@ -660,20 +690,21 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profi // fromString2Cal( calendar, existngCal, &s, "Event" ); GSM_Phone_Functions *Phone; GSM_CalendarEntry note; - bool refresh = true; + bool start = true; Phone=s.Phone.Functions; bool gshutdown = false; PhoneParser handler( calendar, profileName ); int ccc = 0; - while (!gshutdown && ccc++ < 10 ) { + while (!gshutdown && ccc++ < 3) { qDebug("readEvent %d ", ccc); - error=Phone->GetNextCalendar(&s,¬e,refresh); + error=Phone->GetNextCalendar(&s,¬e,start); if (error == ERR_EMPTY) break; + start = false; handler.readEvent( existingCal, ¬e ); } - bool start = true; + start = true; GSM_ToDoEntry ToDo; ccc = 0; while (!gshutdown) { -- cgit v0.9.0.2