aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui-day.c
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2019-02-05 21:56:13 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2019-02-28 08:03:53 +0100
commit528368932ceb05fec10638062ca56d6772f21040 (patch)
tree3124e3805f923ef3461c67cf3cab576f4b378634 /src/ui-day.c
parenta47a562322d52275b0bae7181a5077cf95b24ffb (diff)
downloadcalcurse-528368932ceb05fec10638062ca56d6772f21040.tar.gz
calcurse-528368932ceb05fec10638062ca56d6772f21040.zip
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 <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
-rw-r--r--src/ui-day.c20
1 files changed, 19 insertions, 1 deletions
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: