]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QShowFile.C
ws change
[lyx.git] / src / frontends / qt2 / QShowFile.C
1 /**
2  * \file QShowFile.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon <moz@compsoc.man.ac.uk>
7  */
8
9 #include <config.h>
10
11 #include "QShowFileDialog.h"
12 #include "ControlShowFile.h"
13 #include "QShowFile.h"
14 #include "Qt2BC.h"
15 #include "gettext.h"
16
17 #include <qtextview.h>
18 #include <qpushbutton.h>
19
20 typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > base_class;
21
22 QShowFile::QShowFile(ControlShowFile & c)
23         : base_class(c, _("ShowFile"))
24 {
25 }
26
27
28 void QShowFile::build_dialog()
29 {
30         dialog_.reset(new QShowFileDialog(this));
31
32         bc().setCancel(dialog_->closePB);
33 }
34
35
36 void QShowFile::update_contents()
37 {
38         dialog_->setName(controller().getFileName().c_str());
39
40         string contents = controller().getFileContents();
41         if (contents.empty()) {
42                 contents = "Error -> Cannot load file!";
43         }
44
45         dialog_->text->setText(contents.c_str());
46 }