-rw-r--r-- | libkcal/phoneformat.cpp | 16 | ||||
-rw-r--r-- | libkcal/sharpformat.cpp | 8 |
2 files changed, 22 insertions, 2 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 7e1c9cd..94744fb 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -161,26 +161,32 @@ public: | |||
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(); |
@@ -439,26 +445,32 @@ public: | |||
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(); |
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp index 4e54fdf..f8b066d 100644 --- a/libkcal/sharpformat.cpp +++ b/libkcal/sharpformat.cpp | |||
@@ -156,42 +156,50 @@ class SharpParser : public QObject | |||
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 | ||