summaryrefslogtreecommitdiffabout
path: root/libkcal/vcalformat.cpp
authorzautrix <zautrix>2004-10-25 15:27:39 (UTC)
committer zautrix <zautrix>2004-10-25 15:27:39 (UTC)
commit03ca6830a9e6742b8873aee04d77b3e094b65d30 (patch) (side-by-side diff)
tree170ab278ffeb371aae783815101f64275cd30c53 /libkcal/vcalformat.cpp
parent62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 (diff)
downloadkdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.zip
kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.tar.gz
kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.tar.bz2
fix of vcal crash
Diffstat (limited to 'libkcal/vcalformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/vcalformat.cpp39
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
@@ -289,6 +289,7 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
curAttendee->email().isEmpty())
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()));
}
@@ -452,7 +453,8 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
curAttendee->email().isEmpty())
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()));
}
}
@@ -751,10 +753,12 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
a = new Attendee(0, tmpStr);
} 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)
a->setRSVP(vObjectStringZValue(vp));
@@ -977,10 +981,15 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
a = new Attendee(0, tmpStr);
} 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)
a->setRSVP(vObjectStringZValue(vp));
@@ -1658,7 +1667,25 @@ 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
{
QString statStr = s;