2 * \file ControlChanges.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "ControlChanges.h"
15 #include "BufferView.h"
16 #include "funcrequest.h"
19 #include "support/lstrings.h"
21 using namespace lyx::support;
23 ControlChanges::ControlChanges(Dialog & parent)
24 : Dialog::Controller(parent)
28 bool ControlChanges::find()
30 return lyx::find::findNextChange(kernel().bufferview());
34 string const ControlChanges::getChangeDate()
36 Change c(kernel().bufferview()->getCurrentChange());
37 if (c.type == Change::UNCHANGED || !c.changetime)
40 // ctime adds newline; trim it off!
41 string const date = rtrim(ctime(&c.changetime), "\n");
46 string const ControlChanges::getChangeAuthor()
48 Change c(kernel().bufferview()->getCurrentChange());
49 if (c.type == Change::UNCHANGED)
52 Author const & a(kernel().buffer().authors().get(c.author));
54 string author(a.name());
56 if (!a.email().empty()) {
58 author += a.email() + ")";
65 void ControlChanges::accept()
67 kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
68 lyx::find::findNextChange(kernel().bufferview());
72 void ControlChanges::reject()
74 kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
75 lyx::find::findNextChange(kernel().bufferview());