]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QShowFile.C
Martin's changes to the Note inset.
[lyx.git] / src / frontends / qt2 / QShowFile.C
1 /**
2  * \file QShowFile.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "ControlShowFile.h"
15 #include "qt_helpers.h"
16
17 #include "QShowFile.h"
18 #include "QShowFileDialog.h"
19 #include "Qt2BC.h"
20
21 #include <qtextview.h>
22 #include <qpushbutton.h>
23
24 typedef QController<ControlShowFile, QView<QShowFileDialog> > base_class;
25
26
27 QShowFile::QShowFile(Dialog & parent)
28         : base_class(parent, _("LyX: Show File"))
29 {
30 }
31
32
33 void QShowFile::build_dialog()
34 {
35         dialog_.reset(new QShowFileDialog(this));
36
37         bcview().setCancel(dialog_->closePB);
38 }
39
40
41 void QShowFile::update_contents()
42 {
43         dialog_->setName(toqstr(controller().getFileName()));
44
45         string contents = controller().getFileContents();
46         if (contents.empty()) {
47                 contents = "Error -> Cannot load file!";
48         }
49
50         dialog_->text->setText(toqstr(contents));
51 }