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 "bufferparams.h"
16 #include "BufferView.h"
18 #include "funcrequest.h"
20 #include "support/lstrings.h"
22 using namespace lyx::support;
24 ControlChanges::ControlChanges(Dialog & parent)
25 : Dialog::Controller(parent)
29 bool ControlChanges::find()
31 return lyx::find::findNextChange(kernel().bufferview());
35 string const ControlChanges::getChangeDate()
37 Change c(kernel().bufferview()->getCurrentChange());
38 if (c.type == Change::UNCHANGED || !c.changetime)
41 // ctime adds newline; trim it off!
42 string const date = rtrim(ctime(&c.changetime), "\n");
47 string const ControlChanges::getChangeAuthor()
49 Change c(kernel().bufferview()->getCurrentChange());
50 if (c.type == Change::UNCHANGED)
53 Author const & a(kernel().buffer().authors().get(c.author));
55 string author(a.name());
57 if (!a.email().empty()) {
59 author += a.email() + ")";
66 void ControlChanges::accept()
68 kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
69 lyx::find::findNextChange(kernel().bufferview());
73 void ControlChanges::reject()
75 kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
76 lyx::find::findNextChange(kernel().bufferview());