]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlVCLog.C
Really dull and boring header shit
[lyx.git] / src / frontends / controllers / ControlVCLog.C
1 /**
2  * \file ControlVCLog.C
3  * See the file COPYING.
4  *
5  * \author John Levon
6  * \author Angus Leeming
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 "ControlVCLog.h"
18 #include "Lsstream.h"
19 #include "ButtonControllerBase.h"
20 #include "buffer.h"
21 #include "lyxrc.h"
22 #include "gettext.h"
23
24
25 #include "support/lyxlib.h"
26
27 #include <fstream>
28
29 using std::endl;
30
31
32 ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
33         : ControlDialogBD(lv, d)
34 {}
35
36
37 string const ControlVCLog::getBufferFileName() const
38 {
39         return buffer()->fileName();
40 }
41
42
43 stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
44 {
45         string const name = buffer()->lyxvc.getLogFile();
46
47         std::ifstream in(name.c_str());
48
49         bool found = (in.get());
50
51         if (found) {
52                 in.seekg(0, std::ios::beg); // rewind to the beginning
53
54                 ss << in.rdbuf();
55                 found = ss.good();
56         }
57
58         if (!found)
59                 ss << _("No version control log file found.") << endl;
60
61         lyx::unlink(name);
62
63         return ss;
64 }