Incidence *ICalFormat::fromString(const QString &text) { CalendarLocal cal(mTimeZoneId); fromString(&cal, text); Incidence *ical = 0; Event::List elist = cal.events(); if(elist.count() > 0) { ical = elist.first(); } else { Todo::List tlist = cal.todos(); if(tlist.count() > 0) { ical = tlist.first(); } else { Journal::List jlist = cal.journals(); if(jlist.count() > 0) { ical = jlist.first(); } } } return ical ? ical->clone() : 0; }
bool ResourceLocalDir::doFileLoad(CalendarLocal &cal, const QString &fileName) { if(!cal.load(fileName)) return false; Incidence::List incidences = cal.rawIncidences(); Incidence::List::ConstIterator it; for(it = incidences.constBegin(); it != incidences.constEnd(); ++it) { Incidence *i = *it; if(i) mCalendar.addIncidence(i->clone()); } return true; }
QString ICalFormat::createScheduleMessage(IncidenceBase *incidence, Scheduler::Method method) { icalcomponent *message = 0; // Handle scheduling ID being present if(incidence->type() == "Event" || incidence->type() == "Todo") { Incidence *i = static_cast<Incidence *>(incidence); if(i->schedulingID() != i->uid()) { // We have a separation of scheduling ID and UID i = i->clone(); i->setUid(i->schedulingID()); i->setSchedulingID(QString::null); // Build the message with the cloned incidence message = mImpl->createScheduleComponent(i, method); // And clean up delete i; } } if(message == 0) message = mImpl->createScheduleComponent(incidence, method); // FIXME TODO: Don't we have to free message? What about the ical_string? MEMLEAK QString messageText = QString::fromUtf8(icalcomponent_as_ical_string(message)); #if 0 kdDebug(5800) << "ICalFormat::createScheduleMessage: message START\n" << messageText << "ICalFormat::createScheduleMessage: message END" << endl; #endif return messageText; }