-rw-r--r-- | libkcal/phoneformat.cpp | 8 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 94744fb..bc1b863 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -129,82 +129,84 @@ public: | |||
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 = "na"; |
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 { | 175 | } else { |
176 | Alarm *alarm; | 176 | Alarm *alarm; |
177 | if ( todo->alarms().count() > 0 ) { | 177 | if ( todo->alarms().count() > 0 ) { |
178 | alarm = todo->alarms().first(); | 178 | alarm = todo->alarms().first(); |
179 | alarm->setType( Alarm::Audio ); | ||
180 | alarm->setStartOffset( -60*15 ); | ||
179 | alarm->setEnabled( false ); | 181 | alarm->setEnabled( false ); |
180 | } | 182 | } |
181 | } | 183 | } |
182 | // csum ***************************************** | 184 | // csum ***************************************** |
183 | QStringList attList; | 185 | QStringList attList; |
184 | uint cSum; | 186 | uint cSum; |
185 | if ( todo->hasDueDate() ) | 187 | if ( todo->hasDueDate() ) |
186 | attList << dtToString ( todo->dtDue() ); | 188 | attList << dtToString ( todo->dtDue() ); |
187 | attList << QString::number( id ); | 189 | attList << QString::number( id ); |
188 | attList << todo->summary(); | 190 | attList << todo->summary(); |
189 | attList << completedString; | 191 | attList << completedString; |
190 | attList << QString::number( todo->priority() ); | 192 | attList << QString::number( todo->priority() ); |
191 | attList << alarmString; | 193 | attList << alarmString; |
192 | attList << todo->categoriesStr(); | 194 | attList << todo->categoriesStr(); |
193 | attList << todo->secrecyStr(); | 195 | attList << todo->secrecyStr(); |
194 | cSum = PhoneFormat::getCsum(attList ); | 196 | cSum = PhoneFormat::getCsum(attList ); |
195 | todo->setCsum( mProfileName, QString::number( cSum )); | 197 | todo->setCsum( mProfileName, QString::number( cSum )); |
196 | mCalendar->addTodo( todo); | 198 | mCalendar->addTodo( todo); |
197 | 199 | ||
198 | return true; | 200 | return true; |
199 | } | 201 | } |
200 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) | 202 | bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry*Note) |
201 | { | 203 | { |
202 | 204 | ||
203 | int id = Note->Location; | 205 | int id = Note->Location; |
204 | Event *event; | 206 | Event *event; |
205 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); | 207 | event = existingCalendar->event( mProfileName ,QString::number( id ) ); |
206 | if ( event ) | 208 | if ( event ) |
207 | event = (Event*)event->clone(); | 209 | event = (Event*)event->clone(); |
208 | else | 210 | else |
209 | event = new Event; | 211 | event = new Event; |
210 | event->setID( mProfileName,QString::number( id ) ); | 212 | event->setID( mProfileName,QString::number( id ) ); |
@@ -412,83 +414,85 @@ public: | |||
412 | } else if ( rtype == 1 ) { | 414 | } else if ( rtype == 1 ) { |
413 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 415 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
414 | else r->setWeekly( freq, weekDays, -1 ); | 416 | else r->setWeekly( freq, weekDays, -1 ); |
415 | } else if ( rtype == 3 ) { | 417 | } else if ( rtype == 3 ) { |
416 | if ( hasEndDate ) | 418 | if ( hasEndDate ) |
417 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 419 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
418 | else | 420 | else |
419 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); | 421 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); |
420 | r->addMonthlyDay( startDate.day() ); | 422 | r->addMonthlyDay( startDate.day() ); |
421 | } else if ( rtype == 2 ) { | 423 | } else if ( rtype == 2 ) { |
422 | if ( hasEndDate ) | 424 | if ( hasEndDate ) |
423 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 425 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
424 | else | 426 | else |
425 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 427 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
426 | QBitArray days( 7 ); | 428 | QBitArray days( 7 ); |
427 | days.fill( false ); | 429 | days.fill( false ); |
428 | days.setBit( dayOfWeek - 1 ); | 430 | days.setBit( dayOfWeek - 1 ); |
429 | r->addMonthlyPos( pos, days ); | 431 | r->addMonthlyPos( pos, days ); |
430 | } else if ( rtype == 4 ) { | 432 | } else if ( rtype == 4 ) { |
431 | if ( hasEndDate ) | 433 | if ( hasEndDate ) |
432 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 434 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
433 | else | 435 | else |
434 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 436 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
435 | r->addYearlyNum( startDate.month() ); | 437 | r->addYearlyNum( startDate.month() ); |
436 | } | 438 | } |
437 | } else { | 439 | } else { |
438 | event->recurrence()->unsetRecurs(); | 440 | event->recurrence()->unsetRecurs(); |
439 | } | 441 | } |
440 | 442 | ||
441 | QStringList categoryList; | 443 | QStringList categoryList; |
442 | categoryList << getCategory( Note ); | 444 | categoryList << getCategory( Note ); |
443 | event->setCategories( categoryList ); | 445 | event->setCategories( categoryList ); |
444 | QString alarmString = ""; | 446 | QString alarmString = "na"; |
445 | // strange 0 semms to mean: alarm enabled | 447 | // strange 0 semms to mean: alarm enabled |
446 | if ( alarm ) { | 448 | if ( alarm ) { |
447 | Alarm *alarm; | 449 | Alarm *alarm; |
448 | if ( event->alarms().count() > 0 ) | 450 | if ( event->alarms().count() > 0 ) |
449 | alarm = event->alarms().first(); | 451 | alarm = event->alarms().first(); |
450 | else { | 452 | else { |
451 | alarm = new Alarm( event ); | 453 | alarm = new Alarm( event ); |
452 | event->addAlarm( alarm ); | 454 | event->addAlarm( alarm ); |
453 | } | 455 | } |
454 | alarm->setType( Alarm::Audio ); | 456 | alarm->setType( Alarm::Audio ); |
455 | alarm->setEnabled( true ); | 457 | alarm->setEnabled( true ); |
456 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); | 458 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); |
457 | alarm->setStartOffset( -alarmOffset ); | 459 | alarm->setStartOffset( -alarmOffset ); |
458 | alarmString = QString::number( alarmOffset ); | 460 | alarmString = QString::number( alarmOffset ); |
459 | } else { | 461 | } else { |
460 | Alarm *alarm; | 462 | Alarm *alarm; |
461 | if ( event->alarms().count() > 0 ) { | 463 | if ( event->alarms().count() > 0 ) { |
462 | alarm = event->alarms().first(); | 464 | alarm = event->alarms().first(); |
465 | alarm->setType( Alarm::Audio ); | ||
466 | alarm->setStartOffset( -60*15 ); | ||
463 | alarm->setEnabled( false ); | 467 | alarm->setEnabled( false ); |
464 | } | 468 | } |
465 | } | 469 | } |
466 | // csum ***************************************** | 470 | // csum ***************************************** |
467 | QStringList attList; | 471 | QStringList attList; |
468 | uint cSum; | 472 | uint cSum; |
469 | attList << dtToString ( event->dtStart() ); | 473 | attList << dtToString ( event->dtStart() ); |
470 | attList << dtToString ( event->dtEnd() ); | 474 | attList << dtToString ( event->dtEnd() ); |
471 | attList << QString::number( id ); | 475 | attList << QString::number( id ); |
472 | attList << event->summary(); | 476 | attList << event->summary(); |
473 | attList << event->location(); | 477 | attList << event->location(); |
474 | attList << alarmString; | 478 | attList << alarmString; |
475 | attList << recurString; | 479 | attList << recurString; |
476 | attList << event->categoriesStr(); | 480 | attList << event->categoriesStr(); |
477 | attList << event->secrecyStr(); | 481 | attList << event->secrecyStr(); |
478 | cSum = PhoneFormat::getCsum(attList ); | 482 | cSum = PhoneFormat::getCsum(attList ); |
479 | event->setCsum( mProfileName, QString::number( cSum )); | 483 | event->setCsum( mProfileName, QString::number( cSum )); |
480 | mCalendar->addEvent( event); | 484 | mCalendar->addEvent( event); |
481 | 485 | ||
482 | return true; | 486 | return true; |
483 | } | 487 | } |
484 | 488 | ||
485 | 489 | ||
486 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { | 490 | QDateTime fromGSM ( GSM_DateTime*dtp, bool useTz = true ) { |
487 | QDateTime dt; | 491 | QDateTime dt; |
488 | int y,m,t,h,min,sec; | 492 | int y,m,t,h,min,sec; |
489 | y = dtp->Year; | 493 | y = dtp->Year; |
490 | m = dtp->Month; | 494 | m = dtp->Month; |
491 | t = dtp->Day; | 495 | t = dtp->Day; |
492 | h = dtp->Hour; | 496 | h = dtp->Hour; |
493 | min = dtp->Minute; | 497 | min = dtp->Minute; |
494 | sec = dtp->Second; | 498 | sec = dtp->Second; |
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index f8b066d..defdb09 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -160,64 +160,66 @@ class SharpParser : public QObject | |||
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 { | 168 | } else { |
169 | event->recurrence()->unsetRecurs(); | 169 | event->recurrence()->unsetRecurs(); |
170 | } | 170 | } |
171 | 171 | ||
172 | QString categoryList = attList[1] ; | 172 | QString categoryList = attList[1] ; |
173 | event->setCategories( lookupCategories( categoryList ) ); | 173 | event->setCategories( lookupCategories( categoryList ) ); |
174 | 174 | ||
175 | // strange 0 semms to mean: alarm enabled | 175 | // strange 0 semms to mean: alarm enabled |
176 | if ( attList[8] == "0" ) { | 176 | if ( attList[8] == "0" ) { |
177 | Alarm *alarm; | 177 | Alarm *alarm; |
178 | if ( event->alarms().count() > 0 ) | 178 | if ( event->alarms().count() > 0 ) |
179 | alarm = event->alarms().first(); | 179 | alarm = event->alarms().first(); |
180 | else { | 180 | else { |
181 | alarm = new Alarm( event ); | 181 | alarm = new Alarm( event ); |
182 | event->addAlarm( alarm ); | 182 | event->addAlarm( alarm ); |
183 | } | 183 | } |
184 | alarm->setType( Alarm::Audio ); | 184 | alarm->setType( Alarm::Audio ); |
185 | alarm->setEnabled( true ); | 185 | alarm->setEnabled( true ); |
186 | int alarmOffset = attList[9].toInt(); | 186 | int alarmOffset = attList[9].toInt(); |
187 | alarm->setStartOffset( alarmOffset * -60 ); | 187 | alarm->setStartOffset( alarmOffset * -60 ); |
188 | } else { | 188 | } else { |
189 | Alarm *alarm; | 189 | Alarm *alarm; |
190 | if ( event->alarms().count() > 0 ) { | 190 | if ( event->alarms().count() > 0 ) { |
191 | alarm = event->alarms().first(); | 191 | alarm = event->alarms().first(); |
192 | alarm->setType( Alarm::Audio ); | ||
193 | alarm->setStartOffset( -60*15 ); | ||
192 | alarm->setEnabled( false ); | 194 | alarm->setEnabled( false ); |
193 | } | 195 | } |
194 | } | 196 | } |
195 | 197 | ||
196 | mCalendar->addEvent( event); | 198 | mCalendar->addEvent( event); |
197 | } else if ( qName == "Todo" ) { | 199 | } else if ( qName == "Todo" ) { |
198 | Todo *todo; | 200 | Todo *todo; |
199 | 201 | ||
200 | todo = existingCalendar->todo( "Sharp_DTM", attList[0] ); | 202 | todo = existingCalendar->todo( "Sharp_DTM", attList[0] ); |
201 | if (todo ) | 203 | if (todo ) |
202 | todo = (Todo*)todo->clone(); | 204 | todo = (Todo*)todo->clone(); |
203 | else | 205 | else |
204 | todo = new Todo; | 206 | todo = new Todo; |
205 | 207 | ||
206 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 | 208 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 |
207 | // 0 1 2 3 4 5 6 7 8 | 209 | // 0 1 2 3 4 5 6 7 8 |
208 | //1,,,,,1,4,Loch zumachen,"" | 210 | //1,,,,,1,4,Loch zumachen,"" |
209 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " | 211 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " |
210 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes | 212 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes |
211 | 213 | ||
212 | todo->setID( "Sharp_DTM", attList[0]); | 214 | todo->setID( "Sharp_DTM", attList[0]); |
213 | todo->setCsum( "Sharp_DTM", QString::number( cSum )); | 215 | todo->setCsum( "Sharp_DTM", QString::number( cSum )); |
214 | todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 216 | todo->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
215 | 217 | ||
216 | todo->setSummary( attList[7] ); | 218 | todo->setSummary( attList[7] ); |
217 | todo->setDescription( attList[8]); | 219 | todo->setDescription( attList[8]); |
218 | 220 | ||
219 | int priority = attList[6].toInt(); | 221 | int priority = attList[6].toInt(); |
220 | if ( priority == 0 ) priority = 3; | 222 | if ( priority == 0 ) priority = 3; |
221 | todo->setPriority( priority ); | 223 | todo->setPriority( priority ); |
222 | 224 | ||
223 | QString categoryList = attList[1]; | 225 | QString categoryList = attList[1]; |