#include <config.h>
#include "GuiBibitem.h"
-#include "ControlCommand.h"
#include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
-#include <QCloseEvent>
#include <QLineEdit>
#include <QPushButton>
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);
}
-ControlCommand & GuiBibitemDialog::controller()
+void GuiBibitem::change_adaptor()
{
- return static_cast<ControlCommand &>(GuiDialog::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()
{
- slotClose();
- e->accept();
+ params_["key"] = qstring_to_ucs4(keyED->text());
+ params_["label"] = qstring_to_ucs4(labelED->text());
}
-void GuiBibitemDialog::updateContents()
+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