summaryrefslogtreecommitdiff
path: root/src/calcurse.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-16 16:03:26 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-16 16:03:26 +0200
commit6550591b08eed2c06932f194d5f44ee44084b9b3 (patch)
tree65a3185f61a60d90fd7f918628349b8595877941 /src/calcurse.c
parentf7f49da17ca1352bd86b903d7bac448c3c5174e3 (diff)
downloadcalcurse-6550591b08eed2c06932f194d5f44ee44084b9b3.zip
Add a key binding to reload appointments and todos
This allows for reloading the appointment and todo item files without having to restart calcurse. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/calcurse.c')
-rw-r--r--src/calcurse.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 389334d..ce64b1f 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -254,6 +254,32 @@ static inline void key_generic_save(void)
wins_update(FLAG_STA);
}
+static inline void key_generic_reload(void)
+{
+ /* Reinitialize data structures. */
+ apoint_llist_free();
+ event_llist_free();
+ recur_apoint_llist_free();
+ recur_event_llist_free();
+ todo_free_list();
+
+ apoint_llist_init();
+ event_llist_init();
+ recur_apoint_llist_init();
+ recur_event_llist_init();
+ todo_init_list();
+
+ io_load_todo();
+ io_load_app();
+ ui_todo_load_items();
+ ui_todo_sel_reset();
+
+ do_storage(0);
+ notify_check_next_app(1);
+ ui_calendar_monthly_view_cache_set_invalid();
+ wins_update(FLAG_ALL);
+}
+
static inline void key_generic_import(void)
{
wins_erase_status_bar();
@@ -650,6 +676,7 @@ int main(int argc, char **argv)
HANDLE_KEY(KEY_VIEW_NOTE, key_view_note);
HANDLE_KEY(KEY_GENERIC_HELP, key_generic_help);
HANDLE_KEY(KEY_GENERIC_SAVE, key_generic_save);
+ HANDLE_KEY(KEY_GENERIC_RELOAD, key_generic_reload);
HANDLE_KEY(KEY_GENERIC_IMPORT, key_generic_import);
HANDLE_KEY(KEY_GENERIC_EXPORT, key_generic_export);
HANDLE_KEY(KEY_GENERIC_PREV_DAY, key_generic_prev_day);