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 <QPushButton>
31 GuiIndex::GuiIndex(GuiView & lv)
32 : GuiDialog(lv, "index", qt_("Index Entry Settings"))
36 connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
37 this, SLOT(slotButtonBox(QAbstractButton *)));
38 connect(indicesCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
40 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
41 bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
42 bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
46 void GuiIndex::change_adaptor()
52 void GuiIndex::updateContents()
54 typedef IndicesList::const_iterator const_iterator;
56 IndicesList const & indiceslist = buffer().params().indiceslist();
57 docstring const cur_index = params_.index;
61 const_iterator const begin = indiceslist.begin();
62 const_iterator const end = indiceslist.end();
63 for (const_iterator it = begin; it != end; ++it)
64 indicesCO->addItem(toqstr(it->index()),
65 QVariant(toqstr(it->shortcut())));
67 int const pos = indicesCO->findData(toqstr(cur_index));
68 indicesCO->setCurrentIndex(pos);
72 void GuiIndex::applyView()
74 QString const index = indicesCO->itemData(
75 indicesCO->currentIndex()).toString();
76 params_.index = qstring_to_ucs4(index);
80 bool GuiIndex::initialiseParams(string const & sdata)
82 InsetIndex::string2params(sdata, params_);
87 void GuiIndex::clearParams()
89 params_ = InsetIndexParams();
93 void GuiIndex::dispatchParams()
95 dispatch(FuncRequest(getLfun(), InsetIndex::params2string(params_)));
99 } // namespace frontend
102 #include "moc_GuiIndex.cpp"