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>
This commit is contained in:
parent
ab9256adf0
commit
1af9ccccd7
@ -120,7 +120,6 @@ static inline void key_generic_config_menu(void)
|
||||
static inline void key_generic_add_appt(void)
|
||||
{
|
||||
ui_day_item_add();
|
||||
do_storage(1);
|
||||
wins_update(FLAG_CAL | FLAG_APP | FLAG_STA);
|
||||
}
|
||||
|
||||
@ -136,7 +135,6 @@ static inline void key_add_item(void)
|
||||
case APP:
|
||||
case CAL:
|
||||
ui_day_item_add();
|
||||
do_storage(0);
|
||||
wins_update(FLAG_CAL | FLAG_APP | FLAG_STA);
|
||||
break;
|
||||
case TOD:
|
||||
|
19
src/ui-day.c
19
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user