Pavel Sanda wrote: > 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; Jean-Marc Lasgouttes wrote: > Pavel Sanda <sa...@lyx.org> writes: > > > Jean-Marc Lasgouttes wrote: > >> I think that too many dialogs mean that people won't read them. I > >> prefer the approach with a new checkbox as proposed in the bug, since > >> it explicitly tells that the file will be deleted and allows to > >> avoid that (better that 4 buttons in the dialog IMO). > > > > is it possible to do it with Alert:: ? > > Unfortunately not. However, it might be worth have this new sort of > alert (if we want to implement "don't ask me next time" type of > alerts). would you be satisfied when i change this patch so that Alert::warning(_("Emergency file deleted") has 'dont ask me again'? pavel