2 * \file GuiErrorList.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
8 * Full author contact details are available in file CREDITS.
13 #include "GuiErrorList.h"
15 #include "qt_helpers.h"
17 #include <QListWidget>
18 #include <QTextBrowser>
19 #include <QPushButton>
20 #include <QCloseEvent>
25 /////////////////////////////////////////////////////////////////////
29 /////////////////////////////////////////////////////////////////////
31 GuiErrorListDialog::GuiErrorListDialog(GuiErrorList * form)
35 connect(closePB, SIGNAL(clicked()),
36 form, SLOT(slotClose()));
37 connect(errorsLW, SIGNAL( itemActivated(QListWidgetItem *)),
38 form, SLOT(slotClose()));
39 connect( errorsLW, SIGNAL( itemClicked(QListWidgetItem *)),
40 this, SLOT(select_adaptor(QListWidgetItem *)));
44 void GuiErrorListDialog::select_adaptor(QListWidgetItem * item)
50 void GuiErrorListDialog::closeEvent(QCloseEvent * e)
57 void GuiErrorListDialog::showEvent(QShowEvent *e)
59 errorsLW->setCurrentRow(0);
60 form_->select(errorsLW->item(0));
65 /////////////////////////////////////////////////////////////////////
69 /////////////////////////////////////////////////////////////////////
72 GuiErrorList::GuiErrorList(Dialog & parent)
73 : GuiView<GuiErrorListDialog>(parent, docstring())
77 void GuiErrorList::build_dialog()
79 dialog_.reset(new GuiErrorListDialog(this));
80 bcview().setCancel(dialog_->closePB);
84 void GuiErrorList::select(QListWidgetItem * wi)
86 int const item = dialog_->errorsLW->row(wi);
87 controller().goTo(item);
88 dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
92 void GuiErrorList::update_contents()
94 setTitle(from_utf8(controller().name()));
95 dialog_->errorsLW->clear();
96 dialog_->descriptionTB->setPlainText(QString());
98 ErrorList::const_iterator it = controller().errorList().begin();
99 ErrorList::const_iterator end = controller().errorList().end();
100 for(; it != end; ++it) {
101 dialog_->errorsLW->addItem(toqstr(it->error));
105 } // namespace frontend
109 #include "GuiErrorList_moc.cpp"