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"
14 #include "qt_helpers.h"
15 #include "FuncRequest.h"
17 #include "insets/InsetCommand.h"
20 #include <QPushButton>
27 GuiBibitem::GuiBibitem(GuiView & lv)
28 : GuiDialog(lv, "bibitem", qt_("Bibliography Entry Settings")),
29 params_(insetCode("bibitem"))
33 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
34 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
36 connect(keyED, SIGNAL(textChanged(QString)),
37 this, SLOT(change_adaptor()));
38 connect(labelED, SIGNAL(textChanged(QString)),
39 this, SLOT(change_adaptor()));
41 bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
43 bc().setCancel(closePB);
44 bc().addReadOnly(keyED);
45 bc().addReadOnly(labelED);
49 void GuiBibitem::change_adaptor()
55 void GuiBibitem::updateContents()
57 keyED->setText(toqstr(params_["key"]));
58 labelED->setText(toqstr(params_["label"]));
62 void GuiBibitem::applyView()
64 params_["key"] = qstring_to_ucs4(keyED->text());
65 params_["label"] = qstring_to_ucs4(labelED->text());
69 bool GuiBibitem::isValid()
71 return !keyED->text().isEmpty();
75 bool GuiBibitem::initialiseParams(std::string const & data)
77 // The name passed with LFUN_INSET_APPLY is also the name
78 // used to identify the mailer.
79 InsetCommand::string2params("bibitem", data, params_);
84 void GuiBibitem::dispatchParams()
86 std::string const lfun = InsetCommand::params2string("bibitem", params_);
87 dispatch(FuncRequest(getLfun(), lfun));
91 Dialog * createGuiBibitem(GuiView & lv) { return new GuiBibitem(lv); }
94 } // namespace frontend
97 #include "moc_GuiBibitem.cpp"