From 9be4767f27dd6a4a8fdda8e3a7b6bcdda6183fa2 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Sat, 13 Mar 2010 11:39:50 +0000 Subject: [PATCH] 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 --- src/Buffer.cpp | 26 ++++++++++++++++++++------ src/frontends/qt4/GuiErrorList.cpp | 5 +++-- src/frontends/qt4/GuiView.cpp | 7 +++++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 5236a627ac..8c1abfbd8c 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -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 clist = getChildren(); for (vector::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; diff --git a/src/frontends/qt4/GuiErrorList.cpp b/src/frontends/qt4/GuiErrorList.cpp index 17c07673a8..efc82ba2ad 100644 --- a/src/frontends/qt4/GuiErrorList.cpp +++ b/src/frontends/qt4/GuiErrorList.cpp @@ -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); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 89e439e029..a573c0669a 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -351,6 +351,8 @@ public: /// QFutureWatcher autosave_watcher_; QFutureWatcher preview_watcher_; + /// + string last_export_format; #else struct DummyWatcher { bool isRunning(){return false;} }; DummyWatcher preview_watcher_; @@ -447,6 +449,7 @@ void GuiView::threadFinished() QFutureWatcher const * watcher = static_cast const *>(sender()); message(watcher->result()); + errors(d.last_export_format); #endif } @@ -2824,6 +2827,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) QFuture 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 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 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 f = QtConcurrent::run(previewAndDestroy, master->clone(), format); d.setPreviewFuture(f); + d.last_export_format = doc_buffer->bufferFormat(); #else master->preview(format); #endif