From 528368932ceb05fec10638062ca56d6772f21040 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Tue, 5 Feb 2019 21:56:13 +0100 Subject: View or edit exception days of a recurrent item The exception days are presented for viewing/editing as a string of space-separated dates (in the user-preferred input format). After editing the string is checked for valid dates, but there is no check that a date is meaningful (an occurrence day of the item between start day and until day). Although possible, it is best to add exception days in the usual way by deletion of occurrences. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/ui-day.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/ui-day.c') diff --git a/src/ui-day.c b/src/ui-day.c index 626cf5a..2df9cef 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -367,6 +367,22 @@ cleanup: mem_free(outstr); } +/* Edit the list of exception days for a recurrent item. */ +static void update_exc(llist_t *exc) +{ + if (!exc->head) + return; + char *days; + enum getstr ret; + + status_mesg(_("Exception days:"), ""); + days = recur_exc2str(exc); + ret = updatestring(win[STA].p, &days, 0, 1); + if (ret == GETSTRING_VALID || ret == GETSTRING_RET) + recur_update_exc(exc, days); + mem_free(days); +} + /* Edit an already existing item. */ void ui_day_item_edit(void) { @@ -386,7 +402,7 @@ void ui_day_item_edit(void) re = p->item.rev; const char *choice_recur_evnt[2] = { _("Description"), - _("Repetition"), + _("Repetition") }; switch (status_ask_simplechoice (_("Edit: "), choice_recur_evnt, 2)) { @@ -396,6 +412,7 @@ void ui_day_item_edit(void) break; case 2: update_rept(&re->rpt, re->day); + update_exc(&re->exc); io_set_modified(); break; default: @@ -437,6 +454,7 @@ void ui_day_item_edit(void) case 4: need_check_notify = 1; update_rept(&ra->rpt, ra->start); + update_exc(&ra->exc); io_set_modified(); break; case 5: -- cgit v1.2.3-54-g00ecf