]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlVCLog.C
small fix
[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 #include "ControlVCLog.h"
15 #include "buffer.h"
16 #include "gettext.h"
17 #include "lyxvc.h"
18 #include "support/lyxlib.h"
19 #include <fstream>
20
21 using lyx::support::unlink;
22
23 using std::endl;
24 using std::ostream;
25 using std::string;
26
27
28 ControlVCLog::ControlVCLog(Dialog & parent)
29         : Dialog::Controller(parent)
30 {}
31
32
33 string const ControlVCLog::getBufferFileName() const
34 {
35         return kernel().buffer().fileName();
36 }
37
38
39 void ControlVCLog::getVCLogFile(ostream & ss) const
40 {
41         string const name = kernel().buffer().lyxvc().getLogFile();
42
43         std::ifstream in(name.c_str());
44
45         bool found(false);
46
47         if (in) {
48                 ss << in.rdbuf();
49                 found = ss.good();
50         }
51
52         if (!found)
53                 ss << _("No version control log file found.") << endl;
54
55         unlink(name);
56 }