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 "support/debug.h"
16 #include "qt_helpers.h"
19 #include <QPushButton>
21 #include <QCloseEvent>
28 /////////////////////////////////////////////////////////////////
30 // Base implementation
32 /////////////////////////////////////////////////////////////////
34 GuiIndexDialogBase::GuiIndexDialogBase(GuiView & lv,
35 QString const & title, QString const & label, string const & name)
36 : GuiCommand(lv, name, title)
41 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
42 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
43 connect(keywordED, SIGNAL(textChanged(const QString &)),
44 this, SLOT(change_adaptor()));
46 setFocusProxy(keywordED);
48 keywordLA->setText(label_);
50 keywordED->setWhatsThis( qt_(
51 "The format of the entry in the index.\n"
53 "An entry can be specified as a sub-entry of\n"
54 "another with \"!\":\n"
58 "You can cross-refer to another entry like so:\n"
60 "cars!mileage|see{economy}\n"
62 "For further details refer to the local LaTeX\n"
66 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
68 bc().setCancel(closePB);
69 bc().addReadOnly(keywordED);
73 void GuiIndexDialogBase::change_adaptor()
79 void GuiIndexDialogBase::reject()
85 void GuiIndexDialogBase::closeEvent(QCloseEvent * e)
92 void GuiIndexDialogBase::updateContents()
94 docstring const contents = params_["name"];
95 keywordED->setText(toqstr(contents));
96 bc().setValid(!contents.empty());
100 void GuiIndexDialogBase::applyView()
102 params_["name"] = qstring_to_ucs4(keywordED->text());
106 bool GuiIndexDialogBase::isValid()
108 return !keywordED->text().isEmpty();
112 /////////////////////////////////////////////////////////////////
116 /////////////////////////////////////////////////////////////////
119 GuiIndex::GuiIndex(GuiView & lv)
120 : GuiIndexDialogBase(lv, qt_("Index Entry"), qt_("&Keyword:"), "index")
122 keywordED->setWhatsThis( qt_(
123 "The format of the entry in the index.\n"
125 "An entry can be specified as a sub-entry of\n"
126 "another with \"!\":\n"
130 "You can cross-refer to another entry like so:\n"
132 "cars!mileage|see{economy}\n"
134 "For further details refer to the local LaTeX\n"
140 Dialog * createGuiIndex(GuiView & lv) { return new GuiIndex(lv); }
143 /////////////////////////////////////////////////////////////////
147 /////////////////////////////////////////////////////////////////
149 GuiLabel::GuiLabel(GuiView & lv)
150 : GuiIndexDialogBase(lv, qt_("Label"), qt_("&Label:"), "label")
154 Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); }
157 } // namespace frontend
160 #include "GuiIndex_moc.cpp"