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 docstring const & title, QString const & label, string const & name)
36 : GuiCommand(lv, name)
42 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
43 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
44 connect(keywordED, SIGNAL(textChanged(const QString &)),
45 this, SLOT(change_adaptor()));
47 setFocusProxy(keywordED);
49 keywordLA->setText(label_);
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"
67 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
69 bc().setCancel(closePB);
70 bc().addReadOnly(keywordED);
74 void GuiIndexDialogBase::change_adaptor()
80 void GuiIndexDialogBase::reject()
86 void GuiIndexDialogBase::closeEvent(QCloseEvent * e)
93 void GuiIndexDialogBase::updateContents()
95 docstring const contents = params_["name"];
96 keywordED->setText(toqstr(contents));
97 bc().setValid(!contents.empty());
101 void GuiIndexDialogBase::applyView()
103 params_["name"] = qstring_to_ucs4(keywordED->text());
107 bool GuiIndexDialogBase::isValid()
109 return !keywordED->text().isEmpty();
113 /////////////////////////////////////////////////////////////////
117 /////////////////////////////////////////////////////////////////
120 GuiIndex::GuiIndex(GuiView & lv)
121 : GuiIndexDialogBase(lv, _("Index Entry"), qt_("&Keyword:"), "index")
123 keywordED->setWhatsThis( qt_(
124 "The format of the entry in the index.\n"
126 "An entry can be specified as a sub-entry of\n"
127 "another with \"!\":\n"
131 "You can cross-refer to another entry like so:\n"
133 "cars!mileage|see{economy}\n"
135 "For further details refer to the local LaTeX\n"
141 Dialog * createGuiIndex(GuiView & lv) { return new GuiIndex(lv); }
144 /////////////////////////////////////////////////////////////////
148 /////////////////////////////////////////////////////////////////
150 GuiLabel::GuiLabel(GuiView & lv)
151 : GuiIndexDialogBase(lv, _("Label"), qt_("&Label:"), "label")
155 Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); }
158 } // namespace frontend
161 #include "GuiIndex_moc.cpp"