]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiBibitem.cpp
Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
[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 <QCloseEvent>
18 #include <QLineEdit>
19 #include <QPushButton>
20
21
22 namespace lyx {
23 namespace frontend {
24
25
26 GuiBibitem::GuiBibitem(GuiView & lv)
27         : GuiCommand(lv, "bibitem")
28 {
29         setupUi(this);
30         setViewTitle(_("Bibliography Entry Settings"));
31
32         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
33         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
34
35         connect(keyED, SIGNAL(textChanged(QString)),
36                 this, SLOT(change_adaptor()));
37         connect(labelED, SIGNAL(textChanged(QString)),
38                 this, SLOT(change_adaptor()));
39
40         bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
41         bc().setOK(okPB);
42         bc().setCancel(closePB);
43         bc().addReadOnly(keyED);
44         bc().addReadOnly(labelED);
45 }
46
47
48 void GuiBibitem::change_adaptor()
49 {
50         changed();
51 }
52
53
54 void GuiBibitem::closeEvent(QCloseEvent *e)
55 {
56         slotClose();
57         e->accept();
58 }
59
60
61 void GuiBibitem::updateContents()
62 {
63         keyED->setText(toqstr(params_["key"]));
64         labelED->setText(toqstr(params_["label"]));
65 }
66
67
68 void GuiBibitem::applyView()
69 {
70         params_["key"] = qstring_to_ucs4(keyED->text());
71         params_["label"] = qstring_to_ucs4(labelED->text());
72 }
73
74
75 bool GuiBibitem::isValid()
76 {
77         return !keyED->text().isEmpty();
78 }
79
80
81 Dialog * createGuiBibitem(GuiView & lv) { return new GuiBibitem(lv); }
82
83
84 } // namespace frontend
85 } // namespace lyx
86
87 #include "GuiBibitem_moc.cpp"