diff options
author | mercurialmoon <mercurialmoon@protonmail.com> | 2020-12-23 19:15:05 -0800 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2021-04-11 19:52:02 -0400 |
commit | a49adf2db7cfb3e4b12fed948c76205a42f334cd (patch) | |
tree | 1a946cfa330bbdfb0a4622d5b9cf647b7162d7ba /src/custom.c | |
parent | 9b148900b87b113bc9f30033eff30865a3b43086 (diff) | |
download | calcurse-a49adf2db7cfb3e4b12fed948c76205a42f334cd.tar.gz calcurse-a49adf2db7cfb3e4b12fed948c76205a42f334cd.zip |
Allow configuration of appointment time format
Added the option to configure the format in which appointment time is
displayed. The setting is called "format.appointmenttime" under the
general settings menu. Setting defaults to previous behavior, which was
"%H:%M".
Signed-off-by: mercurialmoon <mercurialmoon@protonmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/custom.c')
-rw-r--r-- | src/custom.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/custom.c b/src/custom.c index accd8d3..889772e 100644 --- a/src/custom.c +++ b/src/custom.c @@ -545,6 +545,7 @@ enum { INPUT_DATE_FMT, HEADING_POS, DAY_HEADING_FMT, + APPOINTMENT_TIME_FMT, NB_OPTIONS }; @@ -573,7 +574,8 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d "format.outputdate = ", "format.inputdate = ", "appearance.headingposition = ", - "format.dayheading = " + "format.dayheading = ", + "format.appointmenttime = " }; const char *panel; const char *position; @@ -746,6 +748,14 @@ static void print_general_option(int i, WINDOW *win, int y, int hilt, void *cb_d mvwaddstr(win, y + 1, XPOS, _("(Format of the date displayed in the appointments panel)")); break; + case APPOINTMENT_TIME_FMT: + custom_apply_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y, XPOS + strlen(opt[APPOINTMENT_TIME_FMT]), + conf.timefmt); + custom_remove_attr(win, ATTR_HIGHEST); + mvwaddstr(win, y + 1, XPOS, + _("(Format of the time displayed in the appointments panel)")); + break; } if (hilt) @@ -771,6 +781,8 @@ static void general_option_edit(int i) _("Enter a text string (an empty string for the default text)"); const char *output_datefmt_str = _("Enter the date format (see 'man 3 strftime' for possible formats) "); + const char *output_timefmt_str = + _("Enter the time format (see 'man 3 strftime' for possible formats) "); const char *input_datefmt_prefix = _("Enter the date format: "); const char *periodic_save_str = _("Enter the delay, in minutes, between automatic saves (0 to disable) "); @@ -893,6 +905,15 @@ static void general_option_edit(int i) conf.day_heading[BUFSIZ - 1] = '\0'; } break; + case APPOINTMENT_TIME_FMT: + status_mesg(output_timefmt_str, ""); + strncpy(buf, conf.timefmt, BUFSIZ); + buf[BUFSIZ - 1] = '\0'; + if (updatestring(win[STA].p, &buf, 0, 1) == 0) { + strncpy(conf.timefmt, buf, BUFSIZ); + conf.timefmt[BUFSIZ - 1] = '\0'; + } + break; } mem_free(buf); |