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 const int gSecondsPerMinute = 60;
73 const int gSecondsPerHour = gSecondsPerMinute * 60;
74 const int gSecondsPerDay = gSecondsPerHour * 24;
75 const int gSecondsPerWeek = gSecondsPerDay * 7;
77 ICalFormatImpl::ICalFormatImpl(
ICalFormat *parent ) :
78 mParent( parent ), mCompat( new
Compat )
82 ICalFormatImpl::~ICalFormatImpl()
90 ToComponentVisitor( ICalFormatImpl *impl,
Scheduler::Method m ) : mImpl( impl ), mComponent( 0 ), mMethod( m ) {}
92 bool visit(
Event *e ) { mComponent = mImpl->writeEvent( e );
return true; }
93 bool visit(
Todo *e ) { mComponent = mImpl->writeTodo( e );
return true; }
94 bool visit(
Journal *e ) { mComponent = mImpl->writeJournal( e );
return true; }
95 bool visit(
FreeBusy *fb ) { mComponent = mImpl->writeFreeBusy( fb, mMethod );
return true; }
97 icalcomponent *component() {
return mComponent; }
100 ICalFormatImpl *mImpl;
101 icalcomponent *mComponent;
107 ToComponentVisitor v(
this, method );
108 if ( incidence->
accept(v) )
109 return v.component();
113 icalcomponent *ICalFormatImpl::writeTodo(
Todo *todo)
116 TQStringList tmpStrList;
118 icalcomponent *vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT);
120 writeIncidence(vtodo,todo);
126 due = writeICalDate(todo->
dtDue(
true).date());
128 due = writeICalDateTime(todo->
dtDue(
true));
130 icalcomponent_add_property(vtodo,icalproperty_new_due(due));
138 start = writeICalDate(todo->
dtStart(
true).date());
141 start = writeICalDateTime(todo->
dtStart(
true));
143 icalcomponent_add_property(vtodo,icalproperty_new_dtstart(start));
153 icaltimetype completed = writeICalDateTime(todo->
completed());
154 icalcomponent_add_property(vtodo,icalproperty_new_completed(completed));
157 icalcomponent_add_property(vtodo,
161 icalcomponent_add_property(vtodo,
162 icalproperty_new_recurrenceid( writeICalDateTime( todo->
dtDue())));
168 icalcomponent *ICalFormatImpl::writeEvent(
Event *event)
171 kdDebug(5800) <<
"Write Event '" <<
event->summary() <<
"' (" <<
event->uid()
176 TQStringList tmpStrList;
178 icalcomponent *vevent = icalcomponent_new(ICAL_VEVENT_COMPONENT);
180 writeIncidence(vevent,event);
186 start = writeICalDate(event->
dtStart().date());
189 start = writeICalDateTime(event->
dtStart());
191 icalcomponent_add_property(vevent,icalproperty_new_dtstart(start));
200 end = writeICalDate( event->
dtEnd().date().addDays( 1 ) );
201 icalcomponent_add_property(vevent,icalproperty_new_dtend(end));
205 end = writeICalDateTime(event->
dtEnd());
206 icalcomponent_add_property(vevent,icalproperty_new_dtend(end));
214 tmpStrList = anEvent->resources();
215 tmpStr = tmpStrList.join(
";");
216 if (!tmpStr.isEmpty())
217 addPropValue(vevent, VCResourcesProp, tmpStr.utf8());
223 case Event::Transparent:
224 icalcomponent_add_property(
226 icalproperty_new_transp( ICAL_TRANSP_TRANSPARENT ) );
229 icalcomponent_add_property(
231 icalproperty_new_transp( ICAL_TRANSP_OPAQUE ) );
238 icalcomponent *ICalFormatImpl::writeFreeBusy(
FreeBusy *freebusy,
241 kdDebug(5800) <<
"icalformatimpl: writeFreeBusy: startDate: "
242 << freebusy->
dtStart().toString(
"ddd MMMM d yyyy: h:m:s ap") <<
" End Date: "
243 << freebusy->dtEnd().toString(
"ddd MMMM d yyyy: h:m:s ap") << endl;
245 icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT);
247 writeIncidenceBase(vfreebusy,freebusy);
249 icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart(
250 writeICalDateTime(freebusy->
dtStart())));
252 icalcomponent_add_property(vfreebusy, icalproperty_new_dtend(
253 writeICalDateTime(freebusy->dtEnd())));
255 if (method == Scheduler::Request) {
256 icalcomponent_add_property(vfreebusy,icalproperty_new_uid(
257 freebusy->
uid().utf8()));
261 TQValueList<Period> list = freebusy->busyPeriods();
262 TQValueList<Period>::Iterator it;
263 icalperiodtype period = icalperiodtype_null_period();
264 for (it = list.begin(); it!= list.end(); ++it) {
265 period.start = writeICalDateTime((*it).start());
266 if ( (*it).hasDuration() ) {
267 period.duration = writeICalDuration( (*it).duration().asSeconds() );
269 period.end = writeICalDateTime((*it).end());
271 icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) );
277 icalcomponent *ICalFormatImpl::writeJournal(
Journal *journal)
279 icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT);
281 writeIncidence(vjournal,journal);
284 if (journal->
dtStart().isValid()) {
288 start = writeICalDate(journal->
dtStart().date());
291 start = writeICalDateTime(journal->
dtStart());
293 icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start));
299 void ICalFormatImpl::writeIncidence(icalcomponent *parent,
Incidence *incidence)
310 p = icalproperty_new_x(TQString::number(incidence->
syncStatus()).utf8());
311 icalproperty_set_x_name(p,
"X-PILOTSTAT");
312 icalcomponent_add_property(parent,p);
314 p = icalproperty_new_x(TQString::number(incidence->
pilotId()).utf8());
315 icalproperty_set_x_name(p,
"X-PILOTID");
316 icalcomponent_add_property(parent,p);
319 TQString modifiedUid;
325 IncidenceListIterator it;
330 modifiedUid = incidence->
uid();
340 writeIncidenceBase(parent,incidence);
343 icalcomponent_add_property(parent,icalproperty_new_created(
344 writeICalDateTime(incidence->
created())));
351 icalcomponent_add_property(parent,icalproperty_new_uid(modifiedUid.utf8()));
355 icalcomponent_add_property(parent,icalproperty_new_uid(
362 icalcomponent_add_property(parent,icalproperty_new_sequence(
368 icalcomponent_add_property(parent,icalproperty_new_lastmodified(
374 icalcomponent_add_property(parent,icalproperty_new_description(
379 if (!incidence->
summary().isEmpty()) {
380 icalcomponent_add_property(parent,icalproperty_new_summary(
385 if (!incidence->
location().isEmpty()) {
386 icalcomponent_add_property(parent,icalproperty_new_location(
391 icalproperty_status status = ICAL_STATUS_NONE;
392 switch (incidence->
status()) {
393 case Incidence::StatusTentative: status = ICAL_STATUS_TENTATIVE;
break;
394 case Incidence::StatusConfirmed: status = ICAL_STATUS_CONFIRMED;
break;
395 case Incidence::StatusCompleted: status = ICAL_STATUS_COMPLETED;
break;
396 case Incidence::StatusNeedsAction: status = ICAL_STATUS_NEEDSACTION;
break;
397 case Incidence::StatusCanceled: status = ICAL_STATUS_CANCELLED;
break;
398 case Incidence::StatusInProcess: status = ICAL_STATUS_INPROCESS;
break;
399 case Incidence::StatusDraft: status = ICAL_STATUS_DRAFT;
break;
400 case Incidence::StatusFinal: status = ICAL_STATUS_FINAL;
break;
401 case Incidence::StatusX: {
402 icalproperty* p = icalproperty_new_status(ICAL_STATUS_X);
403 icalvalue_set_x(icalproperty_get_value(p), incidence->
statusStr().utf8());
404 icalcomponent_add_property(parent, p);
407 case Incidence::StatusNone:
411 if (status != ICAL_STATUS_NONE)
412 icalcomponent_add_property(parent, icalproperty_new_status(status));
415 icalproperty_class secClass;
416 switch (incidence->
secrecy()) {
417 case Incidence::SecrecyPublic:
418 secClass = ICAL_CLASS_PUBLIC;
420 case Incidence::SecrecyConfidential:
421 secClass = ICAL_CLASS_CONFIDENTIAL;
423 case Incidence::SecrecyPrivate:
425 secClass = ICAL_CLASS_PRIVATE;
428 if ( secClass != ICAL_CLASS_PUBLIC ) {
429 icalcomponent_add_property(parent,icalproperty_new_class(secClass));
434 icalcomponent_add_property(parent,icalproperty_new_priority(
439 TQStringList categories = incidence->
categories();
440 TQStringList::Iterator it;
441 for(it = categories.begin(); it != categories.end(); ++it ) {
442 icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8()));
447 icalcomponent_add_property(parent,icalproperty_new_relatedto(
453 icalcomponent_add_property(parent, icalproperty_new_recurrenceid( writeICalDateTime( incidence->
recurrenceID() ) ));
460 RecurrenceRule::List::ConstIterator rit;
461 for ( rit = rrules.begin(); rit != rrules.end(); ++rit ) {
462 icalcomponent_add_property( parent, icalproperty_new_rrule(
463 writeRecurrenceRule( (*rit) ) ) );
467 RecurrenceRule::List::ConstIterator exit;
468 for ( exit = exrules.begin(); exit != exrules.end(); ++exit ) {
469 icalcomponent_add_property( parent, icalproperty_new_rrule(
470 writeRecurrenceRule( (*exit) ) ) );
473 DateList dateList = incidence->
recurrence()->exDates();
474 DateList::ConstIterator exIt;
475 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
476 icalcomponent_add_property(parent,icalproperty_new_exdate(
477 writeICalDate(*exIt)));
479 DateTimeList dateTimeList = incidence->
recurrence()->exDateTimes();
480 DateTimeList::ConstIterator extIt;
481 for(extIt = dateTimeList.begin(); extIt != dateTimeList.end(); ++extIt) {
482 icalcomponent_add_property(parent,icalproperty_new_exdate(
483 writeICalDateTime(*extIt)));
488 DateList::ConstIterator rdIt;
489 for( rdIt = dateList.begin(); rdIt != dateList.end(); ++rdIt) {
490 icalcomponent_add_property( parent, icalproperty_new_rdate(
491 writeICalDatePeriod(*rdIt) ) );
493 dateTimeList = incidence->
recurrence()->rDateTimes();
494 DateTimeList::ConstIterator rdtIt;
495 for( rdtIt = dateTimeList.begin(); rdtIt != dateTimeList.end(); ++rdtIt) {
496 icalcomponent_add_property( parent, icalproperty_new_rdate(
497 writeICalDateTimePeriod(*rdtIt) ) );
502 Attachment::List::ConstIterator atIt;
503 for ( atIt = attachments.begin(); atIt != attachments.end(); ++atIt ) {
504 icalcomponent_add_property( parent, writeAttachment( *atIt ) );
508 Alarm::List::ConstIterator alarmIt;
509 for ( alarmIt = incidence->
alarms().begin();
510 alarmIt != incidence->
alarms().end(); ++alarmIt ) {
511 if ( (*alarmIt)->enabled() ) {
513 icalcomponent_add_component( parent, writeAlarm( *alarmIt ) );
518 if (incidence->hasDuration()) {
519 icaldurationtype duration;
520 duration = writeICalDuration( incidence->duration() );
521 icalcomponent_add_property(parent,icalproperty_new_duration(duration));
525 void ICalFormatImpl::writeIncidenceBase( icalcomponent *parent,
528 icalcomponent_add_property( parent, icalproperty_new_dtstamp(
529 writeICalDateTime( TQDateTime::currentDateTime() ) ) );
532 if ( !incidenceBase->organizer().isEmpty() ) {
533 icalcomponent_add_property( parent, writeOrganizer( incidenceBase->organizer() ) );
538 Attendee::List::ConstIterator it;
539 for( it = incidenceBase->
attendees().begin();
540 it != incidenceBase->
attendees().end(); ++it ) {
541 icalcomponent_add_property( parent, writeAttendee( *it ) );
546 TQStringList comments = incidenceBase->
comments();
547 for (TQStringList::Iterator it=comments.begin(); it!=comments.end(); ++it) {
548 icalcomponent_add_property(parent, icalproperty_new_comment((*it).utf8()));
552 writeCustomProperties( parent, incidenceBase );
555 void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,
CustomProperties *properties)
558 for (TQMap<TQCString, TQString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
559 icalproperty *p = icalproperty_new_x(c.data().utf8());
560 icalproperty_set_x_name(p,c.key());
561 icalcomponent_add_property(parent,p);
565 icalproperty *ICalFormatImpl::writeOrganizer(
const Person &organizer )
567 icalproperty *p = icalproperty_new_organizer(
"MAILTO:" + organizer.email().utf8());
569 if (!organizer.name().isEmpty()) {
570 icalproperty_add_parameter( p, icalparameter_new_cn(organizer.name().utf8()) );
578 icalproperty *ICalFormatImpl::writeAttendee(
Attendee *attendee)
580 icalproperty *p = icalproperty_new_attendee(
"mailto:" + attendee->email().utf8());
582 if (!attendee->name().isEmpty()) {
583 icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8()));
587 icalproperty_add_parameter(p,icalparameter_new_rsvp(
588 attendee->
RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE ));
590 icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION;
591 switch (attendee->
status()) {
593 case Attendee::NeedsAction:
594 status = ICAL_PARTSTAT_NEEDSACTION;
596 case Attendee::Accepted:
597 status = ICAL_PARTSTAT_ACCEPTED;
599 case Attendee::Declined:
600 status = ICAL_PARTSTAT_DECLINED;
602 case Attendee::Tentative:
603 status = ICAL_PARTSTAT_TENTATIVE;
605 case Attendee::Delegated:
606 status = ICAL_PARTSTAT_DELEGATED;
608 case Attendee::Completed:
609 status = ICAL_PARTSTAT_COMPLETED;
611 case Attendee::InProcess:
612 status = ICAL_PARTSTAT_INPROCESS;
615 icalproperty_add_parameter(p,icalparameter_new_partstat(status));
617 icalparameter_role role = ICAL_ROLE_REQPARTICIPANT;
618 switch (attendee->
role()) {
619 case Attendee::Chair:
620 role = ICAL_ROLE_CHAIR;
623 case Attendee::ReqParticipant:
624 role = ICAL_ROLE_REQPARTICIPANT;
626 case Attendee::OptParticipant:
627 role = ICAL_ROLE_OPTPARTICIPANT;
629 case Attendee::NonParticipant:
630 role = ICAL_ROLE_NONPARTICIPANT;
633 icalproperty_add_parameter(p,icalparameter_new_role(role));
635 if (!attendee->
uid().isEmpty()) {
636 icalparameter* icalparameter_uid = icalparameter_new_x(attendee->
uid().utf8());
637 icalparameter_set_xname(icalparameter_uid,
"X-UID");
638 icalproperty_add_parameter(p,icalparameter_uid);
641 if ( !attendee->
delegate().isEmpty() ) {
642 icalparameter* icalparameter_delegate = icalparameter_new_delegatedto( attendee->
delegate().utf8() );
643 icalproperty_add_parameter( p, icalparameter_delegate );
646 if ( !attendee->
delegator().isEmpty() ) {
647 icalparameter* icalparameter_delegator = icalparameter_new_delegatedfrom( attendee->
delegator().utf8() );
648 icalproperty_add_parameter( p, icalparameter_delegator );
654 icalproperty *ICalFormatImpl::writeAttachment(
Attachment *att )
657 if ( att->isUri() ) {
658 attach = icalattach_new_from_url( att->uri().utf8().data() );
660 #ifdef USE_LIBICAL_0_46
661 attach = icalattach_new_from_data ( (
const char *)att->data(), 0, 0 );
663 attach = icalattach_new_from_data ( (
unsigned char *)att->data(), 0, 0 );
666 icalproperty *p = icalproperty_new_attach( attach );
668 if ( !att->mimeType().isEmpty() ) {
669 icalproperty_add_parameter( p,
670 icalparameter_new_fmttype( att->mimeType().utf8().data() ) );
673 if ( att->isBinary() ) {
674 icalproperty_add_parameter( p,
675 icalparameter_new_value( ICAL_VALUE_BINARY ) );
676 icalproperty_add_parameter( p,
677 icalparameter_new_encoding( ICAL_ENCODING_BASE64 ) );
680 if ( att->showInline() ) {
681 icalparameter* icalparameter_inline = icalparameter_new_x(
"inline" );
682 icalparameter_set_xname( icalparameter_inline,
"X-CONTENT-DISPOSITION" );
683 icalproperty_add_parameter( p, icalparameter_inline );
686 if ( !att->label().isEmpty() ) {
687 icalparameter* icalparameter_label = icalparameter_new_x( att->label().utf8() );
688 icalparameter_set_xname( icalparameter_label,
"X-LABEL" );
689 icalproperty_add_parameter( p, icalparameter_label );
695 icalrecurrencetype ICalFormatImpl::writeRecurrenceRule(
RecurrenceRule *recur )
699 icalrecurrencetype r;
700 icalrecurrencetype_clear(&r);
702 switch( recur->recurrenceType() ) {
703 case RecurrenceRule::rSecondly:
704 r.freq = ICAL_SECONDLY_RECURRENCE;
706 case RecurrenceRule::rMinutely:
707 r.freq = ICAL_MINUTELY_RECURRENCE;
709 case RecurrenceRule::rHourly:
710 r.freq = ICAL_HOURLY_RECURRENCE;
712 case RecurrenceRule::rDaily:
713 r.freq = ICAL_DAILY_RECURRENCE;
715 case RecurrenceRule::rWeekly:
716 r.freq = ICAL_WEEKLY_RECURRENCE;
718 case RecurrenceRule::rMonthly:
719 r.freq = ICAL_MONTHLY_RECURRENCE;
721 case RecurrenceRule::rYearly:
722 r.freq = ICAL_YEARLY_RECURRENCE;
725 r.freq = ICAL_NO_RECURRENCE;
726 kdDebug(5800) <<
"ICalFormatImpl::writeRecurrence(): no recurrence" << endl;
731 TQValueList<int> bys;
732 TQValueList<int>::ConstIterator it;
735 bys = recur->bySeconds();
737 for ( it = bys.begin(); it != bys.end(); ++it ) {
738 r.by_second[index++] = *it;
741 bys = recur->byMinutes();
743 for ( it = bys.begin(); it != bys.end(); ++it ) {
744 r.by_minute[index++] = *it;
747 bys = recur->byHours();
749 for ( it = bys.begin(); it != bys.end(); ++it ) {
750 r.by_hour[index++] = *it;
753 bys = recur->byMonthDays();
755 for ( it = bys.begin(); it != bys.end(); ++it ) {
756 r.by_month_day[index++] = icalrecurrencetype_day_position( (*it) * 8 );
759 bys = recur->byYearDays();
761 for ( it = bys.begin(); it != bys.end(); ++it ) {
762 r.by_year_day[index++] = *it;
765 bys = recur->byWeekNumbers();
767 for ( it = bys.begin(); it != bys.end(); ++it ) {
768 r.by_week_no[index++] = *it;
771 bys = recur->byMonths();
773 for ( it = bys.begin(); it != bys.end(); ++it ) {
774 r.by_month[index++] = *it;
777 bys = recur->bySetPos();
779 for ( it = bys.begin(); it != bys.end(); ++it ) {
780 r.by_set_pos[index++] = *it;
784 TQValueList<RecurrenceRule::WDayPos> byd = recur->byDays();
787 for ( TQValueList<RecurrenceRule::WDayPos>::ConstIterator dit = byd.begin();
788 dit != byd.end(); ++dit ) {
789 day = (*dit).day() % 7 + 1;
790 if ( (*dit).pos() < 0 ) {
791 day += (-(*dit).pos())*8;
794 day += (*dit).pos()*8;
796 r.by_day[index++] = day;
799 r.week_start =
static_cast<icalrecurrencetype_weekday
>(
800 recur->weekStart()%7 + 1);
809 }
else if ( recur->
duration() == -1 ) {
813 r.until = writeICalDate(recur->
endDt().date());
815 r.until = writeICalDateTime(recur->
endDt());
820 const char *str = icalrecurrencetype_as_string(&r);
822 kdDebug(5800) <<
" String: " << str << endl;
824 kdDebug(5800) <<
" No String" << endl;
832 icalcomponent *ICalFormatImpl::writeAlarm(
Alarm *alarm)
835 icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT);
837 icalproperty_action action;
838 icalattach *attach = 0;
840 switch (alarm->
type()) {
841 case Alarm::Procedure:
842 action = ICAL_ACTION_PROCEDURE;
843 attach = icalattach_new_from_url(TQFile::encodeName(alarm->
programFile()).data());
844 icalcomponent_add_property(a,icalproperty_new_attach(attach));
846 icalcomponent_add_property(a,icalproperty_new_description(alarm->
programArguments().utf8()));
850 action = ICAL_ACTION_AUDIO;
853 attach = icalattach_new_from_url(TQFile::encodeName( alarm->
audioFile() ).data());
854 icalcomponent_add_property(a,icalproperty_new_attach(attach));
858 action = ICAL_ACTION_EMAIL;
860 for (TQValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
861 icalproperty *p = icalproperty_new_attendee(
"MAILTO:" + (*ad).email().utf8());
862 if (!(*ad).name().isEmpty()) {
863 icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8()));
865 icalcomponent_add_property(a,p);
867 icalcomponent_add_property(a,icalproperty_new_summary(alarm->
mailSubject().utf8()));
868 icalcomponent_add_property(a,icalproperty_new_description(alarm->
mailText().utf8()));
870 if (attachments.count() > 0) {
871 for (TQStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) {
872 attach = icalattach_new_from_url(TQFile::encodeName( *at ).data());
873 icalcomponent_add_property(a,icalproperty_new_attach(attach));
879 action = ICAL_ACTION_DISPLAY;
880 icalcomponent_add_property(a,icalproperty_new_description(alarm->
text().utf8()));
884 kdDebug(5800) <<
"Unknown type of alarm" << endl;
885 action = ICAL_ACTION_NONE;
888 icalcomponent_add_property(a,icalproperty_new_action(action));
891 icaltriggertype trigger;
893 trigger.time = writeICalDateTime(alarm->
time());
894 trigger.duration = icaldurationtype_null_duration();
896 trigger.time = icaltime_null_time();
902 trigger.duration = writeICalDuration( offset.
asSeconds() );
904 icalproperty *p = icalproperty_new_trigger(trigger);
906 icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END));
907 icalcomponent_add_property(a,p);
911 icalcomponent_add_property(a,icalproperty_new_repeat(alarm->
repeatCount()));
912 icalcomponent_add_property(a,icalproperty_new_duration(
918 for (TQMap<TQCString, TQString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
919 icalproperty *p = icalproperty_new_x(c.data().utf8());
920 icalproperty_set_x_name(p,c.key());
921 icalcomponent_add_property(a,p);
927 Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo)
931 readIncidence(vtodo, 0, todo);
933 icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY);
936 icaltimetype icaltime;
938 TQStringList categories;
941 icalproperty_kind kind = icalproperty_isa(p);
944 case ICAL_DUE_PROPERTY:
945 icaltime = icalproperty_get_due(p);
946 if (icaltime.is_date) {
947 todo->
setDtDue(TQDateTime(readICalDate(icaltime),TQTime(0,0,0)),
true);
949 todo->
setDtDue(readICalDateTime(p, icaltime),
true);
955 case ICAL_COMPLETED_PROPERTY:
956 icaltime = icalproperty_get_completed(p);
960 case ICAL_PERCENTCOMPLETE_PROPERTY:
964 case ICAL_RELATEDTO_PROPERTY:
965 todo->
setRelatedToUid(TQString::fromUtf8(icalproperty_get_relatedto(p)));
966 mTodosRelate.append(todo);
969 case ICAL_DTSTART_PROPERTY: {
971 if ( todo->
comments().grep(
"NoStartDate").count() )
978 case ICAL_RECURRENCEID_PROPERTY:
979 icaltime = icalproperty_get_recurrenceid(p);
989 p = icalcomponent_get_next_property(vtodo,ICAL_ANY_PROPERTY);
992 if (mCompat) mCompat->fixEmptySummary( todo );
997 Event *ICalFormatImpl::readEvent( icalcomponent *vevent, icalcomponent *vtimezone )
1002 icaltimezone *tz = icaltimezone_new();
1003 if ( !icaltimezone_set_component( tz, vtimezone ) ) {
1004 icaltimezone_free( tz, 1 );
1008 readIncidence( vevent, tz, event);
1010 icalproperty *p = icalcomponent_get_first_property( vevent, ICAL_ANY_PROPERTY );
1013 icaltimetype icaltime;
1015 TQStringList categories;
1016 icalproperty_transp transparency;
1018 bool dtEndProcessed =
false;
1021 icalproperty_kind kind = icalproperty_isa( p );
1024 case ICAL_DTEND_PROPERTY:
1025 icaltime = icalproperty_get_dtend( p );
1026 if ( icaltime.is_date ) {
1028 TQDate endDate = readICalDate( icaltime ).addDays( -1 );
1030 mCompat->fixFloatingEnd( endDate );
1033 if ( endDate < event->dtStart().date() ) {
1034 endDate =
event->dtStart().date();
1036 event->setDtEnd( TQDateTime( endDate, TQTime( 0, 0, 0 ) ) );
1038 event->setDtEnd(readICalDateTime(p, icaltime, tz));
1039 event->setFloats(
false );
1041 dtEndProcessed =
true;
1044 case ICAL_RELATEDTO_PROPERTY:
1045 event->setRelatedToUid( TQString::fromUtf8( icalproperty_get_relatedto( p ) ) );
1046 mEventsRelate.append( event );
1049 case ICAL_TRANSP_PROPERTY:
1050 transparency = icalproperty_get_transp( p );
1051 if ( transparency == ICAL_TRANSP_TRANSPARENT ) {
1052 event->setTransparency( Event::Transparent );
1054 event->setTransparency( Event::Opaque );
1064 p = icalcomponent_get_next_property( vevent, ICAL_ANY_PROPERTY );
1069 if ( !dtEndProcessed && !event->hasDuration() ) {
1070 event->setDtEnd( event->
dtStart() );
1073 const TQString msade =
event->nonKDECustomProperty(
"X-MICROSOFT-CDO-ALLDAYEVENT");
1074 if ( !msade.isEmpty() ) {
1075 const bool floats = ( msade == TQString::fromLatin1(
"TRUE") );
1076 event->setFloats(floats);
1080 mCompat->fixEmptySummary( event );
1086 FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy)
1090 readIncidenceBase(vfreebusy, freebusy);
1092 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY);
1094 icaltimetype icaltime;
1098 icalproperty_kind kind = icalproperty_isa(p);
1101 case ICAL_DTSTART_PROPERTY:
1102 icaltime = icalproperty_get_dtstart(p);
1103 freebusy->
setDtStart(readICalDateTime(p, icaltime));
1106 case ICAL_DTEND_PROPERTY:
1107 icaltime = icalproperty_get_dtend(p);
1108 freebusy->setDtEnd(readICalDateTime(p, icaltime));
1111 case ICAL_FREEBUSY_PROPERTY:
1113 icalperiodtype icalperiod = icalproperty_get_freebusy(p);
1114 TQDateTime period_start = readICalDateTime(p, icalperiod.start);
1116 if ( !icaltime_is_null_time(icalperiod.end) ) {
1117 TQDateTime period_end = readICalDateTime(p, icalperiod.end);
1118 period =
Period(period_start, period_end);
1120 Duration duration = readICalDuration( icalperiod.duration );
1121 period =
Period(period_start, duration);
1123 icalparameter *param = icalproperty_get_first_parameter( p, ICAL_X_PARAMETER );
1125 if ( strncmp( icalparameter_get_xname( param ),
"X-SUMMARY", 9 ) == 0 ) {
1126 period.setSummary( TQString::fromUtf8(
1127 KCodecs::base64Decode( TQCString( icalparameter_get_xvalue( param ) ) ) ) );
1129 if ( strncmp( icalparameter_get_xname( param ),
"X-LOCATION", 10 ) == 0 ) {
1130 period.setLocation( TQString::fromUtf8(
1131 KCodecs::base64Decode( TQCString( icalparameter_get_xvalue( param ) ) ) ) );
1133 param = icalproperty_get_next_parameter( p, ICAL_X_PARAMETER );
1135 periods.append( period );
1144 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY);
1151 Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal)
1155 readIncidence(vjournal, 0, journal);
1160 Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee)
1162 icalparameter *p = 0;
1164 TQString email = TQString::fromUtf8(icalproperty_get_attendee(attendee));
1165 if ( email.startsWith(
"mailto:",
false ) ) {
1166 email = email.mid( 7 );
1170 TQString uid = TQString();
1171 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER);
1173 name = TQString::fromUtf8(icalparameter_get_cn(p));
1178 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER);
1180 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p);
1181 if (rsvpParameter == ICAL_RSVP_TRUE) rsvp =
true;
1184 Attendee::PartStat status = Attendee::NeedsAction;
1185 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER);
1187 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p);
1188 switch(partStatParameter) {
1190 case ICAL_PARTSTAT_NEEDSACTION:
1191 status = Attendee::NeedsAction;
1193 case ICAL_PARTSTAT_ACCEPTED:
1194 status = Attendee::Accepted;
1196 case ICAL_PARTSTAT_DECLINED:
1197 status = Attendee::Declined;
1199 case ICAL_PARTSTAT_TENTATIVE:
1200 status = Attendee::Tentative;
1202 case ICAL_PARTSTAT_DELEGATED:
1203 status = Attendee::Delegated;
1205 case ICAL_PARTSTAT_COMPLETED:
1206 status = Attendee::Completed;
1208 case ICAL_PARTSTAT_INPROCESS:
1209 status = Attendee::InProcess;
1214 Attendee::Role role = Attendee::ReqParticipant;
1215 p = icalproperty_get_first_parameter(attendee,ICAL_ROLE_PARAMETER);
1217 icalparameter_role roleParameter = icalparameter_get_role(p);
1218 switch(roleParameter) {
1219 case ICAL_ROLE_CHAIR:
1220 role = Attendee::Chair;
1223 case ICAL_ROLE_REQPARTICIPANT:
1224 role = Attendee::ReqParticipant;
1226 case ICAL_ROLE_OPTPARTICIPANT:
1227 role = Attendee::OptParticipant;
1229 case ICAL_ROLE_NONPARTICIPANT:
1230 role = Attendee::NonParticipant;
1235 p = icalproperty_get_first_parameter(attendee,ICAL_X_PARAMETER);
1236 uid = icalparameter_get_xvalue(p);
1247 p = icalproperty_get_first_parameter( attendee, ICAL_DELEGATEDTO_PARAMETER );
1249 a->
setDelegate( icalparameter_get_delegatedto( p ) );
1251 p = icalproperty_get_first_parameter( attendee, ICAL_DELEGATEDFROM_PARAMETER );
1253 a->
setDelegator( icalparameter_get_delegatedfrom( p ) );
1258 Person ICalFormatImpl::readOrganizer( icalproperty *organizer )
1260 TQString email = TQString::fromUtf8(icalproperty_get_organizer(organizer));
1261 if ( email.startsWith(
"mailto:",
false ) ) {
1262 email = email.mid( 7 );
1266 icalparameter *p = icalproperty_get_first_parameter(
1267 organizer, ICAL_CN_PARAMETER );
1270 cn = TQString::fromUtf8( icalparameter_get_cn( p ) );
1277 Attachment *ICalFormatImpl::readAttachment(icalproperty *attach)
1282 icalvalue *value = icalproperty_get_value( attach );
1284 switch( icalvalue_isa( value ) ) {
1285 case ICAL_ATTACH_VALUE:
1287 icalattach *a = icalproperty_get_attach( attach );
1288 if ( !icalattach_get_is_url( a ) ) {
1289 p = (
const char *)icalattach_get_data( a );
1294 p = icalattach_get_url( a );
1296 attachment =
new Attachment( TQString::fromUtf8( p ) );
1301 case ICAL_BINARY_VALUE:
1303 icalattach *a = icalproperty_get_attach( attach );
1304 p = (
const char *)icalattach_get_data( a );
1310 case ICAL_URI_VALUE:
1311 p = icalvalue_get_uri( value );
1312 attachment =
new Attachment( TQString::fromUtf8( p ) );
1320 icalproperty_get_first_parameter( attach, ICAL_FMTTYPE_PARAMETER );
1322 attachment->setMimeType( TQString( icalparameter_get_fmttype( p ) ) );
1325 p = icalproperty_get_first_parameter( attach, ICAL_X_PARAMETER );
1327 TQString xname = TQString( icalparameter_get_xname( p ) ).upper();
1328 TQString xvalue = TQString::fromUtf8( icalparameter_get_xvalue( p ) );
1329 if ( xname ==
"X-CONTENT-DISPOSITION" ) {
1330 attachment->setShowInline( xvalue.lower() ==
"inline" );
1332 if ( xname ==
"X-LABEL" ) {
1333 attachment->setLabel( xvalue );
1335 p = icalproperty_get_next_parameter( attach, ICAL_X_PARAMETER );
1338 p = icalproperty_get_first_parameter( attach, ICAL_X_PARAMETER );
1340 if ( strncmp( icalparameter_get_xname( p ),
"X-LABEL", 7 ) == 0 ) {
1341 attachment->setLabel( TQString::fromUtf8( icalparameter_get_xvalue( p ) ) );
1343 p = icalproperty_get_next_parameter( attach, ICAL_X_PARAMETER );
1350 void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz,
Incidence *incidence)
1352 readIncidenceBase(parent,incidence);
1354 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
1357 int intvalue, inttext;
1358 icaltimetype icaltime;
1359 icaldurationtype icalduration;
1361 TQStringList categories;
1364 icalproperty_kind kind = icalproperty_isa(p);
1367 case ICAL_CREATED_PROPERTY:
1368 icaltime = icalproperty_get_created(p);
1369 incidence->
setCreated(readICalDateTime(p, icaltime, tz));
1372 case ICAL_SEQUENCE_PROPERTY:
1373 intvalue = icalproperty_get_sequence(p);
1377 case ICAL_LASTMODIFIED_PROPERTY:
1378 icaltime = icalproperty_get_lastmodified(p);
1382 case ICAL_DTSTART_PROPERTY:
1383 icaltime = icalproperty_get_dtstart(p);
1384 if (icaltime.is_date) {
1385 incidence->
setDtStart(TQDateTime(readICalDate(icaltime),TQTime(0,0,0)));
1388 incidence->
setDtStart(readICalDateTime(p, icaltime, tz));
1393 case ICAL_DURATION_PROPERTY:
1394 icalduration = icalproperty_get_duration(p);
1395 incidence->setDuration(readICalDuration(icalduration));
1398 case ICAL_DESCRIPTION_PROPERTY:
1399 text = icalproperty_get_description(p);
1403 case ICAL_SUMMARY_PROPERTY:
1404 text = icalproperty_get_summary(p);
1405 incidence->
setSummary(TQString::fromUtf8(text));
1408 case ICAL_LOCATION_PROPERTY:
1409 text = icalproperty_get_location(p);
1413 case ICAL_STATUS_PROPERTY: {
1415 switch (icalproperty_get_status(p)) {
1416 case ICAL_STATUS_TENTATIVE: stat = Incidence::StatusTentative;
break;
1417 case ICAL_STATUS_CONFIRMED: stat = Incidence::StatusConfirmed;
break;
1418 case ICAL_STATUS_COMPLETED: stat = Incidence::StatusCompleted;
break;
1419 case ICAL_STATUS_NEEDSACTION: stat = Incidence::StatusNeedsAction;
break;
1420 case ICAL_STATUS_CANCELLED: stat = Incidence::StatusCanceled;
break;
1421 case ICAL_STATUS_INPROCESS: stat = Incidence::StatusInProcess;
break;
1422 case ICAL_STATUS_DRAFT: stat = Incidence::StatusDraft;
break;
1423 case ICAL_STATUS_FINAL: stat = Incidence::StatusFinal;
break;
1425 incidence->
setCustomStatus(TQString::fromUtf8(icalvalue_get_x(icalproperty_get_value(p))));
1426 stat = Incidence::StatusX;
1428 case ICAL_STATUS_NONE:
1429 default: stat = Incidence::StatusNone;
break;
1431 if (stat != Incidence::StatusX)
1436 case ICAL_PRIORITY_PROPERTY:
1437 intvalue = icalproperty_get_priority( p );
1439 intvalue = mCompat->fixPriority( intvalue );
1443 case ICAL_CATEGORIES_PROPERTY:
1444 text = icalproperty_get_categories(p);
1445 categories.append(TQString::fromUtf8(text));
1448 case ICAL_RECURRENCEID_PROPERTY:
1449 icaltime = icalproperty_get_recurrenceid(p);
1454 case ICAL_RRULE_PROPERTY:
1455 readRecurrenceRule( p, incidence );
1463 case ICAL_RDATE_PROPERTY: {
1464 icaldatetimeperiodtype rd = icalproperty_get_rdate( p );
1465 if ( icaltime_is_valid_time( rd.time ) ) {
1466 if ( icaltime_is_date( rd.time ) ) {
1467 incidence->
recurrence()->addRDate( readICalDate( rd.time ) );
1469 incidence->
recurrence()->addRDateTime( readICalDateTime(p, rd.time, tz ) );
1476 case ICAL_EXRULE_PROPERTY:
1477 readExceptionRule( p, incidence );
1480 case ICAL_EXDATE_PROPERTY:
1481 icaltime = icalproperty_get_exdate(p);
1482 if ( icaltime_is_date(icaltime) ) {
1483 incidence->
recurrence()->addExDate( readICalDate(icaltime) );
1485 incidence->
recurrence()->addExDateTime( readICalDateTime(p, icaltime, tz) );
1489 case ICAL_CLASS_PROPERTY:
1490 inttext = icalproperty_get_class(p);
1491 if (inttext == ICAL_CLASS_PUBLIC ) {
1492 incidence->
setSecrecy(Incidence::SecrecyPublic);
1493 }
else if (inttext == ICAL_CLASS_CONFIDENTIAL ) {
1494 incidence->
setSecrecy(Incidence::SecrecyConfidential);
1496 incidence->
setSecrecy(Incidence::SecrecyPrivate);
1500 case ICAL_ATTACH_PROPERTY:
1510 p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY);
1514 const TQString uid = incidence->
customProperty(
"LIBKCAL",
"ID" );
1515 if ( !uid.isNull() ) {
1520 incidence->
setUid( uid );
1525 if ( incidence->
doesRecur() && mCompat )
1526 mCompat->fixRecurrence( incidence );
1532 for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT);
1534 alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) {
1535 readAlarm(alarm,incidence);
1538 if ( mCompat ) mCompat->fixAlarms( incidence );
1542 void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,
IncidenceBase *incidenceBase)
1544 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
1546 bool uidProcessed =
false;
1549 icalproperty_kind kind = icalproperty_isa( p );
1552 case ICAL_UID_PROPERTY:
1553 uidProcessed =
true;
1554 incidenceBase->
setUid( TQString::fromUtf8(icalproperty_get_uid( p ) ) );
1557 case ICAL_ORGANIZER_PROPERTY:
1561 case ICAL_ATTENDEE_PROPERTY:
1565 case ICAL_COMMENT_PROPERTY:
1567 TQString::fromUtf8( icalproperty_get_comment( p ) ) );
1574 p = icalcomponent_get_next_property( parent, ICAL_ANY_PROPERTY );
1577 if ( !uidProcessed ) {
1578 kdWarning() <<
"The incidence didn't have any UID! Report a bug "
1579 <<
"to the application that generated this file."
1584 incidenceBase->
setUid( TQString() );
1596 icalproperty *next =0;
1598 for ( p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
1603 next = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
1605 TQString value = TQString::fromUtf8(icalproperty_get_x(p));
1606 TQString name = icalproperty_get_x_name(p);
1608 if (name ==
"X-PILOTID" && !value.isEmpty()) {
1610 icalcomponent_remove_property(parent,p);
1611 }
else if (name ==
"X-PILOTSTAT" && !value.isEmpty()) {
1613 icalcomponent_remove_property(parent,p);
1618 readCustomProperties(parent, incidenceBase);
1621 void ICalFormatImpl::readCustomProperties(icalcomponent *parent,
CustomProperties *properties)
1623 TQMap<TQCString, TQString> customProperties;
1624 TQString lastProperty;
1626 icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
1630 TQString value = TQString::fromUtf8(icalproperty_get_x(p));
1631 const char *name = icalproperty_get_x_name(p);
1632 if ( lastProperty != name ) {
1633 customProperties[name] = value;
1635 customProperties[name] = customProperties[name].append(
"," ).append( value );
1638 p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
1639 lastProperty = name;
1647 void ICalFormatImpl::readRecurrenceRule(icalproperty *rrule,
Incidence *incidence )
1653 struct icalrecurrencetype r = icalproperty_get_rrule(rrule);
1658 readRecurrence( r, recurrule );
1659 recur->addRRule( recurrule );
1662 void ICalFormatImpl::readExceptionRule( icalproperty *rrule,
Incidence *incidence )
1666 struct icalrecurrencetype r = icalproperty_get_exrule(rrule);
1671 readRecurrence( r, recurrule );
1674 recur->addExRule( recurrule );
1677 void ICalFormatImpl::readRecurrence(
const struct icalrecurrencetype &r,
RecurrenceRule* recur )
1680 recur->mRRule = TQString( icalrecurrencetype_as_string(
const_cast<struct icalrecurrencetype*
>(&r) ) );
1683 case ICAL_SECONDLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rSecondly );
break;
1684 case ICAL_MINUTELY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rMinutely );
break;
1685 case ICAL_HOURLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rHourly );
break;
1686 case ICAL_DAILY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rDaily );
break;
1687 case ICAL_WEEKLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rWeekly );
break;
1688 case ICAL_MONTHLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rMonthly );
break;
1689 case ICAL_YEARLY_RECURRENCE: recur->setRecurrenceType( RecurrenceRule::rYearly );
break;
1690 case ICAL_NO_RECURRENCE:
1692 recur->setRecurrenceType( RecurrenceRule::rNone );
1698 if ( !icaltime_is_null_time( r.until ) ) {
1702 TQDateTime endDate( readICalDateTime(0, t) );
1712 int wkst = (r.week_start + 5)%7 + 1;
1713 recur->setWeekStart( wkst );
1716 TQValueList<int> lst;
1720 #define readSetByList(rrulecomp,setfunc) \
1723 while ( (i = r.rrulecomp[index++] ) != ICAL_RECURRENCE_ARRAY_MAX ) \
1725 if ( !lst.isEmpty() ) recur->setfunc( lst );
1730 readSetByList( by_second, setBySeconds );
1731 readSetByList( by_minute, setByMinutes );
1732 readSetByList( by_hour, setByHours );
1733 readSetByList( by_month_day, setByMonthDays );
1734 readSetByList( by_year_day, setByYearDays );
1735 readSetByList( by_week_no, setByWeekNumbers );
1736 readSetByList( by_month, setByMonths );
1737 readSetByList( by_set_pos, setBySetPos );
1738 #undef readSetByList
1741 TQValueList<RecurrenceRule::WDayPos> wdlst;
1744 while((day = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
1746 pos.setDay( ( icalrecurrencetype_day_day_of_week( day ) + 5 )%7 + 1 );
1747 pos.setPos( icalrecurrencetype_day_position( day ) );
1749 wdlst.append( pos );
1751 if ( !wdlst.isEmpty() ) recur->setByDays( wdlst );
1759 void ICalFormatImpl::readAlarm(icalcomponent *alarm,
Incidence *incidence)
1768 icalproperty *p = icalcomponent_get_first_property(alarm,ICAL_ACTION_PROPERTY);
1769 Alarm::Type type = Alarm::Display;
1770 icalproperty_action action = ICAL_ACTION_DISPLAY;
1772 kdDebug(5800) <<
"Unknown type of alarm, using default" << endl;
1776 action = icalproperty_get_action(p);
1778 case ICAL_ACTION_DISPLAY: type = Alarm::Display;
break;
1779 case ICAL_ACTION_AUDIO: type = Alarm::Audio;
break;
1780 case ICAL_ACTION_PROCEDURE: type = Alarm::Procedure;
break;
1781 case ICAL_ACTION_EMAIL: type = Alarm::Email;
break;
1783 kdDebug(5800) <<
"Unknown type of alarm: " << action << endl;
1790 p = icalcomponent_get_first_property(alarm,ICAL_ANY_PROPERTY);
1792 icalproperty_kind kind = icalproperty_isa(p);
1796 case ICAL_TRIGGER_PROPERTY: {
1797 icaltriggertype trigger = icalproperty_get_trigger(p);
1798 if (icaltime_is_null_time(trigger.time)) {
1799 if (icaldurationtype_is_null_duration(trigger.duration)) {
1800 kdDebug(5800) <<
"ICalFormatImpl::readAlarm(): Trigger has no time and no duration." << endl;
1802 Duration duration = icaldurationtype_as_int( trigger.duration );
1803 icalparameter *param = icalproperty_get_first_parameter(p,ICAL_RELATED_PARAMETER);
1804 if (param && icalparameter_get_related(param) == ICAL_RELATED_END)
1810 ialarm->
setTime(readICalDateTime(p, trigger.time));
1814 case ICAL_DURATION_PROPERTY: {
1815 icaldurationtype duration = icalproperty_get_duration(p);
1819 case ICAL_REPEAT_PROPERTY:
1824 case ICAL_DESCRIPTION_PROPERTY: {
1825 TQString description = TQString::fromUtf8(icalproperty_get_description(p));
1827 case ICAL_ACTION_DISPLAY:
1828 ialarm->
setText( description );
1830 case ICAL_ACTION_PROCEDURE:
1833 case ICAL_ACTION_EMAIL:
1842 case ICAL_SUMMARY_PROPERTY:
1843 ialarm->
setMailSubject(TQString::fromUtf8(icalproperty_get_summary(p)));
1847 case ICAL_ATTENDEE_PROPERTY: {
1848 TQString email = TQString::fromUtf8(icalproperty_get_attendee(p));
1849 if ( email.startsWith(
"mailto:",
false ) ) {
1850 email = email.mid( 7 );
1853 icalparameter *param = icalproperty_get_first_parameter(p,ICAL_CN_PARAMETER);
1855 name = TQString::fromUtf8(icalparameter_get_cn(param));
1861 case ICAL_ATTACH_PROPERTY: {
1863 if ( attach && attach->isUri() ) {
1865 case ICAL_ACTION_AUDIO:
1868 case ICAL_ACTION_PROCEDURE:
1871 case ICAL_ACTION_EMAIL:
1878 kdDebug() <<
"Alarm attachments currently only support URIs, but "
1879 "no binary data" << endl;
1888 p = icalcomponent_get_next_property(alarm,ICAL_ANY_PROPERTY);
1892 readCustomProperties(alarm, ialarm);
1897 icaldatetimeperiodtype ICalFormatImpl::writeICalDatePeriod(
const TQDate &date )
1899 icaldatetimeperiodtype t;
1900 t.time = writeICalDate( date );
1901 t.period = icalperiodtype_null_period();
1905 icaldatetimeperiodtype ICalFormatImpl::writeICalDateTimePeriod(
const TQDateTime &date )
1907 icaldatetimeperiodtype t;
1908 t.time = writeICalDateTime( date );
1909 t.period = icalperiodtype_null_period();
1913 icaltimetype ICalFormatImpl::writeICalDate(
const TQDate &date)
1915 icaltimetype t = icaltime_null_time();
1917 t.year = date.year();
1918 t.month = date.month();
1926 #ifndef USE_LIBICAL_3_0
1934 icaltimetype ICalFormatImpl::writeICalDateTime(
const TQDateTime &datetime)
1936 icaltimetype t = icaltime_null_time();
1938 t.year = datetime.date().year();
1939 t.month = datetime.date().month();
1940 t.day = datetime.date().day();
1942 t.hour = datetime.time().hour();
1943 t.minute = datetime.time().minute();
1944 t.second = datetime.time().second();
1947 t.zone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
1948 #ifndef USE_LIBICAL_3_0
1956 if (mParent->timeZoneId().isEmpty())
1957 t = icaltime_convert_to_zone( t, 0 );
1959 icaltimezone* tz = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
1960 icaltimezone* utc = icaltimezone_get_utc_timezone();
1963 t = icaltime_convert_to_zone( t, utc );
1965 #ifndef USE_LIBICAL_3_0
1976 TQDateTime ICalFormatImpl::readICalDateTime( icalproperty *p, icaltimetype& t, icaltimezone* tz )
1979 #ifdef USE_LIBICAL_3_0
1980 bool time_is_utc = icaltime_is_utc(t);
1982 bool time_is_utc = t.is_utc;
1984 if ( !time_is_utc ) {
1987 icalparameter *param = p ? icalproperty_get_first_parameter(p, ICAL_TZID_PARAMETER) : 0;
1988 const char *tzid = param ? icalparameter_get_tzid(param) : 0;
1990 icaltimezone* icaltz;
1992 icaltz = icaltimezone_get_builtin_timezone( tzid );
1999 if (tz && tz != icaltimezone_get_utc_timezone()) {
2000 #ifndef USE_LIBICAL_3_0
2006 #ifndef USE_LIBICAL_3_0
2009 t.zone = icaltimezone_get_utc_timezone();
2013 t.zone = icaltimezone_get_utc_timezone();
2018 if ( !mParent->timeZoneId().isEmpty() && t.zone ) {
2020 icaltimezone* viewTimeZone = icaltimezone_get_builtin_timezone ( mParent->timeZoneId().latin1() );
2021 icaltimezone_convert_time( &t,
const_cast<icaltimezone*
>(t.zone), viewTimeZone );
2025 return ICalDate2TQDate(t);
2028 TQDate ICalFormatImpl::readICalDate(icaltimetype t)
2030 return ICalDate2TQDate(t).date();
2033 icaldurationtype ICalFormatImpl::writeICalDuration(
int seconds)
2041 d.is_neg = (seconds<0)?1:0;
2042 if (seconds<0) seconds = -seconds;
2045 d.days = seconds / gSecondsPerDay;
2046 seconds %= gSecondsPerDay;
2047 d.hours = seconds / gSecondsPerHour;
2048 seconds %= gSecondsPerHour;
2049 d.minutes = seconds / gSecondsPerMinute;
2050 seconds %= gSecondsPerMinute;
2051 d.seconds = seconds;
2056 int ICalFormatImpl::readICalDuration(icaldurationtype d)
2060 result += d.weeks * gSecondsPerWeek;
2061 result += d.days * gSecondsPerDay;
2062 result += d.hours * gSecondsPerHour;
2063 result += d.minutes * gSecondsPerMinute;
2064 result += d.seconds;
2066 if (d.is_neg) result *= -1;
2071 icalcomponent *ICalFormatImpl::createCalendarComponent(
Calendar *cal)
2073 icalcomponent *calendar;
2076 calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
2081 p = icalproperty_new_prodid(CalFormat::productId().utf8());
2082 icalcomponent_add_property(calendar,p);
2087 p = icalproperty_new_version(
const_cast<char *
>(_ICAL_VERSION));
2088 icalcomponent_add_property(calendar,p);
2092 writeCustomProperties(calendar, cal);
2102 bool ICalFormatImpl::populate(
Calendar *cal, icalcomponent *calendar )
2107 if (!calendar)
return false;
2113 p = icalcomponent_get_first_property(calendar,ICAL_PRODID_PROPERTY);
2115 kdDebug(5800) <<
"No PRODID property found" << endl;
2116 mLoadedProductId =
"";
2118 mLoadedProductId = TQString::fromUtf8(icalproperty_get_prodid(p));
2122 mCompat = CompatFactory::createCompat( mLoadedProductId );
2125 p = icalcomponent_get_first_property(calendar,ICAL_VERSION_PROPERTY);
2127 kdDebug(5800) <<
"No VERSION property found" << endl;
2128 mParent->setException(
new ErrorFormat(ErrorFormat::CalVersionUnknown));
2131 const char *version = icalproperty_get_version(p);
2133 kdDebug(5800) <<
"No VERSION property found" << endl;
2135 ErrorFormat::CalVersionUnknown,
2136 i18n(
"No VERSION property found" ) ) );
2142 if (strcmp(version,
"1.0") == 0) {
2143 kdDebug(5800) <<
"Expected iCalendar, got vCalendar" << endl;
2144 mParent->setException(
new ErrorFormat(ErrorFormat::CalVersion1,
2145 i18n(
"Expected iCalendar format")));
2147 }
else if (strcmp(version,
"2.0") != 0) {
2148 kdDebug(5800) <<
"Expected iCalendar, got unknown format" << endl;
2149 mParent->setException(
new ErrorFormat(ErrorFormat::CalVersionUnknown));
2155 readCustomProperties(calendar, cal);
2160 icalcomponent *ctz =
2161 icalcomponent_get_first_component( calendar, ICAL_VTIMEZONE_COMPONENT );
2164 mEventsRelate.clear();
2165 mTodosRelate.clear();
2171 c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT);
2174 Todo *todo = readTodo(c);
2177 TQString originalUid = todo->
uid();
2178 todo->
setUid(originalUid + TQString(
"-recur-%1").arg(todo->
recurrenceID().toTime_t()));
2179 if (!cal->
todo(todo->
uid())) {
2180 if ( !cal->
addTodo( todo ) ) {
2185 if (!cal->
event(originalUid)) {
2186 printf(
"FIXME! [WARNING] Parent for child event does not yet exist!\n");
2197 if (!cal->
todo(todo->
uid())) {
2198 if ( !cal->
addTodo( todo ) ) {
2205 mTodosRelate.remove( todo );
2209 c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT);
2213 c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT);
2216 Event *
event = readEvent(c, ctz);
2219 TQString originalUid =
event->uid();
2220 event->setUid(originalUid + TQString(
"-recur-%1").arg(event->
recurrenceID().toTime_t()));
2223 if (!cal->
event(originalUid)) {
2224 printf(
"FIXME! [WARNING] Parent for child event does not yet exist!\n");
2230 event->addChildIncidence(cal->
event(originalUid)->
uid());
2243 mEventsRelate.remove( event );
2247 c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT);
2251 c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT);
2254 Journal *journal = readJournal(c);
2257 TQString originalUid = journal->
uid();
2258 journal->
setUid(originalUid + TQString(
"-recur-%1").arg(journal->
recurrenceID().toTime_t()));
2261 if (!cal->
event(originalUid)) {
2262 printf(
"FIXME! [WARNING] Parent for child event does not yet exist!\n");
2284 c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT);
2290 Event::List::ConstIterator eIt;
2291 for ( eIt = mEventsRelate.begin(); eIt != mEventsRelate.end(); ++eIt ) {
2292 (*eIt)->setRelatedTo( cal->
incidence( (*eIt)->relatedToUid() ) );
2294 Todo::List::ConstIterator tIt;
2295 for ( tIt = mTodosRelate.begin(); tIt != mTodosRelate.end(); ++tIt ) {
2296 (*tIt)->setRelatedTo( cal->
incidence( (*tIt)->relatedToUid() ) );
2302 TQString ICalFormatImpl::extractErrorProperty(icalcomponent *c)
2307 TQString errorMessage;
2309 icalproperty *error;
2310 error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY);
2312 errorMessage += icalproperty_get_xlicerror(error);
2313 errorMessage +=
"\n";
2314 error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY);
2319 return errorMessage;
2322 void ICalFormatImpl::dumpIcalRecurrence(icalrecurrencetype r)
2326 kdDebug(5800) <<
" Freq: " << r.freq << endl;
2327 kdDebug(5800) <<
" Until: " << icaltime_as_ical_string(r.until) << endl;
2328 kdDebug(5800) <<
" Count: " << r.count << endl;
2329 if (r.by_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2331 TQString out =
" By Day: ";
2332 while((i = r.by_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2333 out.append(TQString::number(i) +
" ");
2335 kdDebug(5800) << out << endl;
2337 if (r.by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2339 TQString out =
" By Month Day: ";
2340 while((i = r.by_month_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2341 out.append(TQString::number(i) +
" ");
2343 kdDebug(5800) << out << endl;
2345 if (r.by_year_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2347 TQString out =
" By Year Day: ";
2348 while((i = r.by_year_day[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2349 out.append(TQString::number(i) +
" ");
2351 kdDebug(5800) << out << endl;
2353 if (r.by_month[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2355 TQString out =
" By Month: ";
2356 while((i = r.by_month[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2357 out.append(TQString::number(i) +
" ");
2359 kdDebug(5800) << out << endl;
2361 if (r.by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX) {
2363 TQString out =
" By Set Pos: ";
2364 while((i = r.by_set_pos[index++]) != ICAL_RECURRENCE_ARRAY_MAX) {
2365 kdDebug(5800) <<
"========= " << i << endl;
2366 out.append(TQString::number(i) +
" ");
2368 kdDebug(5800) << out << endl;
2372 icalcomponent *ICalFormatImpl::createScheduleComponent(
IncidenceBase *incidence,
2375 icalcomponent *message = createCalendarComponent();
2377 icalproperty_method icalmethod = ICAL_METHOD_NONE;
2380 case Scheduler::Publish:
2381 icalmethod = ICAL_METHOD_PUBLISH;
2383 case Scheduler::Request:
2384 icalmethod = ICAL_METHOD_REQUEST;
2386 case Scheduler::Refresh:
2387 icalmethod = ICAL_METHOD_REFRESH;
2389 case Scheduler::Cancel:
2390 icalmethod = ICAL_METHOD_CANCEL;
2392 case Scheduler::Add:
2393 icalmethod = ICAL_METHOD_ADD;
2395 case Scheduler::Reply:
2396 icalmethod = ICAL_METHOD_REPLY;
2398 case Scheduler::Counter:
2399 icalmethod = ICAL_METHOD_COUNTER;
2401 case Scheduler::Declinecounter:
2402 icalmethod = ICAL_METHOD_DECLINECOUNTER;
2405 kdDebug(5800) <<
"ICalFormat::createScheduleMessage(): Unknow method" << endl;
2409 icalcomponent_add_property(message,icalproperty_new_method(icalmethod));
2411 icalcomponent *inc = writeIncidence( incidence, method );
2420 if ( icalmethod == ICAL_METHOD_REPLY ) {
2421 struct icalreqstattype rst;
2422 rst.code = ICAL_2_0_SUCCESS_STATUS;
2425 icalcomponent_add_property( inc, icalproperty_new_requeststatus( rst ) );
2427 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.