From b0d6fb2e4cb53269b5e5186837cadfb7121d1540 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 11 Sep 2017 22:03:25 +0200 Subject: Synchronize drafts and contacts when opening the composer. --- framework/src/sinkfabric.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'framework/src') 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: auto scope = SyncScope().resourceFilter(folder->resourceInstanceIdentifier()).filter(QVariant::fromValue(folder->identifier())); scope.setType(); Store::synchronize(scope).exec(); + } else if (message.contains("specialPurpose")) { + auto specialPurpose = message["specialPurpose"].value(); + //Synchronize all drafts folders + if (specialPurpose == "drafts") { + //TODO or rather just synchronize draft mails and have resource figure out what that means? + Sink::Query folderQuery{}; + folderQuery.containsFilter(Sink::ApplicationDomain::SpecialPurpose::Mail::drafts); + folderQuery.request(); + folderQuery.request(); + Store::fetch(folderQuery) + .then([] (const QList &folders) { + for (const auto f : folders) { + auto scope = SyncScope().resourceFilter(f->resourceInstanceIdentifier()).filter(QVariant::fromValue(f->identifier())); + scope.setType(); + Store::synchronize(scope).exec(); + } + }).exec(); + } } else { auto accountId = message["accountId"].value(); auto type = message["type"].value(); @@ -63,7 +81,7 @@ public: //Only synchronize folders by default for now scope.setType(); } - SinkLog() << "Synchronizing all. AccountId: " << accountId << " Type: " << scope.type(); + SinkLog() << "Synchronizing... AccountId: " << accountId << " Type: " << scope.type(); Store::synchronize(scope).exec(); } } -- cgit v1.2.3