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.
16 #include "qt_helpers.h"
19 #include <QPushButton>
21 #include <QCloseEvent>
26 /////////////////////////////////////////////////////////////////////
30 /////////////////////////////////////////////////////////////////////
35 GuiIndexDialog::GuiIndexDialog(GuiIndex * form)
40 connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
41 connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
42 connect(keywordED, SIGNAL(textChanged(const QString &)),
43 this, SLOT(change_adaptor()));
45 setFocusProxy(keywordED);
47 keywordED->setWhatsThis( qt_(
48 "The format of the entry in the index.\n"
50 "An entry can be specified as a sub-entry of\n"
51 "another with \"!\":\n"
55 "You can cross-refer to another entry like so:\n"
57 "cars!mileage|see{economy}\n"
59 "For further details refer to the local LaTeX\n"
65 void GuiIndexDialog::change_adaptor()
71 void GuiIndexDialog::reject()
77 void GuiIndexDialog::closeEvent(QCloseEvent * e)
84 /////////////////////////////////////////////////////////////////////
88 /////////////////////////////////////////////////////////////////////
91 GuiIndex::GuiIndex(GuiDialog & parent, docstring const & title,
92 QString const & label)
93 : GuiView<GuiIndexDialog>(parent, title), label_(label)
98 void GuiIndex::build_dialog()
100 dialog_.reset(new GuiIndexDialog(this));
102 dialog_->keywordLA->setText(label_);
104 bc().setOK(dialog_->okPB);
105 bc().setCancel(dialog_->closePB);
106 bc().addReadOnly(dialog_->keywordED);
110 void GuiIndex::update_contents()
112 docstring const contents = controller().params()["name"];
113 dialog_->keywordED->setText(toqstr(contents));
115 bc().setValid(!contents.empty());
119 void GuiIndex::applyView()
121 controller().params()["name"] = qstring_to_ucs4(dialog_->keywordED->text());
125 bool GuiIndex::isValid()
127 return !dialog_->keywordED->text().isEmpty();
130 } // namespace frontend
133 #include "GuiIndex_moc.cpp"