diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-24 17:21:58 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-24 17:21:58 +0000 |
commit | a71c4476a79950040c9007f84af25cef4e28b351 (patch) | |
tree | 20d54bfeb827604e6b1c4ca01e9702346ddcc068 /kresources/caldav/writer.cpp | |
parent | 45c9a75f1220817f57304df51e018f8cc66aaea4 (diff) | |
download | tdepim-a71c4476a79950040c9007f84af25cef4e28b351.tar.gz tdepim-a71c4476a79950040c9007f84af25cef4e28b351.zip |
Initial CalDAV support
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1130194 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/caldav/writer.cpp')
-rw-r--r-- | kresources/caldav/writer.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/kresources/caldav/writer.cpp b/kresources/caldav/writer.cpp new file mode 100644 index 000000000..e2e87355e --- /dev/null +++ b/kresources/caldav/writer.cpp @@ -0,0 +1,81 @@ +/*========================================================================= +| KCalDAV +|-------------------------------------------------------------------------- +| (c) 2010 Timothy Pearson +| (c) 2009 Kumaran Santhanam (initial KDE4 version) +| +| This project is released under the GNU General Public License. +| Please see the file COPYING for more details. +|-------------------------------------------------------------------------- +| Remote calendar writing class. + ========================================================================*/ + +/*========================================================================= +| INCLUDES + ========================================================================*/ + +#include "writer.h" +#include <kdebug.h> + +/*========================================================================= +| DEFINES + ========================================================================*/ + +// Use caldav_modify_object() function. +// If it's not set, a pair of caldav_delete_object/caldav_add_object +// is used for modifying objects. +// It's done, because, for some reason, SOGo server returns an error +// on caldav_modify_object. DAViCAL works fine both ways. +//#define USE_CALDAV_MODIFY + +/*========================================================================= +| NAMESPACE + ========================================================================*/ + +using namespace KCal; + +/*========================================================================= +| METHODS + ========================================================================*/ + +void CalDavWriter::cleanJob() { + CalDavJob::cleanJob(); +} + +int CalDavWriter::runJob(runtime_info* RT) { + kdDebug() << "writer::run, url: " << url() << "\n"; + + int res = OK; + + kdDebug() << "pushing added objects"; + res = pushObjects(mAdded, caldav_add_object, OK, RT); + if (OK == res) { +#ifdef USE_CALDAV_MODIFY + kdDebug() << "pushing changed objects"; + res = pushObjects(mChanged, caldav_modify_object, OK, RT); + if (OK == res) { + kdDebug() << "pushing deleted objects"; + res = pushObjects(mDeleted, caldav_delete_object, OK, RT); + } +#else // if USE_CALDAV_MODIFY + kdDebug() << "pushing changed objects (delete)"; + res = pushObjects(mChanged, caldav_delete_object, OK, RT); + if (OK == res) { + kdDebug() << "pushing changed objects (add)"; + res = pushObjects(mChanged, caldav_add_object, OK, RT); + if (OK == res) { + kdDebug() << "pushing deleted objects"; + res = pushObjects(mDeleted, caldav_delete_object, OK, RT); + } + } +#endif // if USE_CALDAV_MODIFY + } + + if (OK != res) { + clearObjects(); + } + + return res; +} + +// EOF ======================================================================== |