3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
6 * \author John Levon <moz@compsoc.man.ac.uk>
11 #include "QShowFileDialog.h"
12 #include "ControlShowFile.h"
13 #include "QShowFile.h"
17 #include <qtextview.h>
18 #include <qpushbutton.h>
20 typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > base_class;
22 QShowFile::QShowFile(ControlShowFile & c)
23 : base_class(c, _("ShowFile"))
28 void QShowFile::build_dialog()
30 dialog_.reset(new QShowFileDialog(this));
32 bc().setCancel(dialog_->closePB);
36 void QShowFile::update_contents()
38 dialog_->setName(controller().getFileName().c_str());
40 string contents = controller().getFileContents();
41 if (contents.empty()) {
42 contents = "Error -> Cannot load file!";
45 dialog_->text->setText(contents.c_str());