2 * \file GuiShowFile.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "GuiShowFile.h"
15 #include "ControlShowFile.h"
16 #include "qt_helpers.h"
18 #include <QTextBrowser>
19 #include <QPushButton>
20 #include <QCloseEvent>
26 GuiShowFileDialog::GuiShowFileDialog(LyXView & lv)
27 : GuiDialog(lv, "file")
30 setViewTitle(_("Show File"));
31 setController(new ControlShowFile(*this));
33 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
35 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
36 bc().setCancel(closePB);
40 ControlShowFile & GuiShowFileDialog::controller() const
42 return static_cast<ControlShowFile &>(Dialog::controller());
46 void GuiShowFileDialog::closeEvent(QCloseEvent * e)
53 void GuiShowFileDialog::update_contents()
55 setWindowTitle(toqstr(controller().getFileName()));
57 std::string contents = controller().getFileContents();
58 if (contents.empty()) {
59 contents = "Error -> Cannot load file!";
62 textTB->setPlainText(toqstr(contents));
65 } // namespace frontend
68 #include "GuiShowFile_moc.cpp"