hi, i would like lyx allowing removal of emergency files. i don't agree with automatical removal as suggested in http://bugzilla.lyx.org/show_bug.cgi?id=2120 , so the following patch implements one more confirmation dialog in case newer .emergency file exists (appears after "load original"/"recover" selected).
objections? pavel
diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 1a769cf..fe84542 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2525,11 +2525,32 @@ bool Buffer::readFileHelper(FileName const & s) _("&Recover"), _("&Load Original"), _("&Cancel"))) { - case 0: + case 0: { // the file is not saved if we load the emergency file. markDirty(); - return readFile(e); + docstring str; + bool res; + + if ((res = readFile(e)) == success) + str = _("Document was successfully recovered."); + else + str = _("Document was NOT successfully recovered."); + str += "\n\n" + _("Remove emergency file now?"); + + if (!Alert::prompt(_("Delete emergency file?"), str, 1, 1, + _("&Remove"), _("&Keep it"))) { + e.removeFile(); + if (res == success) + Alert::warning(_("Emergency file deleted"), + _("Do not forget to save your file now!")); + } + return res; + } case 1: + if (!Alert::prompt(_("Delete emergency file?"), + _("Remove emergency file now?"), 1, 1, + _("&Remove"), _("&Keep it"))) + e.removeFile(); break; default: return false;