diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-09-28 19:00:01 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-09-28 19:03:20 +0200 |
commit | 1af9ccccd79fa053dc5eb51f98e0bc1bd6f7d2b5 (patch) | |
tree | d2634793a44e749c42b22aab32e97fb6bb5453c6 /src/ui-day.c | |
parent | ab9256adf082ce78cfb39eb246323e57b846a7a4 (diff) | |
download | calcurse-1af9ccccd79fa053dc5eb51f98e0bc1bd6f7d2b5.zip |
Automatically select new appointments/events
This is a follow-up to commit 65b699f (Make automatic selection of
appointments/events smarter, 2016-02-16). Newly created appointments and
events are now selected automatically.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/ui-day.c')
-rw-r--r-- | src/ui-day.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/ui-day.c b/src/ui-day.c index c8a4420..1956a7f 100644 --- a/src/ui-day.c +++ b/src/ui-day.c @@ -524,6 +524,7 @@ void ui_day_item_add(void) unsigned apoint_duration; unsigned end_h, end_m; int is_appointment = 1; + union aptev_ptr item; /* Get the starting time */ for (;;) { @@ -580,26 +581,28 @@ void ui_day_item_add(void) status_mesg(format_message_2, enter_str); wgetch(win[KEY].p); } + } else { + heures = minutes = 0; } status_mesg(mesg_3, ""); if (getstring(win[STA].p, item_mesg, BUFSIZ, 0, 1) == GETSTRING_VALID) { + apoint_start = date2sec(*ui_calendar_get_slctd_day(), heures, + minutes); if (is_appointment) { - apoint_start = - date2sec(*ui_calendar_get_slctd_day(), heures, - minutes); - apoint_new(item_mesg, 0L, apoint_start, - min2sec(apoint_duration), 0L); + item.apt = apoint_new(item_mesg, 0L, apoint_start, + min2sec(apoint_duration), 0L); if (notify_bar()) notify_check_added(item_mesg, apoint_start, 0L); } else { - event_new(item_mesg, 0L, - date2sec(*ui_calendar_get_slctd_day(), 0, - 0), 1); + item.ev = event_new(item_mesg, 0L, apoint_start, 1); } io_set_modified(); + day_process_storage(ui_calendar_get_slctd_day(), 0); + ui_day_load_items(); + ui_day_set_selitem_by_aptev_ptr(item); } ui_calendar_monthly_view_cache_set_invalid(); |