From 0053dd5cdcaaaf5b1d0422ce63787cd086b5f3de Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 12 Jan 2016 21:34:18 +0100 Subject: ical: Honor completed status of todo items When importing todo items from an iCal file, mark completed items as completed. Signed-off-by: Lukas Fleischer --- src/ical.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/ical.c b/src/ical.c index c8ae023..6588ba9 100644 --- a/src/ical.c +++ b/src/ical.c @@ -1036,6 +1036,7 @@ ical_read_todo(FILE * fdi, FILE * log, int list, unsigned *notodos, struct { char *mesg, *note; int has_priority, priority; + int completed; } vtodo; int skip_alarm; @@ -1055,6 +1056,8 @@ ical_read_todo(FILE * fdi, FILE * log, int list, unsigned *notodos, if (starts_with_ci(buf, "END:VTODO")) { if (!vtodo.has_priority) vtodo.priority = LOWEST; + if (vtodo.completed) + vtodo.priority = -vtodo.priority; if (!vtodo.mesg) { ical_log(log, ICAL_VTODO, ITEMLINE, _("could not retrieve item summary.")); @@ -1076,6 +1079,8 @@ ical_read_todo(FILE * fdi, FILE * log, int list, unsigned *notodos, _("item priority is not acceptable " "(must be between 1 and 9).")); } + } else if (starts_with_ci(buf, "STATUS:COMPLETED")) { + vtodo.completed = 1; } else if (starts_with_ci(buf, "SUMMARY")) { vtodo.mesg = ical_read_summary(buf); } else if (starts_with_ci(buf, "BEGIN:VALARM")) { -- cgit v1.2.3-70-g09d2