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 "ControlCommand.h"
15 #include "qt_helpers.h"
16 #include "FuncRequest.h"
18 #include "insets/InsetCommand.h"
20 #include <QCloseEvent>
22 #include <QPushButton>
29 GuiBibitem::GuiBibitem(LyXView & lv)
30 : GuiDialog(lv, "bibitem"), Controller(this), params_("bibitem")
33 setViewTitle(_("Bibliography Entry Settings"));
34 setController(this, false);
36 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
37 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
39 connect(keyED, SIGNAL(textChanged(QString)),
40 this, SLOT(change_adaptor()));
41 connect(labelED, SIGNAL(textChanged(QString)),
42 this, SLOT(change_adaptor()));
44 bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
46 bc().setCancel(closePB);
47 bc().addReadOnly(keyED);
48 bc().addReadOnly(labelED);
52 void GuiBibitem::change_adaptor()
58 void GuiBibitem::closeEvent(QCloseEvent *e)
65 void GuiBibitem::updateContents()
67 keyED->setText(toqstr(params_["key"]));
68 labelED->setText(toqstr(params_["label"]));
72 void GuiBibitem::applyView()
74 params_["key"] = qstring_to_ucs4(keyED->text());
75 params_["label"] = qstring_to_ucs4(labelED->text());
79 bool GuiBibitem::isValid()
81 return !keyED->text().isEmpty();
85 bool GuiBibitem::initialiseParams(std::string const & data)
87 // The name passed with LFUN_INSET_APPLY is also the name
88 // used to identify the mailer.
89 InsetCommandMailer::string2params("bibitem", data, params_);
94 void GuiBibitem::dispatchParams()
96 std::string const lfun = InsetCommandMailer::params2string("bibitem", params_);
97 dispatch(FuncRequest(getLfun(), lfun));
101 Dialog * createGuiBibitem(LyXView & lv) { return new GuiBibitem(lv); }
104 } // namespace frontend
107 #include "GuiBibitem_moc.cpp"