summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2004-10-25 15:27:39 (UTC)
committer zautrix <zautrix>2004-10-25 15:27:39 (UTC)
commit03ca6830a9e6742b8873aee04d77b3e094b65d30 (patch) (unidiff)
tree170ab278ffeb371aae783815101f64275cd30c53 /libkcal
parent62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 (diff)
downloadkdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.zip
kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.tar.gz
kdepimpi-03ca6830a9e6742b8873aee04d77b3e094b65d30.tar.bz2
fix of vcal crash
Diffstat (limited to 'libkcal') (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
@@ -268,48 +268,49 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
268 // organizer stuff 268 // organizer stuff
269 tmpStr = "MAILTO:" + anEvent->organizer(); 269 tmpStr = "MAILTO:" + anEvent->organizer();
270 addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); 270 addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit());
271 271
272 // attendees 272 // attendees
273 if (anEvent->attendeeCount() != 0) { 273 if (anEvent->attendeeCount() != 0) {
274 QPtrList<Attendee> al = anEvent->attendees(); 274 QPtrList<Attendee> al = anEvent->attendees();
275 QPtrListIterator<Attendee> ai(al); 275 QPtrListIterator<Attendee> ai(al);
276 Attendee *curAttendee; 276 Attendee *curAttendee;
277 277
278 for (; ai.current(); ++ai) { 278 for (; ai.current(); ++ai) {
279 curAttendee = ai.current(); 279 curAttendee = ai.current();
280 if (!curAttendee->email().isEmpty() && 280 if (!curAttendee->email().isEmpty() &&
281 !curAttendee->name().isEmpty()) 281 !curAttendee->name().isEmpty())
282 tmpStr = "MAILTO:" + curAttendee->name() + " <" + 282 tmpStr = "MAILTO:" + curAttendee->name() + " <" +
283 curAttendee->email() + ">"; 283 curAttendee->email() + ">";
284 else if (curAttendee->name().isEmpty()) 284 else if (curAttendee->name().isEmpty())
285 tmpStr = "MAILTO: " + curAttendee->email(); 285 tmpStr = "MAILTO: " + curAttendee->email();
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:
298 if (!anEvent->description().isEmpty()) { 299 if (!anEvent->description().isEmpty()) {
299 VObject *d = addPropValue(vtodo, VCDescriptionProp, 300 VObject *d = addPropValue(vtodo, VCDescriptionProp,
300 anEvent->description().local8Bit()); 301 anEvent->description().local8Bit());
301 if (anEvent->description().find('\n') != -1) 302 if (anEvent->description().find('\n') != -1)
302 addProp(d, VCQuotedPrintableProp); 303 addProp(d, VCQuotedPrintableProp);
303 } 304 }
304 305
305 // summary 306 // summary
306 if (!anEvent->summary().isEmpty()) 307 if (!anEvent->summary().isEmpty())
307 addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit()); 308 addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit());
308 309
309 if (!anEvent->location().isEmpty()) 310 if (!anEvent->location().isEmpty())
310 addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit()); 311 addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit());
311 312
312 // completed 313 // completed
313 // status 314 // status
314 // backward compatibility, KOrganizer used to interpret only these two values 315 // backward compatibility, KOrganizer used to interpret only these two values
315 addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" : 316 addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" :
@@ -431,49 +432,50 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent)
431 // attendee and organizer stuff 432 // attendee and organizer stuff
432 tmpStr = "MAILTO:" + anEvent->organizer(); 433 tmpStr = "MAILTO:" + anEvent->organizer();
433 addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); 434 addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit());
434 435
435 if (anEvent->attendeeCount() != 0) { 436 if (anEvent->attendeeCount() != 0) {
436 QPtrList<Attendee> al = anEvent->attendees(); 437 QPtrList<Attendee> al = anEvent->attendees();
437 QPtrListIterator<Attendee> ai(al); 438 QPtrListIterator<Attendee> ai(al);
438 Attendee *curAttendee; 439 Attendee *curAttendee;
439 440
440 // TODO: Put this functionality into Attendee class 441 // TODO: Put this functionality into Attendee class
441 for (; ai.current(); ++ai) { 442 for (; ai.current(); ++ai) {
442 curAttendee = ai.current(); 443 curAttendee = ai.current();
443 if (!curAttendee->email().isEmpty() && 444 if (!curAttendee->email().isEmpty() &&
444 !curAttendee->name().isEmpty()) 445 !curAttendee->name().isEmpty())
445 tmpStr = "MAILTO:" + curAttendee->name() + " <" + 446 tmpStr = "MAILTO:" + curAttendee->name() + " <" +
446 curAttendee->email() + ">"; 447 curAttendee->email() + ">";
447 else if (curAttendee->name().isEmpty()) 448 else if (curAttendee->name().isEmpty())
448 tmpStr = "MAILTO: " + curAttendee->email(); 449 tmpStr = "MAILTO: " + curAttendee->email();
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()) {
462 // some more variables 464 // some more variables
463 QPtrList<Recurrence::rMonthPos> tmpPositions; 465 QPtrList<Recurrence::rMonthPos> tmpPositions;
464 QPtrList<int> tmpDays; 466 QPtrList<int> tmpDays;
465 int *tmpDay; 467 int *tmpDay;
466 Recurrence::rMonthPos *tmpPos; 468 Recurrence::rMonthPos *tmpPos;
467 QString tmpStr2; 469 QString tmpStr2;
468 int i; 470 int i;
469 471
470 switch(anEvent->recurrence()->doesRecur()) { 472 switch(anEvent->recurrence()->doesRecur()) {
471 case Recurrence::rDaily: 473 case Recurrence::rDaily:
472 tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency()); 474 tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency());
473// if (anEvent->rDuration > 0) 475// if (anEvent->rDuration > 0)
474 //tmpStr += "#"; 476 //tmpStr += "#";
475 break; 477 break;
476 case Recurrence::rWeekly: 478 case Recurrence::rWeekly:
477 tmpStr.sprintf("W%i ",anEvent->recurrence()->frequency()); 479 tmpStr.sprintf("W%i ",anEvent->recurrence()->frequency());
478 for (i = 0; i < 7; i++) { 480 for (i = 0; i < 7; i++) {
479 if (anEvent->recurrence()->days().testBit(i)) 481 if (anEvent->recurrence()->days().testBit(i))
@@ -730,52 +732,54 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
730 732
731 // attendees. 733 // attendees.
732 initPropIterator(&voi, vtodo); 734 initPropIterator(&voi, vtodo);
733 while (moreIteration(&voi)) { 735 while (moreIteration(&voi)) {
734 vo = nextVObject(&voi); 736 vo = nextVObject(&voi);
735 if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { 737 if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) {
736 Attendee *a; 738 Attendee *a;
737 VObject *vp; 739 VObject *vp;
738 s = fakeCString(vObjectUStringZValue(vo)); 740 s = fakeCString(vObjectUStringZValue(vo));
739 QString tmpStr = QString::fromLocal8Bit(s); 741 QString tmpStr = QString::fromLocal8Bit(s);
740 deleteStr(s); 742 deleteStr(s);
741 tmpStr = tmpStr.simplifyWhiteSpace(); 743 tmpStr = tmpStr.simplifyWhiteSpace();
742 int emailPos1, emailPos2; 744 int emailPos1, emailPos2;
743 if ((emailPos1 = tmpStr.find('<')) > 0) { 745 if ((emailPos1 = tmpStr.find('<')) > 0) {
744 // both email address and name 746 // both email address and name
745 emailPos2 = tmpStr.findRev('>'); 747 emailPos2 = tmpStr.findRev('>');
746 a = new Attendee(tmpStr.left(emailPos1 - 1), 748 a = new Attendee(tmpStr.left(emailPos1 - 1),
747 tmpStr.mid(emailPos1 + 1, 749 tmpStr.mid(emailPos1 + 1,
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)));
764 // add the attendee 768 // add the attendee
765 anEvent->addAttendee(a); 769 anEvent->addAttendee(a);
766 } 770 }
767 } 771 }
768 772
769 // description for todo 773 // description for todo
770 if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != 0) { 774 if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) != 0) {
771 s = fakeCString(vObjectUStringZValue(vo)); 775 s = fakeCString(vObjectUStringZValue(vo));
772 anEvent->setDescription(QString::fromLocal8Bit(s)); 776 anEvent->setDescription(QString::fromLocal8Bit(s));
773 deleteStr(s); 777 deleteStr(s);
774 } 778 }
775 779
776 // summary 780 // summary
777 if ((vo = isAPropertyOf(vtodo, VCSummaryProp))) { 781 if ((vo = isAPropertyOf(vtodo, VCSummaryProp))) {
778 s = fakeCString(vObjectUStringZValue(vo)); 782 s = fakeCString(vObjectUStringZValue(vo));
779 anEvent->setSummary(QString::fromLocal8Bit(s)); 783 anEvent->setSummary(QString::fromLocal8Bit(s));
780 deleteStr(s); 784 deleteStr(s);
781 } 785 }
@@ -956,52 +960,57 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
956 960
957 // deal with attendees. 961 // deal with attendees.
958 initPropIterator(&voi, vevent); 962 initPropIterator(&voi, vevent);
959 while (moreIteration(&voi)) { 963 while (moreIteration(&voi)) {
960 vo = nextVObject(&voi); 964 vo = nextVObject(&voi);
961 if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) { 965 if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) {
962 Attendee *a; 966 Attendee *a;
963 VObject *vp; 967 VObject *vp;
964 s = fakeCString(vObjectUStringZValue(vo)); 968 s = fakeCString(vObjectUStringZValue(vo));
965 QString tmpStr = QString::fromLocal8Bit(s); 969 QString tmpStr = QString::fromLocal8Bit(s);
966 deleteStr(s); 970 deleteStr(s);
967 tmpStr = tmpStr.simplifyWhiteSpace(); 971 tmpStr = tmpStr.simplifyWhiteSpace();
968 int emailPos1, emailPos2; 972 int emailPos1, emailPos2;
969 if ((emailPos1 = tmpStr.find('<')) > 0) { 973 if ((emailPos1 = tmpStr.find('<')) > 0) {
970 // both email address and name 974 // both email address and name
971 emailPos2 = tmpStr.findRev('>'); 975 emailPos2 = tmpStr.findRev('>');
972 a = new Attendee(tmpStr.left(emailPos1 - 1), 976 a = new Attendee(tmpStr.left(emailPos1 - 1),
973 tmpStr.mid(emailPos1 + 1, 977 tmpStr.mid(emailPos1 + 1,
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)));
990 // add the attendee 999 // add the attendee
991 anEvent->addAttendee(a); 1000 anEvent->addAttendee(a);
992 } 1001 }
993 } 1002 }
994 1003
995 // This isn't strictly true. An event that doesn't have a start time 1004 // This isn't strictly true. An event that doesn't have a start time
996 // or an end time doesn't "float", it has an anchor in time but it doesn't 1005 // or an end time doesn't "float", it has an anchor in time but it doesn't
997 // "take up" any time. 1006 // "take up" any time.
998 /*if ((isAPropertyOf(vevent, VCDTstartProp) == 0) || 1007 /*if ((isAPropertyOf(vevent, VCDTstartProp) == 0) ||
999 (isAPropertyOf(vevent, VCDTendProp) == 0)) { 1008 (isAPropertyOf(vevent, VCDTendProp) == 0)) {
1000 anEvent->setFloats(TRUE); 1009 anEvent->setFloats(TRUE);
1001 } else { 1010 } else {
1002 }*/ 1011 }*/
1003 1012
1004 anEvent->setFloats(FALSE); 1013 anEvent->setFloats(FALSE);
1005 1014
1006 // start time 1015 // start time
1007 if ((vo = isAPropertyOf(vevent, VCDTstartProp)) != 0) { 1016 if ((vo = isAPropertyOf(vevent, VCDTstartProp)) != 0) {
@@ -1637,49 +1646,67 @@ void VCalFormat::populate(VObject *vcal)
1637 for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { 1646 for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) {
1638 todo->setRelatedTo(mCalendar->todo(todo->relatedToUid())); 1647 todo->setRelatedTo(mCalendar->todo(todo->relatedToUid()));
1639 } 1648 }
1640} 1649}
1641 1650
1642const char *VCalFormat::dayFromNum(int day) 1651const char *VCalFormat::dayFromNum(int day)
1643{ 1652{
1644 const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " }; 1653 const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " };
1645 1654
1646 return days[day]; 1655 return days[day];
1647} 1656}
1648 1657
1649int VCalFormat::numFromDay(const QString &day) 1658int VCalFormat::numFromDay(const QString &day)
1650{ 1659{
1651 if (day == "MO ") return 0; 1660 if (day == "MO ") return 0;
1652 if (day == "TU ") return 1; 1661 if (day == "TU ") return 1;
1653 if (day == "WE ") return 2; 1662 if (day == "WE ") return 2;
1654 if (day == "TH ") return 3; 1663 if (day == "TH ") return 3;
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
1668 if (statStr == "X-ACTION") 1695 if (statStr == "X-ACTION")
1669 status = Attendee::NeedsAction; 1696 status = Attendee::NeedsAction;
1670 else if (statStr == "NEEDS ACTION") 1697 else if (statStr == "NEEDS ACTION")
1671 status = Attendee::NeedsAction; 1698 status = Attendee::NeedsAction;
1672 else if (statStr== "ACCEPTED") 1699 else if (statStr== "ACCEPTED")
1673 status = Attendee::Accepted; 1700 status = Attendee::Accepted;
1674 else if (statStr== "SENT") 1701 else if (statStr== "SENT")
1675 status = Attendee::NeedsAction; 1702 status = Attendee::NeedsAction;
1676 else if (statStr== "TENTATIVE") 1703 else if (statStr== "TENTATIVE")
1677 status = Attendee::Tentative; 1704 status = Attendee::Tentative;
1678 else if (statStr== "CONFIRMED") 1705 else if (statStr== "CONFIRMED")
1679 status = Attendee::Accepted; 1706 status = Attendee::Accepted;
1680 else if (statStr== "DECLINED") 1707 else if (statStr== "DECLINED")
1681 status = Attendee::Declined; 1708 status = Attendee::Declined;
1682 else if (statStr== "COMPLETED") 1709 else if (statStr== "COMPLETED")
1683 status = Attendee::Completed; 1710 status = Attendee::Completed;
1684 else if (statStr== "DELEGATED") 1711 else if (statStr== "DELEGATED")
1685 status = Attendee::Delegated; 1712 status = Attendee::Delegated;
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index 5bef7ed..c7df017 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -74,39 +74,40 @@ class VCalFormat : public CalFormat {
74 /** translate a Event into a VTodo-type VObject and return pointer */ 74 /** translate a Event into a VTodo-type VObject and return pointer */
75 VObject *eventToVTodo(const Todo *anEvent); 75 VObject *eventToVTodo(const Todo *anEvent);
76 /** translate a Event into a VObject and returns a pointer to it. */ 76 /** translate a Event into a VObject and returns a pointer to it. */
77 VObject* eventToVEvent(const Event *anEvent); 77 VObject* eventToVEvent(const Event *anEvent);
78 78
79 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ 79 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */
80 QString qDateToISO(const QDate &); 80 QString qDateToISO(const QDate &);
81 /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ 81 /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */
82 QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); 82 QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE);
83 /** takes a string in the format YYYYMMDDTHHMMSS and returns a 83 /** takes a string in the format YYYYMMDDTHHMMSS and returns a
84 * valid QDateTime. */ 84 * valid QDateTime. */
85 QDateTime ISOToQDateTime(const QString & dtStr); 85 QDateTime ISOToQDateTime(const QString & dtStr);
86 /** takes a string in the format YYYYMMDD and returns a 86 /** takes a string in the format YYYYMMDD and returns a
87 * valid QDate. */ 87 * valid QDate. */
88 QDate ISOToQDate(const QString & dtStr); 88 QDate ISOToQDate(const QString & dtStr);
89 /** takes a vCalendar tree of VObjects, and puts all of them that have 89 /** takes a vCalendar tree of VObjects, and puts all of them that have
90 * the "event" property into the dictionary, todos in the todo-list, etc. */ 90 * the "event" property into the dictionary, todos in the todo-list, etc. */
91 void populate(VObject *vcal); 91 void populate(VObject *vcal);
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;
105 106
106 QPtrList<Event> mEventsRelate; // events with relations 107 QPtrList<Event> mEventsRelate; // events with relations
107 QPtrList<Todo> mTodosRelate; // todos with relations 108 QPtrList<Todo> mTodosRelate; // todos with relations
108}; 109};
109 110
110} 111}
111 112
112#endif 113#endif
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
@@ -1741,49 +1741,50 @@ static void lexAppendc(int c)
1741 if (lexBuf.strsLen > lexBuf.maxToken) { 1741 if (lexBuf.strsLen > lexBuf.maxToken) {
1742 /* double the token string size */ 1742 /* double the token string size */
1743 lexBuf.maxToken <<= 1; 1743 lexBuf.maxToken <<= 1;
1744 lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken); 1744 lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken);
1745 } 1745 }
1746 } 1746 }
1747 1747
1748static char* lexStr() { 1748static char* lexStr() {
1749 return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1); 1749 return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1);
1750 } 1750 }
1751 1751
1752static void lexSkipWhite() { 1752static void lexSkipWhite() {
1753 int c = lexLookahead(); 1753 int c = lexLookahead();
1754 while (c == ' ' || c == '\t') { 1754 while (c == ' ' || c == '\t') {
1755 lexSkipLookahead(); 1755 lexSkipLookahead();
1756 c = lexLookahead(); 1756 c = lexLookahead();
1757 } 1757 }
1758 } 1758 }
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();
1772 } 1773 }
1773 1774
1774static void lexPushLookaheadc(int c) { 1775static void lexPushLookaheadc(int c) {
1775 int putptr; 1776 int putptr;
1776 /* can't putback EOF, because it never leaves lookahead buffer */ 1777 /* can't putback EOF, because it never leaves lookahead buffer */
1777 if (c == EOF) return; 1778 if (c == EOF) return;
1778 putptr = (int)lexBuf.getPtr - 1; 1779 putptr = (int)lexBuf.getPtr - 1;
1779 if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD; 1780 if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
1780 lexBuf.getPtr = putptr; 1781 lexBuf.getPtr = putptr;
1781 lexBuf.buf[putptr] = c; 1782 lexBuf.buf[putptr] = c;
1782 lexBuf.len += 1; 1783 lexBuf.len += 1;
1783 } 1784 }
1784 1785
1785static char* lexLookaheadWord() { 1786static char* lexLookaheadWord() {
1786 /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0 1787 /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0
1787 / and thing bigger than that will stop the lookahead and return 0; 1788 / and thing bigger than that will stop the lookahead and return 0;
1788 / leading white spaces are not recoverable. 1789 / leading white spaces are not recoverable.
1789 */ 1790 */