summaryrefslogtreecommitdiffstats
path: root/kresources/caldav/reader.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-24 17:21:58 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-24 17:21:58 +0000
commita71c4476a79950040c9007f84af25cef4e28b351 (patch)
tree20d54bfeb827604e6b1c4ca01e9702346ddcc068 /kresources/caldav/reader.cpp
parent45c9a75f1220817f57304df51e018f8cc66aaea4 (diff)
downloadtdepim-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/reader.cpp')
-rw-r--r--kresources/caldav/reader.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/kresources/caldav/reader.cpp b/kresources/caldav/reader.cpp
new file mode 100644
index 000000000..e4d4a6e6b
--- /dev/null
+++ b/kresources/caldav/reader.cpp
@@ -0,0 +1,65 @@
+/*=========================================================================
+| 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 loading.
+ ========================================================================*/
+
+/*=========================================================================
+| INCLUDES
+ ========================================================================*/
+
+#include "reader.h"
+#include <kdebug.h>
+
+/*=========================================================================
+| NAMESPACE
+ ========================================================================*/
+
+using namespace KCal;
+
+/*=========================================================================
+| METHODS
+ ========================================================================*/
+
+void CalDavReader::cleanJob() {
+ CalDavJob::cleanJob();
+ mData = "";
+}
+
+int CalDavReader::runJob(runtime_info* RT) {
+ kdDebug() << "reader::run, url: " << url();
+
+ response* result = caldav_get_response();
+ CALDAV_RESPONSE res = OK;
+
+ if (mGetAll) {
+ kdDebug() << "getting all objects";
+ res = caldav_getall_object(result, std::string(url().ascii()).c_str(), RT);
+ } else {
+ kdDebug() << "getting object from the specified time range";
+ res = caldav_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 = "";
+ }
+ }
+
+ caldav_free_response(&result);
+
+ return res;
+}
+
+// EOF ========================================================================