X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiBibitem.cpp;h=20285f8daa224d5ac73959a1a91843e4584c8932;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=8adff5841522257e289511a0a5a6ede23c0a094e;hpb=c9ea6e6eef090b863fb54445010f24443b15eb23;p=lyx.git diff --git a/src/frontends/qt4/GuiBibitem.cpp b/src/frontends/qt4/GuiBibitem.cpp index 8adff58415..20285f8daa 100644 --- a/src/frontends/qt4/GuiBibitem.cpp +++ b/src/frontends/qt4/GuiBibitem.cpp @@ -11,10 +11,11 @@ #include #include "GuiBibitem.h" -#include "ControlCommand.h" #include "qt_helpers.h" +#include "FuncRequest.h" + +#include "insets/InsetCommand.h" -#include #include #include @@ -23,19 +24,18 @@ namespace lyx { namespace frontend { -GuiBibitemDialog::GuiBibitemDialog(LyXView & lv) - : GuiDialog(lv, "bibitem") +GuiBibitem::GuiBibitem(GuiView & lv) + : GuiDialog(lv, "bibitem", qt_("Bibliography Entry Settings")), + params_(insetCode("bibitem")) { setupUi(this); - setViewTitle(_("Bibliography Entry Settings")); - setController(new ControlCommand(*this, "bibitem", "bibitem")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); - connect(keyED, SIGNAL(textChanged(const QString &)), + connect(keyED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); - connect(labelED, SIGNAL(textChanged(const QString &)), + connect(labelED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy); @@ -46,45 +46,52 @@ GuiBibitemDialog::GuiBibitemDialog(LyXView & lv) } -ControlCommand & GuiBibitemDialog::controller() const +void GuiBibitem::change_adaptor() { - return static_cast(Dialog::controller()); + changed(); } -void GuiBibitemDialog::change_adaptor() +void GuiBibitem::updateContents() { - changed(); + keyED->setText(toqstr(params_["key"])); + labelED->setText(toqstr(params_["label"])); } -void GuiBibitemDialog::closeEvent(QCloseEvent *e) +void GuiBibitem::applyView() { - slotWMHide(); - e->accept(); + params_["key"] = qstring_to_ucs4(keyED->text()); + params_["label"] = qstring_to_ucs4(labelED->text()); } -void GuiBibitemDialog::update_contents() +bool GuiBibitem::isValid() { - keyED->setText(toqstr(controller().params()["key"])); - labelED->setText(toqstr(controller().params()["label"])); + return !keyED->text().isEmpty(); } -void GuiBibitemDialog::applyView() +bool GuiBibitem::initialiseParams(std::string const & data) { - controller().params()["key"] = qstring_to_ucs4(keyED->text()); - controller().params()["label"] = qstring_to_ucs4(labelED->text()); + // The name passed with LFUN_INSET_APPLY is also the name + // used to identify the mailer. + InsetCommand::string2params("bibitem", data, params_); + return true; } -bool GuiBibitemDialog::isValid() +void GuiBibitem::dispatchParams() { - return !keyED->text().isEmpty(); + std::string const lfun = InsetCommand::params2string("bibitem", params_); + dispatch(FuncRequest(getLfun(), lfun)); } + +Dialog * createGuiBibitem(GuiView & lv) { return new GuiBibitem(lv); } + + } // namespace frontend } // namespace lyx -#include "GuiBibitem_moc.cpp" +#include "moc_GuiBibitem.cpp"