3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include "ControlCommand.h"
16 #include "qt_helpers.h"
18 #include "QNomenclDialog.h"
21 #include "ButtonController.h"
23 #include <qlineedit.h>
24 #include <qpushbutton.h>
31 typedef QController<ControlCommand, QView<QNomenclDialog> > base_class;
34 QNomencl::QNomencl(Dialog & parent, docstring const & title)
35 : base_class(parent, title)
40 void QNomencl::build_dialog()
42 dialog_.reset(new QNomenclDialog(this));
44 bcview().setOK(dialog_->okPB);
45 bcview().setCancel(dialog_->closePB);
46 bcview().addReadOnly(dialog_->symbolED);
47 bcview().addReadOnly(dialog_->descrED);
48 bcview().addReadOnly(dialog_->prefixED);
52 void QNomencl::update_contents()
54 dialog_->prefixED->setText(toqstr(controller().params()["prefix"]));
55 dialog_->symbolED->setText(toqstr(controller().params()["symbol"]));
56 dialog_->descrED->setText(toqstr(controller().params()["description"]));
58 bc().valid(isValid());
62 void QNomencl::apply()
64 controller().params()["prefix"] = qstring_to_ucs4(dialog_->prefixED->text());
65 controller().params()["symbol"] = qstring_to_ucs4(dialog_->symbolED->text());
66 controller().params()["description"] = qstring_to_ucs4(dialog_->descrED->text());
70 bool QNomencl::isValid()
72 return (!dialog_->symbolED->text().isEmpty() && !dialog_->descrED->text().isEmpty());
75 } // namespace frontend