X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiShowFile.cpp;h=c2a4360b2fca7ff0b4f42ce9cb553ebaad23b297;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=ed0b6b2b271bcce5078751de47fa9bf474fd6207;hpb=42015a8ebd17092c9b55c9519015119d04f52218;p=lyx.git diff --git a/src/frontends/qt4/GuiShowFile.cpp b/src/frontends/qt4/GuiShowFile.cpp index ed0b6b2b27..c2a4360b2f 100644 --- a/src/frontends/qt4/GuiShowFile.cpp +++ b/src/frontends/qt4/GuiShowFile.cpp @@ -18,20 +18,18 @@ #include #include -#include +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())); @@ -40,26 +38,19 @@ GuiShowFile::GuiShowFile(GuiView & lv) } -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; @@ -78,4 +69,4 @@ Dialog * createGuiShowFile(GuiView & lv) { return new GuiShowFile(lv); } } // namespace frontend } // namespace lyx -#include "GuiShowFile_moc.cpp" +#include "moc_GuiShowFile.cpp"