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>
This commit is contained in:
parent
f7f49da17c
commit
6550591b08
@ -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);
|
||||
|
@ -417,6 +417,7 @@ enum key {
|
||||
KEY_GENERIC_HELP,
|
||||
KEY_GENERIC_QUIT,
|
||||
KEY_GENERIC_SAVE,
|
||||
KEY_GENERIC_RELOAD,
|
||||
KEY_GENERIC_COPY,
|
||||
KEY_GENERIC_PASTE,
|
||||
KEY_GENERIC_CHANGE_VIEW,
|
||||
|
@ -56,6 +56,7 @@ static struct keydef_s keydef[NBKEYS] = {
|
||||
{"generic-help", "?"},
|
||||
{"generic-quit", "q Q"},
|
||||
{"generic-save", "s S C-s"},
|
||||
{"generic-reload", "R"},
|
||||
{"generic-copy", "c"},
|
||||
{"generic-paste", "p C-v"},
|
||||
{"generic-change-view", "TAB"},
|
||||
@ -92,7 +93,7 @@ static struct keydef_s keydef[NBKEYS] = {
|
||||
{"view-item", "v V"},
|
||||
{"pipe-item", "|"},
|
||||
{"flag-item", "!"},
|
||||
{"repeat", "r R"},
|
||||
{"repeat", "r"},
|
||||
{"edit-note", "n N"},
|
||||
{"view-note", ">"},
|
||||
{"raise-priority", "+"},
|
||||
@ -470,6 +471,7 @@ void keys_popup_info(enum key key)
|
||||
info[KEY_GENERIC_QUIT] =
|
||||
_("Exit from the current menu, or quit calcurse.");
|
||||
info[KEY_GENERIC_SAVE] = _("Save calcurse data.");
|
||||
info[KEY_GENERIC_RELOAD] = _("Reload appointments and todo items.");
|
||||
info[KEY_GENERIC_COPY] =
|
||||
_("Copy the item that is currently selected.");
|
||||
info[KEY_GENERIC_PASTE] =
|
||||
|
42
src/wins.c
42
src/wins.c
@ -611,9 +611,9 @@ void wins_launch_external(const char *file, const char *cmd)
|
||||
wins_unprepare_external();
|
||||
}
|
||||
|
||||
#define NB_CAL_CMDS 27 /* number of commands while in cal view */
|
||||
#define NB_APP_CMDS 32 /* same thing while in appointment view */
|
||||
#define NB_TOD_CMDS 31 /* same thing while in todo view */
|
||||
#define NB_CAL_CMDS 28 /* number of commands while in cal view */
|
||||
#define NB_APP_CMDS 33 /* same thing while in appointment view */
|
||||
#define NB_TOD_CMDS 32 /* same thing while in todo view */
|
||||
|
||||
static unsigned status_page;
|
||||
|
||||
@ -628,6 +628,7 @@ void wins_status_bar(void)
|
||||
struct binding help = { _("Help"), KEY_GENERIC_HELP };
|
||||
struct binding quit = { _("Quit"), KEY_GENERIC_QUIT };
|
||||
struct binding save = { _("Save"), KEY_GENERIC_SAVE };
|
||||
struct binding reload = { _("Reload"), KEY_GENERIC_RELOAD };
|
||||
struct binding copy = { _("Copy"), KEY_GENERIC_COPY };
|
||||
struct binding paste = { _("Paste"), KEY_GENERIC_PASTE };
|
||||
struct binding chgvu = { _("Chg Win"), KEY_GENERIC_CHANGE_VIEW };
|
||||
@ -670,33 +671,26 @@ void wins_status_bar(void)
|
||||
struct binding othr = { _("OtherCmd"), KEY_GENERIC_OTHER_CMD };
|
||||
|
||||
struct binding *bindings_cal[] = {
|
||||
&help, &quit, &save, &chgvu, &nview, &pview, &up, &down,
|
||||
&left, &right,
|
||||
&togo, &import, &export, &weekb, &weeke, &appt, &todo,
|
||||
&gpday, &gnday,
|
||||
&gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear,
|
||||
&draw, &today,
|
||||
&conf, &cmd
|
||||
&help, &quit, &save, &reload, &chgvu, &nview, &pview, &up,
|
||||
&down, &left, &right, &togo, &import, &export, &weekb, &weeke,
|
||||
&appt, &todo, &gpday, &gnday, &gpweek, &gnweek, &gpmonth,
|
||||
&gnmonth, &gpyear, &gnyear, &draw, &today, &conf, &cmd
|
||||
};
|
||||
|
||||
struct binding *bindings_apoint[] = {
|
||||
&help, &quit, &save, &chgvu, &import, &export, &add, &del,
|
||||
&edit, &view,
|
||||
&pipe, &draw, &rept, &flag, &enote, &vnote, &up, &down,
|
||||
&gpday, &gnday,
|
||||
&gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear,
|
||||
&togo, &today,
|
||||
&conf, &appt, &todo, ©, &paste, &cmd
|
||||
&help, &quit, &save, &reload, &chgvu, &import, &export, &add,
|
||||
&del, &edit, &view, &pipe, &draw, &rept, &flag, &enote, &vnote,
|
||||
&up, &down, &gpday, &gnday, &gpweek, &gnweek, &gpmonth,
|
||||
&gnmonth, &gpyear, &gnyear, &togo, &today, &conf, &appt, &todo,
|
||||
©, &paste, &cmd
|
||||
};
|
||||
|
||||
struct binding *bindings_todo[] = {
|
||||
&help, &quit, &save, &chgvu, &import, &export, &add, &del,
|
||||
&edit, &view,
|
||||
&pipe, &flag, &rprio, &lprio, &enote, &vnote, &up, &down,
|
||||
&gpday, &gnday,
|
||||
&gpweek, &gnweek, &gpmonth, &gnmonth, &gpyear, &gnyear,
|
||||
&togo, &today,
|
||||
&conf, &appt, &todo, &draw, &cmd
|
||||
&help, &quit, &save, &reload, &chgvu, &import, &export, &add,
|
||||
&del, &edit, &view, &pipe, &flag, &rprio, &lprio, &enote,
|
||||
&vnote, &up, &down, &gpday, &gnday, &gpweek, &gnweek, &gpmonth,
|
||||
&gnmonth, &gpyear, &gnyear, &togo, &today, &conf, &appt, &todo,
|
||||
&draw, &cmd
|
||||
};
|
||||
|
||||
enum win active_panel = wins_slctd();
|
||||
|
Loading…
x
Reference in New Issue
Block a user