Error return code for io_reload_data()

The return code from new_data() and io_load_data() is explicitly defined as a
bit mask. A file access error is recognised and reported back to the user.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen
2018-09-05 08:46:16 +02:00
committed by Lukas Fleischer
parent ff402d21ab
commit 4b192c0773
3 changed files with 23 additions and 10 deletions

View File

@@ -309,7 +309,9 @@ static inline void key_generic_reload(void)
int ret;
ret = io_reload_data();
if (ret != IO_RELOAD_CANCEL && ret != IO_RELOAD_NOOP) {
if (ret == IO_RELOAD_LOAD ||
ret == IO_RELOAD_CTINUE ||
ret == IO_RELOAD_MERGE) {
ui_todo_load_items();
ui_todo_sel_reset();
do_storage(0);
@@ -331,6 +333,8 @@ static inline void key_generic_reload(void)
case IO_RELOAD_NOOP:
msg = _("Data were already loaded");
break;
case IO_RELOAD_ERROR:
EXIT(_("Cannot open data file"));
}
status_mesg(msg, "");
}