diff options
author | Frederic Culot <calcurse@culot.org> | 2006-08-01 20:35:44 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2006-08-01 20:35:44 +0000 |
commit | 207bc526facd932b20da7b101e42ce00ca60fa66 (patch) | |
tree | 97d4d15c816c42c3096db87b6d3c6bc23f5854a0 /src/day.c | |
parent | 3a93c079f9e52ad83101101d8abcf73b5196b8da (diff) | |
download | calcurse-207bc526facd932b20da7b101e42ce00ca60fa66.tar.gz calcurse-207bc526facd932b20da7b101e42ce00ca60fa66.zip |
day_erase_item() created
Diffstat (limited to 'src/day.c')
-rwxr-xr-x | src/day.c | 52 |
1 files changed, 51 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $calcurse: day.c,v 1.1 2006/07/31 21:00:03 culot Exp $ */ +/* $calcurse: day.c,v 1.2 2006/08/01 20:35:44 culot Exp $ */ /* * Calcurse - text-based organizer @@ -360,3 +360,53 @@ void day_popup_item(void) return 0; } + +/* + * In order to erase an item, we need to count first the number of + * items for each type (in order: recurrent events, events, + * recurrent appointments and appointments) and then to test the + * type of the item to be deleted. + */ +int day_erase_item(long date, int item_number) { + int i; + int ch = 0; + int nb_item[MAX_TYPES - 1]; + struct day_item_s *p; + char *erase_warning = + _("This item is recurrent. " + "Delete (a)ll occurences or just this (o)ne ?"); + char *erase_choice = + _("[a/o] "); + + for (i = 0; i < MAX_TYPES; i++) + nb_item[i] = 0; + + p = day_items_ptr; + for (i = 1; i < item_number; i++) { + nb_item[p->type - 1]++; + p = p->next; + } + + switch (p->type) { + case RECUR_EVNT: + case RECUR_APPT: + while ( (ch != 'a') && (ch != 'o')) { + status_mesg(erase_warning, erase_choice); + ch = wgetch(swin); + } + if (ch == 'a') { + } else if (ch == 'o') { + } + break; + + case EVNT: + event_delete_bynum(date, nb_item[EVNT - 1]); + break; + + case APPT: + apoint_delete_bynum(date, nb_item[APPT - 1]); + break; + } + + return p->type; +} |