]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlChanges.C
Rewrite the MailInset as suggested to Andr��.
[lyx.git] / src / frontends / controllers / ControlChanges.C
1 /**
2  * \file ControlChanges.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "ControlChanges.h"
14 #include "buffer.h"
15 #include "BufferView.h"
16 #include "funcrequest.h"
17 #include "lyxfind.h"
18 #include "author.h"
19 #include "support/lstrings.h"
20
21
22 ControlChanges::ControlChanges(Dialog & parent)
23         : Dialog::Controller(parent)
24 {}
25
26
27 void ControlChanges::find()
28 {
29         lyxfind::findNextChange(kernel().bufferview());
30 }
31
32
33 string const ControlChanges::getChangeDate()
34 {
35         Change c(kernel().bufferview()->getCurrentChange());
36         if (c.type == Change::UNCHANGED || !c.changetime)
37                 return string();
38         return ctime(&c.changetime);
39 }
40
41
42 string const ControlChanges::getChangeAuthor()
43 {
44         Change c(kernel().bufferview()->getCurrentChange());
45         if (c.type == Change::UNCHANGED)
46                 return string();
47
48         Author const & a(kernel().buffer()->authors().get(c.author));
49
50         string author(a.name());
51
52         if (!a.email().empty()) {
53                 author += " (";
54                 author += a.email() + ")";
55         }
56
57         return author;
58 }
59
60
61 void ControlChanges::accept()
62 {
63         kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
64         lyxfind::findNextChange(kernel().bufferview());
65 }
66
67
68 void ControlChanges::reject()
69 {
70         kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
71         lyxfind::findNextChange(kernel().bufferview());
72 }