]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBibitem.cpp
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / GuiBibitem.cpp
index 3f9412640ac8e070751623b6402deb7489645455..0b2da16cce5ea35d4447962380e37c82ddbf3341 100644 (file)
 #include <config.h>
 
 #include "GuiBibitem.h"
+
 #include "qt_helpers.h"
 
-#include <QCloseEvent>
+#include "insets/InsetCommand.h"
+
 #include <QLineEdit>
 #include <QPushButton>
 
 namespace lyx {
 namespace frontend {
 
-/////////////////////////////////////////////////////////////////////
-//
-// GuiBibItemDialog
-//
-/////////////////////////////////////////////////////////////////////
 
-GuiBibitemDialog::GuiBibitemDialog(GuiBibitem * form)
-       : form_(form)
+GuiBibitem::GuiBibitem(QWidget * parent) : InsetParamsWidget(parent)
 {
        setupUi(this);
-       connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
-
-       connect(keyED, SIGNAL(textChanged(const QString &)),
-               this, SLOT(change_adaptor()));
-       connect(labelED, SIGNAL(textChanged(const QString &)),
-               this, SLOT(change_adaptor()));
-}
-
-
-void GuiBibitemDialog::change_adaptor()
-{
-       form_->changed();
-}
-
-
-void GuiBibitemDialog::closeEvent(QCloseEvent *e)
-{
-       form_->slotWMHide();
-       e->accept();
-}
-
-
-/////////////////////////////////////////////////////////////////////
-//
-// GuiBibItem
-//
-/////////////////////////////////////////////////////////////////////
-
-
-GuiBibitem::GuiBibitem(GuiDialog & parent)
-       : GuiView<GuiBibitemDialog>(parent, _("Bibliography Entry Settings"))
-{
-}
-
-
-void GuiBibitem::build_dialog()
-{
-       dialog_.reset(new GuiBibitemDialog(this));
 
-       bc().setOK(dialog_->okPB);
-       bc().setCancel(dialog_->closePB);
-       bc().addReadOnly(dialog_->keyED);
-       bc().addReadOnly(dialog_->labelED);
+       connect(keyED, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
+       connect(labelED, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
 }
 
 
-void GuiBibitem::update_contents()
+void GuiBibitem::paramsToDialog(Inset const * inset)
 {
-       dialog_->keyED->setText(toqstr(controller().params()["key"]));
-       dialog_->labelED->setText(toqstr(controller().params()["label"]));
+       InsetCommand const * ic = static_cast<InsetCommand const *>(inset);
+       InsetCommandParams const & params = ic->params();
+       keyED->setText(toqstr(params["key"]));
+       labelED->setText(toqstr(params["label"]));
 }
 
 
-void GuiBibitem::apply()
+docstring GuiBibitem::dialogToParams() const
 {
-       controller().params()["key"] = qstring_to_ucs4(dialog_->keyED->text());
-       controller().params()["label"] = qstring_to_ucs4(dialog_->labelED->text());
+       InsetCommandParams params(insetCode());
+       params["key"] = qstring_to_ucs4(keyED->text());
+       params["label"] = qstring_to_ucs4(labelED->text());
+       return from_utf8(InsetCommand::params2string(params));
 }
 
 
-bool GuiBibitem::isValid()
+bool GuiBibitem::checkWidgets() const
 {
-       return !dialog_->keyED->text().isEmpty();
+       if (!InsetParamsWidget::checkWidgets())
+               return false;
+       return !keyED->text().isEmpty();
 }
 
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiBibitem_moc.cpp"
+#include "moc_GuiBibitem.cpp"