summaryrefslogtreecommitdiff
path: root/src/day.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-04-09 20:38:29 +0000
committerFrederic Culot <calcurse@culot.org>2008-04-09 20:38:29 +0000
commit0c281d2c1e53248f0075f988fb4ba02f041bd170 (patch)
tree7f42987f28c6a4912c1bcbb99a1f17b1509fd52f /src/day.c
parent0f6374d787158e50b510a8a032ff80bf7848da8a (diff)
downloadcalcurse-0c281d2c1e53248f0075f988fb4ba02f041bd170.zip
Tony's patch concerning date format configuration imported
Diffstat (limited to 'src/day.c')
-rwxr-xr-xsrc/day.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/day.c b/src/day.c
index 9d7fe79..e2a587f 100755
--- a/src/day.c
+++ b/src/day.c
@@ -1,4 +1,4 @@
-/* $calcurse: day.c,v 1.34 2008/01/20 10:45:38 culot Exp $ */
+/* $calcurse: day.c,v 1.35 2008/04/09 20:38:29 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -564,11 +564,12 @@ update_desc(char **desc)
}
static void
-update_rept(struct rpt_s **rpt, const long start)
+update_rept(struct rpt_s **rpt, const long start, conf_t *conf)
{
const int SINGLECHAR = 2;
- int ch, cancel, newfreq, date_entered, valid_date;
+ int ch, cancel, newfreq, date_entered;
long newuntil;
+ char outstr[BUFSIZ];
char *typstr, *freqstr, *timstr;
char *msg_rpt_type =
_("Enter the new repetition type: (D)aily, (W)eekly, "
@@ -578,8 +579,8 @@ update_rept(struct rpt_s **rpt, const long start)
char *msg_wrong_time =
_("Invalid time: start time must be before end time!");
char *msg_wrong_date = _("The entered date is not valid.");
- char *msg_fmts = _("Possible formats are [mm/dd/yyyy] or '0' "
- "for an endless repetetition");
+ char *msg_fmts = "Possible formats are [%s] or '0' "
+ "for an endless repetetition";
char *msg_enter = _("Press [Enter] to continue");
do {
@@ -615,9 +616,10 @@ update_rept(struct rpt_s **rpt, const long start)
} while (newfreq == 0);
do {
- status_mesg(_("Enter the new ending date: [mm/dd/yyyy] or '0'"),
- "");
- timstr = date_sec2date_str((*rpt)->until);
+ snprintf(outstr, BUFSIZ, "Enter the new ending date: [%s] or '0'",
+ DATEFMT_DESC(conf->input_datefmt));
+ status_mesg(_(outstr), "");
+ timstr = date_sec2date_str((*rpt)->until, DATEFMT(conf->input_datefmt));
cancel = updatestring(win[STA].p, &timstr, 0, 1);
if (cancel) {
free(timstr);
@@ -632,10 +634,8 @@ update_rept(struct rpt_s **rpt, const long start)
date_t new_date;
int newmonth, newday, newyear;
- valid_date = check_date(timstr);
- if (valid_date) {
- sscanf(timstr, "%d / %d / %d",
- &newmonth, &newday, &newyear);
+ if (parse_date(timstr, conf->input_datefmt,
+ &newyear, &newmonth, &newday)) {
t = start;
lt = localtime(&t);
new_date.dd = newday;
@@ -650,7 +650,9 @@ update_rept(struct rpt_s **rpt, const long start)
} else
date_entered = 1;
} else {
- status_mesg(msg_wrong_date, msg_fmts);
+ snprintf(outstr, BUFSIZ, msg_fmts,
+ DATEFMT_DESC(conf->input_datefmt));
+ status_mesg(msg_wrong_date, _(outstr));
wgetch(win[STA].p);
date_entered = 0;
}
@@ -665,7 +667,7 @@ update_rept(struct rpt_s **rpt, const long start)
/* Edit an already existing item. */
void
-day_edit_item(void)
+day_edit_item(conf_t *conf)
{
#define STRT '1'
#define END '2'
@@ -698,7 +700,7 @@ day_edit_item(void)
update_desc(&re->mesg);
break;
case '2':
- update_rept(&re->rpt, re->day);
+ update_rept(&re->rpt, re->day, conf);
break;
default:
return;
@@ -727,7 +729,7 @@ day_edit_item(void)
update_desc(&ra->mesg);
break;
case REPT:
- update_rept(&ra->rpt, ra->start);
+ update_rept(&ra->rpt, ra->start, conf);
break;
case ESCAPE:
return;