2003-02-08 19:18:01 +00:00
|
|
|
/**
|
|
|
|
* \file ControlChanges.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
|
|
|
|
2003-02-13 16:53:15 +00:00
|
|
|
#include <config.h>
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
#include "ControlChanges.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "funcrequest.h"
|
2003-03-09 21:03:43 +00:00
|
|
|
#include "lyxfind.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
#include "author.h"
|
2003-03-09 21:03:43 +00:00
|
|
|
#include "support/lstrings.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
|
2003-03-09 21:03:43 +00:00
|
|
|
|
|
|
|
ControlChanges::ControlChanges(Dialog & parent)
|
|
|
|
: Dialog::Controller(parent)
|
|
|
|
{}
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
void ControlChanges::find()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
lyxfind::findNextChange(kernel().bufferview());
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const ControlChanges::getChangeDate()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
Change c(kernel().bufferview()->getCurrentChange());
|
2003-02-08 19:18:01 +00:00
|
|
|
if (c.type == Change::UNCHANGED || !c.changetime)
|
|
|
|
return string();
|
|
|
|
return ctime(&c.changetime);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string const ControlChanges::getChangeAuthor()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
Change c(kernel().bufferview()->getCurrentChange());
|
2003-02-08 19:18:01 +00:00
|
|
|
if (c.type == Change::UNCHANGED)
|
|
|
|
return string();
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-03-09 21:03:43 +00:00
|
|
|
Author const & a(kernel().buffer()->authors().get(c.author));
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
string author(a.name());
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
if (!a.email().empty()) {
|
|
|
|
author += " (";
|
|
|
|
author += a.email() + ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
return author;
|
|
|
|
}
|
|
|
|
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
void ControlChanges::accept()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
|
|
|
|
lyxfind::findNextChange(kernel().bufferview());
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|
2003-02-13 16:53:15 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
void ControlChanges::reject()
|
|
|
|
{
|
2003-03-09 21:03:43 +00:00
|
|
|
kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
|
|
|
|
lyxfind::findNextChange(kernel().bufferview());
|
2003-02-08 19:18:01 +00:00
|
|
|
}
|