summaryrefslogtreecommitdiffstats
path: root/kresources/caldav/job.cpp
diff options
context:
space:
mode:
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