#include <config.h>
+#include <assert.h>
#include <algorithm>
#include <functional>
#include "support/filetools.h"
#include "support/lyxmanip.h"
#include "support/lyxfunctional.h"
+#include "support/LAssert.h"
#include "lyx_gui_misc.h"
#include "lastfiles.h"
#include "debug.h"
}
-bool BufferList::QwriteAll()
+bool BufferList::qwriteAll()
{
bool askMoreConfirmation = false;
string unsaved;
if (buf->getUser()) buf->getUser()->insetUnlock();
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
if (buf->getUser())
- ProhibitInput(buf->getUser());
+ buf->getUser()->owner()->prohibitInput();
string fname;
if (buf->isUnnamed())
fname = OnlyFilename(buf->fileName());
reask = false;
} else {
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
return false;
}
break;
break;
case 3: // Cancel
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
return false;
}
}
if (buf->getUser())
- AllowInput(buf->getUser());
+ buf->getUser()->owner()->allowInput();
}
bstore.release(buf);
// File information about normal file
FileInfo fileInfo2(s);
+ if (!fileInfo2.exist()) {
+ WriteAlert(_("Error!"), _("Cannot open file"),
+ MakeDisplayPath(s));
+ return 0;
+ }
+
// Check if emergency save file exists and is newer.
e += OnlyFilename(s) + ".emergency";
FileInfo fileInfoE(e);
if (tname.empty()) {
tname = LibFileSearch("templates", "defaults.lyx");
}
- if (!tname.empty() && IsLyXFilename(tname)) {
+ if (!tname.empty()) {
bool templateok = false;
LyXLex lex(0, 0);
lex.setFile(tname);
- if (lex.IsOK()) {
+ if (lex.isOK()) {
if (b->readFile(lex)) {
templateok = true;
}
Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
{
- // make sure our path is absolute
- string const s = MakeAbsPath(filename);
+ // get absolute path of file and add ".lyx" to the filename if
+ // necessary
+ string s = FileSearch(string(), filename, "lyx");
+ if (s.empty()) {
+ s = filename;
+ }
// file already open?
if (exists(s)) {