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"
14 #include "ControlCommand.h"
15 #include "qt_helpers.h"
17 #include <QCloseEvent>
19 #include <QPushButton>
26 GuiBibitemDialog::GuiBibitemDialog(LyXView & lv)
27 : GuiDialog(lv, "bibitem")
30 setViewTitle(_("Bibliography Entry Settings"));
31 setController(new ControlCommand(*this, "bibitem"));
33 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
34 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
36 connect(keyED, SIGNAL(textChanged(const QString &)),
37 this, SLOT(change_adaptor()));
38 connect(labelED, SIGNAL(textChanged(const QString &)),
39 this, SLOT(change_adaptor()));
41 bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy);
43 bc().setCancel(closePB);
44 bc().addReadOnly(keyED);
45 bc().addReadOnly(labelED);
49 ControlCommand & GuiBibitemDialog::controller()
51 return static_cast<ControlCommand &>(GuiDialog::controller());
55 void GuiBibitemDialog::change_adaptor()
61 void GuiBibitemDialog::closeEvent(QCloseEvent *e)
68 void GuiBibitemDialog::updateContents()
70 keyED->setText(toqstr(controller().params()["key"]));
71 labelED->setText(toqstr(controller().params()["label"]));
75 void GuiBibitemDialog::applyView()
77 controller().params()["key"] = qstring_to_ucs4(keyED->text());
78 controller().params()["label"] = qstring_to_ucs4(labelED->text());
82 bool GuiBibitemDialog::isValid()
84 return !keyED->text().isEmpty();
87 } // namespace frontend
90 #include "GuiBibitem_moc.cpp"