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"
19 #include "ButtonController.h"
22 #include <QPushButton>
25 #include <QCloseEvent>
30 /////////////////////////////////////////////////////////////////////
34 /////////////////////////////////////////////////////////////////////
39 QIndexDialog::QIndexDialog(QIndex * form)
44 connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
45 connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
46 connect( keywordED, SIGNAL(textChanged(const QString &)),
47 this, SLOT(change_adaptor()));
49 setFocusProxy(keywordED);
51 keywordED->setWhatsThis( qt_(
52 "The format of the entry in the index.\n"
54 "An entry can be specified as a sub-entry of\n"
55 "another with \"!\":\n"
59 "You can cross-refer to another entry like so:\n"
61 "cars!mileage|see{economy}\n"
63 "For further details refer to the local LaTeX\n"
69 void QIndexDialog::change_adaptor()
75 void QIndexDialog::reject()
81 void QIndexDialog::closeEvent(QCloseEvent * e)
88 /////////////////////////////////////////////////////////////////////
92 /////////////////////////////////////////////////////////////////////
95 typedef QController<ControlCommand, QView<QIndexDialog> > IndexBase;
97 QIndex::QIndex(Dialog & parent, docstring const & title, QString const & label)
98 : IndexBase(parent, title), label_(label)
103 void QIndex::build_dialog()
105 dialog_.reset(new QIndexDialog(this));
107 dialog_->keywordLA->setText(label_);
109 bcview().setOK(dialog_->okPB);
110 bcview().setCancel(dialog_->closePB);
111 bcview().addReadOnly(dialog_->keywordED);
115 void QIndex::update_contents()
117 docstring const contents = controller().params()["name"];
118 dialog_->keywordED->setText(toqstr(contents));
120 bc().valid(!contents.empty());
126 controller().params()["name"] = qstring_to_ucs4(dialog_->keywordED->text());
130 bool QIndex::isValid()
132 return !dialog_->keywordED->text().isEmpty();
135 } // namespace frontend
138 #include "QIndex_moc.cpp"