summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-09-28 19:00:01 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2016-09-28 19:03:20 +0200
commit1af9ccccd79fa053dc5eb51f98e0bc1bd6f7d2b5 (patch)
treed2634793a44e749c42b22aab32e97fb6bb5453c6
parentab9256adf082ce78cfb39eb246323e57b846a7a4 (diff)
downloadcalcurse-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>
-rw-r--r--src/calcurse.c2
-rw-r--r--src/ui-day.c19
2 files changed, 11 insertions, 10 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 89710af..b84d22b 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -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:
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();