-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 16 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 8 |
3 files changed, 23 insertions, 3 deletions
@@ -1,51 +1,51 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | # Makefile for building: kopi-desktop | 2 | # Makefile for building: kopi-desktop |
3 | # Generated by qmake (1.07a) (Qt 3.3.2) on: Sun Aug 8 12:23:00 2004 | 3 | # Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 12:10:32 2004 |
4 | # Project: kopi-desktop.pro | 4 | # Project: kopi-desktop.pro |
5 | # Template: subdirs | 5 | # Template: subdirs |
6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro | 6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro |
7 | ############################################################################# | 7 | ############################################################################# |
8 | 8 | ||
9 | MAKEFILE =Makefile | 9 | MAKEFILE =Makefile |
10 | QMAKE =qmake | 10 | QMAKE =qmake |
11 | DEL_FILE = rm -f | 11 | DEL_FILE = rm -f |
12 | CHK_DIR_EXISTS= test -d | 12 | CHK_DIR_EXISTS= test -d |
13 | MKDIR = mkdir -p | 13 | MKDIR = mkdir -p |
14 | INSTALL_FILE= | 14 | INSTALL_FILE= |
15 | INSTALL_DIR = | 15 | INSTALL_DIR = |
16 | SUBTARGETS = \ | 16 | SUBTARGETS = \ |
17 | sub-gammu-emb-common \ | 17 | sub-gammu-emb-common \ |
18 | sub-libical \ | 18 | sub-libical \ |
19 | sub-libkcal \ | 19 | sub-libkcal \ |
20 | sub-microkde \ | 20 | sub-microkde \ |
21 | sub-libkdepim \ | 21 | sub-libkdepim \ |
22 | sub-kabc \ | 22 | sub-kabc \ |
23 | sub-korganizer \ | 23 | sub-korganizer \ |
24 | sub-kaddressbook \ | 24 | sub-kaddressbook \ |
25 | sub-kabc-plugins-file \ | 25 | sub-kabc-plugins-file \ |
26 | sub-kabc-plugins-dir | 26 | sub-kabc-plugins-dir |
27 | 27 | ||
28 | first: all | 28 | first: all |
29 | 29 | ||
30 | all: Makefile $(SUBTARGETS) | 30 | all: Makefile $(SUBTARGETS) |
31 | 31 | ||
32 | gammu/emb/common/$(MAKEFILE): | 32 | gammu/emb/common/$(MAKEFILE): |
33 | @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" | 33 | @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" |
34 | cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 34 | cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
35 | sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE | 35 | sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE |
36 | cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) | 36 | cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) |
37 | 37 | ||
38 | libical/$(MAKEFILE): | 38 | libical/$(MAKEFILE): |
39 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" | 39 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" |
40 | cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 40 | cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
41 | sub-libical: libical/$(MAKEFILE) FORCE | 41 | sub-libical: libical/$(MAKEFILE) FORCE |
42 | cd libical && $(MAKE) -f $(MAKEFILE) | 42 | cd libical && $(MAKE) -f $(MAKEFILE) |
43 | 43 | ||
44 | libkcal/$(MAKEFILE): | 44 | libkcal/$(MAKEFILE): |
45 | @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" | 45 | @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" |
46 | cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 46 | cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
47 | sub-libkcal: libkcal/$(MAKEFILE) FORCE | 47 | sub-libkcal: libkcal/$(MAKEFILE) FORCE |
48 | cd libkcal && $(MAKE) -f $(MAKEFILE) | 48 | cd libkcal && $(MAKE) -f $(MAKEFILE) |
49 | 49 | ||
50 | microkde/$(MAKEFILE): | 50 | microkde/$(MAKEFILE): |
51 | @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" | 51 | @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 7e1c9cd..94744fb 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -125,98 +125,104 @@ public: | |||
125 | if (error == ERR_NONE) { | 125 | if (error == ERR_NONE) { |
126 | QStringList cat = todo->categories(); | 126 | QStringList cat = todo->categories(); |
127 | QString nCat = QString ( (const char*)Category.Name ); | 127 | QString nCat = QString ( (const char*)Category.Name ); |
128 | if ( !nCat.isEmpty() ) | 128 | if ( !nCat.isEmpty() ) |
129 | if ( !cat.contains( nCat )) { | 129 | if ( !cat.contains( nCat )) { |
130 | cat << nCat; | 130 | cat << nCat; |
131 | todo->setCategories( cat ); | 131 | todo->setCategories( cat ); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | break; | 134 | break; |
135 | case TODO_CONTACTID: | 135 | case TODO_CONTACTID: |
136 | #if 0 | 136 | #if 0 |
137 | // not supported | 137 | // not supported |
138 | entry.Location = ToDo->Entries[j].Number; | 138 | entry.Location = ToDo->Entries[j].Number; |
139 | entry.MemoryType = MEM_ME; | 139 | entry.MemoryType = MEM_ME; |
140 | error=Phone->GetMemory(s, &entry); | 140 | error=Phone->GetMemory(s, &entry); |
141 | if (error == ERR_NONE) { | 141 | if (error == ERR_NONE) { |
142 | name = GSM_PhonebookGetEntryName(&entry); | 142 | name = GSM_PhonebookGetEntryName(&entry); |
143 | if (name != NULL) { | 143 | if (name != NULL) { |
144 | printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number); | 144 | printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number); |
145 | } else { | 145 | } else { |
146 | printmsg("Contact ID : %d\n",ToDo->Entries[j].Number); | 146 | printmsg("Contact ID : %d\n",ToDo->Entries[j].Number); |
147 | } | 147 | } |
148 | } else { | 148 | } else { |
149 | printmsg("Contact : %d\n",ToDo->Entries[j].Number); | 149 | printmsg("Contact : %d\n",ToDo->Entries[j].Number); |
150 | } | 150 | } |
151 | #endif | 151 | #endif |
152 | break; | 152 | break; |
153 | case TODO_PHONE: | 153 | case TODO_PHONE: |
154 | #if 0 | 154 | #if 0 |
155 | // not supported | 155 | // not supported |
156 | printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); | 156 | printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); |
157 | #endif | 157 | #endif |
158 | break; | 158 | break; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | QString alarmString = ""; | 161 | QString alarmString = ""; |
162 | if ( alarm ) { | 162 | if ( alarm ) { |
163 | Alarm *alarm; | 163 | Alarm *alarm; |
164 | if ( todo->alarms().count() > 0 ) | 164 | if ( todo->alarms().count() > 0 ) |
165 | alarm = todo->alarms().first(); | 165 | alarm = todo->alarms().first(); |
166 | else { | 166 | else { |
167 | alarm = new Alarm( todo ); | 167 | alarm = new Alarm( todo ); |
168 | todo->addAlarm( alarm ); | 168 | todo->addAlarm( alarm ); |
169 | } | 169 | } |
170 | alarm->setType( Alarm::Audio ); | 170 | alarm->setType( Alarm::Audio ); |
171 | alarm->setEnabled( true ); | 171 | alarm->setEnabled( true ); |
172 | int alarmOffset = alarmDt.secsTo( todo->dtStart() ); | 172 | int alarmOffset = alarmDt.secsTo( todo->dtStart() ); |
173 | alarm->setStartOffset( alarmOffset ); | 173 | alarm->setStartOffset( -alarmOffset ); |
174 | alarmString = QString::number( alarmOffset ); | 174 | alarmString = QString::number( alarmOffset ); |
175 | } else { | ||
176 | Alarm *alarm; | ||
177 | if ( todo->alarms().count() > 0 ) { | ||
178 | alarm = todo->alarms().first(); | ||
179 | alarm->setEnabled( false ); | ||
180 | } | ||
175 | } | 181 | } |
176 | // csum ***************************************** | 182 | // csum ***************************************** |
177 | QStringList attList; | 183 | QStringList attList; |
178 | uint cSum; | 184 | uint cSum; |
179 | if ( todo->hasDueDate() ) | 185 | if ( todo->hasDueDate() ) |
180 | attList << dtToString ( todo->dtDue() ); | 186 | attList << dtToString ( todo->dtDue() ); |
181 | attList << QString::number( id ); | 187 | attList << QString::number( id ); |
182 | attList << todo->summary(); | 188 | attList << todo->summary(); |
183 | attList << completedString; | 189 | attList << completedString; |
184 | attList << QString::number( todo->priority() ); | 190 | attList << QString::number( todo->priority() ); |
185 | attList << alarmString; | 191 | attList << alarmString; |
186 | attList << todo->categoriesStr(); | 192 | attList << todo->categoriesStr(); |
187 | attList << todo->secrecyStr(); | 193 | attList << todo->secrecyStr(); |
188 | cSum = PhoneFormat::getCsum(attList ); | 194 | cSum = PhoneFormat::getCsum(attList ); |
189 | todo->setCsum( mProfileName, QString::number( cSum )); | 195 | todo->setCsum( mProfileName, QString::number( cSum )); |
190 | mCalendar->addTodo( todo); | 196 | mCalendar->addTodo( todo); |
191 | 197 | ||
192 | return true; | 198 | return true; |
193 | } | 199 | } |
194 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) | 200 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) |
195 | { | 201 | { |
196 | 202 | ||
197 | int id = Note->Location; | 203 | int id = Note->Location; |
198 | Event *event; | 204 | Event *event; |
199 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); | 205 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); |
200 | if ( event ) | 206 | if ( event ) |
201 | event = (Event*)event->clone(); | 207 | event = (Event*)event->clone(); |
202 | else | 208 | else |
203 | event = new Event; | 209 | event = new Event; |
204 | event->setID( mProfileName,QString::number( id ) ); | 210 | event->setID( mProfileName,QString::number( id ) ); |
205 | event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); | 211 | event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); |
206 | 212 | ||
207 | 213 | ||
208 | int i = 0; | 214 | int i = 0; |
209 | bool repeating = false; | 215 | bool repeating = false; |
210 | int repeat_dayofweek = -1; | 216 | int repeat_dayofweek = -1; |
211 | int repeat_day = -1; | 217 | int repeat_day = -1; |
212 | int repeat_weekofmonth = -1; | 218 | int repeat_weekofmonth = -1; |
213 | int repeat_month = -1; | 219 | int repeat_month = -1; |
214 | int repeat_frequency = -1; | 220 | int repeat_frequency = -1; |
215 | int rec_type = -1; | 221 | int rec_type = -1; |
216 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | 222 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; |
217 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | 223 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; |
218 | GSM_DateTime* dtp; | 224 | GSM_DateTime* dtp; |
219 | bool alarm = false; | 225 | bool alarm = false; |
220 | QDateTime alarmDt; | 226 | QDateTime alarmDt; |
221 | repeat_startdate.Day= 0; | 227 | repeat_startdate.Day= 0; |
222 | repeat_stopdate.Day = 0; | 228 | repeat_stopdate.Day = 0; |
@@ -403,98 +409,104 @@ public: | |||
403 | if ( rtype == 0 ) { | 409 | if ( rtype == 0 ) { |
404 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 410 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
405 | else r->setDaily( freq, -1 ); | 411 | else r->setDaily( freq, -1 ); |
406 | } else if ( rtype == 1 ) { | 412 | } else if ( rtype == 1 ) { |
407 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 413 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
408 | else r->setWeekly( freq, weekDays, -1 ); | 414 | else r->setWeekly( freq, weekDays, -1 ); |
409 | } else if ( rtype == 3 ) { | 415 | } else if ( rtype == 3 ) { |
410 | if ( hasEndDate ) | 416 | if ( hasEndDate ) |
411 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 417 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
412 | else | 418 | else |
413 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); | 419 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); |
414 | r->addMonthlyDay( startDate.day() ); | 420 | r->addMonthlyDay( startDate.day() ); |
415 | } else if ( rtype == 2 ) { | 421 | } else if ( rtype == 2 ) { |
416 | if ( hasEndDate ) | 422 | if ( hasEndDate ) |
417 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 423 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
418 | else | 424 | else |
419 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 425 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
420 | QBitArray days( 7 ); | 426 | QBitArray days( 7 ); |
421 | days.fill( false ); | 427 | days.fill( false ); |
422 | days.setBit( dayOfWeek - 1 ); | 428 | days.setBit( dayOfWeek - 1 ); |
423 | r->addMonthlyPos( pos, days ); | 429 | r->addMonthlyPos( pos, days ); |
424 | } else if ( rtype == 4 ) { | 430 | } else if ( rtype == 4 ) { |
425 | if ( hasEndDate ) | 431 | if ( hasEndDate ) |
426 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 432 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
427 | else | 433 | else |
428 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 434 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
429 | r->addYearlyNum( startDate.month() ); | 435 | r->addYearlyNum( startDate.month() ); |
430 | } | 436 | } |
431 | } else { | 437 | } else { |
432 | event->recurrence()->unsetRecurs(); | 438 | event->recurrence()->unsetRecurs(); |
433 | } | 439 | } |
434 | 440 | ||
435 | QStringList categoryList; | 441 | QStringList categoryList; |
436 | categoryList << getCategory( Note ); | 442 | categoryList << getCategory( Note ); |
437 | event->setCategories( categoryList ); | 443 | event->setCategories( categoryList ); |
438 | QString alarmString = ""; | 444 | QString alarmString = ""; |
439 | // strange 0 semms to mean: alarm enabled | 445 | // strange 0 semms to mean: alarm enabled |
440 | if ( alarm ) { | 446 | if ( alarm ) { |
441 | Alarm *alarm; | 447 | Alarm *alarm; |
442 | if ( event->alarms().count() > 0 ) | 448 | if ( event->alarms().count() > 0 ) |
443 | alarm = event->alarms().first(); | 449 | alarm = event->alarms().first(); |
444 | else { | 450 | else { |
445 | alarm = new Alarm( event ); | 451 | alarm = new Alarm( event ); |
446 | event->addAlarm( alarm ); | 452 | event->addAlarm( alarm ); |
447 | } | 453 | } |
448 | alarm->setType( Alarm::Audio ); | 454 | alarm->setType( Alarm::Audio ); |
449 | alarm->setEnabled( true ); | 455 | alarm->setEnabled( true ); |
450 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); | 456 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); |
451 | alarm->setStartOffset( alarmOffset ); | 457 | alarm->setStartOffset( -alarmOffset ); |
452 | alarmString = QString::number( alarmOffset ); | 458 | alarmString = QString::number( alarmOffset ); |
459 | } else { | ||
460 | Alarm *alarm; | ||
461 | if ( event->alarms().count() > 0 ) { | ||
462 | alarm = event->alarms().first(); | ||
463 | alarm->setEnabled( false ); | ||
464 | } | ||
453 | } | 465 | } |
454 | // csum ***************************************** | 466 | // csum ***************************************** |
455 | QStringList attList; | 467 | QStringList attList; |
456 | uint cSum; | 468 | uint cSum; |
457 | attList << dtToString ( event->dtStart() ); | 469 | attList << dtToString ( event->dtStart() ); |
458 | attList << dtToString ( event->dtEnd() ); | 470 | attList << dtToString ( event->dtEnd() ); |
459 | attList << QString::number( id ); | 471 | attList << QString::number( id ); |
460 | attList << event->summary(); | 472 | attList << event->summary(); |
461 | attList << event->location(); | 473 | attList << event->location(); |
462 | attList << alarmString; | 474 | attList << alarmString; |
463 | attList << recurString; | 475 | attList << recurString; |
464 | attList << event->categoriesStr(); | 476 | attList << event->categoriesStr(); |
465 | attList << event->secrecyStr(); | 477 | attList << event->secrecyStr(); |
466 | cSum = PhoneFormat::getCsum(attList ); | 478 | cSum = PhoneFormat::getCsum(attList ); |
467 | event->setCsum( mProfileName, QString::number( cSum )); | 479 | event->setCsum( mProfileName, QString::number( cSum )); |
468 | mCalendar->addEvent( event); | 480 | mCalendar->addEvent( event); |
469 | 481 | ||
470 | return true; | 482 | return true; |
471 | } | 483 | } |
472 | 484 | ||
473 | 485 | ||
474 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { | 486 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { |
475 | QDateTime dt; | 487 | QDateTime dt; |
476 | int y,m,t,h,min,sec; | 488 | int y,m,t,h,min,sec; |
477 | y = dtp->Year; | 489 | y = dtp->Year; |
478 | m = dtp->Month; | 490 | m = dtp->Month; |
479 | t = dtp->Day; | 491 | t = dtp->Day; |
480 | h = dtp->Hour; | 492 | h = dtp->Hour; |
481 | min = dtp->Minute; | 493 | min = dtp->Minute; |
482 | sec = dtp->Second; | 494 | sec = dtp->Second; |
483 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); | 495 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); |
484 | // dtp->Timezone: offset in hours | 496 | // dtp->Timezone: offset in hours |
485 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 497 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
486 | if ( useTz ) | 498 | if ( useTz ) |
487 | dt = dt.addSecs ( offset*60); | 499 | dt = dt.addSecs ( offset*60); |
488 | return dt; | 500 | return dt; |
489 | 501 | ||
490 | } | 502 | } |
491 | 503 | ||
492 | QString dtToString( const QDateTime& dti, bool useTZ = false ) | 504 | QString dtToString( const QDateTime& dti, bool useTZ = false ) |
493 | { | 505 | { |
494 | QString datestr; | 506 | QString datestr; |
495 | QString timestr; | 507 | QString timestr; |
496 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 508 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
497 | QDateTime dt; | 509 | QDateTime dt; |
498 | if (useTZ) | 510 | if (useTZ) |
499 | dt = dti.addSecs ( -(offset*60)); | 511 | dt = dti.addSecs ( -(offset*60)); |
500 | else | 512 | else |
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index 4e54fdf..f8b066d 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -120,114 +120,122 @@ class SharpParser : public QObject | |||
120 | 120 | ||
121 | QString endDateStr = attList[16]; | 121 | QString endDateStr = attList[16]; |
122 | QDate endDate = fromString( endDateStr ).date(); | 122 | QDate endDate = fromString( endDateStr ).date(); |
123 | 123 | ||
124 | QString weekDaysStr = attList[14]; | 124 | QString weekDaysStr = attList[14]; |
125 | uint weekDaysNum = weekDaysStr.toInt(); | 125 | uint weekDaysNum = weekDaysStr.toInt(); |
126 | 126 | ||
127 | QBitArray weekDays( 7 ); | 127 | QBitArray weekDays( 7 ); |
128 | int i; | 128 | int i; |
129 | int bb = 1; | 129 | int bb = 1; |
130 | for( i = 1; i <= 7; ++i ) { | 130 | for( i = 1; i <= 7; ++i ) { |
131 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); | 131 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); |
132 | bb = 2 << (i-1); | 132 | bb = 2 << (i-1); |
133 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); | 133 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); |
134 | } | 134 | } |
135 | // qDebug("next "); | 135 | // qDebug("next "); |
136 | QString posStr = attList[13]; | 136 | QString posStr = attList[13]; |
137 | int pos = posStr.toInt(); | 137 | int pos = posStr.toInt(); |
138 | Recurrence *r = event->recurrence(); | 138 | Recurrence *r = event->recurrence(); |
139 | 139 | ||
140 | if ( rtype == "0" ) { | 140 | if ( rtype == "0" ) { |
141 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 141 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
142 | else r->setDaily( freq, -1 ); | 142 | else r->setDaily( freq, -1 ); |
143 | } else if ( rtype == "1" ) { | 143 | } else if ( rtype == "1" ) { |
144 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 144 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
145 | else r->setWeekly( freq, weekDays, -1 ); | 145 | else r->setWeekly( freq, weekDays, -1 ); |
146 | } else if ( rtype == "3" ) { | 146 | } else if ( rtype == "3" ) { |
147 | if ( hasEndDate ) | 147 | if ( hasEndDate ) |
148 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 148 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
149 | else | 149 | else |
150 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); | 150 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); |
151 | r->addMonthlyDay( startDate.day() ); | 151 | r->addMonthlyDay( startDate.day() ); |
152 | } else if ( rtype == "2" ) { | 152 | } else if ( rtype == "2" ) { |
153 | if ( hasEndDate ) | 153 | if ( hasEndDate ) |
154 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 154 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
155 | else | 155 | else |
156 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 156 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
157 | QBitArray days( 7 ); | 157 | QBitArray days( 7 ); |
158 | days.fill( false ); | 158 | days.fill( false ); |
159 | days.setBit( startDate.dayOfWeek() - 1 ); | 159 | days.setBit( startDate.dayOfWeek() - 1 ); |
160 | r->addMonthlyPos( pos, days ); | 160 | r->addMonthlyPos( pos, days ); |
161 | } else if ( rtype == "4" ) { | 161 | } else if ( rtype == "4" ) { |
162 | if ( hasEndDate ) | 162 | if ( hasEndDate ) |
163 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 163 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
164 | else | 164 | else |
165 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 165 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
166 | r->addYearlyNum( startDate.month() ); | 166 | r->addYearlyNum( startDate.month() ); |
167 | } | 167 | } |
168 | } else { | ||
169 | event->recurrence()->unsetRecurs(); | ||
168 | } | 170 | } |
169 | 171 | ||
170 | QString categoryList = attList[1] ; | 172 | QString categoryList = attList[1] ; |
171 | event->setCategories( lookupCategories( categoryList ) ); | 173 | event->setCategories( lookupCategories( categoryList ) ); |
172 | 174 | ||
173 | // strange 0 semms to mean: alarm enabled | 175 | // strange 0 semms to mean: alarm enabled |
174 | if ( attList[8] == "0" ) { | 176 | if ( attList[8] == "0" ) { |
175 | Alarm *alarm; | 177 | Alarm *alarm; |
176 | if ( event->alarms().count() > 0 ) | 178 | if ( event->alarms().count() > 0 ) |
177 | alarm = event->alarms().first(); | 179 | alarm = event->alarms().first(); |
178 | else { | 180 | else { |
179 | alarm = new Alarm( event ); | 181 | alarm = new Alarm( event ); |
180 | event->addAlarm( alarm ); | 182 | event->addAlarm( alarm ); |
181 | } | 183 | } |
182 | alarm->setType( Alarm::Audio ); | 184 | alarm->setType( Alarm::Audio ); |
183 | alarm->setEnabled( true ); | 185 | alarm->setEnabled( true ); |
184 | int alarmOffset = attList[9].toInt(); | 186 | int alarmOffset = attList[9].toInt(); |
185 | alarm->setStartOffset( alarmOffset * -60 ); | 187 | alarm->setStartOffset( alarmOffset * -60 ); |
188 | } else { | ||
189 | Alarm *alarm; | ||
190 | if ( event->alarms().count() > 0 ) { | ||
191 | alarm = event->alarms().first(); | ||
192 | alarm->setEnabled( false ); | ||
193 | } | ||
186 | } | 194 | } |
187 | 195 | ||
188 | mCalendar->addEvent( event); | 196 | mCalendar->addEvent( event); |
189 | } else if ( qName == "Todo" ) { | 197 | } else if ( qName == "Todo" ) { |
190 | Todo *todo; | 198 | Todo *todo; |
191 | 199 | ||
192 | todo = existingCalendar->todo( "Sharp_DTM", attList[0] ); | 200 | todo = existingCalendar->todo( "Sharp_DTM", attList[0] ); |
193 | if (todo ) | 201 | if (todo ) |
194 | todo = (Todo*)todo->clone(); | 202 | todo = (Todo*)todo->clone(); |
195 | else | 203 | else |
196 | todo = new Todo; | 204 | todo = new Todo; |
197 | 205 | ||
198 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 | 206 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 |
199 | // 0 1 2 3 4 5 6 7 8 | 207 | // 0 1 2 3 4 5 6 7 8 |
200 | //1,,,,,1,4,Loch zumachen,"" | 208 | //1,,,,,1,4,Loch zumachen,"" |
201 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " | 209 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " |
202 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes | 210 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes |
203 | 211 | ||
204 | todo->setID( "Sharp_DTM", attList[0]); | 212 | todo->setID( "Sharp_DTM", attList[0]); |
205 | todo->setCsum( "Sharp_DTM", QString::number( cSum )); | 213 | todo->setCsum( "Sharp_DTM", QString::number( cSum )); |
206 | todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 214 | todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
207 | 215 | ||
208 | todo->setSummary( attList[7] ); | 216 | todo->setSummary( attList[7] ); |
209 | todo->setDescription( attList[8]); | 217 | todo->setDescription( attList[8]); |
210 | 218 | ||
211 | int priority = attList[6].toInt(); | 219 | int priority = attList[6].toInt(); |
212 | if ( priority == 0 ) priority = 3; | 220 | if ( priority == 0 ) priority = 3; |
213 | todo->setPriority( priority ); | 221 | todo->setPriority( priority ); |
214 | 222 | ||
215 | QString categoryList = attList[1]; | 223 | QString categoryList = attList[1]; |
216 | todo->setCategories( lookupCategories( categoryList ) ); | 224 | todo->setCategories( lookupCategories( categoryList ) ); |
217 | 225 | ||
218 | 226 | ||
219 | 227 | ||
220 | QString hasDateStr = attList[3]; // due | 228 | QString hasDateStr = attList[3]; // due |
221 | if ( !hasDateStr.isEmpty() ) { | 229 | if ( !hasDateStr.isEmpty() ) { |
222 | if ( hasDateStr.right(6) == "000000" ) { | 230 | if ( hasDateStr.right(6) == "000000" ) { |
223 | todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); | 231 | todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); |
224 | todo->setFloats( true ); | 232 | todo->setFloats( true ); |
225 | } | 233 | } |
226 | else { | 234 | else { |
227 | todo->setDtDue( fromString( hasDateStr ) ); | 235 | todo->setDtDue( fromString( hasDateStr ) ); |
228 | todo->setFloats( false ); | 236 | todo->setFloats( false ); |
229 | } | 237 | } |
230 | 238 | ||
231 | todo->setHasDueDate( true ); | 239 | todo->setHasDueDate( true ); |
232 | } | 240 | } |
233 | hasDateStr = attList[2];//start | 241 | hasDateStr = attList[2];//start |