summaryrefslogtreecommitdiffstats
path: root/kresources/carddav/writer.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-26 19:26:36 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-26 19:26:36 +0000
commita3e46fcf743ccdac7c2461658898ca254bf64dd6 (patch)
tree59abeeabcc542e38bfea719c5112413e7c0092ec /kresources/carddav/writer.cpp
parent78933401a0506291b4296ea809685aa93e340090 (diff)
downloadtdepim-a3e46fcf743ccdac7c2461658898ca254bf64dd6.tar.gz
tdepim-a3e46fcf743ccdac7c2461658898ca254bf64dd6.zip
Fixed 404 when deleting multiple contacts
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1168498 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/carddav/writer.cpp')
-rw-r--r--kresources/carddav/writer.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/kresources/carddav/writer.cpp b/kresources/carddav/writer.cpp
index 2216fb065..7141bf303 100644
--- a/kresources/carddav/writer.cpp
+++ b/kresources/carddav/writer.cpp
@@ -58,10 +58,15 @@ int CardDavWriter::runJob(runtime_info* RT) {
res = pushObjects(mChanged, carddav_modify_object_by_uri, OK, RT);
if (OK == res) {
kdDebug() << "pushing deleted objects";
- if (getUseURI() == false)
- res = pushObjects(mDeleted, carddav_delete_object, OK, RT);
- else
- res = pushObjects(mDeleted, carddav_delete_object_by_uri, OK, RT);
+ while (mDeleted.contains("BEGIN:VCARD", TRUE) > 0) {
+ int endLocation = mDeleted.find("END:VCARD", 0, TRUE);
+ TQString deletedCurSeq = mDeleted.mid(0, endLocation+9);
+ mDeleted = mDeleted.remove(0, endLocation+9);
+ if (getUseURI() == false)
+ res = pushObjects(deletedCurSeq, carddav_delete_object, OK, RT);
+ else
+ res = pushObjects(deletedCurSeq, carddav_delete_object_by_uri, OK, RT);
+ }
}
#else // if USE_CARDDAV_MODIFY
kdDebug() << "pushing changed objects (delete)";
@@ -77,10 +82,15 @@ int CardDavWriter::runJob(runtime_info* RT) {
res = pushObjects(mChanged, carddav_add_object, OK, RT);
if (OK == res) {
kdDebug() << "pushing deleted objects";
- if (getUseURI() == false)
- res = pushObjects(mDeleted, carddav_delete_object, OK, RT);
- else
- res = pushObjects(mDeleted, carddav_delete_object_by_uri, OK, RT);
+ while (mDeleted.contains("BEGIN:VCARD", TRUE) > 0) {
+ int endLocation = mDeleted.find("END:VCARD", 0, TRUE);
+ TQString deletedCurSeq = mDeleted.mid(0, endLocation+9);
+ mDeleted = mDeleted.remove(0, endLocation+9);
+ if (getUseURI() == false)
+ res = pushObjects(deletedCurSeq, carddav_delete_object, OK, RT);
+ else
+ res = pushObjects(deletedCurSeq, carddav_delete_object_by_uri, OK, RT);
+ }
}
}
#endif // if USE_CARDDAV_MODIFY