diff --git a/src/Buffer.cpp b/src/Buffer.cpp index b9c0bb5864..54c0e89946 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -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�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"), diff --git a/src/BufferList.cpp b/src/BufferList.cpp index 14271db087..f57726a928 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -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�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; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 8d0c75e6dd..8e354768ed 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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�nnes * \author John Levon * \author Abdelrazak Younes - * \author Peter Kümmel + * \author Peter K�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;