]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QShowFile.C
Joao latest bits
[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 #include "debug.h"
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 using std::string;
25
26 typedef QController<ControlShowFile, QView<QShowFileDialog> > base_class;
27
28
29 QShowFile::QShowFile(Dialog & parent)
30         : base_class(parent, _("LyX: Show File"))
31 {
32 }
33
34
35 void QShowFile::build_dialog()
36 {
37         dialog_.reset(new QShowFileDialog(this));
38
39         bcview().setCancel(dialog_->closePB);
40 }
41
42
43 void QShowFile::update_contents()
44 {
45         dialog_->setName(toqstr(controller().getFileName()));
46
47         string contents = controller().getFileContents();
48         if (contents.empty()) {
49                 contents = "Error -> Cannot load file!";
50         }
51
52         dialog_->text->setText(toqstr(contents));
53 }