3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "GuiBibitem.h"
15 #include "qt_helpers.h"
17 #include "insets/InsetCommand.h"
20 #include <QPushButton>
27 GuiBibitem::GuiBibitem(QWidget * parent) : InsetParamsWidget(parent)
31 connect(keyED, SIGNAL(textChanged(QString)),
32 this, SIGNAL(changed()));
33 connect(labelED, SIGNAL(textChanged(QString)),
34 this, SIGNAL(changed()));
35 connect(literalCB, SIGNAL(clicked()),
36 this, SIGNAL(changed()));
40 void GuiBibitem::paramsToDialog(Inset const * inset)
42 InsetCommand const * ic = static_cast<InsetCommand const *>(inset);
43 InsetCommandParams const & params = ic->params();
44 keyED->setText(toqstr(params["key"]));
45 labelED->setText(toqstr(params["label"]));
46 literalCB->setChecked(params["literal"] == "true");
50 docstring GuiBibitem::dialogToParams() const
52 InsetCommandParams params(insetCode());
53 params["key"] = qstring_to_ucs4(keyED->text());
54 params["label"] = qstring_to_ucs4(labelED->text());
55 params["literal"] = literalCB->isChecked()
56 ? from_ascii("true") : from_ascii("false");
57 return from_utf8(InsetCommand::params2string(params));
61 bool GuiBibitem::checkWidgets(bool readonly) const
63 keyED->setReadOnly(readonly);
64 labelED->setReadOnly(readonly);
65 if (!InsetParamsWidget::checkWidgets())
67 return !keyED->text().isEmpty();
70 } // namespace frontend
73 #include "moc_GuiBibitem.cpp"