del_apoint() renamed to del_item() and updated to take recurrent items into account
This commit is contained in:
parent
207bc526fa
commit
0198fff6ef
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: calcurse.c,v 1.1 2006/07/31 21:00:02 culot Exp $ */
|
/* $calcurse: calcurse.c,v 1.2 2006/08/01 20:36:29 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -107,7 +107,7 @@ void update_windows(int surrounded_window);
|
|||||||
void general_config(void);
|
void general_config(void);
|
||||||
void print_general_options(WINDOW *win);
|
void print_general_options(WINDOW *win);
|
||||||
void print_option_incolor(WINDOW *win, bool option, int pos_x, int pos_y);
|
void print_option_incolor(WINDOW *win, bool option, int pos_x, int pos_y);
|
||||||
void del_apoint(void);
|
void del_item(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse is a text-based personal organizer which helps keeping track
|
* Calcurse is a text-based personal organizer which helps keeping track
|
||||||
@ -309,7 +309,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'd': /* Delete an item */
|
case 'd': /* Delete an item */
|
||||||
del_apoint();
|
del_item();
|
||||||
do_storage = true;
|
do_storage = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -768,7 +768,7 @@ void print_option_incolor(WINDOW *win, bool option, int pos_y, int pos_x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Delete an event from the ToDo or Appointment lists */
|
/* Delete an event from the ToDo or Appointment lists */
|
||||||
void del_apoint(void)
|
void del_item(void)
|
||||||
{
|
{
|
||||||
char *choices = "[y/n] ";
|
char *choices = "[y/n] ";
|
||||||
char *del_app_str = _("Do you really want to delete this item ?");
|
char *del_app_str = _("Do you really want to delete this item ?");
|
||||||
@ -779,6 +779,7 @@ void del_apoint(void)
|
|||||||
bool go_for_todo_del = false;
|
bool go_for_todo_del = false;
|
||||||
int to_be_removed = 0;
|
int to_be_removed = 0;
|
||||||
int answer = 0;
|
int answer = 0;
|
||||||
|
int deleted_item_type = 0;
|
||||||
|
|
||||||
/* delete an appointment */
|
/* delete an appointment */
|
||||||
if (which_pan == APPOINTMENT && hilt_app != 0) {
|
if (which_pan == APPOINTMENT && hilt_app != 0) {
|
||||||
@ -799,17 +800,20 @@ void del_apoint(void)
|
|||||||
|
|
||||||
if (go_for_deletion) {
|
if (go_for_deletion) {
|
||||||
if (nb_items != 0) {
|
if (nb_items != 0) {
|
||||||
if (hilt_app <= number_events_inday) {
|
deleted_item_type = day_erase_item(date, hilt_app);
|
||||||
event_delete_bynum(date, hilt_app - 1);
|
if (deleted_item_type == EVNT ||
|
||||||
|
deleted_item_type == RECUR_EVNT) {
|
||||||
number_events_inday--;
|
number_events_inday--;
|
||||||
to_be_removed = 1;
|
to_be_removed = 1;
|
||||||
} else {
|
} else if (deleted_item_type == APPT ||
|
||||||
apoint_delete_bynum(date,
|
deleted_item_type == RECUR_APPT) {
|
||||||
hilt_app -
|
|
||||||
number_events_inday - 1);
|
|
||||||
number_apoints_inday--;
|
number_apoints_inday--;
|
||||||
to_be_removed = 3;
|
to_be_removed = 3;
|
||||||
|
} else { /* NOTREACHED */
|
||||||
|
fputs(_("FATAL ERROR in del_item: no such type\n"), stderr);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hilt_app > 1) --hilt_app;
|
if (hilt_app > 1) --hilt_app;
|
||||||
if (apad->first_onscreen >= to_be_removed)
|
if (apad->first_onscreen >= to_be_removed)
|
||||||
apad->first_onscreen =
|
apad->first_onscreen =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user