diff options
Diffstat (limited to 'libkcal/icalformatimpl.cpp')
-rw-r--r-- | libkcal/icalformatimpl.cpp | 156 |
1 files changed, 77 insertions, 79 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index bdbc1f7be..297118b59 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp @@ -83,8 +83,8 @@ const int gSecondsPerHour = gSecondsPerMinute * 60; const int gSecondsPerDay = gSecondsPerHour * 24; const int gSecondsPerWeek = gSecondsPerDay * 7; -ICalFormatImpl::ICalFormatImpl( ICalFormat *parent ) : - mParent( parent ), mCompat( new Compat ) +ICalFormatImpl::ICalFormatImpl( ICalFormat *tqparent ) : + mParent( tqparent ), mCompat( new Compat ) { } @@ -247,11 +247,9 @@ icalcomponent *ICalFormatImpl::writeEvent(Event *event) icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy, Scheduler::Method method) { -#if QT_VERSION >= 300 kdDebug(5800) << "icalformatimpl: writeFreeBusy: startDate: " << freebusy->dtStart().toString("ddd MMMM d yyyy: h:m:s ap") << " End Date: " << freebusy->dtEnd().toString("ddd MMMM d yyyy: h:m:s ap") << endl; -#endif icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT); @@ -307,30 +305,30 @@ icalcomponent *ICalFormatImpl::writeJournal(Journal *journal) return vjournal; } -void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) +void ICalFormatImpl::writeIncidence(icalcomponent *tqparent,Incidence *incidence) { // pilot sync stuff // TODO: move this application-specific code to kpilot if (incidence->pilotId()) { // NOTE: we can't do setNonKDECustomProperty here because this changes // data and triggers an updated() event... - // incidence->setNonKDECustomProperty("X-PILOTSTAT", TQString::number(incidence->syncStatus())); + // incidence->setNonKDECustomProperty("X-PILOTSTAT", TQString::number(incidence->synctqStatus())); // incidence->setNonKDECustomProperty("X-PILOTID", TQString::number(incidence->pilotId())); icalproperty *p = 0; - p = icalproperty_new_x(TQString::number(incidence->syncStatus()).utf8()); + p = icalproperty_new_x(TQString::number(incidence->synctqStatus()).utf8()); icalproperty_set_x_name(p,"X-PILOTSTAT"); - icalcomponent_add_property(parent,p); + icalcomponent_add_property(tqparent,p); p = icalproperty_new_x(TQString::number(incidence->pilotId()).utf8()); icalproperty_set_x_name(p,"X-PILOTID"); - icalcomponent_add_property(parent,p); + icalcomponent_add_property(tqparent,p); } TQString modifiedUid; if ( incidence->hasRecurrenceID() ) { - // Recurring incidences are special; they must match their parent's UID - // Each child has the parent set as the first item in the list + // Recurring incidences are special; they must match their tqparent's UID + // Each child has the tqparent set as the first item in the list // So, get and set the UID... IncidenceList il = incidence->childIncidences(); IncidenceListIterator it; @@ -348,53 +346,53 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) else incidence->removeCustomProperty( "LIBKCAL", "ID" ); - writeIncidenceBase(parent,incidence); + writeIncidenceBase(tqparent,incidence); // creation date - icalcomponent_add_property(parent,icalproperty_new_created( + icalcomponent_add_property(tqparent,icalproperty_new_created( writeICalDateTime(incidence->created()))); // unique id // If the scheduling ID is different from the real UID, the real // one is stored on X-REALID above if ( incidence->hasRecurrenceID() ) { - // Recurring incidences are special; they must match their parent's UID - icalcomponent_add_property(parent,icalproperty_new_uid(modifiedUid.utf8())); + // Recurring incidences are special; they must match their tqparent's UID + icalcomponent_add_property(tqparent,icalproperty_new_uid(modifiedUid.utf8())); } else { if ( !incidence->schedulingID().isEmpty() ) { - icalcomponent_add_property(parent,icalproperty_new_uid( + icalcomponent_add_property(tqparent,icalproperty_new_uid( incidence->schedulingID().utf8())); } } // revision if ( incidence->revision() > 0 ) { // 0 is default, so don't write that out - icalcomponent_add_property(parent,icalproperty_new_sequence( + icalcomponent_add_property(tqparent,icalproperty_new_sequence( incidence->revision())); } // last modification date if ( incidence->lastModified().isValid() ) { - icalcomponent_add_property(parent,icalproperty_new_lastmodified( + icalcomponent_add_property(tqparent,icalproperty_new_lastmodified( writeICalDateTime(incidence->lastModified()))); } // description if (!incidence->description().isEmpty()) { - icalcomponent_add_property(parent,icalproperty_new_description( + icalcomponent_add_property(tqparent,icalproperty_new_description( incidence->description().utf8())); } // summary if (!incidence->summary().isEmpty()) { - icalcomponent_add_property(parent,icalproperty_new_summary( + icalcomponent_add_property(tqparent,icalproperty_new_summary( incidence->summary().utf8())); } // location if (!incidence->location().isEmpty()) { - icalcomponent_add_property(parent,icalproperty_new_location( + icalcomponent_add_property(tqparent,icalproperty_new_location( incidence->location().utf8())); } @@ -412,7 +410,7 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) case Incidence::StatusX: { icalproperty* p = icalproperty_new_status(ICAL_STATUS_X); icalvalue_set_x(icalproperty_get_value(p), incidence->statusStr().utf8()); - icalcomponent_add_property(parent, p); + icalcomponent_add_property(tqparent, p); break; } case Incidence::StatusNone: @@ -420,7 +418,7 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) break; } if (status != ICAL_STATUS_NONE) - icalcomponent_add_property(parent, icalproperty_new_status(status)); + icalcomponent_add_property(tqparent, icalproperty_new_status(status)); // secrecy icalproperty_class secClass; @@ -437,12 +435,12 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) break; } if ( secClass != ICAL_CLASS_PUBLIC ) { - icalcomponent_add_property(parent,icalproperty_new_class(secClass)); + icalcomponent_add_property(tqparent,icalproperty_new_class(secClass)); } // priority if ( incidence->priority() > 0 ) { // 0 is undefined priority - icalcomponent_add_property(parent,icalproperty_new_priority( + icalcomponent_add_property(tqparent,icalproperty_new_priority( incidence->priority())); } @@ -450,18 +448,18 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) TQStringList categories = incidence->categories(); TQStringList::Iterator it; for(it = categories.begin(); it != categories.end(); ++it ) { - icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); + icalcomponent_add_property(tqparent,icalproperty_new_categories((*it).utf8())); } // related event if ( !incidence->relatedToUid().isEmpty() ) { - icalcomponent_add_property(parent,icalproperty_new_relatedto( + icalcomponent_add_property(tqparent,icalproperty_new_relatedto( incidence->relatedToUid().utf8())); } // recurrenceid if ( incidence->hasRecurrenceID() ) { - icalcomponent_add_property(parent, icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID() ) )); + icalcomponent_add_property(tqparent, icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID() ) )); } // kdDebug(5800) << "Write recurrence for '" << incidence->summary() << "' (" << incidence->uid() @@ -470,27 +468,27 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) RecurrenceRule::List rrules( incidence->recurrence()->rRules() ); RecurrenceRule::List::ConstIterator rit; for ( rit = rrules.begin(); rit != rrules.end(); ++rit ) { - icalcomponent_add_property( parent, icalproperty_new_rrule( + icalcomponent_add_property( tqparent, icalproperty_new_rrule( writeRecurrenceRule( (*rit) ) ) ); } RecurrenceRule::List exrules( incidence->recurrence()->exRules() ); RecurrenceRule::List::ConstIterator exit; for ( exit = exrules.begin(); exit != exrules.end(); ++exit ) { - icalcomponent_add_property( parent, icalproperty_new_rrule( + icalcomponent_add_property( tqparent, icalproperty_new_rrule( writeRecurrenceRule( (*exit) ) ) ); } DateList dateList = incidence->recurrence()->exDates(); DateList::ConstIterator exIt; for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { - icalcomponent_add_property(parent,icalproperty_new_exdate( + icalcomponent_add_property(tqparent,icalproperty_new_exdate( writeICalDate(*exIt))); } DateTimeList dateTimeList = incidence->recurrence()->exDateTimes(); DateTimeList::ConstIterator extIt; for(extIt = dateTimeList.begin(); extIt != dateTimeList.end(); ++extIt) { - icalcomponent_add_property(parent,icalproperty_new_exdate( + icalcomponent_add_property(tqparent,icalproperty_new_exdate( writeICalDateTime(*extIt))); } @@ -498,13 +496,13 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) dateList = incidence->recurrence()->rDates(); DateList::ConstIterator rdIt; for( rdIt = dateList.begin(); rdIt != dateList.end(); ++rdIt) { - icalcomponent_add_property( parent, icalproperty_new_rdate( + icalcomponent_add_property( tqparent, icalproperty_new_rdate( writeICalDatePeriod(*rdIt) ) ); } dateTimeList = incidence->recurrence()->rDateTimes(); DateTimeList::ConstIterator rdtIt; for( rdtIt = dateTimeList.begin(); rdtIt != dateTimeList.end(); ++rdtIt) { - icalcomponent_add_property( parent, icalproperty_new_rdate( + icalcomponent_add_property( tqparent, icalproperty_new_rdate( writeICalDateTimePeriod(*rdtIt) ) ); } @@ -512,7 +510,7 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) Attachment::List attachments = incidence->attachments(); Attachment::List::ConstIterator atIt; for ( atIt = attachments.begin(); atIt != attachments.end(); ++atIt ) { - icalcomponent_add_property( parent, writeAttachment( *atIt ) ); + icalcomponent_add_property( tqparent, writeAttachment( *atIt ) ); } // alarms @@ -521,7 +519,7 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) alarmIt != incidence->alarms().end(); ++alarmIt ) { if ( (*alarmIt)->enabled() ) { // kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; - icalcomponent_add_component( parent, writeAlarm( *alarmIt ) ); + icalcomponent_add_component( tqparent, writeAlarm( *alarmIt ) ); } } @@ -529,19 +527,19 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) if (incidence->hasDuration()) { icaldurationtype duration; duration = writeICalDuration( incidence->duration() ); - icalcomponent_add_property(parent,icalproperty_new_duration(duration)); + icalcomponent_add_property(tqparent,icalproperty_new_duration(duration)); } } -void ICalFormatImpl::writeIncidenceBase( icalcomponent *parent, +void ICalFormatImpl::writeIncidenceBase( icalcomponent *tqparent, IncidenceBase * incidenceBase ) { - icalcomponent_add_property( parent, icalproperty_new_dtstamp( + icalcomponent_add_property( tqparent, icalproperty_new_dtstamp( writeICalDateTime( TQDateTime::tqcurrentDateTime() ) ) ); // organizer stuff if ( !incidenceBase->organizer().isEmpty() ) { - icalcomponent_add_property( parent, writeOrganizer( incidenceBase->organizer() ) ); + icalcomponent_add_property( tqparent, writeOrganizer( incidenceBase->organizer() ) ); } // attendees @@ -549,27 +547,27 @@ void ICalFormatImpl::writeIncidenceBase( icalcomponent *parent, Attendee::List::ConstIterator it; for( it = incidenceBase->attendees().begin(); it != incidenceBase->attendees().end(); ++it ) { - icalcomponent_add_property( parent, writeAttendee( *it ) ); + icalcomponent_add_property( tqparent, writeAttendee( *it ) ); } } // comments TQStringList comments = incidenceBase->comments(); for (TQStringList::Iterator it=comments.begin(); it!=comments.end(); ++it) { - icalcomponent_add_property(parent, icalproperty_new_comment((*it).utf8())); + icalcomponent_add_property(tqparent, icalproperty_new_comment((*it).utf8())); } // custom properties - writeCustomProperties( parent, incidenceBase ); + writeCustomProperties( tqparent, incidenceBase ); } -void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) +void ICalFormatImpl::writeCustomProperties(icalcomponent *tqparent,CustomProperties *properties) { TQMap<TQCString, TQString> custom = properties->customProperties(); for (TQMap<TQCString, TQString>::Iterator c = custom.begin(); c != custom.end(); ++c) { icalproperty *p = icalproperty_new_x(c.data().utf8()); icalproperty_set_x_name(p,c.key()); - icalcomponent_add_property(parent,p); + icalcomponent_add_property(tqparent,p); } } @@ -972,7 +970,7 @@ Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo) todo->setPercentComplete(icalproperty_get_percentcomplete(p)); break; - case ICAL_RELATEDTO_PROPERTY: // related todo (parent) + case ICAL_RELATEDTO_PROPERTY: // related todo (tqparent) todo->setRelatedToUid(TQString::fromUtf8(icalproperty_get_relatedto(p))); mTodosRelate.append(todo); break; @@ -1052,7 +1050,7 @@ Event *ICalFormatImpl::readEvent( icalcomponent *vevent, icalcomponent *vtimezon dtEndProcessed = true; break; - case ICAL_RELATEDTO_PROPERTY: // related event (parent) + case ICAL_RELATEDTO_PROPERTY: // related event (tqparent) event->setRelatedToUid( TQString::fromUtf8( icalproperty_get_relatedto( p ) ) ); mEventsRelate.append( event ); break; @@ -1178,7 +1176,7 @@ Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) } TQString name; - TQString uid = TQString::null; + TQString uid = TQString(); p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); if (p) { name = TQString::fromUtf8(icalparameter_get_cn(p)); @@ -1358,11 +1356,11 @@ Attachment *ICalFormatImpl::readAttachment(icalproperty *attach) return attachment; } -void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Incidence *incidence) +void ICalFormatImpl::readIncidence(icalcomponent *tqparent, icaltimezone *tz, Incidence *incidence) { - readIncidenceBase(parent,incidence); + readIncidenceBase(tqparent,incidence); - icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); + icalproperty *p = icalcomponent_get_first_property(tqparent,ICAL_ANY_PROPERTY); const char *text; int intvalue, inttext; @@ -1422,7 +1420,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Inci break; case ICAL_STATUS_PROPERTY: { // status - Incidence::Status stat; + Incidence::tqStatus stat; switch (icalproperty_get_status(p)) { case ICAL_STATUS_TENTATIVE: stat = Incidence::StatusTentative; break; case ICAL_STATUS_CONFIRMED: stat = Incidence::StatusConfirmed; break; @@ -1433,14 +1431,14 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Inci case ICAL_STATUS_DRAFT: stat = Incidence::StatusDraft; break; case ICAL_STATUS_FINAL: stat = Incidence::StatusFinal; break; case ICAL_STATUS_X: - incidence->setCustomStatus(TQString::fromUtf8(icalvalue_get_x(icalproperty_get_value(p)))); + incidence->setCustomtqStatus(TQString::fromUtf8(icalvalue_get_x(icalproperty_get_value(p)))); stat = Incidence::StatusX; break; case ICAL_STATUS_NONE: default: stat = Incidence::StatusNone; break; } if (stat != Incidence::StatusX) - incidence->seStatus(stat); + incidence->setqStatus(stat); break; } @@ -1468,7 +1466,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Inci // case ICAL_CONTACT_PROPERTY: // incidenceBase->addContact( -// QString::fromUtf8( icalproperty_get_contact( p ) ) ); +// TQString::fromUtf8( icalproperty_get_contact( p ) ) ); // break; case ICAL_RDATE_PROPERTY: { @@ -1518,7 +1516,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Inci break; } - p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); + p = icalcomponent_get_next_property(tqparent,ICAL_ANY_PROPERTY); } // Set the scheduling ID @@ -1540,9 +1538,9 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Inci incidence->setCategories(categories); // iterate through all alarms - for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); + for (icalcomponent *alarm = icalcomponent_get_first_component(tqparent,ICAL_VALARM_COMPONENT); alarm; - alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { + alarm = icalcomponent_get_next_component(tqparent,ICAL_VALARM_COMPONENT)) { readAlarm(alarm,incidence); } // Fix incorrect alarm settings by other applications (like outloook 9) @@ -1550,9 +1548,9 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent, icaltimezone *tz, Inci } -void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) +void ICalFormatImpl::readIncidenceBase(icalcomponent *tqparent,IncidenceBase *incidenceBase) { - icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); + icalproperty *p = icalcomponent_get_first_property(tqparent,ICAL_ANY_PROPERTY); bool uidProcessed = false; @@ -1582,7 +1580,7 @@ void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *inci break; } - p = icalcomponent_get_next_property( parent, ICAL_ANY_PROPERTY ); + p = icalcomponent_get_next_property( tqparent, ICAL_ANY_PROPERTY ); } if ( !uidProcessed ) { @@ -1606,35 +1604,35 @@ void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *inci // (documented in UsingLibical.txt) icalproperty *next =0; - for ( p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); + for ( p = icalcomponent_get_first_property(tqparent,ICAL_X_PROPERTY); p != 0; p = next ) { - next = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); + next = icalcomponent_get_next_property(tqparent,ICAL_X_PROPERTY); TQString value = TQString::fromUtf8(icalproperty_get_x(p)); TQString name = icalproperty_get_x_name(p); if (name == "X-PILOTID" && !value.isEmpty()) { incidenceBase->setPilotId(value.toInt()); - icalcomponent_remove_property(parent,p); + icalcomponent_remove_property(tqparent,p); } else if (name == "X-PILOTSTAT" && !value.isEmpty()) { - incidenceBase->setSyncStatus(value.toInt()); - icalcomponent_remove_property(parent,p); + incidenceBase->setSynctqStatus(value.toInt()); + icalcomponent_remove_property(tqparent,p); } } // custom properties - readCustomProperties(parent, incidenceBase); + readCustomProperties(tqparent, incidenceBase); } -void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) +void ICalFormatImpl::readCustomProperties(icalcomponent *tqparent,CustomProperties *properties) { TQMap<TQCString, TQString> customProperties; TQString lastProperty; - icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); + icalproperty *p = icalcomponent_get_first_property(tqparent,ICAL_X_PROPERTY); while (p) { @@ -1646,7 +1644,7 @@ void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties customProperties[name] = customProperties[name].append( "," ).append( value ); } // kdDebug(5800) << "Set custom property [" << name << '=' << value << ']' << endl; - p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); + p = icalcomponent_get_next_property(tqparent,ICAL_X_PROPERTY); lastProperty = name; } @@ -2168,7 +2166,7 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar ) if (todo) { if (todo->hasRecurrenceID()) { TQString originalUid = todo->uid(); - todo->setUid(originalUid + QString("-recur-%1").arg(todo->recurrenceID().toTime_t())); + todo->setUid(originalUid + TQString("-recur-%1").arg(todo->recurrenceID().toTime_t())); if (!cal->todo(todo->uid())) { if ( !cal->addTodo( todo ) ) { cal->endBatchAdding(); @@ -2179,9 +2177,9 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar ) printf("FIXME! [WARNING] Parent for child event does not yet exist!\n\r"); } else { - // Add this todo to its parent + // Add this todo to its tqparent cal->todo(originalUid)->addChildIncidence(todo->uid()); - // And the parent to the child + // And the tqparent to the child todo->addChildIncidence(cal->todo(originalUid)->uid()); } } @@ -2210,16 +2208,16 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar ) if (event) { if (event->hasRecurrenceID()) { TQString originalUid = event->uid(); - event->setUid(originalUid + QString("-recur-%1").arg(event->recurrenceID().toTime_t())); + event->setUid(originalUid + TQString("-recur-%1").arg(event->recurrenceID().toTime_t())); if (!cal->event(event->uid())) { cal->addEvent(event); if (!cal->event(originalUid)) { printf("FIXME! [WARNING] Parent for child event does not yet exist!\n\r"); } else { - // Add this event to its parent + // Add this event to its tqparent cal->event(originalUid)->addChildIncidence(event->uid()); - // And the parent to the child + // And the tqparent to the child event->addChildIncidence(cal->event(originalUid)->uid()); } } @@ -2248,16 +2246,16 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar ) if (journal) { if (journal->hasRecurrenceID()) { TQString originalUid = journal->uid(); - journal->setUid(originalUid + QString("-recur-%1").arg(journal->recurrenceID().toTime_t())); + journal->setUid(originalUid + TQString("-recur-%1").arg(journal->recurrenceID().toTime_t())); if (!cal->journal(journal->uid())) { cal->addJournal(journal); if (!cal->event(originalUid)) { printf("FIXME! [WARNING] Parent for child event does not yet exist!\n\r"); } else { - // Add this journal to its parent + // Add this journal to its tqparent cal->journal(originalUid)->addChildIncidence(journal->uid()); - // And the parent to the child + // And the tqparent to the child journal->addChildIncidence(cal->journal(originalUid)->uid()); } } |