Fix Error dialog. Patch from Richard and Abdel.

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg158649.html
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg158658.html


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33732 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2010-03-13 11:39:50 +00:00
parent 559537c080
commit 9be4767f27
3 changed files with 30 additions and 8 deletions

View File

@ -3300,17 +3300,26 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
bool const success = theConverters().convert(this, FileName(filename),
tmp_result_file, FileName(absFileName()), backend_format, format,
error_list);
// Emit the signal to show the error list.
// Emit the signal to show the error list or copy it back to the
// cloned Buffer so that it cab be emitted afterwards.
if (format != backend_format) {
errors(error_type);
if (d->cloned_buffer_) {
d->cloned_buffer_->d->errorLists[error_type] =
d->errorLists[error_type];
} else
errors(error_type);
// also to the children, in case of master-buffer-view
std::vector<Buffer *> clist = getChildren();
for (vector<Buffer *>::const_iterator cit = clist.begin();
cit != clist.end(); ++cit)
(*cit)->errors(error_type, true);
cit != clist.end(); ++cit) {
if (d->cloned_buffer_) {
(*cit)->d->cloned_buffer_->d->errorLists[error_type] =
(*cit)->d->errorLists[error_type];
} else
(*cit)->errors(error_type, true);
}
}
if (!success)
return false;
if (d->cloned_buffer_) {
// Enable reverse dvi or pdf to work by copying back the texrow
@ -3318,8 +3327,13 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
// FIXME: There is a possibility of concurrent access to texrow
// here from the main GUI thread that should be securized.
d->cloned_buffer_->d->texrow = d->texrow;
string const error_type = bufferFormat();
d->cloned_buffer_->d->errorLists[error_type] = d->errorLists[error_type];
}
if (!success)
return false;
if (put_in_tempdir) {
result_file = tmp_result_file.absFilename();
return true;

View File

@ -108,8 +108,9 @@ void GuiErrorList::paramsToDialog()
errorsLW->clear();
descriptionTB->setPlainText(QString());
ErrorList::const_iterator it = errorList().begin();
ErrorList::const_iterator end = errorList().end();
ErrorList const & el = errorList();
ErrorList::const_iterator it = el.begin();
ErrorList::const_iterator end = el.end();
for (; it != end; ++it)
errorsLW->addItem(toqstr(it->error));
errorsLW->setCurrentRow(0);

View File

@ -351,6 +351,8 @@ public:
///
QFutureWatcher<docstring> autosave_watcher_;
QFutureWatcher<docstring> preview_watcher_;
///
string last_export_format;
#else
struct DummyWatcher { bool isRunning(){return false;} };
DummyWatcher preview_watcher_;
@ -447,6 +449,7 @@ void GuiView::threadFinished()
QFutureWatcher<docstring> const * watcher =
static_cast<QFutureWatcher<docstring> const *>(sender());
message(watcher->result());
errors(d.last_export_format);
#endif
}
@ -2824,6 +2827,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(exportAndDestroy,
doc_buffer->clone(), format);
d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else
bool const update_unincluded =
doc_buffer->params().maintain_unincluded_children
@ -2844,6 +2848,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(previewAndDestroy,
doc_buffer->clone(), format);
d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else
bool const update_unincluded =
doc_buffer->params().maintain_unincluded_children
@ -2863,6 +2868,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(exportAndDestroy,
master->clone(), format);
d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else
bool const update_unincluded =
master->params().maintain_unincluded_children
@ -2880,6 +2886,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(previewAndDestroy,
master->clone(), format);
d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else
master->preview(format);
#endif