From 2b4a6f9c76cc71bfe07525874921f636c2656d6b Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 30 Apr 2018 14:23:41 +0200 Subject: Better logs + allow collection removal --- examples/caldavresource/caldavresource.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/caldavresource/caldavresource.cpp b/examples/caldavresource/caldavresource.cpp index 3fbd624..900681d 100644 --- a/examples/caldavresource/caldavresource.cpp +++ b/examples/caldavresource/caldavresource.cpp @@ -119,8 +119,6 @@ protected: switch (operation) { case Sink::Operation_Creation: { - SinkLog() << "Replaying creation"; - auto rawIcal = event.getIcal(); if(rawIcal == "") { return KAsync::error("No ICal in event for creation replay"); @@ -132,17 +130,17 @@ protected: item.setContentType("text/calendar"); item.setUrl(urlOf(collectionId, event.getUid())); + SinkLog() << "Creating event:" << event.getSummary(); return createItem(item).then([item] { return resourceID(item); }); } case Sink::Operation_Removal: { // We only need the URL in the DAV item for removal item.setUrl(urlOf(oldRemoteId)); + SinkLog() << "Removing event:" << oldRemoteId; return removeItem(item).then([oldRemoteId] { return oldRemoteId; }); } case Sink::Operation_Modification: - SinkLog() << "Replaying modification"; - auto rawIcal = event.getIcal(); if(rawIcal == "") { return KAsync::error("No ICal in event for modification replay"); @@ -152,6 +150,8 @@ protected: item.setContentType("text/calendar"); item.setUrl(urlOf(oldRemoteId)); + SinkLog() << "Modifying event:" << event.getSummary(); + // It would be nice to check that the URL of the item hasn't // changed and move he item if it did, but since the URL is // pretty much arbitrary, whoe does that anyway? @@ -162,17 +162,16 @@ protected: KAsync::Job replay(const Calendar &calendar, Sink::Operation operation, const QByteArray &oldRemoteId, const QList &changedProperties) Q_DECL_OVERRIDE { - - // TODO: add the URL to list of attributes, can't do nothing otherwise switch (operation) { case Sink::Operation_Creation: - SinkLog() << "Replaying calendar creation"; + SinkWarning() << "Unimplemented replay of calendar creation"; break; case Sink::Operation_Removal: SinkLog() << "Replaying calendar removal"; + removeCollection(urlOf(oldRemoteId)); break; case Sink::Operation_Modification: - SinkLog() << "Replaying calendar modification"; + SinkWarning() << "Unimplemented replay of calendar modification"; break; } -- cgit v1.2.3