summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-08 20:55:19 (UTC)
committer zautrix <zautrix>2004-08-08 20:55:19 (UTC)
commitb51c65d86224ee7d77e672fcfba5ea92d55eed0e (patch) (side-by-side diff)
tree1137e001be49f130477b3b53acfab4f2150ccf86
parent3a769cd15cfdb8e19e5fec2088c59aadeed4800a (diff)
downloadkdepimpi-b51c65d86224ee7d77e672fcfba5ea92d55eed0e.zip
kdepimpi-b51c65d86224ee7d77e672fcfba5ea92d55eed0e.tar.gz
kdepimpi-b51c65d86224ee7d77e672fcfba5ea92d55eed0e.tar.bz2
cleanup
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkcal/phoneformat.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 1a9ccbc..7e1c9cd 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -25,62 +25,48 @@
#include <qptrlist.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qclipboard.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qxml.h>
#include <qlabel.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "phoneformat.h"
#include "syncdefines.h"
using namespace KCal;
-//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
-// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
-
-//ARSD silentalarm = 0
-// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly
-// 12 RFRQ
-// 13 RPOS pos = 4. monday in month
-// 14 RDYS days: 1 mon/ 2 tue .. 64 sun
-// 15 REND 0 = no end/ 1 = end
-// 16 REDT rec end dt
-//ALSD
-//ALED
-//MDAY
-
class PhoneParser : public QObject
{
public:
PhoneParser( Calendar *calendar, QString profileName ) : mCalendar( calendar ), mProfileName ( profileName ) {
;
}
bool readTodo( Calendar *existingCalendar,GSM_ToDoEntry *ToDo, GSM_StateMachine* s)
{
int id = ToDo->Location;
Todo *todo;
todo = existingCalendar->todo( mProfileName ,QString::number( id ) );
if (todo )
todo = (Todo *)todo->clone();
else
todo = new Todo;
todo->setID( mProfileName,QString::number( id ) );
todo->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL );
int priority;
switch (ToDo->Priority) {
case GSM_Priority_Low : priority = 1; break;
case GSM_Priority_Medium : priority = 3; break;
case GSM_Priority_High : priority = 5; break;
default :priority = 3 ; break;
@@ -152,49 +138,48 @@ public:
entry.Location = ToDo->Entries[j].Number;
entry.MemoryType = MEM_ME;
error=Phone->GetMemory(s, &entry);
if (error == ERR_NONE) {
name = GSM_PhonebookGetEntryName(&entry);
if (name != NULL) {
printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number);
} else {
printmsg("Contact ID : %d\n",ToDo->Entries[j].Number);
}
} else {
printmsg("Contact : %d\n",ToDo->Entries[j].Number);
}
#endif
break;
case TODO_PHONE:
#if 0
// not supported
printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text));
#endif
break;
}
}
QString alarmString = "";
- // strange 0 semms to mean: alarm enabled
if ( alarm ) {
Alarm *alarm;
if ( todo->alarms().count() > 0 )
alarm = todo->alarms().first();
else {
alarm = new Alarm( todo );
todo->addAlarm( alarm );
}
alarm->setType( Alarm::Audio );
alarm->setEnabled( true );
int alarmOffset = alarmDt.secsTo( todo->dtStart() );
alarm->setStartOffset( alarmOffset );
alarmString = QString::number( alarmOffset );
}
// csum *****************************************
QStringList attList;
uint cSum;
if ( todo->hasDueDate() )
attList << dtToString ( todo->dtDue() );
attList << QString::number( id );
attList << todo->summary();
attList << completedString;
attList << QString::number( todo->priority() );
attList << alarmString;
@@ -642,97 +627,96 @@ bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal ,QString profi
#endif
}
}
/* Wanted user specific configuration? */
if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break;
s.ConfigNum++;
/* We want to use only one file descriptor for global and state machine debug output */
s.Config[i].UseGlobalDebugFile = true;
/* We wanted to read just user specified configuration. */
{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);
+ qDebug("GSM Init %d (no error is %d)", error, ERR_NONE);
if ( error != ERR_NONE )
return false;
- // fromString2Cal( calendar, existngCal, &s, "Event" );
GSM_Phone_Functions *Phone;
GSM_CalendarEntry note;
bool start = true;
Phone=s.Phone.Functions;
bool gshutdown = false;
PhoneParser handler( calendar, profileName );
int ccc = 0;
- while (!gshutdown && ccc++ < 3) {
+ qDebug("Debug: only 10 calender items are downloaded ");
+ while (!gshutdown && ccc++ < 10) {
qDebug("readEvent %d ", ccc);
error=Phone->GetNextCalendar(&s,&note,start);
if (error == ERR_EMPTY) break;
start = false;
handler.readEvent( existingCal, &note );
}
start = true;
GSM_ToDoEntry ToDo;
ccc = 0;
while (!gshutdown) {
error = Phone->GetNextToDo(&s, &ToDo, start);
if (error == ERR_EMPTY) break;
start = false;
- qDebug("readTodo %d ", ++ccc);
+ qDebug("ReadTodo %d ", ++ccc);
handler.readTodo( existingCal, &ToDo, &s);
}
error=GSM_TerminateConnection(&s);
return true;
}
bool PhoneFormat::save( Calendar *calendar)
{
#if 0
QLabel status ( i18n("Processing/adding events ..."), 0 );
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 200;
int h = status.sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Writing DTM Data") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status.show();
status.raise();
qApp->processEvents();
bool debug = DEBUGMODE;