]> 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 be53275791336cb833ee7acc0c26591b446956d2..c3f41c18ae024b93becfa50efb9b2ec370c40339 100644 (file)
@@ -67,17 +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
-               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()) {
@@ -94,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;
                }
@@ -165,7 +166,7 @@ Buffer * newUnnamedFile(FileName const & path, string const & prefix,
        }
        while (theBufferList().exists(filename) || filename.isReadableFile());
                
-       return newFile(filename.absFilename(), "", false);
+       return newFile(filename.absFilename(), templatename, false);
 }