Relay the ReadStatus all the way up to the GUI also for Buffer::reload().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35908 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-10-29 16:26:32 +00:00
parent 91b4afa3c1
commit c9a91c5474
4 changed files with 11 additions and 10 deletions

View File

@ -4096,7 +4096,7 @@ int Buffer::spellCheck(DocIterator & from, DocIterator & to,
}
bool Buffer::reload()
Buffer::ReadStatus Buffer::reload()
{
setBusy(true);
// c.f. bug 6587
@ -4105,8 +4105,8 @@ bool Buffer::reload()
d->filename.refresh();
docstring const disp_fn = makeDisplayPath(d->filename.absFileName());
bool const success = (loadLyXFile(d->filename) == ReadSuccess);
if (success) {
ReadStatus const status = loadLyXFile(d->filename);
if (status == ReadSuccess) {
updateBuffer();
changed(true);
updateTitles();
@ -4121,7 +4121,7 @@ bool Buffer::reload()
if (graphics::Previews::status() != LyXRC::PREVIEW_OFF)
thePreviews().generateBufferPreviews(*this);
errors("Parse");
return success;
return status;
}

View File

@ -199,7 +199,7 @@ public:
/// read a new document from a string
bool readString(std::string const &);
/// Reloads the LyX file
bool reload();
ReadStatus reload();
//FIXME: The following function should be private
//private:
/// read the header, returns number of unknown tokens

View File

@ -75,7 +75,7 @@ Buffer * checkAndLoadLyXFile(FileName const & filename, bool const acceptDirty)
if (!Alert::prompt(_("Reload saved document?"),
text, 0, 1, _("&Reload"), _("&Keep Changes"))) {
// reload the document
if (!checkBuffer->reload())
if (checkBuffer->reload() != Buffer::ReadSuccess)
return 0;
}
return checkBuffer;

View File

@ -2621,10 +2621,11 @@ static bool ensureBufferClean(Buffer * buffer)
bool GuiView::reloadBuffer()
{
Buffer * buffer = documentBufferView()
? &(documentBufferView()->buffer()) : 0;
if (buffer)
return buffer->reload();
BufferView * view = documentBufferView();
if (view) {
Buffer::ReadStatus status = view->buffer().reload();
return status == Buffer::ReadSuccess;
}
return false;
}