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;
27 ControlChanges::ControlChanges(Dialog & parent)
28 : Dialog::Controller(parent)
32 bool ControlChanges::find()
34 return lyx::find::findNextChange(kernel().bufferview());
38 string const ControlChanges::getChangeDate()
40 Change c(kernel().bufferview()->getCurrentChange());
41 if (c.type == Change::UNCHANGED || !c.changetime)
44 // ctime adds newline; trim it off!
45 string const date = rtrim(ctime(&c.changetime), "\n");
50 string const ControlChanges::getChangeAuthor()
52 Change c(kernel().bufferview()->getCurrentChange());
53 if (c.type == Change::UNCHANGED)
56 Author const & a(kernel().buffer().params().authors().get(c.author));
58 string author(a.name());
60 if (!a.email().empty()) {
62 author += a.email() + ")";
69 void ControlChanges::accept()
71 kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
72 lyx::find::findNextChange(kernel().bufferview());
76 void ControlChanges::reject()
78 kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
79 lyx::find::findNextChange(kernel().bufferview());