summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookE.pro5
-rw-r--r--kmicromail/kmicromailE.pro4
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/korganizerE.pro7
-rw-r--r--libkcal/phoneformat.cpp79
-rw-r--r--libkcal/phoneformat.h14
6 files changed, 66 insertions, 45 deletions
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index 41f293d..86166d8 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -14,24 +14,29 @@ INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../micro
14DEFINES += KAB_EMBEDDED KAB_NOSPLITTER 14DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
15#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL 15#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
16#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 16#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
17#DEFINES += KORG_NOLVALTERNATION 17#DEFINES += KORG_NOLVALTERNATION
18LIBS += -lmicrokdepim 18LIBS += -lmicrokdepim
19#LIBS += -lmicrokcal 19#LIBS += -lmicrokcal
20LIBS += -lmicrokde 20LIBS += -lmicrokde
21LIBS += -lmicrokcal 21LIBS += -lmicrokcal
22LIBS += -lmicroqtcompat 22LIBS += -lmicroqtcompat
23LIBS += -lmicrokabc 23LIBS += -lmicrokabc
24LIBS += -lqpe 24LIBS += -lqpe
25LIBS += -ljpeg 25LIBS += -ljpeg
26
27LIBS += -lmicrogammu
28LIBS += -lbluetooth
29LIBS += -lsdp
30
26LIBS += $(QTOPIALIB) 31LIBS += $(QTOPIALIB)
27LIBS += -L$(QPEDIR)/lib 32LIBS += -L$(QPEDIR)/lib
28LIBS += -Wl,-export-dynamic 33LIBS += -Wl,-export-dynamic
29 34
30INTERFACES = \ 35INTERFACES = \
31# filteredit_base.ui \ 36# filteredit_base.ui \
32# kofilterview_base.ui \ 37# kofilterview_base.ui \
33 38
34HEADERS = \ 39HEADERS = \
35features/mergewidget.h \ 40features/mergewidget.h \
36features/distributionlistwidget.h \ 41features/distributionlistwidget.h \
37kcmconfigs/addresseewidget.h \ 42kcmconfigs/addresseewidget.h \
diff --git a/kmicromail/kmicromailE.pro b/kmicromail/kmicromailE.pro
index 8d13796..9cedb21 100644
--- a/kmicromail/kmicromailE.pro
+++ b/kmicromail/kmicromailE.pro
@@ -47,19 +47,23 @@ INTERFACES = editaccountsui.ui \
47 statuswidgetui.ui \ 47 statuswidgetui.ui \
48 newmaildirui.ui \ 48 newmaildirui.ui \
49 selectstoreui.ui \ 49 selectstoreui.ui \
50 nntpgroupsui.ui 50 nntpgroupsui.ui
51 51
52 52
53INCLUDEPATH += ../microkde ../microkde/kdecore ./libetpan/include $(QPEDIR)/include . .. ../microkde/kdeui ../qtcompat 53INCLUDEPATH += ../microkde ../microkde/kdecore ./libetpan/include $(QPEDIR)/include . .. ../microkde/kdeui ../qtcompat
54LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal 54LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal
55LIBS += $(QTOPIALIB) 55LIBS += $(QTOPIALIB)
56#LIBS += -lqtopia 56#LIBS += -lqtopia
57#next line for Zaurus only 57#next line for Zaurus only
58#LIBS += -luuid 58#LIBS += -luuid
59
60LIBS += -lmicrogammu
61LIBS += -lbluetooth
62LIBS += -lsdp
59# 63#
60OBJECTS_DIR = obj/$(PLATFORM) 64OBJECTS_DIR = obj/$(PLATFORM)
61MOC_DIR = moc/$(PLATFORM) 65MOC_DIR = moc/$(PLATFORM)
62DESTDIR=$(QPEDIR)/bin 66DESTDIR=$(QPEDIR)/bin
63TARGET = ompi 67TARGET = ompi
64 68
65 69
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a7f7010..b307649 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1179,25 +1179,25 @@ void CalendarView::syncPhone()
1179 syncExternal( 1 ); 1179 syncExternal( 1 );
1180} 1180}
1181void CalendarView::syncExternal( int mode ) 1181void CalendarView::syncExternal( int mode )
1182{ 1182{
1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1183 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1184 //mCurrentSyncDevice = "sharp-DTM"; 1184 //mCurrentSyncDevice = "sharp-DTM";
1185 if ( KOPrefs::instance()->mAskForPreferences ) 1185 if ( KOPrefs::instance()->mAskForPreferences )
1186 edit_sync_options(); 1186 edit_sync_options();
1187 qApp->processEvents(); 1187 qApp->processEvents();
1188 CalendarLocal* calendar = new CalendarLocal(); 1188 CalendarLocal* calendar = new CalendarLocal();
1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1189 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1190 bool syncOK = false; 1190 bool syncOK = false;
1191 boo loadSuccess = false; 1191 bool loadSuccess = false;
1192 PhoneFormat* phoneFormat = 0; 1192 PhoneFormat* phoneFormat = 0;
1193#ifndef DESKTOP_VERSION 1193#ifndef DESKTOP_VERSION
1194 SharpFormat* sharpFormat = 0; 1194 SharpFormat* sharpFormat = 0;
1195 if ( mode == 0 ) { // sharp 1195 if ( mode == 0 ) { // sharp
1196 sharpFormat = new SharpFormat () ; 1196 sharpFormat = new SharpFormat () ;
1197 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1197 loadSuccess = sharpFormat->load( calendar, mCalendar );
1198 1198
1199 } else 1199 } else
1200#endif 1200#endif
1201 if ( mode == 1 ) { // phone 1201 if ( mode == 1 ) { // phone
1202 phoneFormat = new PhoneFormat (); 1202 phoneFormat = new PhoneFormat ();
1203 loadSuccess = phoneFormat->load( calendar, mCalendar ); 1203 loadSuccess = phoneFormat->load( calendar, mCalendar );
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 727764a..b39de35 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -8,24 +8,31 @@ DESTDIR=$(QPEDIR)/bin
8INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include 8INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include
9#../libkabcwrap 9#../libkabcwrap
10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
12DEFINES += KORG_NOLVALTERNATION 12DEFINES += KORG_NOLVALTERNATION
13#KORG_NOKABC 13#KORG_NOKABC
14LIBS += -lmicrokdepim 14LIBS += -lmicrokdepim
15LIBS += -lmicrokcal 15LIBS += -lmicrokcal
16LIBS += -lmicrokde 16LIBS += -lmicrokde
17LIBS += -lmicroqtcompat 17LIBS += -lmicroqtcompat
18LIBS += -lmicrokabc 18LIBS += -lmicrokabc
19#LIBS += -lmicrokabcwrap 19#LIBS += -lmicrokabcwrap
20
21#LIBS += $(QPEDIR)/lib/gammu
22LIBS += -lmicrogammu
23LIBS += -lbluetooth
24LIBS += -lsdp
25
26
20LIBS += -lqpe 27LIBS += -lqpe
21LIBS += -ljpeg 28LIBS += -ljpeg
22LIBS += $(QTOPIALIB) 29LIBS += $(QTOPIALIB)
23LIBS += -L$(QPEDIR)/lib 30LIBS += -L$(QPEDIR)/lib
24 31
25INTERFACES = kofilterview_base.ui 32INTERFACES = kofilterview_base.ui
26#filteredit_base.ui 33#filteredit_base.ui
27 34
28HEADERS = \ 35HEADERS = \
29 wordsgerman.h \ 36 wordsgerman.h \
30 filteredit_base.h \ 37 filteredit_base.h \
31 alarmclient.h \ 38 alarmclient.h \
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index f78730d..fa18683 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -50,57 +50,57 @@ using namespace KCal;
50 50
51//ARSD silentalarm = 0 51//ARSD silentalarm = 0
52// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly 52// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly
53// 12 RFRQ 53// 12 RFRQ
54// 13 RPOS pos = 4. monday in month 54// 13 RPOS pos = 4. monday in month
55// 14 RDYS days: 1 mon/ 2 tue .. 64 sun 55// 14 RDYS days: 1 mon/ 2 tue .. 64 sun
56// 15 REND 0 = no end/ 1 = end 56// 15 REND 0 = no end/ 1 = end
57// 16 REDT rec end dt 57// 16 REDT rec end dt
58//ALSD 58//ALSD
59//ALED 59//ALED
60//MDAY 60//MDAY
61 61
62class SharpParser : public QObject 62class 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 }
68 68
69 bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) 69 bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName )
70 { 70 {
71 int i = 1; 71 int i = 1;
72 bool skip = true; 72 bool skip = true;
73 int max = attList.count() -2; 73 int max = attList.count() -2;
74 while ( i < max ) { 74 while ( i < max ) {
75 if ( !attList[i].isEmpty() ) { 75 if ( !attList[i].isEmpty() ) {
76 skip = false; 76 skip = false;
77 break; 77 break;
78 } 78 }
79 ++i ; 79 ++i ;
80 } 80 }
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] );
97 event->setLocation( attList[3] ); 97 event->setLocation( attList[3] );
98 event->setDescription( attList[4] ); 98 event->setDescription( attList[4] );
99 if ( attList[7] == "1" ) { 99 if ( attList[7] == "1" ) {
100 event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) )); 100 event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) ));
101 event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 ))); 101 event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 )));
102 event->setFloats( true ); 102 event->setFloats( true );
103 } else { 103 } else {
104 event->setFloats( false ); 104 event->setFloats( false );
105 event->setDtStart( fromString( attList[5] ) ); 105 event->setDtStart( fromString( attList[5] ) );
106 event->setDtEnd( fromString( attList[6] )); 106 event->setDtEnd( fromString( attList[6] ));
@@ -179,39 +179,39 @@ class SharpParser : public QObject
179 event->addAlarm( alarm ); 179 event->addAlarm( alarm );
180 } 180 }
181 alarm->setType( Alarm::Audio ); 181 alarm->setType( Alarm::Audio );
182 alarm->setEnabled( true ); 182 alarm->setEnabled( true );
183 int alarmOffset = attList[9].toInt(); 183 int alarmOffset = attList[9].toInt();
184 alarm->setStartOffset( alarmOffset * -60 ); 184 alarm->setStartOffset( alarmOffset * -60 );
185 } 185 }
186 186
187 mCalendar->addEvent( event); 187 mCalendar->addEvent( event);
188 } else if ( qName == "Todo" ) { 188 } else if ( qName == "Todo" ) {
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();
194 else 194 else
195 todo = new Todo; 195 todo = new Todo;
196 196
197//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 197//CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1
198// 0 1 2 3 4 5 6 7 8 198// 0 1 2 3 4 5 6 7 8
199//1,,,,,1,4,Loch zumachen,"" 199//1,,,,,1,4,Loch zumachen,""
200//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " 200//3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" "
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] );
208 todo->setDescription( attList[8]); 208 todo->setDescription( attList[8]);
209 209
210 int priority = attList[6].toInt(); 210 int priority = attList[6].toInt();
211 if ( priority == 0 ) priority = 3; 211 if ( priority == 0 ) priority = 3;
212 todo->setPriority( priority ); 212 todo->setPriority( priority );
213 213
214 QString categoryList = attList[1]; 214 QString categoryList = attList[1];
215 todo->setCategories( lookupCategories( categoryList ) ); 215 todo->setCategories( lookupCategories( categoryList ) );
216 216
217 217
@@ -314,35 +314,35 @@ class SharpParser : public QObject
314 if ( it == mCategoriesMap.end() ) return id; 314 if ( it == mCategoriesMap.end() ) return id;
315 else return *it; 315 else return *it;
316 } 316 }
317 317
318 static void setCategory( const QString &id, const QString &name ) 318 static void setCategory( const QString &id, const QString &name )
319 { 319 {
320 mCategoriesMap.insert( id, name ); 320 mCategoriesMap.insert( id, name );
321 } 321 }
322 322
323 static QMap<QString,QString> mCategoriesMap; 323 static QMap<QString,QString> mCategoriesMap;
324}; 324};
325 325
326QMap<QString,QString> SharpParser::mCategoriesMap; 326QMap<QString,QString> PhoneParser::mCategoriesMap;
327 327
328SharpFormat::SharpFormat() 328PhoneFormat::PhoneFormat()
329{ 329{
330 mCategories = 0; 330 mCategories = 0;
331} 331}
332 332
333SharpFormat::~SharpFormat() 333PhoneFormat::~PhoneFormat()
334{ 334{
335} 335}
336ulong SharpFormat::getCsum( const QStringList & attList) 336ulong PhoneFormat::getCsum( const QStringList & attList)
337{ 337{
338 int max = attList.count() -1; 338 int max = attList.count() -1;
339 ulong cSum = 0; 339 ulong cSum = 0;
340 int j,k,i; 340 int j,k,i;
341 int add; 341 int add;
342 for ( i = 1; i < max ; ++i ) { 342 for ( i = 1; i < max ; ++i ) {
343 QString s = attList[i]; 343 QString s = attList[i];
344 if ( ! s.isEmpty() ){ 344 if ( ! s.isEmpty() ){
345 j = s.length(); 345 j = s.length();
346 for ( k = 0; k < j; ++k ) { 346 for ( k = 0; k < j; ++k ) {
347 int mul = k +1; 347 int mul = k +1;
348 add = s[k].unicode (); 348 add = s[k].unicode ();
@@ -350,25 +350,25 @@ ulong SharpFormat::getCsum( const QStringList & attList)
350 mul = mul * mul; 350 mul = mul * mul;
351 add = add * mul *i*i*i; 351 add = add * mul *i*i*i;
352 cSum += add; 352 cSum += add;
353 } 353 }
354 } 354 }
355 } 355 }
356 return cSum; 356 return cSum;
357 357
358} 358}
359//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 359//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
360#include <stdlib.h> 360#include <stdlib.h>
361#define DEBUGMODE false 361#define DEBUGMODE false
362bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) 362bool PhoneFormat::load( Calendar *calendar, Calendar *existngCal )
363{ 363{
364 364
365 GSM_StateMachines; 365 GSM_StateMachines;
366 qDebug(" load "); 366 qDebug(" load ");
367 s.opened = false; 367 s.opened = false;
368 s.msg = NULL; 368 s.msg = NULL;
369 s.ConfigNum = 0; 369 s.ConfigNum = 0;
370 static char*cp; 370 static char*cp;
371 static INI_Section *cfg = NULL; 371 static INI_Section *cfg = NULL;
372 cfg=GSM_FindGammuRC(); 372 cfg=GSM_FindGammuRC();
373 int i; 373 int i;
374 for (i = 0; i <= MAX_CONFIG_NUM; i++) { 374 for (i = 0; i <= MAX_CONFIG_NUM; i++) {
@@ -479,25 +479,25 @@ static char *cp;
479 } 479 }
480 ts.setDevice( &file ); 480 ts.setDevice( &file );
481 text = ts.read(); 481 text = ts.read();
482 file.close(); 482 file.close();
483 483
484 status.setText( i18n("Processing todos ...") ); 484 status.setText( i18n("Processing todos ...") );
485 status.raise(); 485 status.raise();
486 qApp->processEvents(); 486 qApp->processEvents();
487 fromString2Cal( calendar, existngCal, text, "Todo" ); 487 fromString2Cal( calendar, existngCal, text, "Todo" );
488#endif 488#endif
489 return true; 489 return true;
490} 490}
491int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) 491int PhoneFormat::getNumFromRecord( QString answer, Incidence* inc )
492{ 492{
493 int retval = -1; 493 int retval = -1;
494 QStringList templist; 494 QStringList templist;
495 QString tempString; 495 QString tempString;
496 int start = 0; 496 int start = 0;
497 int len = answer.length(); 497 int len = answer.length();
498 int end = answer.find ("\n",start)+1; 498 int end = answer.find ("\n",start)+1;
499 bool ok = true; 499 bool ok = true;
500 start = end; 500 start = end;
501 int ccc = 0; 501 int ccc = 0;
502 while ( start > 0 ) { 502 while ( start > 0 ) {
503 templist.clear(); 503 templist.clear();
@@ -520,34 +520,34 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
520 if ( tempString.right(1) =="\n" ) 520 if ( tempString.right(1) =="\n" )
521 tempString = tempString.left( tempString.length()-1); 521 tempString = tempString.left( tempString.length()-1);
522 522
523 templist.append( tempString ); 523 templist.append( tempString );
524 } 524 }
525 ++ccc; 525 ++ccc;
526 if ( ccc == 2 && loopCount < 25 ) { 526 if ( ccc == 2 && loopCount < 25 ) {
527 start = 0; 527 start = 0;
528 bool ok; 528 bool ok;
529 int newnum = templist[0].toInt( &ok ); 529 int newnum = templist[0].toInt( &ok );
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 }
537 } 537 }
538 //qDebug("getNumFromRecord returning : %d ", retval); 538 //qDebug("getNumFromRecord returning : %d ", retval);
539 return retval; 539 return retval;
540} 540}
541bool SharpFormat::save( Calendar *calendar) 541bool PhoneFormat::save( Calendar *calendar)
542{ 542{
543 543
544 QLabel status ( i18n("Processing/adding events ..."), 0 ); 544 QLabel status ( i18n("Processing/adding events ..."), 0 );
545 int w = status.sizeHint().width()+20 ; 545 int w = status.sizeHint().width()+20 ;
546 if ( w < 200 ) w = 200; 546 if ( w < 200 ) w = 200;
547 int h = status.sizeHint().height()+20 ; 547 int h = status.sizeHint().height()+20 ;
548 int dw = QApplication::desktop()->width(); 548 int dw = QApplication::desktop()->width();
549 int dh = QApplication::desktop()->height(); 549 int dh = QApplication::desktop()->height();
550 status.setCaption(i18n("Writing DTM Data") ); 550 status.setCaption(i18n("Writing DTM Data") );
551 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 551 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
552 status.show(); 552 status.show();
553 status.raise(); 553 status.raise();
@@ -561,38 +561,38 @@ bool SharpFormat::save( Calendar *calendar)
561 QPtrList<Event> er = calendar->rawEvents(); 561 QPtrList<Event> er = calendar->rawEvents();
562 Event* ev = er.first(); 562 Event* ev = er.first();
563 QString fileName = "/tmp/kopitempout"; 563 QString fileName = "/tmp/kopitempout";
564 int i = 0; 564 int i = 0;
565 QString changeString = ePrefix; 565 QString changeString = ePrefix;
566 QString deleteString = ePrefix; 566 QString deleteString = ePrefix;
567 bool deleteEnt = false; 567 bool deleteEnt = false;
568 bool changeEnt = false; 568 bool changeEnt = false;
569 QString message = i18n("Processing event # "); 569 QString message = i18n("Processing event # ");
570 int procCount = 0; 570 int procCount = 0;
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
580 eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); 580 eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
581 changeString += eString + "\n"; 581 changeString += eString + "\n";
582 deleteString += eString + "\n"; 582 deleteString += eString + "\n";
583 deleteEnt = true; 583 deleteEnt = true;
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() );
589 QFile file( fileName ); 589 QFile file( fileName );
590 if (!file.open( IO_ReadOnly ) ) { 590 if (!file.open( IO_ReadOnly ) ) {
591 return false; 591 return false;
592 592
593 } 593 }
594 QTextStream ts( &file ); 594 QTextStream ts( &file );
595 ts.setCodec( QTextCodec::codecForName("utf8") ); 595 ts.setCodec( QTextCodec::codecForName("utf8") );
596 answer = ts.read(); 596 answer = ts.read();
597 file.close(); 597 file.close();
598 //qDebug("answer \n%s ", answer.latin1()); 598 //qDebug("answer \n%s ", answer.latin1());
@@ -647,38 +647,38 @@ bool SharpFormat::save( Calendar *calendar)
647 647
648 648
649 changeString = tPrefix; 649 changeString = tPrefix;
650 deleteString = tPrefix; 650 deleteString = tPrefix;
651 status.setText ( i18n("Processing todos ...") ); 651 status.setText ( i18n("Processing todos ...") );
652 qApp->processEvents(); 652 qApp->processEvents();
653 QPtrList<Todo> tl = calendar->rawTodos(); 653 QPtrList<Todo> tl = calendar->rawTodos();
654 Todo* to = tl.first(); 654 Todo* to = tl.first();
655 i = 0; 655 i = 0;
656 message = i18n("Processing todo # "); 656 message = i18n("Processing todo # ");
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
666 eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); 666 eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
667 changeString += eString + "\n"; 667 changeString += eString + "\n";
668 deleteString += eString + "\n"; 668 deleteString += eString + "\n";
669 deleteEnt = true; 669 deleteEnt = true;
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() );
675 QFile file( fileName ); 675 QFile file( fileName );
676 if (!file.open( IO_ReadOnly ) ) { 676 if (!file.open( IO_ReadOnly ) ) {
677 return false; 677 return false;
678 678
679 } 679 }
680 QTextStream ts( &file ); 680 QTextStream ts( &file );
681 ts.setCodec( QTextCodec::codecForName("utf8") ); 681 ts.setCodec( QTextCodec::codecForName("utf8") );
682 answer = ts.read(); 682 answer = ts.read();
683 file.close(); 683 file.close();
684 //qDebug("answer \n%s ", answer.latin1()); 684 //qDebug("answer \n%s ", answer.latin1());
@@ -725,48 +725,49 @@ bool SharpFormat::save( Calendar *calendar)
725 } 725 }
726 QTextStream ts( &file ); 726 QTextStream ts( &file );
727 ts.setCodec( QTextCodec::codecForName("utf8") ); 727 ts.setCodec( QTextCodec::codecForName("utf8") );
728 ts << deleteString; 728 ts << deleteString;
729 file.close(); 729 file.close();
730 command = "db2file todo -d -c " + codec+ " < "+ fileName; 730 command = "db2file todo -d -c " + codec+ " < "+ fileName;
731 system ( command.latin1() ); 731 system ( command.latin1() );
732 // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); 732 // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
733 } 733 }
734 734
735 return true; 735 return true;
736} 736}
737QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) 737QString PhoneFormat::dtToString( const QDateTime& dti, bool useTZ )
738{ 738{
739 QString datestr; 739 QString datestr;
740 QString timestr; 740 QString timestr;
741 int offset = KGlobal::locale()->localTimeOffset( dti ); 741 int offset = KGlobal::locale()->localTimeOffset( dti );
742 QDateTime dt; 742 QDateTime dt;
743 if (useTZ) 743 if (useTZ)
744 dt = dti.addSecs ( -(offset*60)); 744 dt = dti.addSecs ( -(offset*60));
745 else 745 else
746 dt = dti; 746 dt = dti;
747 if(dt.date().isValid()){ 747 if(dt.date().isValid()){
748 const QDate& date = dt.date(); 748 const QDate& date = dt.date();
749 datestr.sprintf("%04d%02d%02d", 749 datestr.sprintf("%04d%02d%02d",
750 date.year(), date.month(), date.day()); 750 date.year(), date.month(), date.day());
751 } 751 }
752 if(dt.time().isValid()){ 752 if(dt.time().isValid()){
753 const QTime& time = dt.time(); 753 const QTime& time = dt.time();
754 timestr.sprintf("T%02d%02d%02d", 754 timestr.sprintf("T%02d%02d%02d",
755 time.hour(), time.minute(), time.second()); 755 time.hour(), time.minute(), time.second());
756 } 756 }
757 return datestr + timestr; 757 return datestr + timestr;
758} 758}
759QString SharpFormat::getEventString( Event* event ) 759QString 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() ) );
763 list.append( event->categories().join(",") ); 764 list.append( event->categories().join(",") );
764 if ( !event->summary().isEmpty() ) 765 if ( !event->summary().isEmpty() )
765 list.append( event->summary() ); 766 list.append( event->summary() );
766 else 767 else
767 list.append("" ); 768 list.append("" );
768 if ( !event->location().isEmpty() ) 769 if ( !event->location().isEmpty() )
769 list.append( event->location() ); 770 list.append( event->location() );
770 else 771 else
771 list.append("" ); 772 list.append("" );
772 if ( !event->description().isEmpty() ) 773 if ( !event->description().isEmpty() )
@@ -908,29 +909,31 @@ QString SharpFormat::getEventString( Event* event )
908 for(QStringList::Iterator it=list.begin(); 909 for(QStringList::Iterator it=list.begin();
909 it!=list.end(); ++it){ 910 it!=list.end(); ++it){
910 QString& s = (*it); 911 QString& s = (*it);
911 s.replace(QRegExp("\""), "\"\""); 912 s.replace(QRegExp("\""), "\"\"");
912 if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ 913 if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){
913 s.prepend('\"'); 914 s.prepend('\"');
914 s.append('\"'); 915 s.append('\"');
915 } else if(s.isEmpty() && !s.isNull()){ 916 } else if(s.isEmpty() && !s.isNull()){
916 s = "\"\""; 917 s = "\"\"";
917 } 918 }
918 } 919 }
919 return list.join(","); 920 return list.join(",");
920 921#endif
922 return QString();
921 923
922} 924}
923QString SharpFormat::getTodoString( Todo* todo ) 925QString 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() ) );
927 list.append( todo->categories().join(",") ); 930 list.append( todo->categories().join(",") );
928 931
929 if ( todo->hasStartDate() ) { 932 if ( todo->hasStartDate() ) {
930 list.append( dtToString( todo->dtStart()) ); 933 list.append( dtToString( todo->dtStart()) );
931 } else 934 } else
932 list.append( QString() ); 935 list.append( QString() );
933 936
934 if ( todo->hasDueDate() ) { 937 if ( todo->hasDueDate() ) {
935 QTime tim; 938 QTime tim;
936 if ( todo->doesFloat()) { 939 if ( todo->doesFloat()) {
@@ -960,26 +963,28 @@ QString SharpFormat::getTodoString( Todo* todo )
960 for(QStringList::Iterator it=list.begin(); 963 for(QStringList::Iterator it=list.begin();
961 it!=list.end(); ++it){ 964 it!=list.end(); ++it){
962 QString& s = (*it); 965 QString& s = (*it);
963 s.replace(QRegExp("\""), "\"\""); 966 s.replace(QRegExp("\""), "\"\"");
964 if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ 967 if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){
965 s.prepend('\"'); 968 s.prepend('\"');
966 s.append('\"'); 969 s.append('\"');
967 } else if(s.isEmpty() && !s.isNull()){ 970 } else if(s.isEmpty() && !s.isNull()){
968 s = "\"\""; 971 s = "\"\"";
969 } 972 }
970 } 973 }
971 return list.join(","); 974 return list.join(",");
975#endif
976 return QString();
972} 977}
973QString SharpFormat::getPart( const QString & text, bool &ok, int &start ) 978QString PhoneFormat::getPart( const QString & text, bool &ok, int &start )
974{ 979{
975 //qDebug("start %d ", start); 980 //qDebug("start %d ", start);
976 981
977 QString retval =""; 982 QString retval ="";
978 if ( text.at(start) == '"' ) { 983 if ( text.at(start) == '"' ) {
979 if ( text.mid( start,2) == "\"\"" && !( text.mid( start+2,1) == "\"")) { 984 if ( text.mid( start,2) == "\"\"" && !( text.mid( start+2,1) == "\"")) {
980 start = start +2; 985 start = start +2;
981 if ( text.mid( start,1) == "," ) { 986 if ( text.mid( start,1) == "," ) {
982 start += 1; 987 start += 1;
983 } 988 }
984 retval = ""; 989 retval = "";
985 if ( text.mid( start,1) == "\n" ) { 990 if ( text.mid( start,1) == "\n" ) {
@@ -1019,39 +1024,39 @@ QString SharpFormat::getPart( const QString & text, bool &ok, int &start )
1019 start = 0; 1024 start = 0;
1020 ok = false; 1025 ok = false;
1021 return "0"; 1026 return "0";
1022 } 1027 }
1023 // qDebug(" nl < kom ", nl); 1028 // qDebug(" nl < kom ", nl);
1024 retval = text.mid( start, nl-start); 1029 retval = text.mid( start, nl-start);
1025 ok = false; 1030 ok = false;
1026 start = nl+1; 1031 start = nl+1;
1027 return retval; 1032 return retval;
1028 } 1033 }
1029 } 1034 }
1030} 1035}
1031bool SharpFormat::fromString( Calendar *calendar, const QString & text) 1036bool 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;
1038 1043
1039 GSM_CalendarEntrynote; 1044 GSM_CalendarEntrynote;
1040 GSM_CalendarEntry*Note; 1045 GSM_CalendarEntry*Note;
1041 bool refresh= true; 1046 bool refresh= true;
1042 1047
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;
1048 QString tempString; 1053 QString tempString;
1049 int start = 0; 1054 int start = 0;
1050 int error; 1055 int error;
1051 int ccc = 0; 1056 int ccc = 0;
1052 while (!gshutdown && ccc++ < 10 ) { 1057 while (!gshutdown && ccc++ < 10 ) {
1053 QString CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY; 1058 QString CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY;
1054 templist.clear(); 1059 templist.clear();
1055 qDebug("count %d ", ccc); 1060 qDebug("count %d ", ccc);
1056 error=Phone->GetNextCalendar(s,&note,refresh); 1061 error=Phone->GetNextCalendar(s,&note,refresh);
1057 if (error == ERR_EMPTY) break; 1062 if (error == ERR_EMPTY) break;
@@ -1321,39 +1326,39 @@ typedef struct {
1321 1326
1322 1327
1323 1328
1324#if 0 1329#if 0
1325 // qDebug("test %s ", text.latin1()); 1330 // qDebug("test %s ", text.latin1());
1326 QStringList templist; 1331 QStringList templist;
1327 QString tempString; 1332 QString tempString;
1328 int start = 0; 1333 int start = 0;
1329 int len = text.length(); 1334 int len = text.length();
1330 int end = text.find ("\n",start)+1; 1335 int end = text.find ("\n",start)+1;
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 ) {
1336 templist.clear(); 1341 templist.clear();
1337 ok = true; 1342 ok = true;
1338 while ( ok ) { 1343 while ( ok ) {
1339 tempString = getPart( text, ok, start ); 1344 tempString = getPart( text, ok, start );
1340 if ( start >= len || start == 0 ) { 1345 if ( start >= len || start == 0 ) {
1341 start = 0; 1346 start = 0;
1342 ok = false; 1347 ok = false;
1343 } 1348 }
1344 if ( tempString.right(1) =="\n" ) 1349 if ( tempString.right(1) =="\n" )
1345 tempString = tempString.left( tempString.length()-1); 1350 tempString = tempString.left( tempString.length()-1);
1346 //if ( ok ) 1351 //if ( ok )
1347 templist.append( tempString ); 1352 templist.append( tempString );
1348 //qDebug("%d ---%s---", templist.count(),tempString.latin1() ); 1353 //qDebug("%d ---%s---", templist.count(),tempString.latin1() );
1349 } 1354 }
1350 handler.startElement( existingCalendar, templist, type ); 1355 handler.startElement( existingCalendar, templist, type );
1351 } 1356 }
1352#endif 1357#endif
1353 return false; 1358 return false;
1354} 1359}
1355 1360
1356QString SharpFormat::toString( Calendar * ) 1361QString PhoneFormat::toString( Calendar * )
1357{ 1362{
1358 return QString::null; 1363 return QString::null;
1359} 1364}
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h
index f4cb52c..4ddf6f0 100644
--- a/libkcal/phoneformat.h
+++ b/libkcal/phoneformat.h
@@ -9,47 +9,47 @@
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#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>
25 25
26#include "scheduler.h" 26#include "scheduler.h"
27 27
28#include "calformat.h" 28#include "calformat.h"
29extern "C" { 29extern "C" {
30#include "gammu.h" 30#include "../gammu/emb/common/gammu.h"
31} 31}
32 32
33namespace KCal { 33namespace 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
39class SharpFormat : public QObject { 39class 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 *);
46 bool save( Calendar * ); 46 bool save( Calendar * );
47 void setCategoriesList ( QStringList * cat ){ mCategories = cat; } 47 void setCategoriesList ( QStringList * cat ){ mCategories = cat; }
48 bool fromString2Cal( Calendar *, Calendar *, GSM_StateMachine*s , const QString & ); 48 bool fromString2Cal( Calendar *, Calendar *, GSM_StateMachine*s , const QString & );
49 bool fromString( Calendar *, const QString & ); 49 bool fromString( Calendar *, const QString & );
50 QString toString( Calendar * ); 50 QString toString( Calendar * );
51 static ulong getCsum( const QStringList & ); 51 static ulong getCsum( const QStringList & );
52 52
53 private: 53 private:
54 QString getEventString( Event* ); 54 QString getEventString( Event* );
55 QString getTodoString( Todo* ); 55 QString getTodoString( Todo* );