#include <QTextBrowser>
#include <QPushButton>
-#include <QCloseEvent>
+using namespace std;
+using namespace lyx::support;
namespace lyx {
namespace frontend {
-using support::FileName;
-using support::onlyFilename;
GuiShowFile::GuiShowFile(GuiView & lv)
- : GuiDialog(lv, "file")
+ : GuiDialog(lv, "file", qt_("Show File"))
{
setupUi(this);
- setViewTitle(_("Show File"));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
}
-void GuiShowFile::closeEvent(QCloseEvent * e)
-{
- slotClose();
- e->accept();
-}
-
-
void GuiShowFile::updateContents()
{
- setWindowTitle(toqstr(onlyFilename(filename_.absFilename())));
+ setWindowTitle(onlyFileName(toqstr(filename_.absFileName())));
- std::string contents = filename_.fileContents();
- if (contents.empty())
- contents = "Error -> Cannot load file!";
+ QString contents = toqstr(filename_.fileContents("UTF-8"));
+ if (contents.isEmpty())
+ contents = qt_("Error -> Cannot load file!");
- textTB->setPlainText(toqstr(contents));
+ textTB->setPlainText(contents);
}
-bool GuiShowFile::initialiseParams(std::string const & data)
+bool GuiShowFile::initialiseParams(string const & data)
{
filename_ = FileName(data);
return true;
} // namespace frontend
} // namespace lyx
-#include "GuiShowFile_moc.cpp"
+#include "moc_GuiShowFile.cpp"