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