]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QShowFile.C
better selection and scrolling behaviour
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "ControlShowFile.h"
18 #include "gettext.h"
19
20 #include "QShowFile.h"
21 #include "QShowFileDialog.h"
22 #include "Qt2BC.h"
23
24 #include <qtextview.h>
25 #include <qpushbutton.h>
26
27 typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > base_class;
28
29
30 QShowFile::QShowFile()
31         : base_class(_("ShowFile"))
32 {
33 }
34
35
36 void QShowFile::build_dialog()
37 {
38         dialog_.reset(new QShowFileDialog(this));
39
40         bc().setCancel(dialog_->closePB);
41 }
42
43
44 void QShowFile::update_contents()
45 {
46         dialog_->setName(controller().getFileName().c_str());
47
48         string contents = controller().getFileContents();
49         if (contents.empty()) {
50                 contents = "Error -> Cannot load file!";
51         }
52
53         dialog_->text->setText(contents.c_str());
54 }