author | zautrix <zautrix> | 2005-03-16 23:10:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-16 23:10:29 (UTC) |
commit | d2be5ea1cd22f5222aecb0f70a2fe8657fae9698 (patch) (unidiff) | |
tree | 5de4c2b05428d837e2451df06b3ea313bd02c1b8 /libkcal | |
parent | b7184073d5e552e0f04b14c5fc0c20a7bfd26d3d (diff) | |
download | kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.zip kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.tar.gz kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.tar.bz2 |
fixes
-rw-r--r-- | libkcal/vcalformat.cpp | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 223aa5a..62a31ae 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -210,49 +210,49 @@ QString VCalFormat::toString( Calendar *calendar ) | |||
210 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); | 210 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); |
211 | 211 | ||
212 | // TODO: Use all data. | 212 | // TODO: Use all data. |
213 | QPtrList<Event> events = calendar->events(); | 213 | QPtrList<Event> events = calendar->events(); |
214 | Event *event = events.first(); | 214 | Event *event = events.first(); |
215 | if ( !event ) return QString::null; | 215 | if ( !event ) return QString::null; |
216 | 216 | ||
217 | VObject *vevent = eventToVEvent( event ); | 217 | VObject *vevent = eventToVEvent( event ); |
218 | 218 | ||
219 | addVObjectProp( vcal, vevent ); | 219 | addVObjectProp( vcal, vevent ); |
220 | 220 | ||
221 | char *buf = writeMemVObject( 0, 0, vcal ); | 221 | char *buf = writeMemVObject( 0, 0, vcal ); |
222 | 222 | ||
223 | QString result( buf ); | 223 | QString result( buf ); |
224 | 224 | ||
225 | cleanVObject( vcal ); | 225 | cleanVObject( vcal ); |
226 | 226 | ||
227 | return result; | 227 | return result; |
228 | } | 228 | } |
229 | 229 | ||
230 | VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | 230 | VObject *VCalFormat::eventToVTodo(const Todo *anEvent) |
231 | { | 231 | { |
232 | VObject *vtodo; | 232 | VObject *vtodo; |
233 | QString tmpStr; | 233 | QString tmpStr; |
234 | QStringList tmpStrList; | 234 | |
235 | 235 | ||
236 | vtodo = newVObject(VCTodoProp); | 236 | vtodo = newVObject(VCTodoProp); |
237 | 237 | ||
238 | // due date | 238 | // due date |
239 | if (anEvent->hasDueDate()) { | 239 | if (anEvent->hasDueDate()) { |
240 | tmpStr = qDateTimeToISO(anEvent->dtDue(), | 240 | tmpStr = qDateTimeToISO(anEvent->dtDue(), |
241 | !anEvent->doesFloat()); | 241 | !anEvent->doesFloat()); |
242 | addPropValue(vtodo, VCDueProp, tmpStr.local8Bit()); | 242 | addPropValue(vtodo, VCDueProp, tmpStr.local8Bit()); |
243 | } | 243 | } |
244 | 244 | ||
245 | // start date | 245 | // start date |
246 | if (anEvent->hasStartDate()) { | 246 | if (anEvent->hasStartDate()) { |
247 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 247 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
248 | !anEvent->doesFloat()); | 248 | !anEvent->doesFloat()); |
249 | addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit()); | 249 | addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit()); |
250 | } | 250 | } |
251 | 251 | ||
252 | // creation date | 252 | // creation date |
253 | tmpStr = qDateTimeToISO(anEvent->created()); | 253 | tmpStr = qDateTimeToISO(anEvent->created()); |
254 | addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit()); | 254 | addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit()); |
255 | 255 | ||
256 | // unique id | 256 | // unique id |
257 | addPropValue(vtodo, VCUniqueStringProp, | 257 | addPropValue(vtodo, VCUniqueStringProp, |
258 | anEvent->uid().local8Bit()); | 258 | anEvent->uid().local8Bit()); |
@@ -311,49 +311,49 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
311 | addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); | 311 | addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); |
312 | 312 | ||
313 | // completed | 313 | // completed |
314 | // status | 314 | // status |
315 | // backward compatibility, KOrganizer used to interpret only these two values | 315 | // backward compatibility, KOrganizer used to interpret only these two values |
316 | addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : | 316 | addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : |
317 | "NEEDS_ACTION"); | 317 | "NEEDS_ACTION"); |
318 | // completion date | 318 | // completion date |
319 | if (anEvent->hasCompletedDate()) { | 319 | if (anEvent->hasCompletedDate()) { |
320 | tmpStr = qDateTimeToISO(anEvent->completed()); | 320 | tmpStr = qDateTimeToISO(anEvent->completed()); |
321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); | 321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); |
322 | } | 322 | } |
323 | 323 | ||
324 | // priority | 324 | // priority |
325 | tmpStr.sprintf("%i",anEvent->priority()); | 325 | tmpStr.sprintf("%i",anEvent->priority()); |
326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); | 326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); |
327 | 327 | ||
328 | // related event | 328 | // related event |
329 | if (anEvent->relatedTo()) { | 329 | if (anEvent->relatedTo()) { |
330 | addPropValue(vtodo, VCRelatedToProp, | 330 | addPropValue(vtodo, VCRelatedToProp, |
331 | anEvent->relatedTo()->uid().local8Bit()); | 331 | anEvent->relatedTo()->uid().local8Bit()); |
332 | } | 332 | } |
333 | 333 | ||
334 | // categories | 334 | // categories |
335 | tmpStrList = anEvent->categories(); | 335 | QStringList tmpStrList = anEvent->categories(); |
336 | tmpStr = ""; | 336 | tmpStr = ""; |
337 | QString catStr; | 337 | QString catStr; |
338 | for ( QStringList::Iterator it = tmpStrList.begin(); | 338 | for ( QStringList::Iterator it = tmpStrList.begin(); |
339 | it != tmpStrList.end(); | 339 | it != tmpStrList.end(); |
340 | ++it ) { | 340 | ++it ) { |
341 | catStr = *it; | 341 | catStr = *it; |
342 | if (catStr[0] == ' ') | 342 | if (catStr[0] == ' ') |
343 | tmpStr += catStr.mid(1); | 343 | tmpStr += catStr.mid(1); |
344 | else | 344 | else |
345 | tmpStr += catStr; | 345 | tmpStr += catStr; |
346 | // this must be a ';' character as the vCalendar specification requires! | 346 | // this must be a ';' character as the vCalendar specification requires! |
347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
348 | // read in. | 348 | // read in. |
349 | tmpStr += ";"; | 349 | tmpStr += ";"; |
350 | } | 350 | } |
351 | if (!tmpStr.isEmpty()) { | 351 | if (!tmpStr.isEmpty()) { |
352 | tmpStr.truncate(tmpStr.length()-1); | 352 | tmpStr.truncate(tmpStr.length()-1); |
353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); | 353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); |
354 | } | 354 | } |
355 | 355 | ||
356 | // alarm stuff | 356 | // alarm stuff |
357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; | 357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; |
358 | QPtrList<Alarm> alarms = anEvent->alarms(); | 358 | QPtrList<Alarm> alarms = anEvent->alarms(); |
359 | Alarm* alarm; | 359 | Alarm* alarm; |
@@ -375,50 +375,49 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
375 | } else { | 375 | } else { |
376 | a = addProp(vtodo, VCDAlarmProp); | 376 | a = addProp(vtodo, VCDAlarmProp); |
377 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 377 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
378 | addPropValue(a, VCRepeatCountProp, "1"); | 378 | addPropValue(a, VCRepeatCountProp, "1"); |
379 | addPropValue(a, VCDisplayStringProp, "beep!"); | 379 | addPropValue(a, VCDisplayStringProp, "beep!"); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | if (anEvent->pilotId()) { | 384 | if (anEvent->pilotId()) { |
385 | // pilot sync stuff | 385 | // pilot sync stuff |
386 | tmpStr.sprintf("%i",anEvent->pilotId()); | 386 | tmpStr.sprintf("%i",anEvent->pilotId()); |
387 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); | 387 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); |
388 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 388 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); | 389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); |
390 | } | 390 | } |
391 | 391 | ||
392 | return vtodo; | 392 | return vtodo; |
393 | } | 393 | } |
394 | 394 | ||
395 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) | 395 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) |
396 | { | 396 | { |
397 | VObject *vevent; | 397 | VObject *vevent; |
398 | QString tmpStr; | 398 | QString tmpStr; |
399 | QStringList tmpStrList; | 399 | |
400 | |||
401 | vevent = newVObject(VCEventProp); | 400 | vevent = newVObject(VCEventProp); |
402 | 401 | ||
403 | // start and end time | 402 | // start and end time |
404 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 403 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
405 | !anEvent->doesFloat()); | 404 | !anEvent->doesFloat()); |
406 | addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit()); | 405 | addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit()); |
407 | 406 | ||
408 | // events that have time associated but take up no time should | 407 | // events that have time associated but take up no time should |
409 | // not have both DTSTART and DTEND. | 408 | // not have both DTSTART and DTEND. |
410 | if (anEvent->dtStart() != anEvent->dtEnd()) { | 409 | if (anEvent->dtStart() != anEvent->dtEnd()) { |
411 | tmpStr = qDateTimeToISO(anEvent->dtEnd(), | 410 | tmpStr = qDateTimeToISO(anEvent->dtEnd(), |
412 | !anEvent->doesFloat()); | 411 | !anEvent->doesFloat()); |
413 | addPropValue(vevent, VCDTendProp, tmpStr.local8Bit()); | 412 | addPropValue(vevent, VCDTendProp, tmpStr.local8Bit()); |
414 | } | 413 | } |
415 | 414 | ||
416 | // creation date | 415 | // creation date |
417 | tmpStr = qDateTimeToISO(anEvent->created()); | 416 | tmpStr = qDateTimeToISO(anEvent->created()); |
418 | addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit()); | 417 | addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit()); |
419 | 418 | ||
420 | // unique id | 419 | // unique id |
421 | addPropValue(vevent, VCUniqueStringProp, | 420 | addPropValue(vevent, VCUniqueStringProp, |
422 | anEvent->uid().local8Bit()); | 421 | anEvent->uid().local8Bit()); |
423 | 422 | ||
424 | // revision | 423 | // revision |
@@ -582,49 +581,49 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
582 | addPropValue(vevent, VCLocationProp, anEvent->location().local8Bit()); | 581 | addPropValue(vevent, VCLocationProp, anEvent->location().local8Bit()); |
583 | 582 | ||
584 | // status | 583 | // status |
585 | // TODO: define Event status | 584 | // TODO: define Event status |
586 | // addPropValue(vevent, VCStatusProp, anEvent->statusStr().local8Bit()); | 585 | // addPropValue(vevent, VCStatusProp, anEvent->statusStr().local8Bit()); |
587 | 586 | ||
588 | // secrecy | 587 | // secrecy |
589 | const char *text = 0; | 588 | const char *text = 0; |
590 | switch (anEvent->secrecy()) { | 589 | switch (anEvent->secrecy()) { |
591 | case Incidence::SecrecyPublic: | 590 | case Incidence::SecrecyPublic: |
592 | text = "PUBLIC"; | 591 | text = "PUBLIC"; |
593 | break; | 592 | break; |
594 | case Incidence::SecrecyPrivate: | 593 | case Incidence::SecrecyPrivate: |
595 | text = "PRIVATE"; | 594 | text = "PRIVATE"; |
596 | break; | 595 | break; |
597 | case Incidence::SecrecyConfidential: | 596 | case Incidence::SecrecyConfidential: |
598 | text = "CONFIDENTIAL"; | 597 | text = "CONFIDENTIAL"; |
599 | break; | 598 | break; |
600 | } | 599 | } |
601 | if (text) { | 600 | if (text) { |
602 | addPropValue(vevent, VCClassProp, text); | 601 | addPropValue(vevent, VCClassProp, text); |
603 | } | 602 | } |
604 | 603 | ||
605 | // categories | 604 | // categories |
606 | tmpStrList = anEvent->categories(); | 605 | QStringList tmpStrList = anEvent->categories(); |
607 | tmpStr = ""; | 606 | tmpStr = ""; |
608 | QString catStr; | 607 | QString catStr; |
609 | for ( QStringList::Iterator it = tmpStrList.begin(); | 608 | for ( QStringList::Iterator it = tmpStrList.begin(); |
610 | it != tmpStrList.end(); | 609 | it != tmpStrList.end(); |
611 | ++it ) { | 610 | ++it ) { |
612 | catStr = *it; | 611 | catStr = *it; |
613 | if (catStr[0] == ' ') | 612 | if (catStr[0] == ' ') |
614 | tmpStr += catStr.mid(1); | 613 | tmpStr += catStr.mid(1); |
615 | else | 614 | else |
616 | tmpStr += catStr; | 615 | tmpStr += catStr; |
617 | // this must be a ';' character as the vCalendar specification requires! | 616 | // this must be a ';' character as the vCalendar specification requires! |
618 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 617 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
619 | // read in. | 618 | // read in. |
620 | tmpStr += ";"; | 619 | tmpStr += ";"; |
621 | } | 620 | } |
622 | if (!tmpStr.isEmpty()) { | 621 | if (!tmpStr.isEmpty()) { |
623 | tmpStr.truncate(tmpStr.length()-1); | 622 | tmpStr.truncate(tmpStr.length()-1); |
624 | addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit()); | 623 | addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit()); |
625 | } | 624 | } |
626 | 625 | ||
627 | // attachments | 626 | // attachments |
628 | // TODO: handle binary attachments! | 627 | // TODO: handle binary attachments! |
629 | QPtrList<Attachment> attachments = anEvent->attachments(); | 628 | QPtrList<Attachment> attachments = anEvent->attachments(); |
630 | for ( Attachment *at = attachments.first(); at; at = attachments.next() ) | 629 | for ( Attachment *at = attachments.first(); at; at = attachments.next() ) |
@@ -848,66 +847,53 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo) | |||
848 | if ((vo = isAPropertyOf(vtodo, VCPAlarmProp))) { | 847 | if ((vo = isAPropertyOf(vtodo, VCPAlarmProp))) { |
849 | if ((a = isAPropertyOf(vo, VCProcedureNameProp))) { | 848 | if ((a = isAPropertyOf(vo, VCProcedureNameProp))) { |
850 | s = fakeCString(vObjectUStringZValue(a)); | 849 | s = fakeCString(vObjectUStringZValue(a)); |
851 | alarm->setProcedureAlarm(QFile::decodeName(s)); | 850 | alarm->setProcedureAlarm(QFile::decodeName(s)); |
852 | deleteStr(s); | 851 | deleteStr(s); |
853 | } | 852 | } |
854 | } | 853 | } |
855 | if ((vo = isAPropertyOf(vtodo, VCAAlarmProp))) { | 854 | if ((vo = isAPropertyOf(vtodo, VCAAlarmProp))) { |
856 | if ((a = isAPropertyOf(vo, VCAudioContentProp))) { | 855 | if ((a = isAPropertyOf(vo, VCAudioContentProp))) { |
857 | s = fakeCString(vObjectUStringZValue(a)); | 856 | s = fakeCString(vObjectUStringZValue(a)); |
858 | alarm->setAudioAlarm(QFile::decodeName(s)); | 857 | alarm->setAudioAlarm(QFile::decodeName(s)); |
859 | deleteStr(s); | 858 | deleteStr(s); |
860 | } | 859 | } |
861 | } | 860 | } |
862 | } | 861 | } |
863 | 862 | ||
864 | // related todo | 863 | // related todo |
865 | if ((vo = isAPropertyOf(vtodo, VCRelatedToProp)) != 0) { | 864 | if ((vo = isAPropertyOf(vtodo, VCRelatedToProp)) != 0) { |
866 | anEvent->setRelatedToUid(s = fakeCString(vObjectUStringZValue(vo))); | 865 | anEvent->setRelatedToUid(s = fakeCString(vObjectUStringZValue(vo))); |
867 | deleteStr(s); | 866 | deleteStr(s); |
868 | mTodosRelate.append(anEvent); | 867 | mTodosRelate.append(anEvent); |
869 | } | 868 | } |
870 | 869 | ||
871 | // categories | 870 | // categories |
872 | QStringList tmpStrList; | ||
873 | int index1 = 0; | ||
874 | int index2 = 0; | ||
875 | if ((vo = isAPropertyOf(vtodo, VCCategoriesProp)) != 0) { | 871 | if ((vo = isAPropertyOf(vtodo, VCCategoriesProp)) != 0) { |
876 | s = fakeCString(vObjectUStringZValue(vo)); | 872 | s = fakeCString(vObjectUStringZValue(vo)); |
877 | QString categories = QString::fromLocal8Bit(s); | 873 | QString categories = QString::fromLocal8Bit(s); |
878 | deleteStr(s); | 874 | deleteStr(s); |
879 | //const char* category; | 875 | QStringList tmpStrList = QStringList::split( ';', categories ); |
880 | QString category; | ||
881 | while ((index2 = categories.find(',', index1)) != -1) { | ||
882 | //category = (const char *) categories.mid(index1, (index2 - index1)); | ||
883 | category = categories.mid(index1, (index2 - index1)); | ||
884 | tmpStrList.append(category); | ||
885 | index1 = index2+1; | ||
886 | } | ||
887 | // get last category | ||
888 | category = categories.mid(index1, (categories.length()-index1)); | ||
889 | tmpStrList.append(category); | ||
890 | anEvent->setCategories(tmpStrList); | 876 | anEvent->setCategories(tmpStrList); |
891 | } | 877 | } |
892 | 878 | ||
893 | /* PILOT SYNC STUFF */ | 879 | /* PILOT SYNC STUFF */ |
894 | if ((vo = isAPropertyOf(vtodo, XPilotIdProp))) { | 880 | if ((vo = isAPropertyOf(vtodo, XPilotIdProp))) { |
895 | anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo)))); | 881 | anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo)))); |
896 | deleteStr(s); | 882 | deleteStr(s); |
897 | } | 883 | } |
898 | else | 884 | else |
899 | anEvent->setPilotId(0); | 885 | anEvent->setPilotId(0); |
900 | 886 | ||
901 | if ((vo = isAPropertyOf(vtodo, XPilotStatusProp))) { | 887 | if ((vo = isAPropertyOf(vtodo, XPilotStatusProp))) { |
902 | anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo)))); | 888 | anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo)))); |
903 | deleteStr(s); | 889 | deleteStr(s); |
904 | } | 890 | } |
905 | else | 891 | else |
906 | anEvent->setSyncStatus(Event::SYNCMOD); | 892 | anEvent->setSyncStatus(Event::SYNCMOD); |
907 | 893 | ||
908 | return anEvent; | 894 | return anEvent; |
909 | } | 895 | } |
910 | 896 | ||
911 | Event* VCalFormat::VEventToEvent(VObject *vevent) | 897 | Event* VCalFormat::VEventToEvent(VObject *vevent) |
912 | { | 898 | { |
913 | VObject *vo; | 899 | VObject *vo; |
@@ -1307,96 +1293,74 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) | |||
1307 | QString tmpStr(s = fakeCString(vObjectUStringZValue(vo))); | 1293 | QString tmpStr(s = fakeCString(vObjectUStringZValue(vo))); |
1308 | deleteStr(s); | 1294 | deleteStr(s); |
1309 | // TODO: Define Event status | 1295 | // TODO: Define Event status |
1310 | // anEvent->setStatus(tmpStr); | 1296 | // anEvent->setStatus(tmpStr); |
1311 | } | 1297 | } |
1312 | else | 1298 | else |
1313 | // anEvent->setStatus("NEEDS ACTION"); | 1299 | // anEvent->setStatus("NEEDS ACTION"); |
1314 | #endif | 1300 | #endif |
1315 | 1301 | ||
1316 | // secrecy | 1302 | // secrecy |
1317 | int secrecy = Incidence::SecrecyPublic; | 1303 | int secrecy = Incidence::SecrecyPublic; |
1318 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { | 1304 | if ((vo = isAPropertyOf(vevent, VCClassProp)) != 0) { |
1319 | s = fakeCString(vObjectUStringZValue(vo)); | 1305 | s = fakeCString(vObjectUStringZValue(vo)); |
1320 | if (strcmp(s,"PRIVATE") == 0) { | 1306 | if (strcmp(s,"PRIVATE") == 0) { |
1321 | secrecy = Incidence::SecrecyPrivate; | 1307 | secrecy = Incidence::SecrecyPrivate; |
1322 | } else if (strcmp(s,"CONFIDENTIAL") == 0) { | 1308 | } else if (strcmp(s,"CONFIDENTIAL") == 0) { |
1323 | secrecy = Incidence::SecrecyConfidential; | 1309 | secrecy = Incidence::SecrecyConfidential; |
1324 | } | 1310 | } |
1325 | deleteStr(s); | 1311 | deleteStr(s); |
1326 | } | 1312 | } |
1327 | anEvent->setSecrecy(secrecy); | 1313 | anEvent->setSecrecy(secrecy); |
1328 | 1314 | ||
1329 | // categories | 1315 | // categories |
1330 | QStringList tmpStrList; | 1316 | QStringList tmpStrList; |
1331 | int index1 = 0; | ||
1332 | int index2 = 0; | ||
1333 | if ((vo = isAPropertyOf(vevent, VCCategoriesProp)) != 0) { | 1317 | if ((vo = isAPropertyOf(vevent, VCCategoriesProp)) != 0) { |
1334 | s = fakeCString(vObjectUStringZValue(vo)); | 1318 | s = fakeCString(vObjectUStringZValue(vo)); |
1335 | QString categories = QString::fromLocal8Bit(s); | 1319 | QString categories = QString::fromLocal8Bit(s); |
1336 | deleteStr(s); | 1320 | deleteStr(s); |
1337 | //const char* category; | 1321 | tmpStrList = QStringList::split( ';', categories ); |
1338 | QString category; | ||
1339 | while ((index2 = categories.find(',', index1)) != -1) { | ||
1340 | //category = (const char *) categories.mid(index1, (index2 - index1)); | ||
1341 | category = categories.mid(index1, (index2 - index1)); | ||
1342 | tmpStrList.append(category); | ||
1343 | index1 = index2+1; | ||
1344 | } | ||
1345 | // get last category | ||
1346 | category = categories.mid(index1, (categories.length()-index1)); | ||
1347 | tmpStrList.append(category); | ||
1348 | anEvent->setCategories(tmpStrList); | 1322 | anEvent->setCategories(tmpStrList); |
1349 | } | 1323 | } |
1350 | 1324 | ||
1351 | // attachments | 1325 | // attachments |
1352 | tmpStrList.clear(); | ||
1353 | initPropIterator(&voi, vevent); | 1326 | initPropIterator(&voi, vevent); |
1354 | while (moreIteration(&voi)) { | 1327 | while (moreIteration(&voi)) { |
1355 | vo = nextVObject(&voi); | 1328 | vo = nextVObject(&voi); |
1356 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { | 1329 | if (strcmp(vObjectName(vo), VCAttachProp) == 0) { |
1357 | s = fakeCString(vObjectUStringZValue(vo)); | 1330 | s = fakeCString(vObjectUStringZValue(vo)); |
1358 | anEvent->addAttachment(new Attachment(QString(s))); | 1331 | anEvent->addAttachment(new Attachment(QString(s))); |
1359 | deleteStr(s); | 1332 | deleteStr(s); |
1360 | } | 1333 | } |
1361 | } | 1334 | } |
1362 | 1335 | ||
1363 | // resources | 1336 | // resources |
1364 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { | 1337 | if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { |
1365 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); | 1338 | QString resources = (s = fakeCString(vObjectUStringZValue(vo))); |
1366 | deleteStr(s); | 1339 | deleteStr(s); |
1367 | tmpStrList.clear(); | 1340 | tmpStrList = QStringList::split( ';', resources ); |
1368 | index1 = 0; | ||
1369 | index2 = 0; | ||
1370 | QString resource; | ||
1371 | while ((index2 = resources.find(';', index1)) != -1) { | ||
1372 | resource = resources.mid(index1, (index2 - index1)); | ||
1373 | tmpStrList.append(resource); | ||
1374 | index1 = index2; | ||
1375 | } | ||
1376 | anEvent->setResources(tmpStrList); | 1341 | anEvent->setResources(tmpStrList); |
1377 | } | 1342 | } |
1378 | |||
1379 | /* alarm stuff */ | 1343 | /* alarm stuff */ |
1380 | if ((vo = isAPropertyOf(vevent, VCDAlarmProp))) { | 1344 | if ((vo = isAPropertyOf(vevent, VCDAlarmProp))) { |
1381 | Alarm* alarm = anEvent->newAlarm(); | 1345 | Alarm* alarm = anEvent->newAlarm(); |
1382 | VObject *a; | 1346 | VObject *a; |
1383 | if ((a = isAPropertyOf(vo, VCRunTimeProp))) { | 1347 | if ((a = isAPropertyOf(vo, VCRunTimeProp))) { |
1384 | alarm->setTime(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(a)))); | 1348 | alarm->setTime(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(a)))); |
1385 | deleteStr(s); | 1349 | deleteStr(s); |
1386 | } | 1350 | } |
1387 | alarm->setEnabled(true); | 1351 | alarm->setEnabled(true); |
1388 | if ((vo = isAPropertyOf(vevent, VCPAlarmProp))) { | 1352 | if ((vo = isAPropertyOf(vevent, VCPAlarmProp))) { |
1389 | if ((a = isAPropertyOf(vo, VCProcedureNameProp))) { | 1353 | if ((a = isAPropertyOf(vo, VCProcedureNameProp))) { |
1390 | s = fakeCString(vObjectUStringZValue(a)); | 1354 | s = fakeCString(vObjectUStringZValue(a)); |
1391 | alarm->setProcedureAlarm(QFile::decodeName(s)); | 1355 | alarm->setProcedureAlarm(QFile::decodeName(s)); |
1392 | deleteStr(s); | 1356 | deleteStr(s); |
1393 | } | 1357 | } |
1394 | } | 1358 | } |
1395 | if ((vo = isAPropertyOf(vevent, VCAAlarmProp))) { | 1359 | if ((vo = isAPropertyOf(vevent, VCAAlarmProp))) { |
1396 | if ((a = isAPropertyOf(vo, VCAudioContentProp))) { | 1360 | if ((a = isAPropertyOf(vo, VCAudioContentProp))) { |
1397 | s = fakeCString(vObjectUStringZValue(a)); | 1361 | s = fakeCString(vObjectUStringZValue(a)); |
1398 | alarm->setAudioAlarm(QFile::decodeName(s)); | 1362 | alarm->setAudioAlarm(QFile::decodeName(s)); |
1399 | deleteStr(s); | 1363 | deleteStr(s); |
1400 | } | 1364 | } |
1401 | } | 1365 | } |
1402 | } | 1366 | } |