From d2be5ea1cd22f5222aecb0f70a2fe8657fae9698 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 16 Mar 2005 23:10:29 +0000 Subject: fixes --- (limited to 'libkcal') diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 223aa5a..62a31ae 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp @@ -231,7 +231,7 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) { VObject *vtodo; QString tmpStr; - QStringList tmpStrList; + vtodo = newVObject(VCTodoProp); @@ -332,7 +332,7 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) } // categories - tmpStrList = anEvent->categories(); + QStringList tmpStrList = anEvent->categories(); tmpStr = ""; QString catStr; for ( QStringList::Iterator it = tmpStrList.begin(); @@ -396,8 +396,7 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) { VObject *vevent; QString tmpStr; - QStringList tmpStrList; - + vevent = newVObject(VCEventProp); // start and end time @@ -603,7 +602,7 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) } // categories - tmpStrList = anEvent->categories(); + QStringList tmpStrList = anEvent->categories(); tmpStr = ""; QString catStr; for ( QStringList::Iterator it = tmpStrList.begin(); @@ -869,24 +868,11 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo) } // categories - QStringList tmpStrList; - int index1 = 0; - int index2 = 0; if ((vo = isAPropertyOf(vtodo, VCCategoriesProp)) != 0) { s = fakeCString(vObjectUStringZValue(vo)); QString categories = QString::fromLocal8Bit(s); deleteStr(s); - //const char* category; - QString category; - while ((index2 = categories.find(',', index1)) != -1) { - //category = (const char *) categories.mid(index1, (index2 - index1)); - category = categories.mid(index1, (index2 - index1)); - tmpStrList.append(category); - index1 = index2+1; - } - // get last category - category = categories.mid(index1, (categories.length()-index1)); - tmpStrList.append(category); + QStringList tmpStrList = QStringList::split( ';', categories ); anEvent->setCategories(tmpStrList); } @@ -1328,28 +1314,15 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) // categories QStringList tmpStrList; - int index1 = 0; - int index2 = 0; if ((vo = isAPropertyOf(vevent, VCCategoriesProp)) != 0) { s = fakeCString(vObjectUStringZValue(vo)); QString categories = QString::fromLocal8Bit(s); deleteStr(s); - //const char* category; - QString category; - while ((index2 = categories.find(',', index1)) != -1) { - //category = (const char *) categories.mid(index1, (index2 - index1)); - category = categories.mid(index1, (index2 - index1)); - tmpStrList.append(category); - index1 = index2+1; - } - // get last category - category = categories.mid(index1, (categories.length()-index1)); - tmpStrList.append(category); + tmpStrList = QStringList::split( ';', categories ); anEvent->setCategories(tmpStrList); } // attachments - tmpStrList.clear(); initPropIterator(&voi, vevent); while (moreIteration(&voi)) { vo = nextVObject(&voi); @@ -1364,18 +1337,9 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) if ((vo = isAPropertyOf(vevent, VCResourcesProp)) != 0) { QString resources = (s = fakeCString(vObjectUStringZValue(vo))); deleteStr(s); - tmpStrList.clear(); - index1 = 0; - index2 = 0; - QString resource; - while ((index2 = resources.find(';', index1)) != -1) { - resource = resources.mid(index1, (index2 - index1)); - tmpStrList.append(resource); - index1 = index2; - } + tmpStrList = QStringList::split( ';', resources ); anEvent->setResources(tmpStrList); } - /* alarm stuff */ if ((vo = isAPropertyOf(vevent, VCDAlarmProp))) { Alarm* alarm = anEvent->newAlarm(); -- cgit v0.9.0.2