diff options
-rwxr-xr-x | src/day.c | 19 | ||||
-rwxr-xr-x | src/day.h | 39 |
2 files changed, 30 insertions, 28 deletions
@@ -1,4 +1,4 @@ -/* $calcurse: day.c,v 1.22 2007/05/06 13:33:06 culot Exp $ */ +/* $calcurse: day.c,v 1.23 2007/07/01 17:52:45 culot Exp $ */ /* * Calcurse - text-based organizer @@ -359,12 +359,12 @@ void day_popup_item(void) * 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. */ - int day_check_if_item(int year, int month, int day) { + int day_check_if_item(date_t day) { struct recur_event_s *re; recur_apoint_llist_node_t *ra; struct event_s *e; apoint_llist_node_t *a; - const long date = date2sec(year, month, day, 0, 0); + const long date = date2sec(day, 0, 0); for (re = recur_elist; re != 0; re = re->next) if (recur_item_inday(re->day, re->exc, re->rpt->type, @@ -398,7 +398,7 @@ void day_popup_item(void) /* Edit an already existing item. */ void -day_edit_item(int year, int month, int day, int item_num) +day_edit_item(int item_num) { #define STRT '1' #define END '2' @@ -410,9 +410,9 @@ day_edit_item(int year, int month, int day, int item_num) struct rpt_s *rpt; struct tm *lt; time_t t; + date_t new_date; recur_apoint_llist_node_t *ra, *ra_new; - long newtime = 0; - const long date = date2sec(year, month, day, 0, 0); + long date, newtime = 0; int cancel, ch = 0, valid_date = 0, newfreq = 0, date_entered = 0; int newmonth, newday, newyear; unsigned hr, mn; @@ -442,6 +442,7 @@ day_edit_item(int year, int month, int day, int item_num) _("Enter the new ending date: [mm/dd/yyyy] or '0'"); p = day_get_item(item_num); + date = calendar_get_slctd_day_sec(); switch (p->type) { case RECUR_EVNT: @@ -559,8 +560,10 @@ day_edit_item(int year, int month, int day, int item_num) sscanf(timestr, "%d / %d / %d", &newmonth, &newday, &newyear); t = p->start; lt = localtime(&t); - rpt->until = date2sec( - newyear, newmonth, newday, + new_date.dd = newday; + new_date.mm = newmonth; + new_date.yyyy = newyear; + rpt->until = date2sec(new_date, lt->tm_hour, lt->tm_min); if (rpt->until < p->start) { status_mesg(error_msg, @@ -1,4 +1,4 @@ -/* $calcurse: day.h,v 1.11 2007/04/04 19:41:27 culot Exp $ */ +/* $calcurse: day.h,v 1.12 2007/07/01 17:52:45 culot Exp $ */ /* * Calcurse - text-based organizer @@ -29,7 +29,7 @@ #include <stdio.h> -#include "vars.h" +#include "calendar.h" #include "apoint.h" #define MAX_TYPES 4 @@ -58,23 +58,22 @@ struct day_saved_item_s { char *mesg; }; -int day_store_items(long date, int *pnb_events, int *pnb_apoints); -void day_free_list(void); -int day_store_recur_events(long date); -int day_store_events(long date); -int day_store_recur_apoints(long date); -int day_store_apoints(long date); -struct day_item_s *day_add_event(int type, char *mesg, long day, int id); -struct day_item_s *day_add_apoint(int type, char *mesg, long start, long dur, - char state, int real_pos); -void day_write_pad(long date, int width, int length, int incolor); -apoint_llist_node_t *day_item_s2apoint_s(struct day_item_s *p); -void day_popup_item(void); -int day_check_if_item(int year, int month, int day); -void day_edit_item(int year, int month, int day, int item_num); -char *day_edit_time(long time); -int day_erase_item(long date, int item_number, int force_erase); -struct day_item_s *day_get_item(int item_number); -int day_item_nb(long date, int day_num, int type); +int day_store_items(long, int *, int *); +void day_free_list(void); +int day_store_recur_events(long); +int day_store_events(long); +int day_store_recur_apoints(long); +int day_store_apoints(long); +struct day_item_s *day_add_event(int, char *, long, int); +struct day_item_s *day_add_apoint(int, char *, long, long, char, int); +void day_write_pad(long, int, int, int); +apoint_llist_node_t *day_item_s2apoint_s(struct day_item_s *); +void day_popup_item(void); +int day_check_if_item(date_t); +void day_edit_item(int); +char *day_edit_time(long); +int day_erase_item(long, int, int); +struct day_item_s *day_get_item(int); +int day_item_nb(long, int, int); #endif /* CALCURSE_DAY_H */ |