]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlVCLog.C
prefs/tabular MVC work
[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 "ButtonControllerBase.h"
20 #include "buffer.h"
21 #include "lyxrc.h"
22 #include "gettext.h"
23
24 #include "support/lyxlib.h"
25
26 #include <fstream>
27
28 using std::endl;
29 using std::ostream;
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 void ControlVCLog::getVCLogFile(ostream & ss) const
44 {
45         string const name = buffer()->lyxvc.getLogFile();
46
47         std::ifstream in(name.c_str());
48
49         bool found(false);
50
51         if (in) {
52                 ss << in.rdbuf();
53                 found = ss.good();
54         }
55
56         if (!found)
57                 ss << _("No version control log file found.") << endl;
58
59         lyx::unlink(name);
60 }