Changeset View
Changeset View
Standalone View
Standalone View
src/akonadi/akonadiserializer.cpp
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Line(s) | 187 | { | |||
---|---|---|---|---|---|
197 | task->setStartDate(todo->dtStart().dateTime().toUTC()); | 197 | task->setStartDate(todo->dtStart().dateTime().toUTC()); | ||
198 | task->setDueDate(todo->dtDue().dateTime().toUTC()); | 198 | task->setDueDate(todo->dtDue().dateTime().toUTC()); | ||
199 | task->setProperty("itemId", item.id()); | 199 | task->setProperty("itemId", item.id()); | ||
200 | task->setProperty("parentCollectionId", item.parentCollection().id()); | 200 | task->setProperty("parentCollectionId", item.parentCollection().id()); | ||
201 | task->setProperty("todoUid", todo->uid()); | 201 | task->setProperty("todoUid", todo->uid()); | ||
202 | task->setProperty("relatedUid", todo->relatedTo()); | 202 | task->setProperty("relatedUid", todo->relatedTo()); | ||
203 | task->setRunning(todo->customProperty("Zanshin", "Running") == QLatin1String("1")); | 203 | task->setRunning(todo->customProperty("Zanshin", "Running") == QLatin1String("1")); | ||
204 | 204 | | |||
205 | switch (todo->recurrence()->recurrenceType()) { | ||||
206 | case KCalCore::Recurrence::rDaily: | ||||
207 | task->setRecurrence(Domain::Task::RecursDaily); | ||||
208 | break; | ||||
209 | case KCalCore::Recurrence::rWeekly: | ||||
210 | task->setRecurrence(Domain::Task::RecursWeekly); | ||||
211 | break; | ||||
212 | case KCalCore::Recurrence::rMonthlyDay: | ||||
213 | task->setRecurrence(Domain::Task::RecursMonthly); | ||||
214 | break; | ||||
215 | default: | ||||
216 | // Other cases are not supported for now and as such just ignored | ||||
217 | break; | ||||
218 | } | ||||
219 | | ||||
205 | QMimeDatabase mimeDb; | 220 | QMimeDatabase mimeDb; | ||
206 | const auto attachmentsInput = todo->attachments(); | 221 | const auto attachmentsInput = todo->attachments(); | ||
207 | Domain::Task::Attachments attachments; | 222 | Domain::Task::Attachments attachments; | ||
208 | attachments.reserve(attachmentsInput.size()); | 223 | attachments.reserve(attachmentsInput.size()); | ||
209 | std::transform(attachmentsInput.cbegin(), attachmentsInput.cend(), | 224 | std::transform(attachmentsInput.cbegin(), attachmentsInput.cend(), | ||
210 | std::back_inserter(attachments), | 225 | std::back_inserter(attachments), | ||
211 | [&mimeDb] (const KCalCore::Attachment::Ptr &attach) { | 226 | [&mimeDb] (const KCalCore::Attachment::Ptr &attach) { | ||
212 | Domain::Task::Attachment attachment; | 227 | Domain::Task::Attachment attachment; | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 264 | { | |||
263 | if (task->property("todoUid").isValid()) { | 278 | if (task->property("todoUid").isValid()) { | ||
264 | todo->setUid(task->property("todoUid").toString()); | 279 | todo->setUid(task->property("todoUid").toString()); | ||
265 | } | 280 | } | ||
266 | 281 | | |||
267 | if (task->property("relatedUid").isValid()) { | 282 | if (task->property("relatedUid").isValid()) { | ||
268 | todo->setRelatedTo(task->property("relatedUid").toString()); | 283 | todo->setRelatedTo(task->property("relatedUid").toString()); | ||
269 | } | 284 | } | ||
270 | 285 | | |||
286 | switch (task->recurrence()) { | ||||
287 | case Domain::Task::NoRecurrence: | ||||
288 | break; | ||||
289 | case Domain::Task::RecursDaily: | ||||
290 | todo->recurrence()->setDaily(1); | ||||
291 | break; | ||||
292 | case Domain::Task::RecursWeekly: | ||||
293 | todo->recurrence()->setWeekly(1); | ||||
294 | break; | ||||
295 | case Domain::Task::RecursMonthly: | ||||
296 | todo->recurrence()->setMonthly(1); | ||||
297 | break; | ||||
298 | } | ||||
299 | | ||||
271 | for (const auto &attachment : task->attachments()) { | 300 | for (const auto &attachment : task->attachments()) { | ||
272 | KCalCore::Attachment::Ptr attach(new KCalCore::Attachment(QByteArray())); | 301 | KCalCore::Attachment::Ptr attach(new KCalCore::Attachment(QByteArray())); | ||
273 | if (attachment.isUri()) | 302 | if (attachment.isUri()) | ||
274 | attach->setUri(attachment.uri().toString()); | 303 | attach->setUri(attachment.uri().toString()); | ||
275 | else | 304 | else | ||
276 | attach->setDecodedData(attachment.data()); | 305 | attach->setDecodedData(attachment.data()); | ||
277 | attach->setMimeType(attachment.mimeType()); | 306 | attach->setMimeType(attachment.mimeType()); | ||
278 | attach->setLabel(attachment.label()); | 307 | attach->setLabel(attachment.label()); | ||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |