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"
15 #include "qt_helpers.h"
17 #include "controllers/ControlCommand.h"
20 #include <QPushButton>
26 /////////////////////////////////////////////////////////////////////
30 /////////////////////////////////////////////////////////////////////
32 GuiBibitemDialog::GuiBibitemDialog(GuiBibitem * form)
36 connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
37 connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
39 connect(keyED, SIGNAL(textChanged(const QString &)),
40 this, SLOT(change_adaptor()));
41 connect(labelED, SIGNAL(textChanged(const QString &)),
42 this, SLOT(change_adaptor()));
46 void GuiBibitemDialog::change_adaptor()
52 void GuiBibitemDialog::closeEvent(QCloseEvent *e)
59 /////////////////////////////////////////////////////////////////////
63 /////////////////////////////////////////////////////////////////////
65 typedef QController<ControlCommand, GuiView<GuiBibitemDialog> > BibItemBase;
68 GuiBibitem::GuiBibitem(Dialog & parent)
69 : BibItemBase(parent, _("Bibliography Entry Settings"))
74 void GuiBibitem::build_dialog()
76 dialog_.reset(new GuiBibitemDialog(this));
78 bcview().setOK(dialog_->okPB);
79 bcview().setCancel(dialog_->closePB);
80 bcview().addReadOnly(dialog_->keyED);
81 bcview().addReadOnly(dialog_->labelED);
85 void GuiBibitem::update_contents()
87 dialog_->keyED->setText(toqstr(controller().params()["key"]));
88 dialog_->labelED->setText(toqstr(controller().params()["label"]));
92 void GuiBibitem::apply()
94 controller().params()["key"] = qstring_to_ucs4(dialog_->keyED->text());
95 controller().params()["label"] = qstring_to_ucs4(dialog_->labelED->text());
99 bool GuiBibitem::isValid()
101 return !dialog_->keyED->text().isEmpty();
104 } // namespace frontend
107 #include "GuiBibitem_moc.cpp"