2 * \file GuiPrintindex.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.
15 #include "GuiPrintindex.h"
17 #include "qt_helpers.h"
20 #include "BufferParams.h"
21 #include "FuncRequest.h"
22 #include "IndicesList.h"
24 #include "insets/InsetCommand.h"
26 #include <QPushButton>
33 GuiPrintindex::GuiPrintindex(GuiView & lv)
34 : GuiDialog(lv, "index_print", qt_("Index Settings")),
35 params_(insetCode("index_print"))
39 connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
40 connect(cancelPB, SIGNAL(clicked()), this, SLOT(slotClose()));
41 connect(indicesCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
43 bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
45 bc().setCancel(cancelPB);
49 void GuiPrintindex::change_adaptor()
55 void GuiPrintindex::updateContents()
57 typedef IndicesList::const_iterator const_iterator;
59 IndicesList const & indiceslist = buffer().params().indiceslist();
60 docstring const cur_index = params_["type"];
64 const_iterator const begin = indiceslist.begin();
65 const_iterator const end = indiceslist.end();
66 for (const_iterator it = begin; it != end; ++it)
67 indicesCO->addItem(toqstr(it->index()),
68 QVariant(toqstr(it->shortcut())));
70 int const pos = indicesCO->findData(toqstr(cur_index));
71 indicesCO->setCurrentIndex(pos);
75 void GuiPrintindex::applyView()
77 QString const index = indicesCO->itemData(
78 indicesCO->currentIndex()).toString();
79 params_["type"] = qstring_to_ucs4(index);
83 void GuiPrintindex::paramsToDialog(InsetCommandParams const & /*icp*/)
85 int const pos = indicesCO->findData(toqstr(params_["type"]));
86 indicesCO->setCurrentIndex(pos);
87 bc().setValid(isValid());
91 bool GuiPrintindex::initialiseParams(string const & data)
93 // The name passed with LFUN_INSET_APPLY is also the name
94 // used to identify the mailer.
95 InsetCommand::string2params("index_print", data, params_);
100 void GuiPrintindex::dispatchParams()
102 std::string const lfun = InsetCommand::params2string("index_print", params_);
103 dispatch(FuncRequest(getLfun(), lfun));
107 Dialog * createGuiPrintindex(GuiView & lv) { return new GuiPrintindex(lv); }
110 } // namespace frontend
113 #include "moc_GuiPrintindex.cpp"