diff options
author | Frederic Culot <calcurse@culot.org> | 2006-11-02 13:41:45 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2006-11-02 13:41:45 +0000 |
commit | f9709c4aa3d2d7fb1d0c863dd262b1dd7fe90f37 (patch) | |
tree | 014c016177dd50fc0c500eabb60d4a3b3d2441ab /src | |
parent | 0a961944fb32a770206e2cd1f1240cb4f81ee5ca (diff) | |
download | calcurse-f9709c4aa3d2d7fb1d0c863dd262b1dd7fe90f37.zip |
calls to getstring() updated
'E' key added to edit already existing items
Diffstat (limited to 'src')
-rwxr-xr-x | src/calcurse.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/calcurse.c b/src/calcurse.c index a0eb279..6dc3c6c 100755 --- a/src/calcurse.c +++ b/src/calcurse.c @@ -1,4 +1,4 @@ -/* $calcurse: calcurse.c,v 1.25 2006/10/28 13:11:21 culot Exp $ */ +/* $calcurse: calcurse.c,v 1.26 2006/11/02 13:41:45 culot Exp $ */ /* * Calcurse - text-based organizer @@ -333,6 +333,14 @@ int main(int argc, char **argv) } break; + case 'E': + case 'e': /* Edit an existing item */ + if (which_pan == APPOINTMENT) { + } else if (which_pan == TODO) { + todo_edit_item(hilt_tod, colr); + } + break; + case 'D': case 'd': /* Delete an item */ del_item(); @@ -829,7 +837,7 @@ void config_notify_bar(void) break; case '2': status_mesg(date_str, ""); - if (getstring(swin, colr, buf, 0, 1) == 0) { + if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0) { pthread_mutex_lock(&nbar->mutex); strncpy(nbar->datefmt, buf, strlen(buf) + 1); pthread_mutex_unlock(&nbar->mutex); @@ -838,7 +846,7 @@ void config_notify_bar(void) break; case '3': status_mesg(time_str, ""); - if (getstring(swin, colr, buf, 0, 1) == 0 ) { + if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0 ) { pthread_mutex_lock(&nbar->mutex); strncpy(nbar->timefmt, buf, strlen(buf) + 1); pthread_mutex_unlock(&nbar->mutex); @@ -847,7 +855,7 @@ void config_notify_bar(void) break; case '4': status_mesg(count_str, ""); - if (getstring(swin, colr, buf, 0, 1) == 0 && + if (getstring(swin, colr, buf, MAX_LENGTH, 0, 1) == 0 && is_all_digit(buf) && atoi(buf) >= 0 && atoi(buf) <= DAYINSEC) { pthread_mutex_lock(&nbar->mutex); @@ -1076,6 +1084,7 @@ void del_item(void) */ void add_item(void) { +#define LTIME 6 char *mesg_1 = _("Enter start time ([hh:mm] or [h:mm]), leave blank for an all-day event : "); char *mesg_2 = _("Enter end time ([hh:mm] or [h:mm]) or duration (in minutes) : "); char *mesg_3 = _("Enter description :"); @@ -1083,7 +1092,7 @@ void add_item(void) char *format_message_2 = _("You entered an invalid end time, should be [h:mm] or [hh:mm] or [mm]"); char *enter_str = _("Press [Enter] to continue"); int Id; - char item_time[MAX_LENGTH] = ""; + char item_time[LTIME] = ""; char item_mesg[MAX_LENGTH] = ""; long apoint_duration, apoint_start; apoint_llist_node_t *apoint_pointeur; @@ -1095,7 +1104,7 @@ void add_item(void) /* Get the starting time */ while (check_time(item_time) != 1) { status_mesg(mesg_1, ""); - if (getstring(swin, colr, item_time, 0, 1) == 0) { + if (getstring(swin, colr, item_time, LTIME, 0, 1) == 0) { if (strlen(item_time) == 0){ is_appointment = 0; break; @@ -1115,7 +1124,7 @@ void add_item(void) strcpy(item_time, ""); while (check_time(item_time) == 0) { status_mesg(mesg_2, ""); - if (getstring(swin, colr, item_time, 0, 1) != 0) + if (getstring(swin, colr, item_time, LTIME, 0, 1) != 0) return; //nothing entered, cancel adding of event else if (check_time(item_time) == 0) { status_mesg(format_message_2, enter_str); @@ -1143,7 +1152,7 @@ void add_item(void) } // get the item description status_mesg(mesg_3, ""); - if (getstring(swin, colr, item_mesg, 0, 1) == 0) { + if (getstring(swin, colr, item_mesg, MAX_LENGTH, 0, 1) == 0) { if (is_appointment){ // insert the appointment in list apoint_start = date2sec(sel_year, sel_month, sel_day, |