]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlChanges.C
Move the external dialog to the new scheme.
[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 "ViewBase.h"
14 #include "ButtonControllerBase.h"
15 #include "ControlChanges.h"
16 #include "frontends/Dialogs.h"
17 #include "frontends/LyXView.h"
18 #include "buffer.h"
19 #include "lyxfind.h"
20 #include "lyxfunc.h"
21 #include "debug.h"
22 #include "BufferView.h"
23 #include "support/lstrings.h"
24 #include "funcrequest.h"
25 #include "author.h"
26
27 ControlChanges::ControlChanges(LyXView & lv, Dialogs & d)
28         : ControlDialogBD(lv, d)
29 {
30 }
31
32
33 void ControlChanges::find()
34 {
35         lyxfind::findNextChange(bufferview());
36 }
37
38
39 string const ControlChanges::getChangeDate()
40 {
41         Change c(bufferview()->getCurrentChange());
42         if (c.type == Change::UNCHANGED || !c.changetime)
43                 return string();
44         return ctime(&c.changetime);
45 }
46
47
48 string const ControlChanges::getChangeAuthor()
49 {
50         Change c(bufferview()->getCurrentChange());
51         if (c.type == Change::UNCHANGED)
52                 return string();
53
54         Author const & a(bufferview()->buffer()->authors().get(c.author));
55
56         string author(a.name());
57
58         if (!a.email().empty()) {
59                 author += " (";
60                 author += a.email() + ")";
61         }
62
63         return author;
64 }
65
66
67 void ControlChanges::accept()
68 {
69         lv_.dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
70         lyxfind::findNextChange(bufferview());
71 }
72
73
74 void ControlChanges::reject()
75 {
76         lv_.dispatch(FuncRequest(LFUN_REJECT_CHANGE));
77         lyxfind::findNextChange(bufferview());
78 }