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"
14 #include "ControlErrorList.h"
16 #include "qt_helpers.h"
18 #include <QListWidget>
19 #include <QTextBrowser>
20 #include <QPushButton>
21 #include <QCloseEvent>
28 GuiErrorListDialog::GuiErrorListDialog(LyXView & lv)
29 : GuiDialog(lv, "errorlist")
32 setController(new ControlErrorList(*this));
34 connect(closePB, SIGNAL(clicked()),
35 this, SLOT(slotClose()));
36 connect(errorsLW, SIGNAL(itemActivated(QListWidgetItem *)),
37 this, SLOT(slotClose()));
38 connect( errorsLW, SIGNAL(itemClicked(QListWidgetItem *)),
39 this, SLOT(select_adaptor(QListWidgetItem *)));
41 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
42 bc().setCancel(closePB);
46 ControlErrorList & GuiErrorListDialog::controller() const
48 return static_cast<ControlErrorList &>(GuiDialog::controller());
52 void GuiErrorListDialog::select_adaptor(QListWidgetItem * item)
58 void GuiErrorListDialog::closeEvent(QCloseEvent * e)
65 void GuiErrorListDialog::showEvent(QShowEvent *e)
67 errorsLW->setCurrentRow(0);
68 select(errorsLW->item(0));
73 void GuiErrorListDialog::select(QListWidgetItem * wi)
75 int const item = errorsLW->row(wi);
76 controller().goTo(item);
77 descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
81 void GuiErrorListDialog::update_contents()
83 setViewTitle(from_utf8(controller().name()));
85 descriptionTB->setPlainText(QString());
87 ErrorList::const_iterator it = controller().errorList().begin();
88 ErrorList::const_iterator end = controller().errorList().end();
89 for (; it != end; ++it)
90 errorsLW->addItem(toqstr(it->error));
93 } // namespace frontend
97 #include "GuiErrorList_moc.cpp"