summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/vcalformat.cpp39
-rw-r--r--libkcal/vcalformat.h3
-rw-r--r--libkcal/versit/vcc.c3
3 files changed, 37 insertions, 8 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index df93209..223aa5a 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -286,12 +286,13 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
286 else if (curAttendee->email().isEmpty()) 286 else if (curAttendee->email().isEmpty())
287 tmpStr = "MAILTO: " + curAttendee->name(); 287 tmpStr = "MAILTO: " + curAttendee->name();
288 else if (curAttendee->name().isEmpty() && 288 else if (curAttendee->name().isEmpty() &&
289 curAttendee->email().isEmpty()) 289 curAttendee->email().isEmpty())
290 kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; 290 kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl;
291 VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit()); 291 VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit());
292 addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role()));
292 addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); 293 addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");
293 addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); 294 addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status()));
294 } 295 }
295 } 296 }
296 297
297 // description BL: 298 // description BL:
@@ -449,13 +450,14 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
449 else if (curAttendee->email().isEmpty()) 450 else if (curAttendee->email().isEmpty())
450 tmpStr = "MAILTO: " + curAttendee->name(); 451 tmpStr = "MAILTO: " + curAttendee->name();
451 else if (curAttendee->name().isEmpty() && 452 else if (curAttendee->name().isEmpty() &&
452 curAttendee->email().isEmpty()) 453 curAttendee->email().isEmpty())
453 kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; 454 kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl;
454 VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); 455 VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit());
455 addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");; 456 addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role()));
457 addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");
456 addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); 458 addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status()));
457 } 459 }
458 } 460 }
459 461
460 // recurrence rule stuff 462 // recurrence rule stuff
461 if (anEvent->recurrence()->doesRecur()) { 463 if (anEvent->recurrence()->doesRecur()) {
@@ -748,16 +750,18 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
748 emailPos2 - (emailPos1 + 1))); 750 emailPos2 - (emailPos1 + 1)));
749 } else if (tmpStr.find('@') > 0) { 751 } else if (tmpStr.find('@') > 0) {
750 // just an email address 752 // just an email address
751 a = new Attendee(0, tmpStr); 753 a = new Attendee(0, tmpStr);
752 } else { 754 } else {
753 // just a name 755 // just a name
754 QString email = tmpStr.replace( QRegExp(" "), "." ); 756 // QString email = tmpStr.replace( QRegExp(" "), "." );
755 a = new Attendee(tmpStr,email); 757 a = new Attendee(tmpStr,0);
756 } 758 }
757 759 // is there a Role property?
760 if ((vp = isAPropertyOf(vo, VCRoleProp)) != 0)
761 a->setRole(readRole(vObjectStringZValue(vp)));
758 // is there an RSVP property? 762 // is there an RSVP property?
759 if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0) 763 if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0)
760 a->setRSVP(vObjectStringZValue(vp)); 764 a->setRSVP(vObjectStringZValue(vp));
761 // is there a status property? 765 // is there a status property?
762 if ((vp = isAPropertyOf(vo, VCStatusProp)) != 0) 766 if ((vp = isAPropertyOf(vo, VCStatusProp)) != 0)
763 a->setStatus(readStatus(vObjectStringZValue(vp))); 767 a->setStatus(readStatus(vObjectStringZValue(vp)));
@@ -974,16 +978,21 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
974 emailPos2 - (emailPos1 + 1))); 978 emailPos2 - (emailPos1 + 1)));
975 } else if (tmpStr.find('@') > 0) { 979 } else if (tmpStr.find('@') > 0) {
976 // just an email address 980 // just an email address
977 a = new Attendee(0, tmpStr); 981 a = new Attendee(0, tmpStr);
978 } else { 982 } else {
979 // just a name 983 // just a name
980 QString email = tmpStr.replace( QRegExp(" "), "." ); 984 //QString email = tmpStr.replace( QRegExp(" "), "." );
981 a = new Attendee(tmpStr,email); 985 a = new Attendee(tmpStr,0);
982 } 986 }
983 987
988
989 // is there a Role property?
990 if ((vp = isAPropertyOf(vo, VCRoleProp)) != 0)
991 a->setRole(readRole(vObjectStringZValue(vp)));
992
984 // is there an RSVP property? 993 // is there an RSVP property?
985 if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0) 994 if ((vp = isAPropertyOf(vo, VCRSVPProp)) != 0)
986 a->setRSVP(vObjectStringZValue(vp)); 995 a->setRSVP(vObjectStringZValue(vp));
987 // is there a status property? 996 // is there a status property?
988 if ((vp = isAPropertyOf(vo, VCStatusProp)) != 0) 997 if ((vp = isAPropertyOf(vo, VCStatusProp)) != 0)
989 a->setStatus(readStatus(vObjectStringZValue(vp))); 998 a->setStatus(readStatus(vObjectStringZValue(vp)));
@@ -1655,13 +1664,31 @@ int VCalFormat::numFromDay(const QString &day)
1655 if (day == "FR ") return 4; 1664 if (day == "FR ") return 4;
1656 if (day == "SA ") return 5; 1665 if (day == "SA ") return 5;
1657 if (day == "SU ") return 6; 1666 if (day == "SU ") return 6;
1658 1667
1659 return -1; // something bad happened. :) 1668 return -1; // something bad happened. :)
1660} 1669}
1670Attendee::Role VCalFormat::readRole(const char *s) const
1671{
1672 QString statStr = s;
1673 statStr = statStr.upper();
1674 Attendee::Role role = Attendee::ReqParticipant;
1675
1676 if ( statStr == "OWNER")
1677 role = Attendee::Chair;
1678 // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair };
1679
1680 return role;
1681}
1661 1682
1683QCString VCalFormat::writeRole(Attendee::Role role) const
1684{
1685 if ( role == Attendee::Chair )
1686 return "OWNER";
1687 return "ATTENDEE";
1688}
1662Attendee::PartStat VCalFormat::readStatus(const char *s) const 1689Attendee::PartStat VCalFormat::readStatus(const char *s) const
1663{ 1690{
1664 QString statStr = s; 1691 QString statStr = s;
1665 statStr = statStr.upper(); 1692 statStr = statStr.upper();
1666 Attendee::PartStat status; 1693 Attendee::PartStat status;
1667 1694
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index 5bef7ed..c7df017 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -92,13 +92,14 @@ class VCalFormat : public CalFormat {
92 92
93 /** takes a number 0 - 6 and returns the two letter string of that day, 93 /** takes a number 0 - 6 and returns the two letter string of that day,
94 * i.e. MO, TU, WE, etc. */ 94 * i.e. MO, TU, WE, etc. */
95 const char *dayFromNum(int day); 95 const char *dayFromNum(int day);
96 /** the reverse of the above function. */ 96 /** the reverse of the above function. */
97 int numFromDay(const QString &day); 97 int numFromDay(const QString &day);
98 98 Attendee::Role VCalFormat::readRole(const char *s) const;
99 QCString writeRole(Attendee::Role role) const;
99 Attendee::PartStat readStatus(const char *s) const; 100 Attendee::PartStat readStatus(const char *s) const;
100 QCString writeStatus(Attendee::PartStat status) const; 101 QCString writeStatus(Attendee::PartStat status) const;
101 102
102 private: 103 private:
103 Calendar *mCalendar; 104 Calendar *mCalendar;
104 bool useLocalTime; 105 bool useLocalTime;
diff --git a/libkcal/versit/vcc.c b/libkcal/versit/vcc.c
index 9be752d..5413813 100644
--- a/libkcal/versit/vcc.c
+++ b/libkcal/versit/vcc.c
@@ -1759,13 +1759,14 @@ static void lexSkipWhite() {
1759 1759
1760static char* lexGetWord() { 1760static char* lexGetWord() {
1761 int c; 1761 int c;
1762 lexSkipWhite(); 1762 lexSkipWhite();
1763 lexClearToken(); 1763 lexClearToken();
1764 c = lexLookahead(); 1764 c = lexLookahead();
1765 while (c != EOF && !strchr("\t\n ;:=",c)) { 1765 // LR while (c != EOF && !strchr("\t\n ;:=",c)) {
1766 while (c != EOF && !strchr("\t\n;:=",c)) {
1766 lexAppendc(c); 1767 lexAppendc(c);
1767 lexSkipLookahead(); 1768 lexSkipLookahead();
1768 c = lexLookahead(); 1769 c = lexLookahead();
1769 } 1770 }
1770 lexAppendc(0); 1771 lexAppendc(0);
1771 return lexStr(); 1772 return lexStr();