GuiPrintNomencl.{cpp,h}:
[lyx.git] / src / frontends / qt4 / GuiIndex.cpp
blob0f25c93da72f4f3d32825e568e4d8857c8f444fd
1 /**
2 * \file GuiIndex.cpp
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.
13 #include <config.h>
15 #include "GuiIndex.h"
17 #include "qt_helpers.h"
19 #include "Buffer.h"
20 #include "BufferParams.h"
21 #include "FuncRequest.h"
22 #include "IndicesList.h"
24 #include "insets/InsetIndex.h"
26 #include <QPushButton>
28 using namespace std;
30 namespace lyx {
31 namespace frontend {
33 GuiIndex::GuiIndex(GuiView & lv)
34 : GuiDialog(lv, "index", qt_("Index Entry Settings"))
36 setupUi(this);
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);
43 bc().setOK(okPB);
44 bc().setCancel(cancelPB);
48 void GuiIndex::change_adaptor()
50 changed();
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;
61 indicesCO->clear();
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_);
85 return true;
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
105 } // namespace lyx
107 #include "moc_GuiIndex.cpp"