]> git.lyx.org Git - features.git/blob - src/frontends/kde/FormLog.C
Update to MVC. Ref,Toc and citation don't work at all currently.
[features.git] / src / frontends / kde / FormLog.C
1 /**
2  * \file FormLog.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include <config.h>
10 #include <fstream>
11
12 #include "FormLog.h"
13 #include "ControlLog.h"
14 #include "logdlg.h" 
15 #include "gettext.h"
16
17 using std::ifstream;
18 using std::getline;
19
20 FormLog::FormLog(ControlLog & c)
21         : KFormBase<ControlLog, LogDialog>(c)
22 {
23 }
24
25
26 void FormLog::update()
27 {
28         std::pair<Buffer::LogType, string> const logfile = controller().logfile();
29
30         if (logfile.first == Buffer::buildlog)
31                 dialog_->setCaption(_("Build log"));
32         else
33                 dialog_->setCaption(_("LaTeX log"));
34
35         dialog_->setLogText("");
36
37         ifstream ifstr(logfile.second.c_str());
38         if (!ifstr) {
39                 if (logfile.first == Buffer::buildlog)
40                         dialog_->setLogText(_("No build log file found"));
41                 else
42                         dialog_->setLogText(_("No LaTeX log file found"));
43                 return;
44         }
45
46         string text;
47         string line;
48
49         while (getline(ifstr, line))
50                 text += line + "\n";
51  
52         dialog_->setLogText(text);
53 }
54
55
56 void FormLog::build()
57 {
58         dialog_.reset(new LogDialog(this, 0, _("LyX: LaTeX Log")));
59
60         bc().setCancel(dialog_->button_cancel);
61 }