From: Art Cancro Date: Tue, 20 Jan 2009 04:51:47 +0000 (+0000) Subject: * When saving a Task, if the status is COMPLETED then also set PERCENT-COMPLETE:100... X-Git-Tag: v7.86~1592 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=c23931edd4019965dea322ea753bcb5fda0b8be7;p=citadel.git * When saving a Task, if the status is COMPLETED then also set PERCENT-COMPLETE:100 so Kontact sees it as complete as well. (We probably should go the other way too, but that needs further discussion.) --- diff --git a/webcit/calendar.c b/webcit/calendar.c index d50e1f77e..d97750bbb 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -842,10 +842,19 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from icalcomponent_remove_property(vtodo,prop); icalproperty_free(prop); } + icalcomponent_remove_property(vtodo, + icalcomponent_get_first_property(vtodo, ICAL_PERCENTCOMPLETE_PROPERTY)); if (havebstr("status")) { - icalproperty_status taskStatus = icalproperty_string_to_status( - bstr("status")); + icalproperty_status taskStatus = icalproperty_string_to_status(bstr("status")); icalcomponent_set_status(vtodo, taskStatus); + icalcomponent_add_property(vtodo, + icalproperty_new_percentcomplete( + (strcasecmp(bstr("status"), "completed") ? 0 : 100) + ) + ); + } + else { + icalcomponent_add_property(vtodo, icalproperty_new_percentcomplete(0)); } while (prop = icalcomponent_get_first_property(vtodo, ICAL_CATEGORIES_PROPERTY), prop != NULL) {