summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2012-11-11 16:30:47 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2012-11-11 16:30:47 (GMT)
commitf60ac8df94c5412c26ee89c6dda3f3f32e22b275 (patch)
treee0d6aa15d7bbf935dd12fe3746b879b2b61c0cbd
parent930653df0206c78f8b7003c85141a448151e2aac (diff)
downloadlibkolab-f60ac8df94c5412c26ee89c6dda3f3f32e22b275.tar.gz
Store the related-to field.libkolab-0.4.0
-rw-r--r--conversion/kcalconversion.cpp12
-rw-r--r--tests/kcalconversiontest.cpp6
-rw-r--r--tests/testfiles/v3/task/complex.ics1
-rw-r--r--tests/testfiles/v3/task/complex.ics.mime3
4 files changed, 22 insertions, 0 deletions
diff --git a/conversion/kcalconversion.cpp b/conversion/kcalconversion.cpp
index f9a0943..1ba81f3 100644
--- a/conversion/kcalconversion.cpp
+++ b/conversion/kcalconversion.cpp
@@ -802,6 +802,12 @@ KCalCore::Todo::Ptr toKCalCore ( const Todo &todo )
if (todo.due().isValid()) {
e->setDtDue(toDate(todo.due()));
}
+ if (!todo.relatedTo().empty()) {
+ e->setRelatedTo(Conversion::fromStdString(todo.relatedTo().front()), KCalCore::Incidence::RelTypeParent);
+ if (todo.relatedTo().size() > 1) {
+ Error() << "only one relation support but got multiple";
+ }
+ }
e->setPercentComplete(todo.percentComplete());
return e;
}
@@ -813,6 +819,12 @@ Todo fromKCalCore ( const KCalCore::Todo &todo )
getTodoEvent(t, todo);
t.setDue(fromDate(todo.dtDue(true)));
t.setPercentComplete(todo.percentComplete());
+ const QString relatedTo = todo.relatedTo(KCalCore::Incidence::RelTypeParent);
+ if (!relatedTo.isEmpty()) {
+ std::vector<std::string> relateds;
+ relateds.push_back(Conversion::toStdString(relatedTo));
+ t.setRelatedTo(relateds);
+ }
return t;
}
diff --git a/tests/kcalconversiontest.cpp b/tests/kcalconversiontest.cpp
index cbbc861..23698dd 100644
--- a/tests/kcalconversiontest.cpp
+++ b/tests/kcalconversiontest.cpp
@@ -412,11 +412,15 @@ void KCalConversionTest::testTodoConversion_data()
kcal.setUid("uid");
kcal.setDtStart(toDate(date));
kcal.setDtDue(toDate(date2));
+ kcal.setRelatedTo("uid2", KCalCore::Incidence::RelTypeParent);
Kolab::Todo kolab;
kolab.setUid("uid");
kolab.setStart(date);
kolab.setDue(date2);
+ std::vector<std::string> relateds;
+ relateds.push_back("uid2");
+ kolab.setRelatedTo(relateds);
QTest::newRow( "todo" ) << kcal << kolab;
}
@@ -433,11 +437,13 @@ void KCalConversionTest::testTodoConversion()
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());
}
void KCalConversionTest::testJournalConversion_data()
diff --git a/tests/testfiles/v3/task/complex.ics b/tests/testfiles/v3/task/complex.ics
index 0188830..d15b1ec 100644
--- a/tests/testfiles/v3/task/complex.ics
+++ b/tests/testfiles/v3/task/complex.ics
@@ -38,6 +38,7 @@ ATTACH;VALUE=BINARY;FMTTYPE=image/png;ENCODING=BASE64;X-LABEL=akonadi.png:
qttsdfKKguo4ZlguO36xWAgLth3mbSsyTatnyFz6B+BnWV0A/UiAAAAAAElFTkSuQmCC
DUE;TZID=Europe/Berlin:20090908T160000
DTSTART;TZID=Europe/Berlin:20090901T160000
+RELATED-TO:f064e7de-b197-466c-a10e-bdf8e83ab08c
PERCENT-COMPLETE:50
RECURRENCE-ID;TZID=Europe/Berlin:20090908T160000
BEGIN:VALARM
diff --git a/tests/testfiles/v3/task/complex.ics.mime b/tests/testfiles/v3/task/complex.ics.mime
index e52f694..e432f01 100644
--- a/tests/testfiles/v3/task/complex.ics.mime
+++ b/tests/testfiles/v3/task/complex.ics.mime
@@ -58,6 +58,9 @@ Content-Disposition: attachment; filename="kolab.xml"
<text>Business</text>
<text>Education</text>
</categories>
+ <related-to>
+ <text>f064e7de-b197-466c-a10e-bdf8e83ab08c</text>
+ </related-to>
<dtstart>
<parameters>
<tzid>