3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author John Levon <moz@compsoc.man.ac.uk>
11 #include "ControlShowFile.h"
14 #include "QShowFile.h"
15 #include "QShowFileDialog.h"
18 #include <qtextview.h>
19 #include <qpushbutton.h>
21 typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > base_class;
23 QShowFile::QShowFile(ControlShowFile & c)
24 : base_class(c, _("ShowFile"))
29 void QShowFile::build_dialog()
31 dialog_.reset(new QShowFileDialog(this));
33 bc().setCancel(dialog_->closePB);
37 void QShowFile::update_contents()
39 dialog_->setName(controller().getFileName().c_str());
41 string contents = controller().getFileContents();
42 if (contents.empty()) {
43 contents = "Error -> Cannot load file!";
46 dialog_->text->setText(contents.c_str());