summaryrefslogtreecommitdiffstats
path: root/examples/caldavresource/caldavresource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/caldavresource/caldavresource.cpp')
-rw-r--r--examples/caldavresource/caldavresource.cpp15
1 files 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:
119 119
120 switch (operation) { 120 switch (operation) {
121 case Sink::Operation_Creation: { 121 case Sink::Operation_Creation: {
122 SinkLog() << "Replaying creation";
123
124 auto rawIcal = event.getIcal(); 122 auto rawIcal = event.getIcal();
125 if(rawIcal == "") { 123 if(rawIcal == "") {
126 return KAsync::error<QByteArray>("No ICal in event for creation replay"); 124 return KAsync::error<QByteArray>("No ICal in event for creation replay");
@@ -132,17 +130,17 @@ protected:
132 item.setContentType("text/calendar"); 130 item.setContentType("text/calendar");
133 item.setUrl(urlOf(collectionId, event.getUid())); 131 item.setUrl(urlOf(collectionId, event.getUid()));
134 132
133 SinkLog() << "Creating event:" << event.getSummary();
135 return createItem(item).then([item] { return resourceID(item); }); 134 return createItem(item).then([item] { return resourceID(item); });
136 } 135 }
137 case Sink::Operation_Removal: { 136 case Sink::Operation_Removal: {
138 // We only need the URL in the DAV item for removal 137 // We only need the URL in the DAV item for removal
139 item.setUrl(urlOf(oldRemoteId)); 138 item.setUrl(urlOf(oldRemoteId));
140 139
140 SinkLog() << "Removing event:" << oldRemoteId;
141 return removeItem(item).then([oldRemoteId] { return oldRemoteId; }); 141 return removeItem(item).then([oldRemoteId] { return oldRemoteId; });
142 } 142 }
143 case Sink::Operation_Modification: 143 case Sink::Operation_Modification:
144 SinkLog() << "Replaying modification";
145
146 auto rawIcal = event.getIcal(); 144 auto rawIcal = event.getIcal();
147 if(rawIcal == "") { 145 if(rawIcal == "") {
148 return KAsync::error<QByteArray>("No ICal in event for modification replay"); 146 return KAsync::error<QByteArray>("No ICal in event for modification replay");
@@ -152,6 +150,8 @@ protected:
152 item.setContentType("text/calendar"); 150 item.setContentType("text/calendar");
153 item.setUrl(urlOf(oldRemoteId)); 151 item.setUrl(urlOf(oldRemoteId));
154 152
153 SinkLog() << "Modifying event:" << event.getSummary();
154
155 // It would be nice to check that the URL of the item hasn't 155 // It would be nice to check that the URL of the item hasn't
156 // changed and move he item if it did, but since the URL is 156 // changed and move he item if it did, but since the URL is
157 // pretty much arbitrary, whoe does that anyway? 157 // pretty much arbitrary, whoe does that anyway?
@@ -162,17 +162,16 @@ protected:
162 KAsync::Job<QByteArray> replay(const Calendar &calendar, Sink::Operation operation, 162 KAsync::Job<QByteArray> replay(const Calendar &calendar, Sink::Operation operation,
163 const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE 163 const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE
164 { 164 {
165
166 // TODO: add the URL to list of attributes, can't do nothing otherwise
167 switch (operation) { 165 switch (operation) {
168 case Sink::Operation_Creation: 166 case Sink::Operation_Creation:
169 SinkLog() << "Replaying calendar creation"; 167 SinkWarning() << "Unimplemented replay of calendar creation";
170 break; 168 break;
171 case Sink::Operation_Removal: 169 case Sink::Operation_Removal:
172 SinkLog() << "Replaying calendar removal"; 170 SinkLog() << "Replaying calendar removal";
171 removeCollection(urlOf(oldRemoteId));
173 break; 172 break;
174 case Sink::Operation_Modification: 173 case Sink::Operation_Modification:
175 SinkLog() << "Replaying calendar modification"; 174 SinkWarning() << "Unimplemented replay of calendar modification";
176 break; 175 break;
177 } 176 }
178 177