Changeset View
Changeset View
Standalone View
Standalone View
resources/kolab/pimkolab/conversion/kcalconversion.cpp
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Line(s) | 262 | { | |||
---|---|---|---|---|---|
278 | i.setSummary(fromStdString(e.summary())); //TODO detect richtext | 278 | i.setSummary(fromStdString(e.summary())); //TODO detect richtext | ||
279 | i.setDescription(fromStdString(e.description())); //TODO detect richtext | 279 | i.setDescription(fromStdString(e.description())); //TODO detect richtext | ||
280 | i.setStatus(toStatus(e.status())); | 280 | i.setStatus(toStatus(e.status())); | ||
281 | foreach (const Kolab::Attendee &a, e.attendees()) { | 281 | foreach (const Kolab::Attendee &a, e.attendees()) { | ||
282 | /* | 282 | /* | ||
283 | * KCalCore always sets a UID if empty, but that's just a pointer, and not the uid of a real contact. | 283 | * KCalCore always sets a UID if empty, but that's just a pointer, and not the uid of a real contact. | ||
284 | * Since that means the semantics of the two are different, we have to store the kolab uid as a custom property. | 284 | * Since that means the semantics of the two are different, we have to store the kolab uid as a custom property. | ||
285 | */ | 285 | */ | ||
286 | KCalCore::Attendee::Ptr attendee = KCalCore::Attendee::Ptr(new KCalCore::Attendee(fromStdString(a.contact().name()), | 286 | KCalCore::Attendee attendee(fromStdString(a.contact().name()), | ||
287 | fromStdString(a.contact().email()), | 287 | fromStdString(a.contact().email()), | ||
288 | a.rsvp(), | 288 | a.rsvp(), | ||
289 | toPartStat(a.partStat()), | 289 | toPartStat(a.partStat()), | ||
290 | toRole(a.role()))); | 290 | toRole(a.role())); | ||
291 | if (!a.contact().uid().empty()) { //TODO Identify contact from addressbook based on uid | 291 | if (!a.contact().uid().empty()) { //TODO Identify contact from addressbook based on uid | ||
292 | attendee->customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID, fromStdString(a.contact().uid())); | 292 | attendee.customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID, fromStdString(a.contact().uid())); | ||
293 | } | 293 | } | ||
294 | if (!a.delegatedTo().empty()) { | 294 | if (!a.delegatedTo().empty()) { | ||
295 | if (a.delegatedTo().size() > 1) { | 295 | if (a.delegatedTo().size() > 1) { | ||
296 | qCWarning(PIMKOLAB_LOG) << "multiple delegatees are not supported"; | 296 | qCWarning(PIMKOLAB_LOG) << "multiple delegatees are not supported"; | ||
297 | } | 297 | } | ||
298 | attendee->setDelegate(toMailto(a.delegatedTo().front().email(), a.delegatedTo().front().name()).toString()); | 298 | attendee.setDelegate(toMailto(a.delegatedTo().front().email(), a.delegatedTo().front().name()).toString()); | ||
299 | } | 299 | } | ||
300 | if (!a.delegatedFrom().empty()) { | 300 | if (!a.delegatedFrom().empty()) { | ||
301 | if (a.delegatedFrom().size() > 1) { | 301 | if (a.delegatedFrom().size() > 1) { | ||
302 | qCWarning(PIMKOLAB_LOG) << "multiple delegators are not supported"; | 302 | qCWarning(PIMKOLAB_LOG) << "multiple delegators are not supported"; | ||
303 | } | 303 | } | ||
304 | attendee->setDelegator(toMailto(a.delegatedFrom().front().email(), a.delegatedFrom().front().name()).toString()); | 304 | attendee.setDelegator(toMailto(a.delegatedFrom().front().email(), a.delegatedFrom().front().name()).toString()); | ||
305 | } | 305 | } | ||
306 | if (a.cutype() != Kolab::CutypeIndividual) { | 306 | if (a.cutype() != Kolab::CutypeIndividual) { | ||
307 | attendee->customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE, QString::number(a.cutype())); | 307 | attendee.customProperties().setNonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE, QString::number(a.cutype())); | ||
308 | } | 308 | } | ||
309 | i.addAttendee(attendee); | 309 | i.addAttendee(attendee); | ||
310 | } | 310 | } | ||
311 | foreach (const Kolab::Attachment &a, e.attachments()) { | 311 | foreach (const Kolab::Attachment &a, e.attachments()) { | ||
312 | KCalCore::Attachment::Ptr ptr; | 312 | KCalCore::Attachment::Ptr ptr; | ||
313 | if (!a.uri().empty()) { | 313 | if (!a.uri().empty()) { | ||
314 | ptr = KCalCore::Attachment::Ptr(new KCalCore::Attachment(fromStdString(a.uri()), fromStdString(a.mimetype()))); | 314 | ptr = KCalCore::Attachment::Ptr(new KCalCore::Attachment(fromStdString(a.uri()), fromStdString(a.mimetype()))); | ||
315 | } else { | 315 | } else { | ||
Show All 28 Lines | 339 | { | |||
344 | i.setClassification(fromSecrecy(e.secrecy())); | 344 | i.setClassification(fromSecrecy(e.secrecy())); | ||
345 | i.setCategories(fromStringList(e.categories())); | 345 | i.setCategories(fromStringList(e.categories())); | ||
346 | 346 | | |||
347 | i.setStart(fromDate(e.dtStart(), e.allDay())); | 347 | i.setStart(fromDate(e.dtStart(), e.allDay())); | ||
348 | i.setSummary(toStdString(e.summary())); | 348 | i.setSummary(toStdString(e.summary())); | ||
349 | i.setDescription(toStdString(e.description())); | 349 | i.setDescription(toStdString(e.description())); | ||
350 | i.setStatus(fromStatus(e.status())); | 350 | i.setStatus(fromStatus(e.status())); | ||
351 | std::vector<Kolab::Attendee> attendees; | 351 | std::vector<Kolab::Attendee> attendees; | ||
352 | foreach (const KCalCore::Attendee::Ptr &ptr, e.attendees()) { | 352 | foreach (const KCalCore::Attendee &ptr, e.attendees()) { | ||
353 | const QString &uid = ptr->customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID); | 353 | const QString &uid = ptr.customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_UUID); | ||
354 | Kolab::Attendee a(Kolab::ContactReference(toStdString(ptr->email()), toStdString(ptr->name()), toStdString(uid))); | 354 | Kolab::Attendee a(Kolab::ContactReference(toStdString(ptr.email()), toStdString(ptr.name()), toStdString(uid))); | ||
355 | a.setRSVP(ptr->RSVP()); | 355 | a.setRSVP(ptr.RSVP()); | ||
356 | a.setPartStat(fromPartStat(ptr->status())); | 356 | a.setPartStat(fromPartStat(ptr.status())); | ||
357 | a.setRole(fromRole(ptr->role())); | 357 | a.setRole(fromRole(ptr.role())); | ||
358 | if (!ptr->delegate().isEmpty()) { | 358 | if (!ptr.delegate().isEmpty()) { | ||
359 | std::string name; | 359 | std::string name; | ||
360 | const std::string &email = fromMailto(QUrl(ptr->delegate()), name); | 360 | const std::string &email = fromMailto(QUrl(ptr.delegate()), name); | ||
361 | a.setDelegatedTo(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name)); | 361 | a.setDelegatedTo(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name)); | ||
362 | } | 362 | } | ||
363 | if (!ptr->delegator().isEmpty()) { | 363 | if (!ptr.delegator().isEmpty()) { | ||
364 | std::string name; | 364 | std::string name; | ||
365 | const std::string &email = fromMailto(QUrl(ptr->delegator()), name); | 365 | const std::string &email = fromMailto(QUrl(ptr.delegator()), name); | ||
366 | a.setDelegatedFrom(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name)); | 366 | a.setDelegatedFrom(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name)); | ||
367 | } | 367 | } | ||
368 | const QString &cutype = ptr->customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE); | 368 | const QString &cutype = ptr.customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE); | ||
369 | if (!cutype.isEmpty()) { | 369 | if (!cutype.isEmpty()) { | ||
370 | a.setCutype(static_cast<Kolab::Cutype>(cutype.toInt())); | 370 | a.setCutype(static_cast<Kolab::Cutype>(cutype.toInt())); | ||
371 | } | 371 | } | ||
372 | 372 | | |||
373 | attendees.push_back(a); | 373 | attendees.push_back(a); | ||
374 | } | 374 | } | ||
375 | i.setAttendees(attendees); | 375 | i.setAttendees(attendees); | ||
376 | std::vector<Kolab::Attachment> attachments; | 376 | std::vector<Kolab::Attachment> attachments; | ||
▲ Show 20 Lines • Show All 477 Lines • Show Last 20 Lines |