minor improvements and bugfixes

This commit is contained in:
Frederic Culot 2008-01-17 19:35:42 +00:00
parent 738a3a4170
commit 54c2b60041
4 changed files with 35 additions and 15 deletions

View File

@ -1,3 +1,9 @@
17 Jan 2008:
exit_calcurse() improved: screen is now cleared completely when
calcurse exits
io_export_data() improved: it is now possible to cancel calendar export
bugfix in day_edit_item(): null-terminating character missing
13 Jan 2008: 13 Jan 2008:
Ability to attach notes to appointments and events added Ability to attach notes to appointments and events added

View File

@ -1,4 +1,4 @@
/* $calcurse: day.c,v 1.32 2008/01/13 12:40:45 culot Exp $ */ /* $calcurse: day.c,v 1.33 2008/01/17 19:35:42 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -432,7 +432,8 @@ day_write_pad(long date, int width, int length, int incolor)
} }
/* Display an item inside a popup window. */ /* Display an item inside a popup window. */
void day_popup_item(void) void
day_popup_item(void)
{ {
char *error = char *error =
_("FATAL ERROR in day_popup_item: unknown item type\n"); _("FATAL ERROR in day_popup_item: unknown item type\n");
@ -452,7 +453,9 @@ void day_popup_item(void)
* Need to know if there is an item for the current selected day inside * Need to know if there is an item for the current selected day inside
* calendar. This is used to put the correct colors inside calendar panel. * calendar. This is used to put the correct colors inside calendar panel.
*/ */
int day_check_if_item(date_t day) { int
day_check_if_item(date_t day)
{
struct recur_event_s *re; struct recur_event_s *re;
recur_apoint_llist_node_t *ra; recur_apoint_llist_node_t *ra;
struct event_s *e; struct event_s *e;
@ -490,8 +493,8 @@ int day_check_if_item(date_t day) {
} }
/* Update an existing item. */ /* Update an existing item. */
static void update_item(long date, int item_num, struct day_item_s *p, static void
struct rpt_s *rpt) update_item(long date, int item_num, struct day_item_s *p, struct rpt_s *rpt)
{ {
recur_apoint_llist_node_t *ra_new; recur_apoint_llist_node_t *ra_new;
@ -546,10 +549,11 @@ day_edit_time(long time)
void void
day_edit_item(void) day_edit_item(void)
{ {
#define STRT '1' #define SINGLECHAR 2
#define END '2' #define STRT '1'
#define DESC '3' #define END '2'
#define REPT '4' #define DESC '3'
#define REPT '4'
struct day_item_s *p; struct day_item_s *p;
struct recur_event_s *re; struct recur_event_s *re;
@ -666,8 +670,9 @@ day_edit_item(void)
while ( (ch != 'D') && (ch != 'W') && (ch != 'M') while ( (ch != 'D') && (ch != 'W') && (ch != 'M')
&& (ch != 'Y') ) { && (ch != 'Y') ) {
status_mesg(mesg_type_1, mesg_type_2); status_mesg(mesg_type_1, mesg_type_2);
typestr = (char *)malloc(sizeof(char) * 2); typestr = (char *)malloc(sizeof(char) * SINGLECHAR);
*typestr = recur_def2char(rpt->type); snprintf(typestr, SINGLECHAR, "%c",
recur_def2char(rpt->type));
cancel = updatestring(win[STA].p, &typestr, 0, 1); cancel = updatestring(win[STA].p, &typestr, 0, 1);
ch = toupper(*typestr); ch = toupper(*typestr);
free(typestr); free(typestr);

View File

@ -1,4 +1,4 @@
/* $calcurse: io.c,v 1.25 2008/01/13 12:40:45 culot Exp $ */ /* $calcurse: io.c,v 1.26 2008/01/17 19:35:42 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -126,6 +126,7 @@ io_get_export_stream(void)
_("The file cannot be accessed, please enter another file name."); _("The file cannot be accessed, please enter another file name.");
char *press_enter = char *press_enter =
_("Press [ENTER] to continue."); _("Press [ENTER] to continue.");
int cancel;
stream = NULL; stream = NULL;
stream_name = (char *)malloc(BUFSIZ); stream_name = (char *)malloc(BUFSIZ);
@ -136,7 +137,11 @@ io_get_export_stream(void)
while (stream == NULL) { while (stream == NULL) {
status_mesg(question, ""); status_mesg(question, "");
updatestring(win[STA].p, &stream_name, 0, 1); cancel = updatestring(win[STA].p, &stream_name, 0, 1);
if (cancel) {
free(stream_name);
return (NULL);
}
stream = fopen(stream_name, "w"); stream = fopen(stream_name, "w");
if (stream == NULL) { if (stream == NULL) {
status_mesg(wrong_name, press_enter); status_mesg(wrong_name, press_enter);
@ -841,6 +846,9 @@ io_export_data(export_mode_t mode, conf_t *conf)
/* NOTREACHED */ /* NOTREACHED */
} }
if (stream == NULL)
return;
io_export_header(stream); io_export_header(stream);
if (!conf->skip_progress_bar && mode == IO_EXPORT_INTERACTIVE) if (!conf->skip_progress_bar && mode == IO_EXPORT_INTERACTIVE)

View File

@ -1,4 +1,4 @@
/* $calcurse: utils.c,v 1.39 2008/01/13 12:40:45 culot Exp $ */ /* $calcurse: utils.c,v 1.40 2008/01/17 19:35:42 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -45,7 +45,8 @@ void
exit_calcurse(int status) exit_calcurse(int status)
{ {
endwin(); endwin();
erase(); clear();
refresh();
calendar_stop_date_thread(); calendar_stop_date_thread();
exit(status); exit(status);
} }