summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-03-16 23:10:29 (UTC)
committer zautrix <zautrix>2005-03-16 23:10:29 (UTC)
commitd2be5ea1cd22f5222aecb0f70a2fe8657fae9698 (patch) (unidiff)
tree5de4c2b05428d837e2451df06b3ea313bd02c1b8 /libkcal
parentb7184073d5e552e0f04b14c5fc0c20a7bfd26d3d (diff)
downloadkdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.zip
kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.tar.gz
kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.tar.bz2
fixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/vcalformat.cpp50
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
@@ -228,13 +228,13 @@ QString VCalFormat::toString( Calendar *calendar )
228} 228}
229 229
230VObject *VCalFormat::eventToVTodo(const Todo *anEvent) 230VObject *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(),
@@ -329,13 +329,13 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
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;
@@ -393,14 +393,13 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
393} 393}
394 394
395VObject* VCalFormat::eventToVEvent(const Event *anEvent) 395VObject* 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());
@@ -600,13 +599,13 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
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;
@@ -866,30 +865,17 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
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))));
@@ -1325,34 +1311,21 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
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)));
@@ -1361,24 +1334,15 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
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))));