QVariant NemoCalendarImportModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() >= mEventList.count()) return QVariant(); KCalCore::Event::Ptr event = mEventList.at(index.row()); switch(role) { case DisplayLabelRole: return event->summary(); case DescriptionRole: return event->description(); case StartTimeRole: return event->dtStart().dateTime(); case EndTimeRole: return event->dtEnd().dateTime(); case AllDayRole: return event->allDay(); case LocationRole: return event->location(); case UidRole: return event->uid(); default: return QVariant(); } }
void KoRdfCalendarEvent::fromKEvent(KCalCore::Event::Ptr event) { m_dtstart = event->dtStart(); m_dtend = event->dtEnd(); m_summary = event->summary(); m_location = event->location(); m_uid = event->uid(); Soprano::Node n = Soprano::LiteralValue(m_dtstart.dateTime()); KDateTime::Spec tz = toKTimeZone(n); KDateTime roundTrip = VEventDateTimeToKDateTime(n.toString(), tz); kDebug(30015) << "summary:" << m_summary; kDebug(30015) << "location:" << m_location; kDebug(30015) << "uid:" << m_uid; kDebug(30015) << "dtstart:" << m_dtstart; kDebug(30015) << "dtstart.offset:" << m_dtstart.timeZone().currentOffset(); kDebug(30015) << "dtstart.utc:" << m_dtstart.toUtc(); kDebug(30015) << " local.offset:" << KSystemTimeZones::local().currentOffset(); kDebug(30015) << "dtstart.roundTrip:" << roundTrip; kDebug(30015) << "dtend:" << m_dtend; kDebug(30015) << "dtstart.rdfnode:" << n; kDebug(30015) << "dtstart.roundTrip.offset:" << tz.timeZone().currentOffset(); }
void KCalConversionTest::testConversion() { QFETCH(KCalCore::Event, kcal); QFETCH(Kolab::Event, kolab); KCalCore::Event::Ptr e = toKCalCore(kolab); const Kolab::Event &b = fromKCalCore(kcal); QCOMPARE(e->uid(), kcal.uid()); QCOMPARE(e->created(), kcal.created()); QCOMPARE(e->lastModified(), kcal.lastModified()); QCOMPARE(e->revision(), kcal.revision()); QCOMPARE(e->secrecy(), kcal.secrecy()); QCOMPARE(e->categories(), kcal.categories()); QCOMPARE(e->dtStart(), kcal.dtStart()); QCOMPARE(e->dtEnd(), kcal.dtEnd()); QCOMPARE(e->duration(), kcal.duration()); QCOMPARE(e->transparency(), kcal.transparency()); QCOMPARE(*e->recurrence(), *kcal.recurrence()); QCOMPARE(e->recurrenceId(), kcal.recurrenceId()); QCOMPARE(e->recurrenceType(), kcal.recurrenceType()); QCOMPARE(e->summary(), kcal.summary()); QCOMPARE(e->description(), kcal.description()); QCOMPARE(e->priority(), kcal.priority()); QCOMPARE(e->status(), kcal.status()); QCOMPARE(e->location(), kcal.location()); QCOMPARE(e->organizer()->name(), kcal.organizer()->name()); QCOMPARE(e->organizer()->email(), kcal.organizer()->email()); QCOMPARE(e->nonKDECustomProperty("X-KOLAB-URL"), kcal.nonKDECustomProperty("X-KOLAB-URL")); //otherwise we'd break the customProperties comparison e->removeNonKDECustomProperty("X-KOLAB-URL"); kcal.removeNonKDECustomProperty("X-KOLAB-URL"); compareAttendeesVectors(e->attendees(), kcal.attendees()); comparePointerVectors(e->attachments(), kcal.attachments()); // QCOMPARE(e->alarms(), kcal.alarms()); //TODO QCOMPARE(e->customProperties(), kcal.customProperties()); // QBENCHMARK { // toKCalCore(kolab); // } QCOMPARE(b.uid(), kolab.uid()); QCOMPARE(b.created(), kolab.created()); QCOMPARE(b.lastModified(), kolab.lastModified()); QCOMPARE(b.sequence(), kolab.sequence()); QCOMPARE(b.classification(), kolab.classification()); QCOMPARE(b.categories(), kolab.categories()); QCOMPARE(b.start(), kolab.start()); QCOMPARE(b.end(), kolab.end()); QCOMPARE(b.duration(), kolab.duration()); QCOMPARE(b.transparency(), kolab.transparency()); QCOMPARE(b.recurrenceRule(), kolab.recurrenceRule()); QCOMPARE(b.recurrenceID(), kolab.recurrenceID()); QCOMPARE(b.recurrenceDates(), kolab.recurrenceDates()); QCOMPARE(b.exceptionDates(), kolab.exceptionDates()); QCOMPARE(b.summary(), kolab.summary()); QCOMPARE(b.description(), kolab.description()); QCOMPARE(b.status(), kolab.status()); QCOMPARE(b.location(), kolab.location()); QCOMPARE(b.organizer(), kolab.organizer()); QCOMPARE(b.url(), kolab.url()); QCOMPARE(b.attendees(), kolab.attendees()); QCOMPARE(b.attachments(), kolab.attachments()); QCOMPARE(b.customProperties(), kolab.customProperties()); }