]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.cpp
Get rid of all-insets-toggle and explain how to replace it with inset-forall.
[lyx.git] / src / buffer_funcs.cpp
index 8224241ee1db2a4a871648da302dc2cb653ca8bb..c3f41c18ae024b93becfa50efb9b2ec370c40339 100644 (file)
@@ -67,18 +67,16 @@ Buffer * checkAndLoadLyXFile(FileName const & filename, bool const acceptDirty)
                if (checkBuffer->isClean() || acceptDirty)
                        return checkBuffer;
                docstring const file = makeDisplayPath(filename.absFilename(), 20);
-               docstring text = bformat(_(
+               docstring const text = bformat(_(
                                "The document %1$s is already loaded and has unsaved changes.\n"
                                "Do you want to abandon your changes and reload the version on disk?"), file);
-               if (Alert::prompt(_("Reload saved document?"),
-                               text, 0, 1,  _("&Reload"), _("&Keep Changes")))
-                       return checkBuffer;
-
-               // FIXME: should be LFUN_REVERT
-               checkBuffer->markClean();
-               theBufferList().release(checkBuffer);
-               // Load it again.
-               return checkAndLoadLyXFile(filename);
+               if (!Alert::prompt(_("Reload saved document?"),
+                         text, 0, 1,  _("&Reload"), _("&Keep Changes"))) {
+                       // reload the document
+                       if (!checkBuffer->reload())
+                               return 0;
+               }
+               return checkBuffer;
        }
 
        if (filename.exists()) {
@@ -95,6 +93,8 @@ Buffer * checkAndLoadLyXFile(FileName const & filename, bool const acceptDirty)
                        return 0;
                }
                if (!b->loadLyXFile(filename)) {
+                       // do not save an emergency file when releasing the buffer
+                       b->markClean();
                        theBufferList().release(b);
                        return 0;
                }