summaryrefslogtreecommitdiffabout
path: root/libkcal/vcalformat.cpp
authorzautrix <zautrix>2005-03-16 23:10:29 (UTC)
committer zautrix <zautrix>2005-03-16 23:10:29 (UTC)
commitd2be5ea1cd22f5222aecb0f70a2fe8657fae9698 (patch) (side-by-side diff)
tree5de4c2b05428d837e2451df06b3ea313bd02c1b8 /libkcal/vcalformat.cpp
parentb7184073d5e552e0f04b14c5fc0c20a7bfd26d3d (diff)
downloadkdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.zip
kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.tar.gz
kdepimpi-d2be5ea1cd22f5222aecb0f70a2fe8657fae9698.tar.bz2
fixes
Diffstat (limited to 'libkcal/vcalformat.cpp') (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 )
}
VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
{
VObject *vtodo;
QString tmpStr;
- QStringList tmpStrList;
+
vtodo = newVObject(VCTodoProp);
// due date
if (anEvent->hasDueDate()) {
tmpStr = qDateTimeToISO(anEvent->dtDue(),
@@ -329,13 +329,13 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
if (anEvent->relatedTo()) {
addPropValue(vtodo, VCRelatedToProp,
anEvent->relatedTo()->uid().local8Bit());
}
// categories
- tmpStrList = anEvent->categories();
+ QStringList tmpStrList = anEvent->categories();
tmpStr = "";
QString catStr;
for ( QStringList::Iterator it = tmpStrList.begin();
it != tmpStrList.end();
++it ) {
catStr = *it;
@@ -393,14 +393,13 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
}
VObject* VCalFormat::eventToVEvent(const Event *anEvent)
{
VObject *vevent;
QString tmpStr;
- QStringList tmpStrList;
-
+
vevent = newVObject(VCEventProp);
// start and end time
tmpStr = qDateTimeToISO(anEvent->dtStart(),
!anEvent->doesFloat());
addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit());
@@ -600,13 +599,13 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
}
if (text) {
addPropValue(vevent, VCClassProp, text);
}
// categories
- tmpStrList = anEvent->categories();
+ QStringList tmpStrList = anEvent->categories();
tmpStr = "";
QString catStr;
for ( QStringList::Iterator it = tmpStrList.begin();
it != tmpStrList.end();
++it ) {
catStr = *it;
@@ -866,30 +865,17 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
anEvent->setRelatedToUid(s = fakeCString(vObjectUStringZValue(vo)));
deleteStr(s);
mTodosRelate.append(anEvent);
}
// 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);
}
/* PILOT SYNC STUFF */
if ((vo = isAPropertyOf(vtodo, XPilotIdProp))) {
anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo))));
@@ -1325,34 +1311,21 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
deleteStr(s);
}
anEvent->setSecrecy(secrecy);
// 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);
if (strcmp(vObjectName(vo), VCAttachProp) == 0) {
s = fakeCString(vObjectUStringZValue(vo));
anEvent->addAttachment(new Attachment(QString(s)));
@@ -1361,24 +1334,15 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
}
// resources
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();
VObject *a;
if ((a = isAPropertyOf(vo, VCRunTimeProp))) {
alarm->setTime(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(a))));