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 "ControlCommand.h"
18 #include "qt_helpers.h"
21 #include <QPushButton>
23 #include <QCloseEvent>
31 GuiIndexDialogBase::GuiIndexDialogBase(LyXView & lv,
32 docstring const & title, QString const & label)
33 : GuiDialog(lv, "index")
38 setController(new ControlCommand(*this, "index", "index"));
40 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
41 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
42 connect(keywordED, SIGNAL(textChanged(const QString &)),
43 this, SLOT(change_adaptor()));
45 setFocusProxy(keywordED);
47 keywordLA->setText(label_);
49 keywordED->setWhatsThis( qt_(
50 "The format of the entry in the index.\n"
52 "An entry can be specified as a sub-entry of\n"
53 "another with \"!\":\n"
57 "You can cross-refer to another entry like so:\n"
59 "cars!mileage|see{economy}\n"
61 "For further details refer to the local LaTeX\n"
65 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
67 bc().setCancel(closePB);
68 bc().addReadOnly(keywordED);
72 ControlCommand & GuiIndexDialogBase::controller() const
74 return static_cast<ControlCommand &>(Dialog::controller());
78 void GuiIndexDialogBase::change_adaptor()
84 void GuiIndexDialogBase::reject()
90 void GuiIndexDialogBase::closeEvent(QCloseEvent * e)
97 void GuiIndexDialogBase::update_contents()
99 docstring const contents = controller().params()["name"];
100 keywordED->setText(toqstr(contents));
101 bc().setValid(!contents.empty());
105 void GuiIndexDialogBase::applyView()
107 controller().params()["name"] = qstring_to_ucs4(keywordED->text());
111 bool GuiIndexDialogBase::isValid()
113 return !keywordED->text().isEmpty();
116 } // namespace frontend
119 #include "GuiIndex_moc.cpp"