diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-31 07:49:08 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-31 07:49:08 +0000 |
commit | 7ef3b0e2a5e5bc9bf928e989e4f66932be096824 (patch) | |
tree | d1b924b843f78b9d9de26becb36bb8e12f7fef44 /kresources/carddav/reader.cpp | |
parent | f4a40d0495ff26b8767cf321fa8039e5ac633c12 (diff) | |
download | tdepim-7ef3b0e2a5e5bc9bf928e989e4f66932be096824.tar.gz tdepim-7ef3b0e2a5e5bc9bf928e989e4f66932be096824.zip |
Added new carddav resource for kaddressbook
Lots of bugfixes for korganizer caldav resource
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1132701 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/carddav/reader.cpp')
-rw-r--r-- | kresources/carddav/reader.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/kresources/carddav/reader.cpp b/kresources/carddav/reader.cpp new file mode 100644 index 000000000..57375e9f9 --- /dev/null +++ b/kresources/carddav/reader.cpp @@ -0,0 +1,65 @@ +/*========================================================================= +| KABCDAV +|-------------------------------------------------------------------------- +| (c) 2010 Timothy Pearson +| +| This project is released under the GNU General Public License. +| Please see the file COPYING for more details. +|-------------------------------------------------------------------------- +| Remote address book loading. + ========================================================================*/ + +/*========================================================================= +| INCLUDES + ========================================================================*/ + +#include "reader.h" +#include <kdebug.h> +#include <string> + +/*========================================================================= +| NAMESPACE + ========================================================================*/ + +using namespace KABC; + +/*========================================================================= +| METHODS + ========================================================================*/ + +void CardDavReader::cleanJob() { + CardDavJob::cleanJob(); + mData = ""; +} + +int CardDavReader::runJob(runtime_info* RT) { + kdDebug() << "reader::run, url: " << url(); + + response* result = carddav_get_response(); + CARDDAV_RESPONSE res = OK; + + if (mGetAll) { + kdDebug() << "getting all objects"; + res = carddav_getall_object(result, std::string(url().ascii()).c_str(), RT); + } else { + kdDebug() << "getting object from the specified time range"; + res = carddav_get_object(result, mTimeStart.toTime_t(), mTimeEnd.toTime_t(), std::string(url().ascii()).c_str(), RT); + } + + if (OK == res) { + kdDebug() << "success"; + if (result->msg) { + mData = result->msg; + } else { + kdDebug() << "empty collection"; + // empty collection + mData = ""; + } + } + + carddav_free_response(&result); + + return res; +} + +// EOF ======================================================================== |