]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiBibitem.cpp
Correct early return position for if use_pixmap_cache_ check
[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
15 #include "qt_helpers.h"
16
17 #include "insets/InsetCommand.h"
18
19 #include <QLineEdit>
20 #include <QPushButton>
21
22
23 namespace lyx {
24 namespace frontend {
25
26
27 GuiBibitem::GuiBibitem(QWidget * parent) : InsetParamsWidget(parent)
28 {
29         setupUi(this);
30
31         connect(keyED, SIGNAL(textChanged(QString)),
32                 this, SIGNAL(changed()));
33         connect(labelED, SIGNAL(textChanged(QString)),
34                 this, SIGNAL(changed()));
35 }
36
37
38 void GuiBibitem::paramsToDialog(Inset const * inset)
39 {
40         InsetCommand const * ic = static_cast<InsetCommand const *>(inset);
41         InsetCommandParams const & params = ic->params();
42         keyED->setText(toqstr(params["key"]));
43         labelED->setText(toqstr(params["label"]));
44 }
45
46
47 docstring GuiBibitem::dialogToParams() const
48 {
49         InsetCommandParams params(insetCode());
50         params["key"] = qstring_to_ucs4(keyED->text());
51         params["label"] = qstring_to_ucs4(labelED->text());
52         return from_utf8(InsetCommand::params2string(params));
53 }
54
55
56 bool GuiBibitem::checkWidgets(bool readonly) const
57 {
58         keyED->setReadOnly(readonly);
59         labelED->setReadOnly(readonly);
60         if (!InsetParamsWidget::checkWidgets())
61                 return false;
62         return !keyED->text().isEmpty();
63 }
64
65 } // namespace frontend
66 } // namespace lyx
67
68 #include "moc_GuiBibitem.cpp"