summaryrefslogtreecommitdiffstats
path: root/src/calcurse.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-16 20:03:06 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-16 20:05:21 +0200
commit46d260a4381f88d4ac8b2dc17179db8beaee5718 (patch)
tree88ff173f79f7bb84545273f315b48a0b14322a3f /src/calcurse.c
parentb36d253dce737a188bff85891fc5b4c4341f6564 (diff)
downloadcalcurse-46d260a4381f88d4ac8b2dc17179db8beaee5718.tar.gz
calcurse-46d260a4381f88d4ac8b2dc17179db8beaee5718.zip
Warn when reloading with unsaved modifications
Since the reload operation overwrites all changes, warn before reloading if there are unsaved modifications. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/calcurse.c')
-rw-r--r--src/calcurse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index ce64b1f..149d7bb 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -256,6 +256,13 @@ static inline void key_generic_save(void)
static inline void key_generic_reload(void)
{
+ if (io_get_modified() && status_ask_bool(_("By reloading items, you "
+ "will lose any unsaved modifications. "
+ "Continue?")) != 1) {
+ wins_update(FLAG_STA);
+ return;
+ }
+
/* Reinitialize data structures. */
apoint_llist_free();
event_llist_free();
@@ -271,6 +278,7 @@ static inline void key_generic_reload(void)
io_load_todo();
io_load_app();
+ io_unset_modified();
ui_todo_load_items();
ui_todo_sel_reset();
@@ -616,6 +624,7 @@ int main(int argc, char **argv)
io_load_keys(conf.pager);
io_load_todo();
io_load_app();
+ io_unset_modified();
wins_resize();
/*
* Refresh the hidden key handler window here to prevent wgetch() from