#include "ButtonController.h"
#include "DialogView.h"
#include "DockView.h"
-#include "GuiBibitem.h"
#include "GuiDelimiter.h"
#include "GuiIndex.h"
#include "GuiMathMatrix.h"
Dialog * createGuiMath(LyXView & lv);
Dialog * createGuiNomencl(LyXView & lv);
Dialog * createGuiNote(LyXView & lv);
-Dialog * createGuiParagraph(LyXView & lv)
+Dialog * createGuiParagraph(LyXView & lv);
Dialog * createGuiPreferences(LyXView & lv);
Dialog * createGuiPrint(LyXView & lv);
Dialog * createGuiRef(LyXView & lv);
if (name == "aboutlyx")
return createGuiAbout(lyxview_);
if (name == "bibitem")
- return new GuiBibitemDialog(lyxview_);
+ return createGuiBibitem(lyxview_);
if (name == "bibtex")
return createGuiBibtex(lyxview_);
if (name == "box")
#include "GuiBibitem.h"
#include "ControlCommand.h"
#include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
#include <QCloseEvent>
#include <QLineEdit>
namespace frontend {
-GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
- : GuiDialog(lv, "bibitem")
+GuiBibitem::GuiBibitem(LyXView & lv)
+ : GuiDialog(lv, "bibitem"), Controller(this), params_("bibitem")
{
setupUi(this);
setViewTitle(_("Bibliography Entry Settings"));
- setController(new ControlCommand(*this, "bibitem"));
+ setController(this, false);
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()
-{
- return static_cast<ControlCommand &>(GuiDialog::controller());
-}
-
-
-void GuiBibitemDialog::change_adaptor()
+void GuiBibitem::change_adaptor()
{
changed();
}
-void GuiBibitemDialog::closeEvent(QCloseEvent *e)
+void GuiBibitem::closeEvent(QCloseEvent *e)
{
slotClose();
e->accept();
}
-void GuiBibitemDialog::updateContents()
+void GuiBibitem::updateContents()
{
- keyED->setText(toqstr(controller().params()["key"]));
- labelED->setText(toqstr(controller().params()["label"]));
+ keyED->setText(toqstr(params_["key"]));
+ labelED->setText(toqstr(params_["label"]));
}
-void GuiBibitemDialog::applyView()
+void GuiBibitem::applyView()
{
- controller().params()["key"] = qstring_to_ucs4(keyED->text());
- controller().params()["label"] = qstring_to_ucs4(labelED->text());
+ params_["key"] = qstring_to_ucs4(keyED->text());
+ params_["label"] = qstring_to_ucs4(labelED->text());
}
-bool GuiBibitemDialog::isValid()
+bool GuiBibitem::isValid()
{
return !keyED->text().isEmpty();
}
+
+bool GuiBibitem::initialiseParams(std::string const & data)
+{
+ // The name passed with LFUN_INSET_APPLY is also the name
+ // used to identify the mailer.
+ InsetCommandMailer::string2params("bibitem", data, params_);
+ return true;
+}
+
+
+void GuiBibitem::dispatchParams()
+{
+ std::string const lfun = InsetCommandMailer::params2string("bibitem", params_);
+ dispatch(FuncRequest(getLfun(), lfun));
+}
+
+
+Dialog * createGuiBibitem(LyXView & lv) { return new GuiBibitem(lv); }
+
+
} // namespace frontend
} // namespace lyx
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
+ * \author Angus Leeming
* \author John Levon
*
* Full author contact details are available in file CREDITS.
#define GUIBIBITEM_H
#include "GuiDialog.h"
-#include "ControlCommand.h"
#include "ui_BibitemUi.h"
+#include "frontends/Dialog.h"
+
+#include "insets/InsetCommandParams.h"
+
namespace lyx {
namespace frontend {
-class GuiBibitemDialog : public GuiDialog, public Ui::BibitemUi
+class GuiBibitem : public GuiDialog, public Ui::BibitemUi, public Controller
{
Q_OBJECT
public:
- GuiBibitemDialog(LyXView & lv);
+ GuiBibitem(LyXView & lv);
private Q_SLOTS:
void change_adaptor();
///
void closeEvent(QCloseEvent * e);
/// parent controller
- ControlCommand & controller();
+ Controller & controller() { return *this; }
private:
///
void applyView();
/// update
void updateContents();
+ ///
+ bool initialiseParams(std::string const & data);
+ /// clean-up on hide.
+ void clearParams() { params_.clear(); }
+ /// clean-up on hide.
+ void dispatchParams();
+ ///
+ bool isBufferDependent() const { return true; }
+
+private:
+ ///
+ InsetCommandParams params_;
};
} // namespace frontend