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 lyx::support::rtrim;
29 ControlChanges::ControlChanges(Dialog & parent)
30 : Dialog::Controller(parent)
34 bool ControlChanges::find()
36 return lyx::find::findNextChange(kernel().bufferview());
40 string const ControlChanges::getChangeDate()
42 Change c(kernel().bufferview()->getCurrentChange());
43 if (c.type == Change::UNCHANGED || !c.changetime)
46 // ctime adds newline; trim it off!
47 string const date = rtrim(ctime(&c.changetime), "\n");
52 string const ControlChanges::getChangeAuthor()
54 Change c(kernel().bufferview()->getCurrentChange());
55 if (c.type == Change::UNCHANGED)
58 Author const & a(kernel().buffer().params().authors().get(c.author));
60 string author(a.name());
62 if (!a.email().empty()) {
64 author += a.email() + ")";
71 void ControlChanges::accept()
73 kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
74 lyx::find::findNextChange(kernel().bufferview());
78 void ControlChanges::reject()
80 kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
81 lyx::find::findNextChange(kernel().bufferview());