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>
24 using namespace lyx::support;
30 GuiShowFile::GuiShowFile(GuiView & lv)
31 : GuiDialog(lv, "file")
34 setViewTitle(_("Show File"));
36 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
39 bc().setCancel(closePB);
43 void GuiShowFile::closeEvent(QCloseEvent * e)
50 void GuiShowFile::updateContents()
52 setWindowTitle(toqstr(onlyFilename(filename_.absFilename())));
54 docstring contents = filename_.fileContents("UTF-8");
56 contents = _("Error -> Cannot load file!");
58 textTB->setPlainText(toqstr(contents));
62 bool GuiShowFile::initialiseParams(string const & data)
64 filename_ = FileName(data);
69 void GuiShowFile::clearParams()
75 Dialog * createGuiShowFile(GuiView & lv) { return new GuiShowFile(lv); }
78 } // namespace frontend
81 #include "GuiShowFile_moc.cpp"