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"
17 #include "bufferparams.h"
18 #include "BufferView.h"
20 #include "funcrequest.h"
22 #include "support/lstrings.h"
24 using namespace lyx::support;
26 ControlChanges::ControlChanges(Dialog & parent)
27 : Dialog::Controller(parent)
31 bool ControlChanges::find()
33 return lyx::find::findNextChange(kernel().bufferview());
37 string const ControlChanges::getChangeDate()
39 Change c(kernel().bufferview()->getCurrentChange());
40 if (c.type == Change::UNCHANGED || !c.changetime)
43 // ctime adds newline; trim it off!
44 string const date = rtrim(ctime(&c.changetime), "\n");
49 string const ControlChanges::getChangeAuthor()
51 Change c(kernel().bufferview()->getCurrentChange());
52 if (c.type == Change::UNCHANGED)
55 Author const & a(kernel().buffer().params().authors().get(c.author));
57 string author(a.name());
59 if (!a.email().empty()) {
61 author += a.email() + ")";
68 void ControlChanges::accept()
70 kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
71 lyx::find::findNextChange(kernel().bufferview());
75 void ControlChanges::reject()
77 kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
78 lyx::find::findNextChange(kernel().bufferview());