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