summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-12 21:34:18 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-13 17:39:44 +0100
commit0053dd5cdcaaaf5b1d0422ce63787cd086b5f3de (patch)
treeab39a3881520d3864c2f25253eae9d2f0a3ebeba /src
parent576784bca813a0c4eb7641f3bef59ae78ed12eec (diff)
downloadcalcurse-0053dd5cdcaaaf5b1d0422ce63787cd086b5f3de.zip
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 <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/ical.c5
1 files changed, 5 insertions, 0 deletions
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")) {