/* This file is part of
- * ======================================================
+ * ======================================================
*
* LyX, The Document Processor
*
* \author Angus Leeming <a.leeming@ic.ac.uk>
*/
+#include <config.h>
+#include <fstream>
+#include "Lsstream.h"
+
#ifdef __GNUG__
#pragma implementation
#endif
-#include <config.h>
+#include "ViewBase.h"
+#include "ButtonControllerBase.h"
#include "ControlVCLog.h"
#include "buffer.h"
+#include "BufferView.h"
#include "LyXView.h"
#include "Dialogs.h"
#include "lyxrc.h"
+#include "support/lyxlib.h"
using SigC::slot;
+using std::endl;
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, d)
d_.showVCLogFile.connect(slot(this, &ControlVCLog::show));
}
-
-void ControlVCLog::setParams()
+string const ControlVCLog::getBufferFileName() const
{
- logfile_ = lv_.view()->buffer()->lyxvc.getLogFile();
+ return lv_.view()->buffer()->fileName();
}
-void ControlVCLog::clearParams()
+stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
{
- logfile_.erase();
+ string const name = lv_.view()->buffer()->lyxvc.getLogFile();
+
+ std::ifstream in(name.c_str());
+
+ bool found = (in.get());
+
+ if (found) {
+ in.seekg(0, std::ios::beg); // rewind to the beginning
+
+ ss << in.rdbuf();
+ found = ss.good();
+ }
+
+ if (!found)
+ ss << "No version control log file found." << endl;
+
+ lyx::unlink(name);
+
+ return ss;
}