summaryrefslogtreecommitdiffstats
path: root/kresources/caldav/job.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-30 04:23:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-30 04:23:41 +0000
commit5572a114be163aeae75648f8e82ce692d4a77517 (patch)
tree2da72faeaf863704e8b030424cf8090e33137bcb /kresources/caldav/job.cpp
parent66f01dde7cd5e36d9623428f70a008c9e8abe1d3 (diff)
downloadtdepim-5572a114be163aeae75648f8e82ce692d4a77517.tar.gz
tdepim-5572a114be163aeae75648f8e82ce692d4a77517.zip
Separated event and task reads into two separate jobs
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1169762 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kresources/caldav/job.cpp')
-rw-r--r--kresources/caldav/job.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/kresources/caldav/job.cpp b/kresources/caldav/job.cpp
index 1f6c38c49..6edfbbfe8 100644
--- a/kresources/caldav/job.cpp
+++ b/kresources/caldav/job.cpp
@@ -62,6 +62,12 @@ void CalDavJob::setErrorString(const TQString& err, const long number) {
mErrorNumber = number;
}
+void CalDavJob::setTasksErrorString(const TQString& err, const long number) {
+ mTasksError = true;
+ mTasksErrorString = err;
+ mTasksErrorNumber = number;
+}
+
void CalDavJob::processError(const caldav_error* err) {
TQString error_string;
@@ -70,7 +76,7 @@ void CalDavJob::processError(const caldav_error* err) {
if (-401 == code) { // unauthorized
error_string = i18n("Unauthorized. Username or password incorrect.");
} else if (-599 <= code && code <= -300) {
- error_string = i18n("HTTP error %1. Maybe, URL is not a CalDAV resource.").arg(-code);
+ error_string = i18n("HTTP error %1. Please ensure that the URL is a valid CalDAV resource.").arg(-code);
} else {
error_string = err->str;
}
@@ -78,12 +84,29 @@ void CalDavJob::processError(const caldav_error* err) {
setErrorString(error_string, code);
}
+void CalDavJob::processTasksError(const caldav_error* err) {
+ TQString error_string;
+
+ long code = err->code;
+
+ if (-401 == code) { // unauthorized
+ error_string = i18n("Unauthorized. Username or password incorrect.");
+ } else if (-599 <= code && code <= -300) {
+ error_string = i18n("HTTP error %1. Please ensure that the URL is a valid CalDAV resource.").arg(-code);
+ } else {
+ error_string = err->str;
+ }
+
+ setTasksErrorString(error_string, code);
+}
+
void CalDavJob::run() {
log("cleaning job");
cleanJob();
int res = OK;
+ int tasksres = OK;
runtime_info* caldav_runtime = caldav_get_runtime_info();
@@ -92,14 +115,22 @@ void CalDavJob::run() {
enableCaldavDebug(caldav_runtime);
#endif // KCALDAV_DEBUG
- log("running job");
+ log("running event job");
res = runJob(caldav_runtime);
if (OK != res) {
- log("job failed");
+ log("event job failed");
processError(caldav_runtime->error);
}
+ log("running tasks job");
+ tasksres = runTasksJob(caldav_runtime);
+
+ if (OK != tasksres) {
+ log("tasks job failed");
+ processTasksError(caldav_runtime->error);
+ }
+
caldav_free_runtime_info(&caldav_runtime);
// Signal done