mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 06:20:28 +00:00
aba7831f62
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1910 a592a061-630c-0410-9148-cb99ea01b6c8
66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
/* This file is part of
|
|
* ======================================================
|
|
*
|
|
* LyX, The Document Processor
|
|
*
|
|
* Copyright 2001 The LyX Team.
|
|
*
|
|
* ======================================================
|
|
*
|
|
* \file ControlVCLog.C
|
|
* \author John Levon, moz@compsoc.man.ac.uk
|
|
* \author Angus Leeming <a.leeming@ic.ac.uk>
|
|
*/
|
|
|
|
#include <fstream>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include <config.h>
|
|
#include "Lsstream.h"
|
|
#include "ControlVCLog.h"
|
|
#include "buffer.h"
|
|
#include "LyXView.h"
|
|
#include "Dialogs.h"
|
|
#include "lyxrc.h"
|
|
|
|
using SigC::slot;
|
|
using std::endl;
|
|
|
|
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
|
|
: ControlDialog<ControlConnectBD>(lv, d)
|
|
{
|
|
d_.showVCLogFile.connect(slot(this, &ControlVCLog::show));
|
|
}
|
|
|
|
string const ControlVCLog::getBufferFileName() const
|
|
{
|
|
return lv_.view()->buffer()->fileName();
|
|
}
|
|
|
|
|
|
std::stringstream & ControlVCLog::getVCLogFile(std::stringstream & ss) const
|
|
{
|
|
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;
|
|
}
|