diff options
Diffstat (limited to 'kresources')
-rw-r--r-- | kresources/caldav/reader.cpp | 15 | ||||
-rw-r--r-- | kresources/caldav/writer.cpp | 31 |
2 files changed, 28 insertions, 18 deletions
diff --git a/kresources/caldav/reader.cpp b/kresources/caldav/reader.cpp index 9e167e7d0..02358ba04 100644 --- a/kresources/caldav/reader.cpp +++ b/kresources/caldav/reader.cpp @@ -63,20 +63,22 @@ int CalDavReader::runJob(runtime_info* RT) { caldav_free_response(&result); - if ((OK == res) && (tasksUrl() != "")) { + CALDAV_RESPONSE tasksres = OK; + + if ((OK == tasksres) && (tasksUrl() != "")) { kdDebug() << "reader::run, url: " << tasksUrl(); result = caldav_get_response(); if (mGetAll) { kdDebug() << "getting all objects"; - res = caldav_tasks_getall_object(result, std::string(tasksUrl().ascii()).c_str(), RT); + tasksres = caldav_tasks_getall_object(result, std::string(tasksUrl().ascii()).c_str(), RT); } else { kdDebug() << "getting object from the specified time range"; - res = caldav_tasks_get_object(result, mTimeStart.toTime_t(), mTimeEnd.toTime_t(), std::string(tasksUrl().ascii()).c_str(), RT); + tasksres = caldav_tasks_get_object(result, mTimeStart.toTime_t(), mTimeEnd.toTime_t(), std::string(tasksUrl().ascii()).c_str(), RT); } - if (OK == res) { + if (OK == tasksres) { kdDebug() << "success"; if (result->msg) { mTasksData = result->msg; @@ -90,7 +92,10 @@ int CalDavReader::runJob(runtime_info* RT) { caldav_free_response(&result); } - return res; + if (tasksres == OK) + return res; + else + return tasksres; } // EOF ======================================================================== diff --git a/kresources/caldav/writer.cpp b/kresources/caldav/writer.cpp index c4101a0b3..de168f363 100644 --- a/kresources/caldav/writer.cpp +++ b/kresources/caldav/writer.cpp @@ -75,37 +75,42 @@ int CalDavWriter::runJob(runtime_info* RT) { } } - if ((OK == res) && (tasksUrl() != "")) { + int tasksres = OK; + + if ((OK == tasksres) && (tasksUrl() != "")) { kdDebug() << "pushing added tasks objects"; - res = pushTasksObjects(mTasksAdded, caldav_add_object, OK, RT); - if (OK == res) { + tasksres = pushTasksObjects(mTasksAdded, caldav_add_object, OK, RT); + if (OK == tasksres) { #ifdef USE_CALDAV_TASKS_MODIFY kdDebug() << "pushing changed objects"; - res = pushTasksObjects(mTasksChanged, caldav_tasks_modify_object, OK, RT); - if (OK == res) { + tasksres = pushTasksObjects(mTasksChanged, caldav_tasks_modify_object, OK, RT); + if (OK == tasksres) { kdDebug() << "pushing deleted objects"; - res = pushTasksObjects(mTasksDeleted, caldav_tasks_delete_object, OK, RT); + tasksres = pushTasksObjects(mTasksDeleted, caldav_tasks_delete_object, OK, RT); } #else // if USE_CALDAV_TASKS_MODIFY kdDebug() << "pushing changed objects (delete)"; - res = pushTasksObjects(mTasksChanged, caldav_tasks_delete_object, OK, RT); - if (OK == res) { + tasksres = pushTasksObjects(mTasksChanged, caldav_tasks_delete_object, OK, RT); + if (OK == tasksres) { kdDebug() << "pushing changed objects (add)"; - res = pushTasksObjects(mTasksChanged, caldav_add_object, OK, RT); - if (OK == res) { + tasksres = pushTasksObjects(mTasksChanged, caldav_add_object, OK, RT); + if (OK == tasksres) { kdDebug() << "pushing deleted objects"; - res = pushTasksObjects(mTasksDeleted, caldav_tasks_delete_object, OK, RT); + tasksres = pushTasksObjects(mTasksDeleted, caldav_tasks_delete_object, OK, RT); } } #endif // if USE_CALDAV_TASKS_MODIFY } } - if (OK != res) { + if ((OK != res) || (OK != tasksres)) { clearObjects(); } - return res; + if (tasksres == OK) + return res; + else + return tasksres; } // EOF ======================================================================== |