]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiPrintindex.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiPrintindex.cpp
index a175f8b651c3735f256e5f6b7c342913c91a82b7..c639fd9e4735e978c96872bac29c31c4898f4a6b 100644 (file)
 #include "FuncRequest.h"
 #include "IndicesList.h"
 
+#include "support/lstrings.h"
+
 #include "insets/InsetCommand.h"
 
 #include <QPushButton>
 
 using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace frontend {
@@ -58,10 +61,14 @@ void GuiPrintindex::updateContents()
        typedef IndicesList::const_iterator const_iterator;
 
        IndicesList const & indiceslist = buffer().params().indiceslist();
-       docstring const cur_index = params_["type"];
+       docstring const cur_index = suffixIs(params_.getCmdName(), '*') ?
+               from_ascii("printall") : params_["type"];
 
        indicesCO->clear();
 
+       indicesCO->addItem(qt_("<All indexes>"),
+                       QVariant(QString("printall")));
+
        const_iterator const begin = indiceslist.begin();
        const_iterator const end = indiceslist.end();
        for (const_iterator it = begin; it != end; ++it)
@@ -78,17 +85,24 @@ void GuiPrintindex::applyView()
 {
        QString const index = indicesCO->itemData(
                indicesCO->currentIndex()).toString();
+       string cmd = "printindex";
        if (subindexCB->isChecked())
-               params_.setCmdName("printsubindex");
+               cmd = "printsubindex";
+       if (index == QString("printall"))
+               cmd += '*';
+       params_.setCmdName(cmd);
+       if (index == QString("printall"))
+               params_["type"] = docstring();
        else
-               params_.setCmdName("printindex");
-       params_["type"] = qstring_to_ucs4(index);
+               params_["type"] = qstring_to_ucs4(index);
 }
 
 
 void GuiPrintindex::paramsToDialog(InsetCommandParams const & /*icp*/)
 {
-       int const pos = indicesCO->findData(toqstr(params_["type"]));
+       int const pos = suffixIs(params_.getCmdName(), '*') ?
+               indicesCO->findData(QString("printall")) :
+               indicesCO->findData(toqstr(params_["type"]));
        subindexCB->setChecked(params_.getCmdName() == "printsubindex");
        indicesCO->setCurrentIndex(pos);
        bc().setValid(isValid());
@@ -100,6 +114,7 @@ bool GuiPrintindex::initialiseParams(string const & data)
        // The name passed with LFUN_INSET_APPLY is also the name
        // used to identify the mailer.
        InsetCommand::string2params("index_print", data, params_);
+       paramsToDialog(params_);
        return true;
 }