]> 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 ac4e514fd7e3b23cc652832355990c00b551b487..4126045410b36c3895585162fa69235d2f26b3f0 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <QTextBrowser>
 #include <QPushButton>
-#include <QCloseEvent>
 
 using namespace std;
 using namespace lyx::support;
@@ -28,40 +27,33 @@ namespace frontend {
 
 
 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())));
 
-       docstring contents = filename_.fileContents("UTF-8");
-       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(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"