Fix bug #2120 - Emergency saves removal.

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg143251.html
http://marc.info/?l=lyx-devel&m=124938609111483&w=2


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30976 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2009-08-11 08:20:43 +00:00
parent 01b9c5a16e
commit 06bc0ad306

View File

@ -3040,11 +3040,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!"), true);
}
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;