2 * \file GuiShowFile.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #include "GuiShowFile.h"
16 #include "qt_helpers.h"
17 #include "support/filetools.h"
19 #include <QTextBrowser>
20 #include <QPushButton>
21 #include <QCloseEvent>
28 using support::FileName;
29 using support::onlyFilename;
31 GuiShowFile::GuiShowFile(GuiView & lv)
32 : GuiDialog(lv, "file")
35 setViewTitle(_("Show File"));
37 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
39 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
40 bc().setCancel(closePB);
44 void GuiShowFile::closeEvent(QCloseEvent * e)
51 void GuiShowFile::updateContents()
53 setWindowTitle(toqstr(onlyFilename(filename_.absFilename())));
55 docstring contents = filename_.fileContents("UTF-8");
57 contents = _("Error -> Cannot load file!");
59 textTB->setPlainText(toqstr(contents));
63 bool GuiShowFile::initialiseParams(string const & data)
65 filename_ = FileName(data);
70 void GuiShowFile::clearParams()
76 Dialog * createGuiShowFile(GuiView & lv) { return new GuiShowFile(lv); }
79 } // namespace frontend
82 #include "GuiShowFile_moc.cpp"