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
14 #include "ControlCommand.h"
15 #include "qt_helpers.h"
17 #include "QIndexDialog.h"
20 #include "ButtonController.h"
22 #include <qlineedit.h>
23 #include <qpushbutton.h>
25 typedef QController<ControlCommand, QView<QIndexDialog> > base_class;
28 QIndex::QIndex(Dialog & parent, string const & title, QString const & label)
29 : base_class(parent, title), label_(label)
34 void QIndex::build_dialog()
36 dialog_.reset(new QIndexDialog(this));
38 dialog_->keywordLA->setText(label_);
40 bcview().setOK(dialog_->okPB);
41 bcview().setCancel(dialog_->closePB);
42 bcview().addReadOnly(dialog_->keywordED);
46 void QIndex::update_contents()
48 string const contents = controller().params().getContents();
49 dialog_->keywordED->setText(toqstr(contents));
51 bc().valid(!contents.empty());
57 controller().params().setContents(fromqstr(dialog_->keywordED->text()));
61 bool QIndex::isValid()
63 return !dialog_->keywordED->text().isEmpty();