Exemplo n.º 1
0
void KoRdfCalendarEvent::importFromData(const QByteArray &ba, const KoDocumentRdf *_rdf, KoCanvasBase *host)
{
#ifdef KDEPIMLIBS_FOUND
    kDebug(30015) << "data.sz:" << ba.size();
    kDebug(30015) << "_rdf:" << _rdf;
    if (_rdf) {
        m_rdf = _rdf;
    }
    KCalCore::VCalFormat v;
    KCalCore::Calendar::Ptr cal(new KCalCore::MemoryCalendar(KSystemTimeZones::local()));
    bool rc = v.fromRawString(cal, ba);
    kDebug(30015) << "parse rc:" << rc;
    KCalCore::Event::List events = cal->rawEvents();
    kDebug(30015) << "found event count:" << events.size();
    if (events.size() >= 1) {
        KCalCore::Event::Ptr e = events[0];
        fromKEvent(e);
    }
    importFromDataComplete(ba, documentRdf(), host);
#else
    Q_UNUSED(ba);
    Q_UNUSED(_rdf);
    Q_UNUSED(host);
#endif
}
void NemoCalendarAgendaModel::load()
{
    // TODO: we really need a centralised event cache
    KCalCore::Event::List eventList = NemoCalendarDb::calendar()->rawEventsForDate(mStartDate, KDateTime::Spec(KDateTime::LocalZone), KCalCore::EventSortStartDate, KCalCore::SortDirectionAscending);
    qDebug() << Q_FUNC_INFO << "Loaded " << eventList.count() << " events for " << mStartDate;

    beginResetModel();
    qDeleteAll(mEvents);
    mEvents.clear();
    mEvents.reserve(eventList.size());

    foreach (const KCalCore::Event::Ptr &evt, eventList) {
        NemoCalendarEvent *event = new NemoCalendarEvent(evt);
        mEvents.append(event);
    }