lyx_mirror/src/frontends/qt4/GuiShowFile.cpp
André Pönitz 470aba2a0e cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20217 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-11 18:33:42 +00:00

69 lines
1.3 KiB
C++

/**
* \file GuiShowFile.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "GuiShowFile.h"
#include "ControlShowFile.h"
#include "qt_helpers.h"
#include <QTextBrowser>
#include <QPushButton>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
GuiShowFileDialog::GuiShowFileDialog(LyXView & lv)
: GuiDialog(lv, "file")
{
setupUi(this);
setViewTitle(_("Show File"));
setController(new ControlShowFile(*this));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
bc().setPolicy(ButtonPolicy::OkCancelPolicy);
bc().setCancel(closePB);
}
ControlShowFile & GuiShowFileDialog::controller()
{
return static_cast<ControlShowFile &>(GuiDialog::controller());
}
void GuiShowFileDialog::closeEvent(QCloseEvent * e)
{
slotClose();
e->accept();
}
void GuiShowFileDialog::updateContents()
{
setWindowTitle(toqstr(controller().getFileName()));
std::string contents = controller().getFileContents();
if (contents.empty()) {
contents = "Error -> Cannot load file!";
}
textTB->setPlainText(toqstr(contents));
}
} // namespace frontend
} // namespace lyx
#include "GuiShowFile_moc.cpp"