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>
29 /////////////////////////////////////////////////////////////////
31 // Base implementation
33 /////////////////////////////////////////////////////////////////
35 GuiIndexDialogBase::GuiIndexDialogBase(LyXView & lv,
36 docstring const & title, QString const & label, std::string const & name)
37 : GuiCommand(lv, name)
43 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
44 connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
45 connect(keywordED, SIGNAL(textChanged(const QString &)),
46 this, SLOT(change_adaptor()));
48 setFocusProxy(keywordED);
50 keywordLA->setText(label_);
52 keywordED->setWhatsThis( qt_(
53 "The format of the entry in the index.\n"
55 "An entry can be specified as a sub-entry of\n"
56 "another with \"!\":\n"
60 "You can cross-refer to another entry like so:\n"
62 "cars!mileage|see{economy}\n"
64 "For further details refer to the local LaTeX\n"
68 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
70 bc().setCancel(closePB);
71 bc().addReadOnly(keywordED);
75 void GuiIndexDialogBase::change_adaptor()
81 void GuiIndexDialogBase::reject()
87 void GuiIndexDialogBase::closeEvent(QCloseEvent * e)
94 void GuiIndexDialogBase::updateContents()
96 docstring const contents = params_["name"];
97 keywordED->setText(toqstr(contents));
98 bc().setValid(!contents.empty());
102 void GuiIndexDialogBase::applyView()
104 params_["name"] = qstring_to_ucs4(keywordED->text());
108 bool GuiIndexDialogBase::isValid()
110 return !keywordED->text().isEmpty();
114 /////////////////////////////////////////////////////////////////
118 /////////////////////////////////////////////////////////////////
121 GuiIndex::GuiIndex(LyXView & lv)
122 : GuiIndexDialogBase(lv, _("Index Entry"), qt_("&Keyword:"), "index")
124 keywordED->setWhatsThis( qt_(
125 "The format of the entry in the index.\n"
127 "An entry can be specified as a sub-entry of\n"
128 "another with \"!\":\n"
132 "You can cross-refer to another entry like so:\n"
134 "cars!mileage|see{economy}\n"
136 "For further details refer to the local LaTeX\n"
142 Dialog * createGuiIndex(LyXView & lv) { return new GuiIndex(lv); }
145 /////////////////////////////////////////////////////////////////
149 /////////////////////////////////////////////////////////////////
151 GuiLabel::GuiLabel(LyXView & lv)
152 : GuiIndexDialogBase(lv, _("Label"), qt_("&Label:"), "label")
156 Dialog * createGuiLabel(LyXView & lv) { return new GuiLabel(lv); }
159 } // namespace frontend
162 #include "GuiIndex_moc.cpp"