23 #include <tqdatetime.h>
25 #include <tqptrlist.h>
30 #include <tdelocale.h>
34 #include <libical/ical.h>
35 #include <libical/icalparser.h>
36 #include <libical/icalrestriction.h>
41 #include "icalformat.h"
42 #include "icalformatimpl.h"
47 #define _ICAL_VERSION "2.0"
52 static TQDateTime ICalDate2TQDate(
const icaltimetype& t)
56 const int year = (t.year>=1754) ? t.year : 1754;
57 return TQDateTime(TQDate(year,t.month,t.day), TQTime(t.hour,t.minute,t.second));
72 static TQString quoteForParam(
const TQString &text )
76 if ( tmp.contains(
';' ) || tmp.contains(
':' ) || tmp.contains(
',' ) )
78 return TQString::fromLatin1(
"\"" ) + tmp + TQString::fromLatin1(
"\"" );
81 const int gSecondsPerMinute = 60;
82 const int gSecondsPerHour = gSecondsPerMinute * 60;
83 const int gSecondsPerDay = gSecondsPerHour * 24;
84 const int gSecondsPerWeek = gSecondsPerDay * 7;
86 ICalFormatImpl::ICalFormatImpl(
ICalFormat *parent ) :
87 mParent( parent ), mCompat( new
Compat )
91 ICalFormatImpl::~ICalFormatImpl()
99 ToComponentVisitor( ICalFormatImpl *impl,
Scheduler::Method m ) : mImpl( impl ), mComponent( 0 ), mMethod( m ) {}
101 bool visit(
Event *e ) { mComponent = mImpl->writeEvent( e );
return true; }
102 bool visit(
Todo *e ) { mComponent = mImpl->writeTodo( e );
return true; }
103 bool visit(
Journal *e ) { mComponent = mImpl->writeJournal( e );
return true; }
104 bool visit(
FreeBusy *fb ) { mComponent = mImpl->writeFreeBusy( fb, mMethod );
return true; }
106 icalcomponent *component() {
return mComponent; }
109 ICalFormatImpl *mImpl;
110 icalcomponent *mComponent;
116 ToComponentVisitor v(
this, method );
117 if ( incidence->
accept(v) )
118 return v.component();
122 icalcomponent *ICalFormatImpl::writeTodo(
Todo *todo)
125 TQStringList tmpStrList;
127 icalcomponent *vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT);
129 writeIncidence(vtodo,todo);
135 due = writeICalDate(todo->
dtDue(
true).date());
137 due = writeICalDateTime(todo->
dtDue(
true));
139 icalcomponent_add_property(vtodo,icalproperty_new_due(due));
147 start = writeICalDate(todo->
dtStart(
true).date());
150 start = writeICalDateTime(todo->
dtStart(
true));
152 icalcomponent_add_property(vtodo,icalproperty_new_dtstart(start));
162 icaltimetype completed = writeICalDateTime(todo->
completed());
163 icalcomponent_add_property(vtodo,icalproperty_new_completed(completed));
166 icalcomponent_add_property(vtodo,
170 icalcomponent_add_property(vtodo,
171 icalproperty_new_recurrenceid( writeICalDateTime( todo->
dtDue())));
177 icalcomponent *ICalFormatImpl::writeEvent(
Event *event)
180 kdDebug(5800) <<
"Write Event '" <<
event->summary() <<
"' (" <<
event->uid()
185 TQStringList tmpStrList;
187 icalcomponent *vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT);
189 writeIncidence(vevent,event);
195 start = writeICalDate(event->
dtStart().date());
198 start = writeICalDateTime(event->
dtStart());
200 icalcomponent_add_property(vevent,icalproperty_new_dtstart(start));
209 end = writeICalDate( event->
dtEnd().date().addDays( 1 ) );
210 icalcomponent_add_property(vevent,icalproperty_new_dtend(end));
214 end = writeICalDateTime(event->
dtEnd());
215 icalcomponent_add_property(vevent,icalproperty_new_dtend(end));
223 tmpStrList = anEvent->resources();
224 tmpStr = tmpStrList.join(
";");
225 if (!tmpStr.isEmpty())
226 addPropValue(vevent, VCResourcesProp, tmpStr.utf8());
232 case Event::Transparent:
233 icalcomponent_add_property(
235 icalproperty_new_transp( ICAL_TRANSP_TRANSPARENT ) );
238 icalcomponent_add_property(
240 icalproperty_new_transp( ICAL_TRANSP_OPAQUE ) );
247 icalcomponent *ICalFormatImpl::writeFreeBusy(
FreeBusy *freebusy,
250 kdDebug(5800) <<
"icalformatimpl: writeFreeBusy: startDate: "
251 << freebusy->
dtStart().toString(
"ddd MMMM d yyyy: h:m:s ap") <<
" End Date: "
252 << freebusy->dtEnd().toString(
"ddd MMMM d yyyy: h:m:s ap") << endl;
254 icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT);
256 writeIncidenceBase(vfreebusy,freebusy);
258 icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart(
259 writeICalDateTime(freebusy->
dtStart())));
261 icalcomponent_add_property(vfreebusy, icalproperty_new_dtend(
262 writeICalDateTime(freebusy->dtEnd())));
264 if (method == Scheduler::Request) {
265 icalcomponent_add_property(vfreebusy,icalproperty_new_uid(
266 freebusy->
uid().utf8()));
270 TQValueList<Period> list = freebusy->busyPeriods();
271 TQValueList<Period>::Iterator it;
272 icalperiodtype period = icalperiodtype_null_period();
273 for (it = list.begin(); it!= list.end(); ++it) {
274 period.start = writeICalDateTime((*it).start());
275 if ( (*it).hasDuration() ) {
276 period.duration = writeICalDuration( (*it).duration().asSeconds() );
278 period.end = writeICalDateTime((*it).end());
280 icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) );
286 icalcomponent *ICalFormatImpl::writeJournal(
Journal *journal)
288 icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT);
290 writeIncidence(vjournal,journal);
293 if (journal->
dtStart().isValid()) {
297 start = writeICalDate(journal->
dtStart().date());
300 start = writeICalDateTime(journal->
dtStart());
302 icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start));
308 void ICalFormatImpl::writeIncidence(icalcomponent *parent,
Incidence *incidence)
319 p = icalproperty_new_x(TQString::number(incidence->
syncStatus()).utf8());
320 icalproperty_set_x_name(p,
"X-PILOTSTAT");
321 icalcomponent_add_property(parent,p);
323 p = icalproperty_new_x(TQString::number(incidence->
pilotId()).utf8());
324 icalproperty_set_x_name(p,
"X-PILOTID");
325 icalcomponent_add_property(parent,p);
328 TQString modifiedUid;
334 IncidenceListIterator it;
339 modifiedUid = incidence->
uid();
349 writeIncidenceBase(parent,incidence);
352 icalcomponent_add_property(parent,icalproperty_new_created(
353 writeICalDateTime(incidence->
created())));
360 icalcomponent_add_property(parent,icalproperty_new_uid(modifiedUid.utf8()));
364 icalcomponent_add_property(parent,icalproperty_new_uid(
371 icalcomponent_add_property(parent,icalproperty_new_sequence(
377 icalcomponent_add_property(parent,icalproperty_new_lastmodified(
383 icalcomponent_add_property(parent,icalproperty_new_description(
388 if (!incidence->
summary().isEmpty()) {
389 icalcomponent_add_property(parent,icalproperty_new_summary(
394 if (!incidence->
location().isEmpty()) {
395 icalcomponent_add_property(parent,icalproperty_new_location(
400 icalproperty_status status = ICAL_STATUS_NONE;
401 switch (incidence->
status()) {
402 case Incidence::StatusTentative: status = ICAL_STATUS_TENTATIVE;
break;
403 case Incidence::StatusConfirmed: status = ICAL_STATUS_CONFIRMED;
break;
404 case Incidence::StatusCompleted: status = ICAL_STATUS_COMPLETED;
break;
405 case Incidence::StatusNeedsAction: status = ICAL_STATUS_NEEDSACTION;
break;
406 case Incidence::StatusCanceled: status = ICAL_STATUS_CANCELLED;
break;
407 case Incidence::StatusInProcess: status = ICAL_STATUS_INPROCESS;
break;
408 case Incidence::StatusDraft: status = ICAL_STATUS_DRAFT;
break;
409 case Incidence::StatusFinal: status = ICAL_STATUS_FINAL;
break;
410 case Incidence::StatusX: {
411 icalproperty* p = icalproperty_new_status(ICAL_STATUS_X);
412 icalvalue_set_x(icalproperty_get_value(p), incidence->
statusStr().utf8());
413 icalcomponent_add_property(parent, p);
416 case Incidence::StatusNone:
420 if (status != ICAL_STATUS_NONE)
421 icalcomponent_add_property(parent, icalproperty_new_status(status));
424 icalproperty_class secClass;
425 switch (incidence->
secrecy()) {
426 case Incidence::SecrecyPublic:
427 secClass = ICAL_CLASS_PUBLIC;
429 case Incidence::SecrecyConfidential:
430 secClass = ICAL_CLASS_CONFIDENTIAL;
432 case Incidence::SecrecyPrivate:
434 secClass = ICAL_CLASS_PRIVATE;
437 if ( secClass != ICAL_CLASS_PUBLIC ) {
438 icalcomponent_add_property(parent,icalproperty_new_class(secClass));
443 icalcomponent_add_property(parent,icalproperty_new_priority(
448 TQStringList categories = incidence->
categories();
449 TQStringList::Iterator it;
450 for(it = categories.begin(); it != categories.end(); ++it ) {
451 icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8()));
456 icalcomponent_add_property(parent,icalproperty_new_relatedto(
462 icalcomponent_add_property(parent, icalproperty_new_recurrenceid( writeICalDateTime( incidence->
recurrenceID() ) ));
469 RecurrenceRule::List::ConstIterator rit;
470 for ( rit = rrules.begin(); rit != rrules.end(); ++rit ) {
471 icalcomponent_add_property( parent, icalproperty_new_rrule(
472 writeRecurrenceRule( (*rit) ) ) );
476 RecurrenceRule::List::ConstIterator exit;
477 for ( exit = exrules.begin(); exit != exrules.end(); ++exit ) {
478 icalcomponent_add_property( parent, icalproperty_new_rrule(
479 writeRecurrenceRule( (*exit) ) ) );
482 DateList dateList = incidence->
recurrence()->exDates();
483 DateList::ConstIterator exIt;
484 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
485 icalcomponent_add_property(parent,icalproperty_new_exdate(
486 writeICalDate(*exIt)));
488 DateTimeList dateTimeList = incidence->
recurrence()->exDateTimes();
489 DateTimeList::ConstIterator extIt;
490 for(extIt = dateTimeList.begin(); extIt != dateTimeList.end(); ++extIt) {
491 icalcomponent_add_property(parent,icalproperty_new_exdate(
492 writeICalDateTime(*extIt)));
497 DateList::ConstIterator rdIt;
498 for( rdIt = dateList.begin(); rdIt != dateList.end(); ++rdIt) {
499 icalcomponent_add_property( parent, icalproperty_new_rdate(
500 writeICalDatePeriod(*rdIt) ) );
502 dateTimeList = incidence->
recurrence()->rDateTimes();
503 DateTimeList::ConstIterator rdtIt;
504 for( rdtIt = dateTimeList.begin(); rdtIt != dateTimeList.end(); ++rdtIt) {
505 icalcomponent_add_property( parent, icalproperty_new_rdate(
506 writeICalDateTimePeriod(*rdtIt) ) );
511 Attachment::List::ConstIterator atIt;
512 for ( atIt = attachments.begin(); atIt != attachments.end(); ++atIt ) {
513 icalcomponent_add_property( parent, writeAttachment( *atIt ) );
517 Alarm::List::ConstIterator alarmIt;
518 for ( alarmIt = incidence->
alarms().begin();
519 alarmIt != incidence->
alarms().end(); ++alarmIt ) {
520 if ( (*alarmIt)->enabled() ) {
522 icalcomponent_add_component( parent, writeAlarm( *alarmIt ) );
527 if (incidence->hasDuration()) {
528 icaldurationtype duration;
529 duration = writeICalDuration( incidence->duration() );
530 icalcomponent_add_property(parent,icalproperty_new_duration(duration));
534 void ICalFormatImpl::writeIncidenceBase( icalcomponent *parent,
537 icalcomponent_add_property( parent, icalproperty_new_dtstamp(
538 writeICalDateTime( TQDateTime::currentDateTime() ) ) );
541 if ( !incidenceBase->organizer().isEmpty() ) {
542 icalcomponent_add_property( parent, writeOrganizer( incidenceBase->organizer() ) );
547 Attendee::List::ConstIterator it;
548 for( it = incidenceBase->
attendees().begin();
549 it != incidenceBase->
attendees().end(); ++it ) {
550 icalcomponent_add_property( parent, writeAttendee( *it ) );
555 TQStringList comments = incidenceBase->
comments();
556 for (TQStringList::Iterator it=comments.begin(); it!=comments.end(); ++it) {
557 icalcomponent_add_property(parent, icalproperty_new_comment((*it).utf8()));
561 writeCustomProperties( parent, incidenceBase );
564 void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,
CustomProperties *properties)
567 for (TQMap<TQCString, TQString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
568 icalproperty *p = icalproperty_new_x(c.data().utf8());
569 icalproperty_set_x_name(p,c.key());
570 icalcomponent_add_property(parent,p);
574 icalproperty *ICalFormatImpl::writeOrganizer(
const Person &organizer )
576 icalproperty *p = icalproperty_new_organizer(
"MAILTO:" + organizer.email().utf8());
578 if (!organizer.name().isEmpty()) {
579 icalproperty_add_parameter( p, icalparameter_new_cn(quoteForParam(organizer.name()).utf8()) );
587 icalproperty *ICalFormatImpl::writeAttendee(
Attendee *attendee)
589 icalproperty *p = icalproperty_new_attendee(
"mailto:" + attendee->email().utf8());
591 if (!attendee->name().isEmpty()) {
592 icalproperty_add_parameter(p,icalparameter_new_cn(quoteForParam(attendee->name()).utf8()));
596 icalproperty_add_parameter(p,icalparameter_new_rsvp(
597 attendee->
RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE ));
599 icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION;
600 switch (attendee->
status()) {
602 case Attendee::NeedsAction:
603 status = ICAL_PARTSTAT_NEEDSACTION;
605 case Attendee::Accepted:
606 status = ICAL_PARTSTAT_ACCEPTED;
608 case Attendee::Declined:
609 status = ICAL_PARTSTAT_DECLINED;
611 case Attendee::Tentative:
612 status = ICAL_PARTSTAT_TENTATIVE;
614 case Attendee::Delegated:
615 status = ICAL_PARTSTAT_DELEGATED;
617 case Attendee::Completed:
618 status = ICAL_PARTSTAT_COMPLETED;
620 case Attendee::InProcess:
621 status = ICAL_PARTSTAT_INPROCESS;
624 icalproperty_add_parameter(p,icalparameter_new_partstat(status));
626 icalparameter_role role = ICAL_ROLE_REQPARTICIPANT;
627 switch (attendee->
role()) {
628 case Attendee::Chair:
629 role = ICAL_ROLE_CHAIR;
632 case Attendee::ReqParticipant:
633 role = ICAL_ROLE_REQPARTICIPANT;
635 case Attendee::OptParticipant:
636 role = ICAL_ROLE_OPTPARTICIPANT;
638 case Attendee::NonParticipant:
639 role = ICAL_ROLE_NONPARTICIPANT;
642 icalproperty_add_parameter(p,icalparameter_new_role(role));
644 if (!attendee->
uid().isEmpty()) {
645 icalparameter* icalparameter_uid = icalparameter_new_x(attendee->
uid().utf8());
646 icalparameter_set_xname(icalparameter_uid,
"X-UID");
647 icalproperty_add_parameter(p,icalparameter_uid);
650 if ( !attendee->
delegate().isEmpty() ) {
651 icalparameter* icalparameter_delegate = icalparameter_new_delegatedto( attendee->
delegate().utf8() );
652 icalproperty_add_parameter( p, icalparameter_delegate );
655 if ( !attendee->
delegator().isEmpty() ) {
656 icalparameter* icalparameter_delegator = icalparameter_new_delegatedfrom( attendee->
delegator().utf8() );
657 icalproperty_add_parameter( p, icalparameter_delegator );
663 icalproperty *ICalFormatImpl::writeAttachment(
Attachment *att )
666 if ( att->isUri() ) {
667 attach = icalattach_new_from_url( att->uri().utf8().data() );
669 #ifdef USE_LIBICAL_0_46
670 attach = icalattach_new_from_data ( (
const char *)att->data(), 0, 0 );
672 attach = icalattach_new_from_data ( (
unsigned char *)att->data(), 0, 0 );
675 icalproperty *p = icalproperty_new_attach( attach );
677 if ( !att->mimeType().isEmpty() ) {
678 icalproperty_add_parameter( p,
679 icalparameter_new_fmttype( att->mimeType().utf8().data() ) );
682 if ( att->isBinary() ) {
683 icalproperty_add_parameter( p,
684 icalparameter_new_value( ICAL_VALUE_BINARY ) );
685 icalproperty_add_parameter( p,
686 icalparameter_new_encoding( ICAL_ENCODING_BASE64 ) );
689 if ( att->showInline() ) {
690 icalparameter* icalparameter_inline = icalparameter_new_x(
"inline" );
691 icalparameter_set_xname( icalparameter_inline,
"X-CONTENT-DISPOSITION" );
692 icalproperty_add_parameter( p, icalparameter_inline );
695 if ( !att->label().isEmpty() ) {
696 icalparameter* icalparameter_label = icalparameter_new_x( att->label().utf8() );
697 icalparameter_set_xname( icalparameter_label,
"X-LABEL" );
698 icalproperty_add_parameter( p, icalparameter_label );
704 icalrecurrencetype ICalFormatImpl::writeRecurrenceRule(
RecurrenceRule *recur )
708 icalrecurrencetype r;
709 icalrecurrencetype_clear(&r);
711 switch( recur->recurrenceType() ) {
712 case RecurrenceRule::rSecondly:
713 r.freq = ICAL_SECONDLY_RECURRENCE;
715 case RecurrenceRule::rMinutely:
716 r.freq = ICAL_MINUTELY_RECURRENCE;
718 case RecurrenceRule::rHourly:
719 r.freq = ICAL_HOURLY_RECURRENCE;
721 case RecurrenceRule::rDaily:
722 r.freq = ICAL_DAILY_RECURRENCE;
724 case RecurrenceRule::rWeekly:
725 r.freq = ICAL_WEEKLY_RECURRENCE;
727 case RecurrenceRule::rMonthly:
728 r.freq = ICAL_MONTHLY_RECURRENCE;
730 case RecurrenceRule::rYearly:
731 r.freq = ICAL_YEARLY_RECURRENCE;
734 r.freq = ICAL_NO_RECURRENCE;
735 kdDebug(5800) <<
"ICalFormatImpl::writeRecurrence(): no recurrence" << endl;
740 TQValueList<int> bys;
741 TQValueList<int>::ConstIterator it;
744 bys = recur->bySeconds();
746 for ( it = bys.begin(); it != bys.end(); ++it ) {
747 r.by_second[index++] = *it;
750 bys = recur->byMinutes();
752 for ( it = bys.begin(); it != bys.end(); ++it ) {
753 r.by_minute[index++] = *it;
756 bys = recur->byHours();
758 for ( it = bys.begin(); it != bys.end(); ++it ) {
759 r.by_hour[index++] = *it;
762 bys = recur->byMonthDays();
764 for ( it = bys.begin(); it != bys.end(); ++it ) {
765 r.by_month_day[index++] = icalrecurrencetype_day_position( (*it) * 8 );
768 bys = recur->byYearDays();
770 for ( it = bys.begin(); it != bys.end(); ++it ) {
771 r.by_year_day[index++] = *it;
774 bys = recur->byWeekNumbers();
776 for ( it = bys.begin(); it != bys.end(); ++it ) {
777 r.by_week_no[index++] = *it;
780 bys = recur->byMonths();
782 for ( it = bys.begin(); it != bys.end(); ++it ) {
783 r.by_month[index++] = *it;
786 bys = recur->bySetPos();
788 for ( it = bys.begin(); it != bys.end(); ++it ) {
789 r.by_set_pos[index++] = *it;
793 TQValueList<RecurrenceRule::WDayPos> byd = recur->byDays();
796 for ( TQValueList<RecurrenceRule::WDayPos>::ConstIterator dit = byd.begin();
797 dit != byd.end(); ++dit ) {
798 day = (*dit).day() % 7 + 1;
799 if ( (*dit).pos() < 0 ) {
800 day += (-(*dit).pos())*8;
803 day += (*dit).pos()*8;
805 r.by_day[index++] = day;
808 r.week_start =
static_cast<icalrecurrencetype_weekday
>(
809 recur->weekStart()%7 + 1);
818 }
else if ( recur->
duration() == -1 ) {
822 r.until = writeICalDate(recur->
endDt().date());
824 r.until = writeICalDateTime(recur->
endDt());
829 const char *str = icalrecurrencetype_as_string(&r);
831 kdDebug(5800) <<
" String: " << str << endl;
833 kdDebug(5800) <<
" No String" << endl;
841 icalcomponent *ICalFormatImpl::writeAlarm(
Alarm *alarm)
844 icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT);
846 icalproperty_action action;
847 icalattach *attach = 0;
849 switch (alarm->
type()) {
850 case Alarm::Procedure:
851 action = ICAL_ACTION_PROCEDURE;
852 attach = icalattach_new_from_url(TQFile::encodeName(alarm->
programFile()).data());
853 icalcomponent_add_property(a,icalproperty_new_attach(attach));
855 icalcomponent_add_property(a,icalproperty_new_description(alarm->
programArguments().utf8()));
859 action = ICAL_ACTION_AUDIO;
862 attach = icalattach_new_from_url(TQFile::encodeName( alarm->
audioFile() ).data());
863 icalcomponent_add_property(a,icalproperty_new_attach(attach));
867 action = ICAL_ACTION_EMAIL;
869 for (TQValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
870 icalproperty *p = icalproperty_new_attendee(
"MAILTO:" + (*ad).email().utf8());
871 if (!(*ad).name().isEmpty()) {
872 icalproperty_add_parameter(p,icalparameter_new_cn(quoteForParam((*ad).name()).utf8()));
874 icalcomponent_add_property(a,p);
876 icalcomponent_add_property(a,icalproperty_new_summary(alarm->
mailSubject().utf8()));
877 icalcomponent_add_property(a,icalproperty_new_description(alarm->
mailText().utf8()));
879 if (attachments.count() > 0) {
880 for (TQStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) {
881 attach = icalattach_new_from_url(TQFile::encodeName( *at ).data());
882 icalcomponent_add_property(a,icalproperty_new_attach(attach));
888 action = ICAL_ACTION_DISPLAY;
889 icalcomponent_add_property(a,icalproperty_new_description(alarm->
text().utf8()));
893 kdDebug(5800) <<
"Unknown type of alarm" << endl;
894 action = ICAL_ACTION_NONE;
897 icalcomponent_add_property(a,icalproperty_new_action(action));
900 icaltriggertype trigger;
902 trigger.time = writeICalDateTime(alarm->
time());
903 trigger.duration = icaldurationtype_null_duration();
905 trigger.time = icaltime_null_time();
911 trigger.duration = writeICalDuration( offset.
asSeconds() );
913 icalproperty *p = icalproperty_new_trigger(trigger);
915 icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END));
916 icalcomponent_add_property(a,p);
920 icalcomponent_add_property(a,icalproperty_new_repeat(alarm->
repeatCount()));
921 icalcomponent_add_property(a,icalproperty_new_duration(
927 for (TQMap<TQCString, TQString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
928 icalproperty *p = icalproperty_new_x(c.data().utf8());
929 icalproperty_set_x_name(p,c.key());
930 icalcomponent_add_property(a,p);
936 Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo)
940 readIncidence(vtodo, 0, todo);
942 icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY);
945 icaltimetype icaltime;
947 TQStringList categories;
950 icalproperty_kind kind = icalproperty_isa(p);
953 case ICAL_DUE_PROPERTY:
954 icaltime = icalproperty_get_due(p);
955 if (icaltime.is_date) {
956 todo->
setDtDue(TQDateTime(readICalDate(icaltime),TQTime(0,0,0)),
true);
958 todo->
setDtDue(readICalDateTime(p, icaltime),
true);
964 case ICAL_COMPLETED_PROPERTY:
965 icaltime = icalproperty_get_completed(p);
969 case ICAL_PERCENTCOMPLETE_PROPERTY:
973 case ICAL_RELATEDTO_PROPERTY:
974 todo->
setRelatedToUid(TQString::fromUtf8(icalproperty_get_relatedto(p)));
975 mTodosRelate.append(todo);
978 case ICAL_DTSTART_PROPERTY: {
980 if ( todo->
comments().grep(
"NoStartDate").count() )
987 case ICAL_RECURRENCEID_PROPERTY:
988 icaltime = icalproperty_get_recurrenceid(p);
998 p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY);
1001 if (mCompat) mCompat->fixEmptySummary( todo );
1006 Event *ICalFormatImpl::readEvent( icalcomponent *vevent, icalcomponent *vtimezone )
1011 icaltimezone *tz = icaltimezone_new();
1012 if ( !icaltimezone_set_component( tz, vtimezone ) ) {
1013 icaltimezone_free( tz, 1 );
1017 readIncidence( vevent, tz, event);
1019 icalproperty *p = icalcomponent_get_first_property( vevent, ICAL_ANY_PROPERTY );
1022 icaltimetype icaltime;
1024 TQStringList categories;
1025 icalproperty_transp transparency;
1027 bool dtEndProcessed =
false;
1030 icalproperty_kind kind = icalproperty_isa( p );
1033 case ICAL_DTEND_PROPERTY:
1034 icaltime = icalproperty_get_dtend( p );
1035 if ( icaltime.is_date ) {
1037 TQDate endDate = readICalDate( icaltime ).addDays( -1 );
1039 mCompat->fixFloatingEnd( endDate );
1042 if ( endDate < event->dtStart().date() ) {
1043 endDate =
event->dtStart().date();
1045 event->setDtEnd( TQDateTime( endDate, TQTime( 0, 0, 0 ) ) );
1047 event->setDtEnd(readICalDateTime(p, icaltime, tz));
1048 event->setFloats(
false );
1050 dtEndProcessed =
true;
1053 case ICAL_RELATEDTO_PROPERTY:
1054 event->setRelatedToUid( TQString::fromUtf8( icalproperty_get_relatedto( p ) ) );
1055 mEventsRelate.append( event );
1058 case ICAL_TRANSP_PROPERTY:
1059 transparency = icalproperty_get_transp( p );
1060 if ( transparency == ICAL_TRANSP_TRANSPARENT ) {
1061 event->setTransparency( Event::Transparent );
1063 event->setTransparency( Event::Opaque );
1073 p = icalcomponent_get_next_property( vevent, ICAL_ANY_PROPERTY );
1078 if ( !dtEndProcessed && !event->hasDuration() ) {
1079 event->setDtEnd( event->
dtStart() );
1082 const TQString msade =
event->nonKDECustomProperty(
"X-MICROSOFT-CDO-ALLDAYEVENT");
1083 if ( !msade.isEmpty() ) {
1084 const bool floats = ( msade == TQString::fromLatin1(
"TRUE") );
1085 event->setFloats(floats);
1089 mCompat->fixEmptySummary( event );
1095 FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy)
1099 readIncidenceBase(vfreebusy, freebusy);
1101 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY);
1103 icaltimetype icaltime;
1107 icalproperty_kind kind = icalproperty_isa(p);
1110 case ICAL_DTSTART_PROPERTY:
1111 icaltime = icalproperty_get_dtstart(p);
1112 freebusy->
setDtStart(readICalDateTime(p, icaltime));
1115 case ICAL_DTEND_PROPERTY:
1116 icaltime = icalproperty_get_dtend(p);
1117 freebusy->setDtEnd(readICalDateTime(p, icaltime));
1120 case ICAL_FREEBUSY_PROPERTY:
1122 icalperiodtype icalperiod = icalproperty_get_freebusy(p);
1123 TQDateTime period_start = readICalDateTime(p, icalperiod.start);
1125 if ( !icaltime_is_null_time(icalperiod.end) ) {
1126 TQDateTime period_end = readICalDateTime(p, icalperiod.end);
1127 period =
Period(period_start, period_end);
1129 Duration duration = readICalDuration( icalperiod.duration );
1130 period =
Period(period_start, duration);
1132 icalparameter *param = icalproperty_get_first_parameter( p, ICAL_X_PARAMETER );
1134 if ( strncmp( icalparameter_get_xname( param ),
"X-SUMMARY", 9 ) == 0 ) {
1135 period.setSummary( TQString::fromUtf8(
1136 KCodecs::base64Decode( TQCString( icalparameter_get_xvalue( param ) ) ) ) );
1138 if ( strncmp( icalparameter_get_xname( param ),
"X-LOCATION", 10 ) == 0 ) {
1139 period.setLocation( TQString::fromUtf8(
1140 KCodecs::base64Decode( TQCString( icalparameter_get_xvalue( param ) ) ) ) );
1142 param = icalproperty_get_next_parameter( p, ICAL_X_PARAMETER );
1144 periods.append( period );
1153 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY);
1160 Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal)
1164 readIncidence(vjournal, 0, journal);
1169 Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee)
1171 icalparameter *p = 0;
1173 TQString email = TQString::fromUtf8(icalproperty_get_attendee(attendee));
1174 if ( email.startsWith(
"mailto:",
false ) ) {
1175 email = email.mid( 7 );
1179 TQString uid = TQString();
1180 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER);
1182 name = TQString::fromUtf8(icalparameter_get_cn(p));
1187 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER);
1189 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p);
1190 if (rsvpParameter == ICAL_RSVP_TRUE) rsvp =
true;
1193 Attendee::PartStat status = Attendee::NeedsAction;
1194 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER);
1196 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p);
1197 switch(partStatParameter) {
1199 case ICAL_PARTSTAT_NEEDSACTION:
1200 status = Attendee::NeedsAction;
1202 case ICAL_PARTSTAT_ACCEPTED:
1203 status = Attendee::Accepted;
1205 case ICAL_PARTSTAT_DECLINED:
1206 status = Attendee::Declined;
1208 case ICAL_PARTSTAT_TENTATIVE:
1209 status = Attendee::Tentative;
1211 case ICAL_PARTSTAT_DELEGATED:
1212 status = Attendee::Delegated;
1214 case ICAL_PARTSTAT_COMPLETED:
1215 status = Attendee::Completed;
1217 case ICAL_PARTSTAT_INPROCESS:
1218 status = Attendee::InProcess;
1223 Attendee::Role role = Attendee::ReqParticipant;
1224 p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER);
1226 icalparameter_role roleParameter = icalparameter_get_role(p);
1227 switch(roleParameter) {
1228 case ICAL_ROLE_CHAIR:
1229 role = Attendee::Chair;
1232 case ICAL_ROLE_REQPARTICIPANT:
1233 role = Attendee::ReqParticipant;
1235 case ICAL_ROLE_OPTPARTICIPANT:
1236 role = Attendee::OptParticipant;
1238 case ICAL_ROLE_NONPARTICIPANT:
1239 role = Attendee::NonParticipant;
1244 p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER);
1245 uid = icalparameter_get_xvalue(p);
1256 p = icalproperty_get_first_parameter( attendee, ICAL_DELEGATEDTO_PARAMETER );
1258 a->
setDelegate( icalparameter_get_delegatedto( p ) );
1260 p = icalproperty_get_first_parameter( attendee, ICAL_DELEGATEDFROM_PARAMETER );
1262 a->
setDelegator( icalparameter_get_delegatedfrom( p ) );
1267 Person ICalFormatImpl::readOrganizer( icalproperty *organizer )
1269 TQString email = TQString::fromUtf8(icalproperty_get_organizer(organizer));
1270 if ( email.startsWith(
"mailto:",
false ) ) {
1271 email = email.mid( 7 );
1275 icalparameter *p = icalproperty_get_first_parameter(
1276 organizer, ICAL_CN_PARAMETER );
1279 cn = TQString::fromUtf8( icalparameter_get_cn( p ) );
1286 Attachment *ICalFormatImpl::readAttachment(icalproperty *attach)
1291 icalvalue *value = icalproperty_get_value( attach );
1293 switch( icalvalue_isa( value ) ) {
1294 case ICAL_ATTACH_VALUE:
1296 icalattach *a = icalproperty_get_attach( attach );
1297 if ( !icalattach_get_is_url( a ) ) {
1298 p = (
const char *)icalattach_get_data( a );
1303 p = icalattach_get_url( a );
1305 attachment =
new Attachment( TQString::fromUtf8( p ) );
1310 case ICAL_BINARY_VALUE:
1312 icalattach *a = icalproperty_get_attach( attach );
1313 p = (
const char *)icalattach_get_data( a );
1319 case ICAL_URI_VALUE:
1320 p = icalvalue_get_uri( value );
1321 attachment =
new Attachment( TQString::fromUtf8( p ) );
1329 icalproperty_get_first_parameter( attach, ICAL_FMTTYPE_PARAMETER );
1331 attachment->setMimeType( TQString( icalparameter_get_fmttype( p ) ) );
1334 p = icalproperty_get_first_parameter( attach, ICAL_X_PARAMETER );
1336 TQString xname = TQString( icalparameter_get_xname( p ) ).upper();
1337 TQString xvalue = TQString::fromUtf8( icalparameter_get_xvalue( p ) );
1338 if ( xname ==
"X-CONTENT-DISPOSITION" ) {
1339 attachment->setShowInline( xvalue.lower() ==
"inline" );
1341 if ( xname ==
"X-LABEL" ) {
1342 attachment->setLabel( xvalue );
1344 p = icalproperty_get_next_parameter( attach, ICAL_X_PARAMETER );
1347 p = icalproperty_get_first_parameter( attach, ICAL_X_PARAMETER );
1349 if ( strncmp( icalparameter_get_xname( p ),
"X-LABEL", 7 ) == 0 ) {
1350 attachment->setLabel( TQString::fromUtf8( icalparameter_get_xvalue( p ) ) );
1352 p = icalproperty_get_next_parameter( attach, ICAL_X_PARAMETER );
1359 void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz,
Incidence *incidence)
1361 readIncidenceBase(parent,incidence);
1363 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
1366 int intvalue, inttext;
1367 icaltimetype icaltime;
1368 icaldurationtype icalduration;
1370 TQStringList categories;
1373 icalproperty_kind kind = icalproperty_isa(p);
1376 case ICAL_CREATED_PROPERTY:
1377 icaltime = icalproperty_get_created(p);
1378 incidence->
setCreated(readICalDateTime(p, icaltime, tz));
1381 case ICAL_SEQUENCE_PROPERTY:
1382 intvalue = icalproperty_get_sequence(p);
1386 case ICAL_LASTMODIFIED_PROPERTY:
1387 icaltime = icalproperty_get_lastmodified(p);
1391 case ICAL_DTSTART_PROPERTY:
1392 icaltime = icalproperty_get_dtstart(p);
1393 if (icaltime.is_date) {
1394 incidence->
setDtStart(TQDateTime(readICalDate(icaltime),TQTime(0,0,0)));
1397 incidence->
setDtStart(readICalDateTime(p, icaltime, tz));
1402 case ICAL_DURATION_PROPERTY:
1403 icalduration = icalproperty_get_duration(p);
1404 incidence->setDuration(readICalDuration(icalduration));
1407 case ICAL_DESCRIPTION_PROPERTY:
1408 text = icalproperty_get_description(p);
1412 case ICAL_SUMMARY_PROPERTY:
1413 text = icalproperty_get_summary(p);
1414 incidence->
setSummary(TQString::fromUtf8(text));
1417 case ICAL_LOCATION_PROPERTY:
1418 text = icalproperty_get_location(p);
1422 case ICAL_STATUS_PROPERTY: {
1424 switch (icalproperty_get_status(p)) {
1425 case ICAL_STATUS_TENTATIVE: stat = Incidence::StatusTentative;
break;
1426 case ICAL_STATUS_CONFIRMED: stat = Incidence::StatusConfirmed;
break;
1427 case ICAL_STATUS_COMPLETED: stat = Incidence::StatusCompleted;
break;
1428 case ICAL_STATUS_NEEDSACTION: stat = Incidence::StatusNeedsAction;
break;
1429 case ICAL_STATUS_CANCELLED: stat = Incidence::StatusCanceled;
break;
1430 case ICAL_STATUS_INPROCESS: stat = Incidence::StatusInProcess;
break;
1431 case ICAL_STATUS_DRAFT: stat = Incidence::StatusDraft;
break;
1432 case ICAL_STATUS_FINAL: stat = Incidence::StatusFinal;
break;
1434 incidence->
setCustomStatus(TQString::fromUtf8(icalvalue_get_x(icalproperty_get_value(p))));
1435 stat = Incidence::StatusX;
1437 case ICAL_STATUS_NONE:
1438 default: stat = Incidence::StatusNone;
break;
1440 if (stat != Incidence::StatusX)
1445 case ICAL_PRIORITY_PROPERTY:
1446 intvalue = icalproperty_get_priority( p );
1448 intvalue = mCompat->fixPriority( intvalue );
1452 case ICAL_CATEGORIES_PROPERTY:
1453 text = icalproperty_get_categories(p);
1454 categories.append(TQString::fromUtf8(text));
1457 case ICAL_RECURRENCEID_PROPERTY:
1458 icaltime = icalproperty_get_recurrenceid(p);
1463 case ICAL_RRULE_PROPERTY:
1464 readRecurrenceRule( p, incidence );
1472 case ICAL_RDATE_PROPERTY: {
1473 icaldatetimeperiodtype rd = icalproperty_get_rdate( p );
1474 if ( icaltime_is_valid_time( rd.time ) ) {
1475 if ( icaltime_is_date( rd.time ) ) {
1476 incidence->
recurrence()->addRDate( readICalDate( rd.time ) );
1478 incidence->
recurrence()->addRDateTime( readICalDateTime(p, rd.time, tz ) );
1485 case ICAL_EXRULE_PROPERTY:
1486 readExceptionRule( p, incidence );
1489 case ICAL_EXDATE_PROPERTY:
1490 icaltime = icalproperty_get_exdate(p);
1491 if ( icaltime_is_date(icaltime) ) {
1492 incidence->
recurrence()->addExDate( readICalDate(icaltime) );
1494 incidence->
recurrence()->addExDateTime( readICalDateTime(p, icaltime, tz) );
1498 case ICAL_CLASS_PROPERTY:
1499 inttext = icalproperty_get_class(p);
1500 if (inttext == ICAL_CLASS_PUBLIC ) {
1501 incidence->
setSecrecy(Incidence::SecrecyPublic);
1502 }
else if (inttext == ICAL_CLASS_CONFIDENTIAL ) {
1503 incidence->
setSecrecy(Incidence::SecrecyConfidential);
1505 incidence->
setSecrecy(Incidence::SecrecyPrivate);
1509 case ICAL_ATTACH_PROPERTY:
1519 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY);
1523 const TQString uid = incidence->
customProperty(
"LIBKCAL",
"ID" );
1524 if ( !uid.isNull() ) {
1529 incidence->
setUid( uid );
1534 if ( incidence->
doesRecur() && mCompat )
1535 mCompat->fixRecurrence( incidence );
1541 for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT);
1543 alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) {
1544 readAlarm(alarm,incidence);
1547 if ( mCompat ) mCompat->fixAlarms( incidence );
1551 void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,
IncidenceBase *incidenceBase)
1553 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
1555 bool uidProcessed =
false;
1558 icalproperty_kind kind = icalproperty_isa( p );
1561 case ICAL_UID_PROPERTY:
1562 uidProcessed =
true;
1563 incidenceBase->
setUid( TQString::fromUtf8(icalproperty_get_uid( p ) ) );
1566 case ICAL_ORGANIZER_PROPERTY:
1570 case ICAL_ATTENDEE_PROPERTY:
1574 case ICAL_COMMENT_PROPERTY:
1576 TQString::fromUtf8( icalproperty_get_comment( p ) ) );
1583 p = icalcomponent_get_next_property( parent, ICAL_ANY_PROPERTY );
1586 if ( !uidProcessed ) {
1587 kdWarning() <<
"The incidence didn't have any UID! Report a bug "
1588 <<
"to the application that generated this file."
1593 incidenceBase->
setUid( TQString() );
1605 icalproperty *next =0;
1607 for ( p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
1612 next = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
1614 TQString value = TQString::fromUtf8(icalproperty_get_x(p));
1615 TQString name = icalproperty_get_x_name(p);
1617 if (name ==
"X-PILOTID" && !value.isEmpty()) {
1619 icalcomponent_remove_property(parent,p);
1620 }
else if (name ==
"X-PILOTSTAT" && !value.isEmpty()) {
1622 icalcomponent_remove_property(parent,p);
1627 readCustomProperties(parent, incidenceBase);
1630 void ICalFormatImpl::readCustomProperties(icalcomponent *parent,
CustomProperties *properties)
1632 TQMap<TQCString, TQString> customProperties;
1633 TQString lastProperty;
1635 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
1639 TQString value = TQString::fromUtf8(icalproperty_get_x(p));
1640 const char *name = icalproperty_get_x_name(p);
1641 if ( lastProperty != name ) {
1642 customProperties[name] = value;
1644 customProperties[name] = customProperties[name].append(
"," ).append( value );
1647 p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
1648 lastProperty = name;
1656 void ICalFormatImpl::readRecurrenceRule(icalproperty *rrule,
Incidence *incidence )
1662 struct icalrecurrencetype r = icalproperty_get_rrule(rrule);
1667 readRecurrence( r, recurrule );
1668 recur->addRRule( recurrule );
1671 void ICalFormatImpl::readExceptionRule( icalproperty *rrule,
Incidence *incidence )
1675 struct icalrecurrencetype r = icalproperty_get_exrule(rrule);
1680 readRecurrence( r, recurrule );
1683 recur->addExRule( recurrule );
1686 void ICalFormatImpl::readRecurrence(
const struct icalrecurrencetype &r,
RecurrenceRule* recur )
1689 recur->mRRule = TQString( icalrecurrencetype_as_string(
const_cast<struct icalrecurrencetype*
>(&r) ) );
1692 case ICAL_SECONDLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rSecondly );
break;
1693 case ICAL_MINUTELY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rMinutely );
break;
1694 case ICAL_HOURLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rHourly );
break;
1695 case ICAL_DAILY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rDaily );
break;
1696 case ICAL_WEEKLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rWeekly );
break;
1697 case ICAL_MONTHLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rMonthly );
break;
1698 case ICAL_YEARLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rYearly );
break;
1699 case ICAL_NO_RECURRENCE:
1701 recur->setRecurrenceType( RecurrenceRule::rNone );
1707 if ( !icaltime_is_null_time( r.until ) ) {
1711 TQDateTime endDate( readICalDateTime(0, t) );
1721 int wkst = (r.week_start + 5)%7 + 1;
1722 recur->setWeekStart( wkst );
1725 TQValueList<int> lst;
1729 #define readSetByList(rrulecomp,setfunc) \
1732 while ( (i = r.rrulecomp[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) \
1734 if ( !lst.isEmpty() ) recur->setfunc( lst );
1739 readSetByList( by_second, setBySeconds );
1740 readSetByList( by_minute, setByMinutes );
1741 readSetByList( by_hour, setByHours );
1742 readSetByList( by_month_day, setByMonthDays );
1743 readSetByList( by_year_day, setByYearDays );
1744 readSetByList( by_week_no, setByWeekNumbers );
1745 readSetByList( by_month, setByMonths );
1746 readSetByList( by_set_pos, setBySetPos );
1747 #undef readSetByList
1750 TQValueList<RecurrenceRule::WDayPos> wdlst;
1753 while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
1755 pos.setDay( ( icalrecurrencetype_day_day_of_week( day ) + 5 )%7 + 1 );
1756 pos.setPos( icalrecurrencetype_day_position( day ) );
1758 wdlst.append( pos );
1760 if ( !wdlst.isEmpty() ) recur->setByDays( wdlst );
1768 void ICalFormatImpl::readAlarm(icalcomponent *alarm,
Incidence *incidence)
1777 icalproperty *p = icalcomponent_get_first_property(alarm,ICAL_ACTION_PROPERTY);
1778 Alarm::Type type = Alarm::Display;
1779 icalproperty_action action = ICAL_ACTION_DISPLAY;
1781 kdDebug(5800) <<
"Unknown type of alarm, using default" << endl;
1785 action = icalproperty_get_action(p);
1787 case ICAL_ACTION_DISPLAY: type = Alarm::Display;
break;
1788 case ICAL_ACTION_AUDIO: type = Alarm::Audio;
break;
1789 case ICAL_ACTION_PROCEDURE: type = Alarm::Procedure;
break;
1790 case ICAL_ACTION_EMAIL: type = Alarm::Email;
break;
1792 kdDebug(5800) <<
"Unknown type of alarm: " << action << endl;
1799 p = icalcomponent_get_first_property(alarm,ICAL_ANY_PROPERTY);
1801 icalproperty_kind kind = icalproperty_isa(p);
1805 case ICAL_TRIGGER_PROPERTY: {
1806 icaltriggertype trigger = icalproperty_get_trigger(p);
1807 if (icaltime_is_null_time(trigger.time)) {
1808 if (icaldurationtype_is_null_duration(trigger.duration)) {
1809 kdDebug(5800) <<
"ICalFormatImpl::readAlarm(): Trigger has no time and no duration." << endl;
1811 Duration duration = icaldurationtype_as_int( trigger.duration );
1812 icalparameter *param = icalproperty_get_first_parameter(p,ICAL_RELATED_PARAMETER);
1813 if (param && icalparameter_get_related(param) == ICAL_RELATED_END)
1819 ialarm->
setTime(readICalDateTime(p, trigger.time));
1823 case ICAL_DURATION_PROPERTY: {
1824 icaldurationtype duration = icalproperty_get_duration(p);
1828 case ICAL_REPEAT_PROPERTY:
1833 case ICAL_DESCRIPTION_PROPERTY: {
1834 TQString description = TQString::fromUtf8(icalproperty_get_description(p));
1836 case ICAL_ACTION_DISPLAY:
1837 ialarm->
setText( description );
1839 case ICAL_ACTION_PROCEDURE:
1842 case ICAL_ACTION_EMAIL:
1851 case ICAL_SUMMARY_PROPERTY:
1852 ialarm->
setMailSubject(TQString::fromUtf8(icalproperty_get_summary(p)));
1856 case ICAL_ATTENDEE_PROPERTY: {
1857 TQString email = TQString::fromUtf8(icalproperty_get_attendee(p));
1858 if ( email.startsWith(
"mailto:",
false ) ) {
1859 email = email.mid( 7 );
1862 icalparameter *param = icalproperty_get_first_parameter(p,ICAL_CN_PARAMETER);
1864 name = TQString::fromUtf8(icalparameter_get_cn(param));
1870 case ICAL_ATTACH_PROPERTY: {
1872 if ( attach && attach->isUri() ) {
1874 case ICAL_ACTION_AUDIO:
1877 case ICAL_ACTION_PROCEDURE:
1880 case ICAL_ACTION_EMAIL:
1887 kdDebug() <<
"Alarm attachments currently only support URIs, but "
1888 "no binary data" << endl;
1897 p = icalcomponent_get_next_property(alarm,ICAL_ANY_PROPERTY);
1901 readCustomProperties(alarm, ialarm);
1906 icaldatetimeperiodtype ICalFormatImpl::writeICalDatePeriod(
const TQDate &date )
1908 icaldatetimeperiodtype t;
1909 t.time = writeICalDate( date );
1910 t.period = icalperiodtype_null_period();
1914 icaldatetimeperiodtype ICalFormatImpl::writeICalDateTimePeriod(
const TQDateTime &date )
1916 icaldatetimeperiodtype t;
1917 t.time = writeICalDateTime( date );
1918 t.period = icalperiodtype_null_period();
1922 icaltimetype ICalFormatImpl::writeICalDate(
const TQDate &date)
1924 icaltimetype t = icaltime_null_time();
1926 t.year = date.year();
1927 t.month = date.month();
1935 #ifndef USE_LIBICAL_3_0
1943 icaltimetype ICalFormatImpl::writeICalDateTime(
const TQDateTime &datetime)
1945 icaltimetype t = icaltime_null_time();
1947 t.year = datetime.date().year();
1948 t.month = datetime.date().month();
1949 t.day = datetime.date().day();
1951 t.hour = datetime.time().hour();
1952 t.minute = datetime.time().minute();
1953 t.second = datetime.time().second();
1956 t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
1957 #ifndef USE_LIBICAL_3_0
1965 if (mParent->timeZoneId().isEmpty())
1966 t = icaltime_convert_to_zone( t, 0 );
1968 icaltimezone* tz = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
1969 icaltimezone* utc = icaltimezone_get_utc_timezone();
1972 t = icaltime_convert_to_zone( t, utc );
1974 #ifndef USE_LIBICAL_3_0
1985 TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz )
1988 #ifdef USE_LIBICAL_3_0
1989 bool time_is_utc = icaltime_is_utc(t);
1991 bool time_is_utc = t.is_utc;
1993 if ( !time_is_utc ) {
1996 icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0;
1997 const char *tzid = param ? icalparameter_get_tzid(param) : 0;
1999 icaltimezone* icaltz;
2001 icaltz = icaltimezone_get_builtin_timezone( tzid );
2008 if (tz && tz != icaltimezone_get_utc_timezone()) {
2009 #ifndef USE_LIBICAL_3_0
2015 #ifndef USE_LIBICAL_3_0
2018 t.zone = icaltimezone_get_utc_timezone();
2022 t.zone = icaltimezone_get_utc_timezone();
2027 if ( !mParent->timeZoneId().isEmpty() && t.zone ) {
2029 icaltimezone* viewTimeZone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
2030 icaltimezone_convert_time( &t,
const_cast<icaltimezone*
>(t.zone), viewTimeZone );
2034 return ICalDate2TQDate(t);
2037 TQDate ICalFormatImpl::readICalDate(icaltimetype t)
2039 return ICalDate2TQDate(t).date();
2042 icaldurationtype ICalFormatImpl::writeICalDuration(
int seconds)
2050 d.is_neg = (seconds<0)?1:0;
2051 if (seconds<0) seconds = -seconds;
2054 d.days = seconds / gSecondsPerDay;
2055 seconds %= gSecondsPerDay;
2056 d.hours = seconds / gSecondsPerHour;
2057 seconds %= gSecondsPerHour;
2058 d.minutes = seconds / gSecondsPerMinute;
2059 seconds %= gSecondsPerMinute;
2060 d.seconds = seconds;
2065 int ICalFormatImpl::readICalDuration(icaldurationtype d)
2069 result += d.weeks * gSecondsPerWeek;
2070 result += d.days * gSecondsPerDay;
2071 result += d.hours * gSecondsPerHour;
2072 result += d.minutes * gSecondsPerMinute;
2073 result += d.seconds;
2075 if (d.is_neg) result *= -1;
2080 icalcomponent *ICalFormatImpl::createCalendarComponent(
Calendar *cal)
2082 icalcomponent *calendar;
2085 calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
2090 p = icalproperty_new_prodid(CalFormat::productId().utf8());
2091 icalcomponent_add_property(calendar,p);
2096 p = icalproperty_new_version(
const_cast<char *
>(_ICAL_VERSION));
2097 icalcomponent_add_property(calendar,p);
2101 writeCustomProperties(calendar, cal);
2111 bool ICalFormatImpl::populate(
Calendar *cal, icalcomponent *calendar )
2116 if (!calendar)
return false;
2122 p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY);
2124 kdDebug(5800) <<
"No PRODID property found" << endl;
2125 mLoadedProductId =
"";
2127 mLoadedProductId = TQString::fromUtf8(icalproperty_get_prodid(p));
2131 mCompat = CompatFactory::createCompat( mLoadedProductId );
2134 p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY);
2136 kdDebug(5800) <<
"No VERSION property found" << endl;
2137 mParent->setException(
new ErrorFormat(ErrorFormat::CalVersionUnknown));
2140 const char *version = icalproperty_get_version(p);
2142 kdDebug(5800) <<
"No VERSION property found" << endl;
2144 ErrorFormat::CalVersionUnknown,
2145 i18n(
"No VERSION property found" ) ) );
2151 if (strcmp(version,
"1.0") == 0) {
2152 kdDebug(5800) <<
"Expected iCalendar, got vCalendar" << endl;
2153 mParent->setException(
new ErrorFormat(ErrorFormat::CalVersion1,
2154 i18n(
"Expected iCalendar format")));
2156 }
else if (strcmp(version,
"2.0") != 0) {
2157 kdDebug(5800) <<
"Expected iCalendar, got unknown format" << endl;
2158 mParent->setException(
new ErrorFormat(ErrorFormat::CalVersionUnknown));
2164 readCustomProperties(calendar, cal);
2169 icalcomponent *ctz =
2170 icalcomponent_get_first_component( calendar, ICAL_VTIMEZONE_COMPONENT );
2173 mEventsRelate.clear();
2174 mTodosRelate.clear();
2180 c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT);
2183 Todo *todo = readTodo(c);
2186 TQString originalUid = todo->
uid();
2187 todo->
setUid(originalUid + TQString(
"-recur-%1").arg(todo->
recurrenceID().toTime_t()));
2188 if (!cal->
todo(todo->
uid())) {
2189 if ( !cal->
addTodo( todo ) ) {
2194 if (!cal->
event(originalUid)) {
2195 printf(
"FIXME! [WARNING] Parent for child event does not yet exist!\n");
2206 if (!cal->
todo(todo->
uid())) {
2207 if ( !cal->
addTodo( todo ) ) {
2214 mTodosRelate.remove( todo );
2218 c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT);
2222 c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT);
2225 Event *
event = readEvent(c, ctz);
2228 TQString originalUid =
event->uid();
2229 event->setUid(originalUid + TQString(
"-recur-%1").arg(event->
recurrenceID().toTime_t()));
2232 if (!cal->
event(originalUid)) {
2233 printf(
"FIXME! [WARNING] Parent for child event does not yet exist!\n");
2239 event->addChildIncidence(cal->
event(originalUid)->
uid());
2252 mEventsRelate.remove( event );
2256 c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT);
2260 c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT);
2263 Journal *journal = readJournal(c);
2266 TQString originalUid = journal->
uid();
2267 journal->
setUid(originalUid + TQString(
"-recur-%1").arg(journal->
recurrenceID().toTime_t()));
2270 if (!cal->
event(originalUid)) {
2271 printf(
"FIXME! [WARNING] Parent for child event does not yet exist!\n");
2293 c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT);
2299 Event::List::ConstIterator eIt;
2300 for ( eIt = mEventsRelate.begin(); eIt != mEventsRelate.end(); ++eIt ) {
2301 (*eIt)->setRelatedTo( cal->
incidence( (*eIt)->relatedToUid() ) );
2303 Todo::List::ConstIterator tIt;
2304 for ( tIt = mTodosRelate.begin(); tIt != mTodosRelate.end(); ++tIt ) {
2305 (*tIt)->setRelatedTo( cal->
incidence( (*tIt)->relatedToUid() ) );
2311 TQString ICalFormatImpl::extractErrorProperty(icalcomponent *c)
2316 TQString errorMessage;
2318 icalproperty *error;
2319 error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY);
2321 errorMessage += icalproperty_get_xlicerror(error);
2322 errorMessage +=
"\n";
2323 error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY);
2328 return errorMessage;
2331 void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r)
2335 kdDebug(5800) <<
" Freq: " << r.freq << endl;
2336 kdDebug(5800) <<
" Until: " << icaltime_as_ical_string(r.until) << endl;
2337 kdDebug(5800) <<
" Count: " << r.count << endl;
2338 if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2340 TQString out =
" By Day: ";
2341 while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2342 out.append(TQString::number(i) +
" ");
2344 kdDebug(5800) << out << endl;
2346 if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2348 TQString out =
" By Month Day: ";
2349 while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2350 out.append(TQString::number(i) +
" ");
2352 kdDebug(5800) << out << endl;
2354 if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2356 TQString out =
" By Year Day: ";
2357 while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2358 out.append(TQString::number(i) +
" ");
2360 kdDebug(5800) << out << endl;
2362 if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2364 TQString out =
" By Month: ";
2365 while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2366 out.append(TQString::number(i) +
" ");
2368 kdDebug(5800) << out << endl;
2370 if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2372 TQString out =
" By Set Pos: ";
2373 while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2374 kdDebug(5800) <<
"========= " << i << endl;
2375 out.append(TQString::number(i) +
" ");
2377 kdDebug(5800) << out << endl;
2381 icalcomponent *ICalFormatImpl::createScheduleComponent(
IncidenceBase *incidence,
2384 icalcomponent *message = createCalendarComponent();
2386 icalproperty_method icalmethod = ICAL_METHOD_NONE;
2389 case Scheduler::Publish:
2390 icalmethod = ICAL_METHOD_PUBLISH;
2392 case Scheduler::Request:
2393 icalmethod = ICAL_METHOD_REQUEST;
2395 case Scheduler::Refresh:
2396 icalmethod = ICAL_METHOD_REFRESH;
2398 case Scheduler::Cancel:
2399 icalmethod = ICAL_METHOD_CANCEL;
2401 case Scheduler::Add:
2402 icalmethod = ICAL_METHOD_ADD;
2404 case Scheduler::Reply:
2405 icalmethod = ICAL_METHOD_REPLY;
2407 case Scheduler::Counter:
2408 icalmethod = ICAL_METHOD_COUNTER;
2410 case Scheduler::Declinecounter:
2411 icalmethod = ICAL_METHOD_DECLINECOUNTER;
2414 kdDebug(5800) <<
"ICalFormat::createScheduleMessage(): Unknow method" << endl;
2418 icalcomponent_add_property(message,icalproperty_new_method(icalmethod));
2420 icalcomponent *inc = writeIncidence( incidence, method );
2429 if ( icalmethod == ICAL_METHOD_REPLY ) {
2430 struct icalreqstattype rst;
2431 rst.code = ICAL_2_0_SUCCESS_STATUS;
2434 icalcomponent_add_property( inc, icalproperty_new_requeststatus( rst ) );
2436 icalcomponent_add_component( message, inc );
Provides the main "calendar" object class.
This class represents an alarm notification.
bool hasStartOffset() const
Return whether the alarm is defined in terms of an offset relative to the start of the event.
TQString audioFile() const
Return the name of the audio file for the alarm.
Duration snoozeTime() const
Get how long the alarm snooze interval is.
void setMailSubject(const TQString &mailAlarmSubject)
Set the subject line of the mail.
TQString programFile() const
Return the name of the program file to execute when the alarm is triggered.
void addMailAttachment(const TQString &mailAttachFile)
Add this filename to the list of files to attach to the email.
void setRepeatCount(int alarmRepeatCount)
Set how many times an alarm is to repeat itself after its initial occurrence (w/snoozes).
TQString mailSubject() const
Return the subject line of the mail.
TQDateTime time() const
Return the date/time when an alarm goes off.
TQString text() const
Return the text string that displays when the alarm is triggered.
void setEnabled(bool enable)
Set the alarm enabled status.
void addMailAddress(const Person &mailAlarmAddress)
Add this address to the list of addresses to send mail to when the alarm is triggered.
Duration endOffset() const
Return offset of alarm in time relative to the end of the event.
bool hasEndOffset() const
Return whether the alarm is defined in terms of an offset relative to the end of the event.
Duration startOffset() const
Return offset of alarm in time relative to the start of the event.
void setSnoozeTime(const Duration &alarmSnoozeTime)
Set the interval between snoozes for the alarm.
TQString programArguments() const
Return the arguments to the program to run when the alarm is triggered.
void setEndOffset(const Duration &)
Set offset of alarm in time relative to the end of the event.
void setText(const TQString &text)
Set the text to be displayed when the alarm is triggered.
void setProgramArguments(const TQString &arguments)
Set the arguments to the program to execute when the alarm is triggered.
TQString mailText() const
Return the email body text.
bool hasTime() const
Return true, if the alarm has an explicit date/time.
void setStartOffset(const Duration &)
Set offset of alarm in time relative to the start of the event.
TQValueList< Person > mailAddresses() const
Return the addresses to send mail to when an alarm goes off.
void setTime(const TQDateTime &alarmTime)
Set the time to trigger an alarm.
Type type() const
Return the type of the alarm.
void setAudioFile(const TQString &audioFile)
Set the file to play when the audio alarm is triggered.
void setMailText(const TQString &text)
Set the email body text.
void setType(Type type)
Set the type of the alarm.
void setProgramFile(const TQString &programFile)
Set the program file to execute when the alarm is triggered.
int repeatCount() const
Get how many times an alarm repeats, after its initial occurrence.
TQStringList mailAttachments() const
Return the filenames to attach to the email.
This class represents information related to an attachment.
This class represents information related to an attendee of an event.
void setDelegator(const TQString &delegator)
Sets the delegator.
void setDelegate(const TQString &delegate)
Sets the delegate.
TQString uid() const
Return unique id of the attendee.
TQString delegate() const
Returns the delegate.
Role role() const
Return role of Attendee.
TQString delegator() const
Returns the delegator.
bool RSVP() const
Return, if Attendee is asked to reply.
PartStat status() const
Return status.
This is the main "calendar" object class.
virtual bool addJournal(Journal *journal)=0
Insert a Journal into the Calendar.
virtual Todo * todo(const TQString &uid)=0
Returns the Todo associated with the given unique identifier.
virtual Event * event(const TQString &uid)=0
Returns the Event associated with the given unique identifier.
virtual bool addEvent(Event *event)=0
Insert an Event into the Calendar.
ErrorFormat * exception() const
Returns an exception, if there is any, containing information about the last error that occurred.
virtual Journal * journal(const TQString &uid)=0
Returns the Journal associated with the given unique identifier.
virtual bool addTodo(Todo *todo)=0
Insert a Todo into the Calendar.
Incidence * incidence(const TQString &uid)
Returns the Incidence associated with the given unique identifier.
void endBatchAdding()
Emits the endBatchAdding() signal.
This class provides compatibility to older (broken) versions of KOrganizer.
This class represents custom calendar properties.
void setCustomProperties(const TQMap< TQCString, TQString > &properties)
Initialise the alarm's custom calendar properties to the specified key/value pairs.
TQMap< TQCString, TQString > customProperties() const
Return all custom calendar property key/value pairs.
void setCustomProperty(const TQCString &app, const TQCString &key, const TQString &value)
Create or modify a custom calendar property.
TQString customProperty(const TQCString &app, const TQCString &key) const
Return the value of a custom calendar property.
void removeCustomProperty(const TQCString &app, const TQCString &key)
Delete a custom calendar property.
This class represents a duration.
int value() const
Returns the length of the duration in seconds or days.
int asSeconds() const
Returns the length of the duration in seconds.
This class provides an Event in the sense of RFC2445.
virtual TQDateTime dtEnd() const
Return end date and time.
Transparency transparency() const
Return the event's time transparency level.
bool hasEndDate() const
Return whether the event has an end date/time.
This class provides information about free/busy time of a calendar user.
void addPeriods(const PeriodList &)
Adds a list of periods to the freebusy object and then sorts that list.
This class provides the interface for a visitor of calendar components.
virtual bool visit(Event *)
Reimplement this function in your concrete subclass of IncidenceBase::Visitor to perform actions on a...
This class provides the base class common to all calendar components.
void setOrganizer(const Person &o)
sets the organizer for the event
int attendeeCount() const
Return number of attendees.
void setPilotId(unsigned long id)
Set Pilot Id.
unsigned long pilotId() const
Return Pilot Id.
TQStringList comments() const
Return all comments associated with this incidence.
bool doesFloat() const
Return true or false depending on whether the incidence "floats," i.e.
const Attendee::List & attendees() const
Return list of attendees.
TQString uid() const
Return the unique id for the event.
void addComment(const TQString &comment)
Add a comment to this incidence.
void setUid(const TQString &)
Set the unique id for the event.
int syncStatus() const
Return synchronisation status.
virtual TQDateTime dtStart() const
returns an event's starting date/time as a TQDateTime.
virtual bool accept(Visitor &)
Accept IncidenceVisitor.
virtual void setDtStart(const TQDateTime &dtStart)
for setting the event's starting date/time with a TQDateTime.
TQDateTime lastModified() const
Return the time the incidence was last modified.
void setSyncStatus(int status)
Set synchronisation satus.
void setLastModified(const TQDateTime &lm)
Sets the time the incidence was last modified.
void addAttendee(Attendee *attendee, bool doUpdate=true)
Add Attendee to this incidence.
This class provides the base class common to all calendar components.
TQString statusStr() const
Return the event's status string.
void addAttachment(Attachment *attachment)
Add attachment.
TQString relatedToUid() const
What event does this one relate to? This function should only be used when constructing a calendar be...
void setLocation(const TQString &location)
Set the event's/todo's location.
const Alarm::List & alarms() const
All alarms that are associated with this incidence.
void setSummary(const TQString &summary)
Set short summary.
void setCustomStatus(const TQString &status)
Sets the incidence status to a non-standard status value.
void setSchedulingID(const TQString &sid)
Set the event's/todo's scheduling ID.
Alarm * newAlarm()
Create a new alarm which is associated with this incidence.
TQDateTime created() const
Return time and date of creation.
int revision() const
Return the number of revisions this event has seen.
void setPriority(int priority)
Set the incidences priority.
void setSecrecy(int)
Sets secrecy status.
int secrecy() const
Return the event's secrecy.
IncidenceList childIncidences() const
Returns an EventList of all child incidences.
TQString description() const
Return long description.
Status
Enumeration for describing an event's status.
TQStringList categories() const
Return categories as a list of strings.
void setStatus(Status status)
Sets the incidence status to a standard status value.
void setDescription(const TQString &description)
Set the long description.
int priority() const
Return priority.
Status status() const
Return the event's status.
void setFloats(bool f)
Set whether the incidence floats, i.e.
void setRelatedToUid(const TQString &)
Point at some other event to which the event relates.
bool doesRecur() const
Forward to Recurrence::doesRecur().
virtual void setDtStart(const TQDateTime &dtStart)
Set starting date/time.
TQString schedulingID() const
Return the event's/todo's scheduling ID.
bool hasRecurrenceID() const
Returns true if the incidence has recurrenceID, otherwise return false.
TQDateTime recurrenceID() const
Returns the incidence recurrenceID.
void setCategories(const TQStringList &categories)
Set categories.
TQString location() const
Return the event's/todo's location.
Attachment::List attachments() const
Return list of all associated attachments.
TQString summary() const
Return short summary.
Recurrence * recurrence() const
Return the recurrence rule associated with this incidence.
void setRevision(int rev)
Set the number of revisions this event has seen.
void addChildIncidence(TQString childIncidence)
Attach a child incidence to a parent incidence.
void setCreated(const TQDateTime &)
Set creation date.
void setHasRecurrenceID(bool hasRecurrenceID)
Sets if the incidence has recurrenceID.
void setRecurrenceID(const TQDateTime &recurrenceID)
Set the incidences recurrenceID.
This class provides a Journal in the sense of RFC2445.
This class represents a period of time.
This class represents a person.
structure for describing the n-th weekday of the month/year.
This class represents a recurrence rule for a calendar incidence.
TQDateTime endDt(bool *result=0) const
Returns the date and time of the last recurrence.
void setDuration(int duration)
Sets the total number of times the event is to occur, including both the first and last.
void setFrequency(int freq)
Sets the frequency of recurrence, in terms of the recurrence time period type.
void setEndDt(const TQDateTime &endDateTime)
Sets the date and time of the last recurrence.
uint frequency() const
Returns frequency of recurrence, in terms of the recurrence time period type.
int duration() const
Returns -1 if the event recurs infinitely, 0 if the end date is set, otherwise the total number of re...
bool doesFloat() const
Returns whether the start date has no time associated.
void setStartDt(const TQDateTime &start)
Set start of recurrence, as a date and time.
This class represents a recurrence rule for a calendar incidence.
This class provides a Todo in the sense of RFC2445.
bool hasDueDate() const
Returns true if the todo has a due date, otherwise return false.
bool isCompleted() const
Returns true if the todo is 100% completed, otherwise return false.
void setDtRecurrence(const TQDateTime &dt)
Sets the due date/time of the current occurrence if recurrent.
bool hasStartDate() const
Returns true if the todo has a start date, otherwise return false.
void setDtDue(const TQDateTime &dtDue, bool first=false)
Sets due date and time.
void setCompleted(bool completed)
Set completed state.
TQDateTime dtStart(bool first=false) const
Returns the startdate of the todo.
TQDateTime completed() const
Returns date and time when todo was completed.
void setHasStartDate(bool hasStartDate)
Set if the todo has a start date.
int percentComplete() const
Returns how many percent of the task are completed.
bool hasCompletedDate() const
Returns true, if todo has a date associated with completion, otherwise return false.
TQDateTime dtDue(bool first=false) const
Returns due date and time.
void setHasDueDate(bool hasDueDate)
Set if the todo has a due date.
void setPercentComplete(int)
Set how many percent of the task are completed.
Namespace KCal is for global classes, objects and/or functions in libkcal.