]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiShowFile.cpp
Disable CheckTeX while buffer is processed
[lyx.git] / src / frontends / qt4 / GuiShowFile.cpp
1 /**
2  * \file GuiShowFile.cpp
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  * \author Herbert Voß
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "GuiShowFile.h"
15
16 #include "qt_helpers.h"
17 #include "support/filetools.h"
18
19 #include <QTextBrowser>
20 #include <QPushButton>
21
22 using namespace std;
23 using namespace lyx::support;
24
25 namespace lyx {
26 namespace frontend {
27
28
29 GuiShowFile::GuiShowFile(GuiView & lv)
30         : GuiDialog(lv, "file", qt_("Show File"))
31 {
32         setupUi(this);
33
34         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
35
36         bc().setPolicy(ButtonPolicy::OkCancelPolicy);
37         bc().setCancel(closePB);
38 }
39
40
41 void GuiShowFile::updateContents()
42 {
43         setWindowTitle(onlyFileName(toqstr(filename_.absFileName())));
44
45         QString contents = toqstr(filename_.fileContents("UTF-8"));
46         if (contents.isEmpty())
47                 contents = qt_("Error -> Cannot load file!");
48
49         textTB->setPlainText(contents);
50 }
51
52
53 bool GuiShowFile::initialiseParams(string const & data)
54 {
55         filename_ = FileName(data);
56         return true;
57 }
58
59
60 void GuiShowFile::clearParams()
61 {
62         filename_.erase();
63 }
64
65
66 Dialog * createGuiShowFile(GuiView & lv) { return new GuiShowFile(lv); }
67
68
69 } // namespace frontend
70 } // namespace lyx
71
72 #include "moc_GuiShowFile.cpp"