3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "QShowFile.h"
15 #include "qt_helpers.h"
17 #include "controllers/ControlShowFile.h"
19 #include <QTextBrowser>
20 #include <QPushButton>
25 /////////////////////////////////////////////////////////////////////
29 /////////////////////////////////////////////////////////////////////
31 QShowFileDialog::QShowFileDialog(QShowFile * form)
35 connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
39 void QShowFileDialog::closeEvent(QCloseEvent * e)
46 /////////////////////////////////////////////////////////////////////
50 /////////////////////////////////////////////////////////////////////
52 typedef QController<ControlShowFile, QView<QShowFileDialog> >
56 QShowFile::QShowFile(Dialog & parent)
57 : ShowFileBase(parent, _("Show File"))
62 void QShowFile::build_dialog()
64 dialog_.reset(new QShowFileDialog(this));
66 bcview().setCancel(dialog_->closePB);
70 void QShowFile::update_contents()
72 dialog_->setWindowTitle(toqstr(controller().getFileName()));
74 std::string contents = controller().getFileContents();
75 if (contents.empty()) {
76 contents = "Error -> Cannot load file!";
79 dialog_->textTB->setPlainText(toqstr(contents));
82 } // namespace frontend
85 #include "QShowFile_moc.cpp"