Changeset View
Changeset View
Standalone View
Standalone View
src/vcalformat.cpp
Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Line(s) | 219 | } else { | |||
---|---|---|---|---|---|
222 | } | 222 | } | ||
223 | } | 223 | } | ||
224 | 224 | | |||
225 | // attendees. | 225 | // attendees. | ||
226 | initPropIterator(&voi, vtodo); | 226 | initPropIterator(&voi, vtodo); | ||
227 | while (moreIteration(&voi)) { | 227 | while (moreIteration(&voi)) { | ||
228 | vo = nextVObject(&voi); | 228 | vo = nextVObject(&voi); | ||
229 | if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { | 229 | if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { | ||
230 | Attendee::Ptr a; | 230 | Attendee a; | ||
231 | VObject *vp; | 231 | VObject *vp; | ||
232 | s = fakeCString(vObjectUStringZValue(vo)); | 232 | s = fakeCString(vObjectUStringZValue(vo)); | ||
233 | QString tmpStr = QString::fromUtf8(s); | 233 | QString tmpStr = QString::fromUtf8(s); | ||
234 | deleteStr(s); | 234 | deleteStr(s); | ||
235 | tmpStr = tmpStr.simplified(); | 235 | tmpStr = tmpStr.simplified(); | ||
236 | int emailPos1; | 236 | int emailPos1; | ||
237 | if ((emailPos1 = tmpStr.indexOf(QLatin1Char('<'))) > 0) { | 237 | if ((emailPos1 = tmpStr.indexOf(QLatin1Char('<'))) > 0) { | ||
238 | // both email address and name | 238 | // both email address and name | ||
239 | int emailPos2 = tmpStr.lastIndexOf(QLatin1Char('>')); | 239 | int emailPos2 = tmpStr.lastIndexOf(QLatin1Char('>')); | ||
240 | a = Attendee::Ptr(new Attendee(tmpStr.left(emailPos1 - 1), | 240 | a = Attendee(tmpStr.left(emailPos1 - 1), tmpStr.mid(emailPos1 + 1, emailPos2 - (emailPos1 + 1))); | ||
241 | tmpStr.mid(emailPos1 + 1, | | |||
242 | emailPos2 - (emailPos1 + 1)))); | | |||
243 | } else if (tmpStr.indexOf(QLatin1Char('@')) > 0) { | 241 | } else if (tmpStr.indexOf(QLatin1Char('@')) > 0) { | ||
244 | // just an email address | 242 | // just an email address | ||
245 | a = Attendee::Ptr(new Attendee(QString(), tmpStr)); | 243 | a = Attendee(QString(), tmpStr); | ||
246 | } else { | 244 | } else { | ||
247 | // just a name | 245 | // just a name | ||
248 | // WTF??? Replacing the spaces of a name and using this as email? | 246 | // WTF??? Replacing the spaces of a name and using this as email? | ||
249 | QString email = tmpStr.replace(QLatin1Char(' '), QLatin1Char('.')); | 247 | QString email = tmpStr.replace(QLatin1Char(' '), QLatin1Char('.')); | ||
250 | a = Attendee::Ptr(new Attendee(tmpStr, email)); | 248 | a = Attendee(tmpStr, email); | ||
251 | } | 249 | } | ||
252 | 250 | | |||
253 | // is there an RSVP property? | 251 | // is there an RSVP property? | ||
254 | if ((vp = isAPropertyOf(vo, VCRSVPProp)) != nullptr) { | 252 | if ((vp = isAPropertyOf(vo, VCRSVPProp)) != nullptr) { | ||
255 | a->setRSVP(vObjectStringZValue(vp)); | 253 | a.setRSVP(vObjectStringZValue(vp)); | ||
256 | } | 254 | } | ||
257 | // is there a status property? | 255 | // is there a status property? | ||
258 | if ((vp = isAPropertyOf(vo, VCStatusProp)) != nullptr) { | 256 | if ((vp = isAPropertyOf(vo, VCStatusProp)) != nullptr) { | ||
259 | a->setStatus(readStatus(vObjectStringZValue(vp))); | 257 | a.setStatus(readStatus(vObjectStringZValue(vp))); | ||
260 | } | 258 | } | ||
261 | // add the attendee | 259 | // add the attendee | ||
262 | anEvent->addAttendee(a); | 260 | anEvent->addAttendee(a); | ||
263 | } | 261 | } | ||
264 | } | 262 | } | ||
265 | 263 | | |||
266 | // description for todo | 264 | // description for todo | ||
267 | if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != nullptr) { | 265 | if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != nullptr) { | ||
▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Line(s) | 694 | } else { | |||
699 | } | 697 | } | ||
700 | } | 698 | } | ||
701 | 699 | | |||
702 | // deal with attendees. | 700 | // deal with attendees. | ||
703 | initPropIterator(&voi, vevent); | 701 | initPropIterator(&voi, vevent); | ||
704 | while (moreIteration(&voi)) { | 702 | while (moreIteration(&voi)) { | ||
705 | vo = nextVObject(&voi); | 703 | vo = nextVObject(&voi); | ||
706 | if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { | 704 | if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { | ||
707 | Attendee::Ptr a; | 705 | Attendee a; | ||
708 | VObject *vp = nullptr; | 706 | VObject *vp = nullptr; | ||
709 | s = fakeCString(vObjectUStringZValue(vo)); | 707 | s = fakeCString(vObjectUStringZValue(vo)); | ||
710 | QString tmpStr = QString::fromUtf8(s); | 708 | QString tmpStr = QString::fromUtf8(s); | ||
711 | deleteStr(s); | 709 | deleteStr(s); | ||
712 | tmpStr = tmpStr.simplified(); | 710 | tmpStr = tmpStr.simplified(); | ||
713 | int emailPos1; | 711 | int emailPos1; | ||
714 | if ((emailPos1 = tmpStr.indexOf(QLatin1Char('<'))) > 0) { | 712 | if ((emailPos1 = tmpStr.indexOf(QLatin1Char('<'))) > 0) { | ||
715 | // both email address and name | 713 | // both email address and name | ||
716 | int emailPos2 = tmpStr.lastIndexOf(QLatin1Char('>')); | 714 | int emailPos2 = tmpStr.lastIndexOf(QLatin1Char('>')); | ||
717 | a = Attendee::Ptr(new Attendee(tmpStr.left(emailPos1 - 1), | 715 | a = Attendee(tmpStr.left(emailPos1 - 1), tmpStr.mid(emailPos1 + 1, emailPos2 - (emailPos1 + 1))); | ||
718 | tmpStr.mid(emailPos1 + 1, | | |||
719 | emailPos2 - (emailPos1 + 1)))); | | |||
720 | } else if (tmpStr.indexOf(QLatin1Char('@')) > 0) { | 716 | } else if (tmpStr.indexOf(QLatin1Char('@')) > 0) { | ||
721 | // just an email address | 717 | // just an email address | ||
722 | a = Attendee::Ptr(new Attendee(QString(), tmpStr)); | 718 | a = Attendee(QString(), tmpStr); | ||
723 | } else { | 719 | } else { | ||
724 | // just a name | 720 | // just a name | ||
725 | QString email = tmpStr.replace(QLatin1Char(' '), QLatin1Char('.')); | 721 | QString email = tmpStr.replace(QLatin1Char(' '), QLatin1Char('.')); | ||
726 | a = Attendee::Ptr(new Attendee(tmpStr, email)); | 722 | a = Attendee(tmpStr, email); | ||
727 | } | 723 | } | ||
728 | 724 | | |||
729 | // is there an RSVP property? | 725 | // is there an RSVP property? | ||
730 | if ((vp = isAPropertyOf(vo, VCRSVPProp)) != nullptr) { | 726 | if ((vp = isAPropertyOf(vo, VCRSVPProp)) != nullptr) { | ||
731 | a->setRSVP(vObjectStringZValue(vp)); | 727 | a.setRSVP(vObjectStringZValue(vp)); | ||
732 | } | 728 | } | ||
733 | // is there a status property? | 729 | // is there a status property? | ||
734 | if ((vp = isAPropertyOf(vo, VCStatusProp)) != nullptr) { | 730 | if ((vp = isAPropertyOf(vo, VCStatusProp)) != nullptr) { | ||
735 | a->setStatus(readStatus(vObjectStringZValue(vp))); | 731 | a.setStatus(readStatus(vObjectStringZValue(vp))); | ||
736 | } | 732 | } | ||
737 | // add the attendee | 733 | // add the attendee | ||
738 | anEvent->addAttendee(a); | 734 | anEvent->addAttendee(a); | ||
739 | } | 735 | } | ||
740 | } | 736 | } | ||
741 | 737 | | |||
742 | // This isn't strictly true. An event that doesn't have a start time | 738 | // This isn't strictly true. An event that doesn't have a start time | ||
743 | // or an end time isn't all-day, it has an anchor in time but it doesn't | 739 | // or an end time isn't all-day, it has an anchor in time but it doesn't | ||
▲ Show 20 Lines • Show All 989 Lines • Show Last 20 Lines |