summaryrefslogtreecommitdiffstats
path: root/framework/src
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-11 22:03:25 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-11 22:05:01 +0200
commitb0d6fb2e4cb53269b5e5186837cadfb7121d1540 (patch)
tree5650b5eba377273108d28770ca7f80e2e2bf10d9 /framework/src
parent52f266ecbd34ce298a4bce93992ffbb631ae90f8 (diff)
downloadkube-b0d6fb2e4cb53269b5e5186837cadfb7121d1540.tar.gz
kube-b0d6fb2e4cb53269b5e5186837cadfb7121d1540.zip
Synchronize drafts and contacts when opening the composer.
Diffstat (limited to 'framework/src')
-rw-r--r--framework/src/sinkfabric.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/framework/src/sinkfabric.cpp b/framework/src/sinkfabric.cpp
index 766380af..79afd33b 100644
--- a/framework/src/sinkfabric.cpp
+++ b/framework/src/sinkfabric.cpp
@@ -45,6 +45,24 @@ public:
45 auto scope = SyncScope().resourceFilter(folder->resourceInstanceIdentifier()).filter<Mail::Folder>(QVariant::fromValue(folder->identifier())); 45 auto scope = SyncScope().resourceFilter(folder->resourceInstanceIdentifier()).filter<Mail::Folder>(QVariant::fromValue(folder->identifier()));
46 scope.setType<ApplicationDomain::Mail>(); 46 scope.setType<ApplicationDomain::Mail>();
47 Store::synchronize(scope).exec(); 47 Store::synchronize(scope).exec();
48 } else if (message.contains("specialPurpose")) {
49 auto specialPurpose = message["specialPurpose"].value<QString>();
50 //Synchronize all drafts folders
51 if (specialPurpose == "drafts") {
52 //TODO or rather just synchronize draft mails and have resource figure out what that means?
53 Sink::Query folderQuery{};
54 folderQuery.containsFilter<Sink::ApplicationDomain::Folder::SpecialPurpose>(Sink::ApplicationDomain::SpecialPurpose::Mail::drafts);
55 folderQuery.request<Sink::ApplicationDomain::Folder::SpecialPurpose>();
56 folderQuery.request<Sink::ApplicationDomain::Folder::Name>();
57 Store::fetch<Sink::ApplicationDomain::Folder>(folderQuery)
58 .then([] (const QList<Sink::ApplicationDomain::Folder::Ptr> &folders) {
59 for (const auto f : folders) {
60 auto scope = SyncScope().resourceFilter(f->resourceInstanceIdentifier()).filter<Mail::Folder>(QVariant::fromValue(f->identifier()));
61 scope.setType<ApplicationDomain::Mail>();
62 Store::synchronize(scope).exec();
63 }
64 }).exec();
65 }
48 } else { 66 } else {
49 auto accountId = message["accountId"].value<QString>(); 67 auto accountId = message["accountId"].value<QString>();
50 auto type = message["type"].value<QString>(); 68 auto type = message["type"].value<QString>();
@@ -63,7 +81,7 @@ public:
63 //Only synchronize folders by default for now 81 //Only synchronize folders by default for now
64 scope.setType<ApplicationDomain::Folder>(); 82 scope.setType<ApplicationDomain::Folder>();
65 } 83 }
66 SinkLog() << "Synchronizing all. AccountId: " << accountId << " Type: " << scope.type(); 84 SinkLog() << "Synchronizing... AccountId: " << accountId << " Type: " << scope.type();
67 Store::synchronize(scope).exec(); 85 Store::synchronize(scope).exec();
68 } 86 }
69 } 87 }