]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlVCLog.C
fix rbearing
[lyx.git] / src / frontends / controllers / ControlVCLog.C
1 /**
2  * \file ControlVCLog.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  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlVCLog.h"
19 #include "Lsstream.h"
20 #include "ButtonControllerBase.h"
21 #include "buffer.h"
22 #include "lyxrc.h"
23 #include "gettext.h"
24
25
26 #include "support/lyxlib.h"
27
28 #include <fstream>
29
30 using std::endl;
31
32
33 ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
34         : ControlDialogBD(lv, d)
35 {}
36
37
38 string const ControlVCLog::getBufferFileName() const
39 {
40         return buffer()->fileName();
41 }
42
43
44 stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
45 {
46         string const name = buffer()->lyxvc.getLogFile();
47
48         std::ifstream in(name.c_str());
49
50         bool found = (in.get());
51
52         if (found) {
53                 in.seekg(0, std::ios::beg); // rewind to the beginning
54
55                 ss << in.rdbuf();
56                 found = ss.good();
57         }
58
59         if (!found)
60                 ss << _("No version control log file found.") << endl;
61
62         lyx::unlink(name);
63
64         return ss;
65 }