From 41f8f9bc05c059cafa780ac8aec27a56cba2c278 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 12 May 2017 08:20:43 +0200 Subject: No more SINK_DEBUG_AREA --- examples/davresource/davresource.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'examples/davresource/davresource.cpp') diff --git a/examples/davresource/davresource.cpp b/examples/davresource/davresource.cpp index 50471ed..6631148 100644 --- a/examples/davresource/davresource.cpp +++ b/examples/davresource/davresource.cpp @@ -42,8 +42,6 @@ #define ENTITY_TYPE_CONTACT "contact" #define ENTITY_TYPE_ADDRESSBOOK "addressbook" -SINK_DEBUG_AREA("davresource") - using namespace Sink; static KAsync::Job runJob(KJob *job) -- cgit v1.2.3 From 3357b1473efa0ccfa06cb4c2f3ab387c33038274 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 25 Jun 2017 16:10:38 +0200 Subject: Register the right facade. --- examples/davresource/davresource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/davresource/davresource.cpp') diff --git a/examples/davresource/davresource.cpp b/examples/davresource/davresource.cpp index 6631148..88b7338 100644 --- a/examples/davresource/davresource.cpp +++ b/examples/davresource/davresource.cpp @@ -269,7 +269,7 @@ Sink::Resource *DavResourceFactory::createResource(const ResourceContext &contex void DavResourceFactory::registerFacades(const QByteArray &name, Sink::FacadeFactory &factory) { factory.registerFacade>(name); - factory.registerFacade>(name); + factory.registerFacade>(name); } void DavResourceFactory::registerAdaptorFactories(const QByteArray &name, Sink::AdaptorFactoryRegistry ®istry) -- cgit v1.2.3 From 26c27fd619857d0945b6c110a863bdc8b4a5e073 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 29 Jun 2017 12:09:11 +0200 Subject: Ported to KDAV2, enabled the dav resource by default. --- examples/davresource/davresource.cpp | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'examples/davresource/davresource.cpp') diff --git a/examples/davresource/davresource.cpp b/examples/davresource/davresource.cpp index 88b7338..1d45f20 100644 --- a/examples/davresource/davresource.cpp +++ b/examples/davresource/davresource.cpp @@ -31,12 +31,12 @@ #include "contactpreprocessor.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include //This is the resources entity type, and not the domain type #define ENTITY_TYPE_CONTACT "contact" @@ -85,7 +85,7 @@ public: return remoteId; } - void synchronizeAddressbooks(const KDAV::DavCollection::List &addressbookList) + void synchronizeAddressbooks(const KDAV2::DavCollection::List &addressbookList) { const QByteArray bufferType = ENTITY_TYPE_ADDRESSBOOK; SinkTrace() << "Found addressbooks " << addressbookList.size(); @@ -119,12 +119,12 @@ public: return list; } - static QByteArray getRid(const KDAV::DavItem &item) + static QByteArray getRid(const KDAV2::DavItem &item) { return item.url().toDisplayString().toUtf8(); } - static QByteArray getRid(const KDAV::DavCollection &item) + static QByteArray getRid(const KDAV2::DavCollection &item) { return item.url().toDisplayString().toUtf8(); } @@ -133,7 +133,7 @@ public: { if (query.type() == ApplicationDomain::getTypeName()) { SinkLogCtx(mLogCtx) << "Synchronizing addressbooks:" << mResourceUrl.url(); - auto collectionsFetchJob = new KDAV::DavCollectionsFetchJob(mResourceUrl); + auto collectionsFetchJob = new KDAV2::DavCollectionsFetchJob(mResourceUrl); auto job = runJob(collectionsFetchJob).then([this, collectionsFetchJob] (const KAsync::Error &error) { if (error) { SinkWarningCtx(mLogCtx) << "Failed to synchronize addressbooks." << collectionsFetchJob->errorString(); @@ -145,29 +145,29 @@ public: } else if (query.type() == ApplicationDomain::getTypeName()) { SinkLogCtx(mLogCtx) << "Synchronizing contacts."; auto ridList = QSharedPointer::create(); - auto collectionsFetchJob = new KDAV::DavCollectionsFetchJob(mResourceUrl); + auto collectionsFetchJob = new KDAV2::DavCollectionsFetchJob(mResourceUrl); auto job = runJob(collectionsFetchJob).then([this, collectionsFetchJob] { synchronizeAddressbooks(collectionsFetchJob ->collections()); return collectionsFetchJob->collections(); }) - .serialEach([this, ridList](const KDAV::DavCollection &collection) { + .serialEach([this, ridList](const KDAV2::DavCollection &collection) { auto collId = getRid(collection); const auto addressbookLocalId = syncStore().resolveRemoteId(ENTITY_TYPE_ADDRESSBOOK, collId); auto ctag = collection.CTag().toLatin1(); if (ctag != syncStore().readValue(collId + "_ctagXX")) { SinkTraceCtx(mLogCtx) << "Syncing " << collId; - auto cache = std::shared_ptr(new KDAV::EtagCache()); - auto davItemsListJob = new KDAV::DavItemsListJob(collection.url(), cache); + auto cache = std::shared_ptr(new KDAV2::EtagCache()); + auto davItemsListJob = new KDAV2::DavItemsListJob(collection.url(), cache); const QByteArray bufferType = ENTITY_TYPE_CONTACT; QHash mergeCriteria; auto colljob = runJob(davItemsListJob).then([davItemsListJob] { return KAsync::value(davItemsListJob->items()); }) - .serialEach([=] (const KDAV::DavItem &item) { + .serialEach([=] (const KDAV2::DavItem &item) { QByteArray rid = getRid(item); if (item.etag().toLatin1() != syncStore().readValue(rid + "_etag")){ SinkTrace() << "Updating " << rid; - auto davItemFetchJob = new KDAV::DavItemFetchJob(item); + auto davItemFetchJob = new KDAV2::DavItemFetchJob(item); auto itemjob = runJob(davItemFetchJob) .then([=] { const auto item = davItemFetchJob->item(); @@ -178,7 +178,7 @@ public: createOrModify(bufferType, rid, contact, mergeCriteria); return item; }) - .then([this, ridList] (const KDAV::DavItem &item) { + .then([this, ridList] (const KDAV2::DavItem &item) { const auto rid = getRid(item); syncStore().writeValue(rid + "_etag", item.etag().toLatin1()); ridList->append(rid); @@ -225,7 +225,7 @@ KAsync::Job replay(const ApplicationDomain::Contact &contact, Sink:: } public: - KDAV::DavUrl mResourceUrl; + KDAV2::DavUrl mResourceUrl; }; @@ -242,7 +242,7 @@ DavResource::DavResource(const Sink::ResourceContext &resourceContext) resourceUrl.setUserName(config.value("username").toString()); resourceUrl.setPassword(config.value("password").toString()); - mResourceUrl = KDAV::DavUrl(resourceUrl, KDAV::CardDav); + mResourceUrl = KDAV2::DavUrl(resourceUrl, KDAV2::CardDav); auto synchronizer = QSharedPointer::create(resourceContext); synchronizer->mResourceUrl = mResourceUrl; -- cgit v1.2.3 From 682b90cc4138ce7d4c2a4eb4b28c8a17b08cd6de Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 29 Jun 2017 12:13:22 +0200 Subject: KDE_FORK_SLAVES is no longer necessary --- examples/davresource/davresource.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'examples/davresource/davresource.cpp') diff --git a/examples/davresource/davresource.cpp b/examples/davresource/davresource.cpp index 1d45f20..465220f 100644 --- a/examples/davresource/davresource.cpp +++ b/examples/davresource/davresource.cpp @@ -232,11 +232,6 @@ public: DavResource::DavResource(const Sink::ResourceContext &resourceContext) : Sink::GenericResource(resourceContext) { - /* - * Fork KIO slaves (used in kdav), instead of starting them via klauncher. - * Otherwise we have yet another runtime dependency that will i.e. not work in the docker container. - */ - qputenv("KDE_FORK_SLAVES", "TRUE"); auto config = ResourceConfig::getConfiguration(resourceContext.instanceId()); auto resourceUrl = QUrl::fromUserInput(config.value("server").toString()); resourceUrl.setUserName(config.value("username").toString()); -- cgit v1.2.3