/** * \file GuiBibitem.cpp * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author John Levon * * Full author contact details are available in file CREDITS. */ #include #include "GuiBibitem.h" #include "qt_helpers.h" #include "FuncRequest.h" #include #include #include namespace lyx { namespace frontend { GuiBibitem::GuiBibitem(LyXView & lv) : GuiCommand(lv, "bibitem") { setupUi(this); setViewTitle(_("Bibliography Entry Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(keyED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); connect(labelED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); bc().setPolicy(ButtonPolicy::OkCancelReadOnlyPolicy); bc().setOK(okPB); bc().setCancel(closePB); bc().addReadOnly(keyED); bc().addReadOnly(labelED); } void GuiBibitem::change_adaptor() { changed(); } void GuiBibitem::closeEvent(QCloseEvent *e) { slotClose(); e->accept(); } void GuiBibitem::updateContents() { keyED->setText(toqstr(params_["key"])); labelED->setText(toqstr(params_["label"])); } void GuiBibitem::applyView() { params_["key"] = qstring_to_ucs4(keyED->text()); params_["label"] = qstring_to_ucs4(labelED->text()); } bool GuiBibitem::isValid() { return !keyED->text().isEmpty(); } Dialog * createGuiBibitem(LyXView & lv) { return new GuiBibitem(lv); } } // namespace frontend } // namespace lyx #include "GuiBibitem_moc.cpp"