]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiShowFile.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiShowFile.cpp
index ed0b6b2b271bcce5078751de47fa9bf474fd6207..4126045410b36c3895585162fa69235d2f26b3f0 100644 (file)
 
 #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()));
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+               this, SLOT(slotButtonBox(QAbstractButton *)));
 
        bc().setPolicy(ButtonPolicy::OkCancelPolicy);
-       bc().setCancel(closePB);
-}
-
-
-void GuiShowFile::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
+       bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
 }
 
 
 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 & sdata)
 {
-       filename_ = FileName(data);
+       filename_ = FileName(sdata);
        return true;
 }
 
@@ -78,4 +70,4 @@ Dialog * createGuiShowFile(GuiView & lv) { return new GuiShowFile(lv); }
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiShowFile_moc.cpp"
+#include "moc_GuiShowFile.cpp"