Emergency save of dirty Buffers when they are destroyed.

Better fix to be committed for 1.6.5.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31117 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-08-18 13:40:17 +00:00
parent 0aeadcb787
commit 412cd14027
3 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author Lars Gullik Bj<EFBFBD>nnes
* \author Stefan Schimanski
*
* Full author contact details are available in file CREDITS.
@ -313,6 +313,20 @@ Buffer::~Buffer()
d->children_positions.clear();
d->position_to_children.clear();
if (!isClean()) {
docstring const text = bformat(_("The document %1$s has unsaved changes."
"\n\nDo you want to save the document or discard the changes?"), from_utf8(absFileName()));
int const ret = Alert::prompt(_("Save changed document?"),
text, 0, 2, _("&Save"), _("&Discard"));
switch (ret) {
case 0:
save();
break;
case 1:
break;
}
}
if (!d->temppath.destroyDirectory()) {
Alert::warning(_("Could not remove temporary directory"),
bformat(_("Could not remove the temporary directory %1$s"),

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author Lars Gullik Bj<EFBFBD>nnes
*
* Full author contact details are available in file CREDITS.
*/
@ -282,6 +282,8 @@ docstring BufferList::emergencyWrite(Buffer * buf)
}
user_message += _(" Save failed! Bummer. Document is lost.");
// Don't try again
buf->markClean();
return user_message;
}

View File

@ -3,10 +3,10 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
* \author Lars Gullik Bj<EFBFBD>nnes
* \author John Levon
* \author Abdelrazak Younes
* \author Peter Kümmel
* \author Peter K<EFBFBD>mmel
*
* Full author contact details are available in file CREDITS.
*/
@ -1875,6 +1875,7 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
// have no autosave file but I guess
// this is really improbable (Jug)
buf.removeAutosaveFile();
buf.markClean();
break;
case 2:
return false;