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>
23 using namespace lyx::support;
29 GuiShowFile::GuiShowFile(GuiView & lv)
30 : GuiDialog(lv, "file", qt_("Show File"))
34 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
36 bc().setPolicy(ButtonPolicy::OkCancelPolicy);
37 bc().setCancel(closePB);
41 void GuiShowFile::updateContents()
43 setWindowTitle(onlyFileName(toqstr(filename_.absFileName())));
45 QString contents = toqstr(filename_.fileContents("UTF-8"));
46 if (contents.isEmpty())
47 contents = qt_("Error -> Cannot load file!");
49 textTB->setPlainText(contents);
53 bool GuiShowFile::initialiseParams(string const & data)
55 filename_ = FileName(data);
60 void GuiShowFile::clearParams()
66 Dialog * createGuiShowFile(GuiView & lv) { return new GuiShowFile(lv); }
69 } // namespace frontend
72 #include "moc_GuiShowFile.cpp"