3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
7 * \author Martin Vermeer
8 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
17 #include "qt_helpers.h"
20 #include "BufferParams.h"
21 #include "FuncRequest.h"
22 #include "IndicesList.h"
24 #include "insets/InsetIndex.h"
26 #include <QPushButton>
33 GuiIndex::GuiIndex(GuiView & lv)
34 : GuiDialog(lv, "index", qt_("Index Entry Settings"))
38 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
39 connect(cancelPB, SIGNAL(clicked()), this, SLOT(slotClose()));
40 connect(indicesCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
42 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
44 bc().setCancel(cancelPB);
48 void GuiIndex::change_adaptor()
54 void GuiIndex::updateContents()
56 typedef IndicesList::const_iterator const_iterator;
58 IndicesList const & indiceslist = buffer().params().indiceslist();
59 docstring const cur_index = params_.index;
63 const_iterator const begin = indiceslist.begin();
64 const_iterator const end = indiceslist.end();
65 for (const_iterator it = begin; it != end; ++it)
66 indicesCO->addItem(toqstr(it->index()),
67 QVariant(toqstr(it->shortcut())));
69 int const pos = indicesCO->findData(toqstr(cur_index));
70 indicesCO->setCurrentIndex(pos);
74 void GuiIndex::applyView()
76 QString const index = indicesCO->itemData(
77 indicesCO->currentIndex()).toString();
78 params_.index = qstring_to_ucs4(index);
82 bool GuiIndex::initialiseParams(string const & data)
84 InsetIndex::string2params(data, params_);
89 void GuiIndex::clearParams()
91 params_ = InsetIndexParams();
95 void GuiIndex::dispatchParams()
97 dispatch(FuncRequest(getLfun(), InsetIndex::params2string(params_)));
101 Dialog * createGuiIndex(GuiView & lv) { return new GuiIndex(lv); }
104 } // namespace frontend
107 #include "moc_GuiIndex.cpp"