-rw-r--r-- | libkcal/vcalformat.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index df93209..223aa5a 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp @@ -290,4 +290,5 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit()); + addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); @@ -453,5 +454,6 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); - addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");; + addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); + addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); } @@ -752,8 +754,10 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo) } else { // just a name - QString email = tmpStr.replace( QRegExp(" "), "." ); - a = new Attendee(tmpStr,email); + // QString email = tmpStr.replace( QRegExp(" "), "." ); + a = new Attendee(tmpStr,0); } - + // is there a Role property? + if ((vp = isAPropertyOf(vo, VCRoleProp)) != 0) + a->setRole(readRole(vObjectStringZValue(vp))); // is there an RSVP property? if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0) @@ -978,8 +982,13 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) } else { // just a name - QString email = tmpStr.replace( QRegExp(" "), "." ); - a = new Attendee(tmpStr,email); + //QString email = tmpStr.replace( QRegExp(" "), "." ); + a = new Attendee(tmpStr,0); } + + // is there a Role property? + if ((vp = isAPropertyOf(vo, VCRoleProp)) != 0) + a->setRole(readRole(vObjectStringZValue(vp))); + // is there an RSVP property? if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0) @@ -1659,5 +1668,23 @@ int VCalFormat::numFromDay(const QString &day) return -1; // something bad happened. :) } +Attendee::Role VCalFormat::readRole(const char *s) const +{ + QString statStr = s; + statStr = statStr.upper(); + Attendee::Role role = Attendee::ReqParticipant; + + if ( statStr == "OWNER") + role = Attendee::Chair; + // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; + + return role; +} +QCString VCalFormat::writeRole(Attendee::Role role) const +{ + if ( role == Attendee::Chair ) + return "OWNER"; + return "ATTENDEE"; +} Attendee::PartStat VCalFormat::readStatus(const char *s) const { |