]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiBibitem.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiBibitem.cpp
1 /**
2  * \file GuiBibitem.cpp
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 "GuiBibitem.h"
14 #include "qt_helpers.h"
15 #include "FuncRequest.h"
16
17 #include <QLineEdit>
18 #include <QPushButton>
19
20
21 namespace lyx {
22 namespace frontend {
23
24
25 GuiBibitem::GuiBibitem(GuiView & lv)
26         : GuiCommand(lv, "bibitem", qt_("Bibliography Entry Settings"))
27 {
28         setupUi(this);
29
30         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
31         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
32
33         connect(keyED, SIGNAL(textChanged(QString)),
34                 this, SLOT(change_adaptor()));
35         connect(labelED, SIGNAL(textChanged(QString)),
36                 this, SLOT(change_adaptor()));
37
38         bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
39         bc().setOK(okPB);
40         bc().setCancel(closePB);
41         bc().addReadOnly(keyED);
42         bc().addReadOnly(labelED);
43 }
44
45
46 void GuiBibitem::change_adaptor()
47 {
48         changed();
49 }
50
51
52 void GuiBibitem::updateContents()
53 {
54         keyED->setText(toqstr(params_["key"]));
55         labelED->setText(toqstr(params_["label"]));
56 }
57
58
59 void GuiBibitem::applyView()
60 {
61         params_["key"] = qstring_to_ucs4(keyED->text());
62         params_["label"] = qstring_to_ucs4(labelED->text());
63 }
64
65
66 bool GuiBibitem::isValid()
67 {
68         return !keyED->text().isEmpty();
69 }
70
71
72 Dialog * createGuiBibitem(GuiView & lv) { return new GuiBibitem(lv); }
73
74
75 } // namespace frontend
76 } // namespace lyx
77
78 #include "GuiBibitem_moc.cpp"