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