summaryrefslogtreecommitdiffstats
path: root/framework/domain/composercontroller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/domain/composercontroller.cpp')
-rw-r--r--framework/domain/composercontroller.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/framework/domain/composercontroller.cpp b/framework/domain/composercontroller.cpp
index a4a8857f..9fb2c6f8 100644
--- a/framework/domain/composercontroller.cpp
+++ b/framework/domain/composercontroller.cpp
@@ -221,17 +221,22 @@ void ComposerController::send()
221 .then<void, QList<ApplicationDomain::SinkResource::Ptr>>([=](const QList<ApplicationDomain::SinkResource::Ptr> &resources) -> KAsync::Job<void> { 221 .then<void, QList<ApplicationDomain::SinkResource::Ptr>>([=](const QList<ApplicationDomain::SinkResource::Ptr> &resources) -> KAsync::Job<void> {
222 if (!resources.isEmpty()) { 222 if (!resources.isEmpty()) {
223 auto resourceId = resources[0]->identifier(); 223 auto resourceId = resources[0]->identifier();
224 SinkTrace() << "Sending message via resource: " << resourceId; 224 SinkLog() << "Sending message via resource: " << resourceId;
225 Mail mail(resourceId); 225 Mail mail(resourceId);
226 mail.setBlobProperty("mimeMessage", message->encodedContent()); 226 mail.setMimeMessage(message->encodedContent());
227 return Store::create(mail); 227 return Store::create(mail)
228 .then<void>([=] {
229 //Trigger a sync, but don't wait for it.
230 Store::synchronize(Sink::SyncScope{}.resourceFilter(resourceId)).exec();
231 return KAsync::null<void>();
232 });
228 } 233 }
229 return KAsync::error<void>(0, "Failed to find a MailTransport resource."); 234 return KAsync::error<void>(0, "Failed to find a MailTransport resource.");
235 })
236 .syncThen<void>([&] (const KAsync::Error &error) {
237 emit done();
230 }); 238 });
231 run(job); 239 run(job);
232 job = job.syncThen<void>([&] {
233 emit done();
234 });
235} 240}
236 241
237void ComposerController::updateSaveAsDraftAction() 242void ComposerController::updateSaveAsDraftAction()
@@ -268,7 +273,7 @@ void ComposerController::saveAsDraft()
268 return Store::create(mail); 273 return Store::create(mail);
269 }); 274 });
270 } else { 275 } else {
271 SinkWarning() << "Modifying an existing mail" << existingMail.identifier(); 276 SinkLog() << "Modifying an existing mail" << existingMail.identifier();
272 existingMail.setDraft(true); 277 existingMail.setDraft(true);
273 existingMail.setMimeMessage(message->encodedContent()); 278 existingMail.setMimeMessage(message->encodedContent());
274 return Store::modify(existingMail); 279 return Store::modify(existingMail);