diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-27 02:26:47 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-15 16:14:19 +0200 |
commit | 26816c21f60450e461a5b6ef4ef740f6070ce278 (patch) | |
tree | 55e8aee03e094abf702438e6cd26233047345e70 /examples/maildirresource/maildirresource.cpp | |
parent | 9a9bb39f7641a818434cafa0dae0c8aa47124c0b (diff) | |
download | sink-26816c21f60450e461a5b6ef4ef740f6070ce278.tar.gz sink-26816c21f60450e461a5b6ef4ef740f6070ce278.zip |
Ported to the kasync revamp
Diffstat (limited to 'examples/maildirresource/maildirresource.cpp')
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 392b422..e69d822 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -367,7 +367,7 @@ public: | |||
367 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE | 367 | KAsync::Job<void> synchronizeWithSource() Q_DECL_OVERRIDE |
368 | { | 368 | { |
369 | SinkLog() << " Synchronizing"; | 369 | SinkLog() << " Synchronizing"; |
370 | return KAsync::start<void, KAsync::Job<void> >([this]() { | 370 | return KAsync::start<void>([this]() { |
371 | KPIM::Maildir maildir(mMaildirPath, true); | 371 | KPIM::Maildir maildir(mMaildirPath, true); |
372 | if (!maildir.isValid(false)) { | 372 | if (!maildir.isValid(false)) { |
373 | return KAsync::error<void>(1, "Maildir path doesn't point to a valid maildir: " + mMaildirPath); | 373 | return KAsync::error<void>(1, "Maildir path doesn't point to a valid maildir: " + mMaildirPath); |
@@ -402,18 +402,14 @@ public: | |||
402 | if (operation == Sink::Operation_Creation) { | 402 | if (operation == Sink::Operation_Creation) { |
403 | const auto remoteId = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); | 403 | const auto remoteId = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); |
404 | SinkTrace() << "Mail created: " << remoteId; | 404 | SinkTrace() << "Mail created: " << remoteId; |
405 | return KAsync::start<QByteArray>([=]() -> QByteArray { | 405 | return KAsync::value(remoteId.toUtf8()); |
406 | return remoteId.toUtf8(); | ||
407 | }); | ||
408 | } else if (operation == Sink::Operation_Removal) { | 406 | } else if (operation == Sink::Operation_Removal) { |
409 | SinkTrace() << "Removing a mail: " << oldRemoteId; | 407 | SinkTrace() << "Removing a mail: " << oldRemoteId; |
410 | return KAsync::null<QByteArray>(); | 408 | return KAsync::null<QByteArray>(); |
411 | } else if (operation == Sink::Operation_Modification) { | 409 | } else if (operation == Sink::Operation_Modification) { |
412 | SinkTrace() << "Modifying a mail: " << oldRemoteId; | 410 | SinkTrace() << "Modifying a mail: " << oldRemoteId; |
413 | const auto remoteId = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); | 411 | const auto remoteId = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); |
414 | return KAsync::start<QByteArray>([=]() -> QByteArray { | 412 | return KAsync::value(remoteId.toUtf8()); |
415 | return remoteId.toUtf8(); | ||
416 | }); | ||
417 | } | 413 | } |
418 | return KAsync::null<QByteArray>(); | 414 | return KAsync::null<QByteArray>(); |
419 | } | 415 | } |
@@ -427,9 +423,7 @@ public: | |||
427 | SinkTrace() << "Creating a new folder: " << path; | 423 | SinkTrace() << "Creating a new folder: " << path; |
428 | KPIM::Maildir maildir(path, false); | 424 | KPIM::Maildir maildir(path, false); |
429 | maildir.create(); | 425 | maildir.create(); |
430 | return KAsync::start<QByteArray>([=]() -> QByteArray { | 426 | return KAsync::value(path.toUtf8()); |
431 | return path.toUtf8(); | ||
432 | }); | ||
433 | } else if (operation == Sink::Operation_Removal) { | 427 | } else if (operation == Sink::Operation_Removal) { |
434 | const auto path = oldRemoteId; | 428 | const auto path = oldRemoteId; |
435 | SinkTrace() << "Removing a folder: " << path; | 429 | SinkTrace() << "Removing a folder: " << path; |
@@ -438,9 +432,7 @@ public: | |||
438 | return KAsync::null<QByteArray>(); | 432 | return KAsync::null<QByteArray>(); |
439 | } else if (operation == Sink::Operation_Modification) { | 433 | } else if (operation == Sink::Operation_Modification) { |
440 | SinkWarning() << "Folder modifications are not implemented"; | 434 | SinkWarning() << "Folder modifications are not implemented"; |
441 | return KAsync::start<QByteArray>([=]() -> QByteArray { | 435 | return KAsync::value(oldRemoteId); |
442 | return oldRemoteId; | ||
443 | }); | ||
444 | } | 436 | } |
445 | return KAsync::null<QByteArray>(); | 437 | return KAsync::null<QByteArray>(); |
446 | } | 438 | } |