Beispiel #1
0
void KCalConversionTest::testTodoConversion()
{
    QFETCH(KCalCore::Todo, kcal);
    QFETCH(Kolab::Todo, kolab);
    
    const KCalCore::Todo::Ptr e = toKCalCore(kolab);
    
    QCOMPARE(e->uid(), kcal.uid());
    QCOMPARE(e->dtStart(), kcal.dtStart());
    QCOMPARE(e->dtDue(), kcal.dtDue());
    QCOMPARE(e->relatedTo(KCalCore::Incidence::RelTypeParent), kcal.relatedTo(KCalCore::Incidence::RelTypeParent));
   
    const Kolab::Todo &b = fromKCalCore(kcal);
    QCOMPARE(b.uid(), kolab.uid());
    QCOMPARE(b.start(), kolab.start());
    QCOMPARE(b.due(), kolab.due());
    QCOMPARE(b.relatedTo(), kolab.relatedTo());
}
KCalCore::Event::Ptr timetrackerstorage::baseEvent(const KCalCore::Todo::Ptr &todo)
{
    kDebug(5970) << "Entering function";
    KCalCore::Event::Ptr e( new KCalCore::Event() );
    QStringList categories;
    e->setSummary(todo->summary());

    // Can't use setRelatedToUid()--no error, but no RelatedTo written to disk
    e->setRelatedTo( todo->uid() );

    // Have to turn this off to get datetimes in date fields.
    e->setAllDay(false);
    e->setDtStart(KDateTime(todo->dtStart()));

    // So someone can filter this mess out of their calendar display
    categories.append(i18n("KTimeTracker"));
    e->setCategories(categories);

    return e;
}