]> git.lyx.org Git - lyx.git/blobdiff - src/factory.C
fix compilation bug
[lyx.git] / src / factory.C
index 520da4ba22b003ebcb4d355d0314be74805dee39..3509bc8150b612b3d2ce56836ecfd2f538778f7f 100644 (file)
@@ -1,3 +1,14 @@
+/**
+ * \file factory.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
 
 #include "funcrequest.h"
 #include "bufferparams.h"
@@ -82,11 +93,16 @@ Inset * createInset(FuncRequest const & cmd)
                        return 0;
 
                case LFUN_INDEX_INSERT: {
-                       string entry = cmd.argument;
-                       if (entry.empty())
-                               entry = bv->getLyXText()->getStringToIndex(bv);
-                       if (!entry.empty())
-                               return new InsetIndex(InsetCommandParams("index", entry));
+                       string const entry = cmd.argument.empty() ?
+                               "index" : cmd.argument;
+                       InsetCommandParams icp;
+                       icp.setFromString(entry);
+
+                       if (icp.getContents().empty())
+                               icp.setContents(bv->getLyXText()->getStringToIndex(bv));
+                       if (!icp.getContents().empty())
+                               return new InsetIndex(icp);
+                       
                        bv->owner()->getDialogs().createIndex();
                        return 0;
                }
@@ -114,7 +130,7 @@ Inset * createInset(FuncRequest const & cmd)
                        }
                        return 0;
 
-               case LFUN_INDEX_PRINT: 
+               case LFUN_INDEX_PRINT:
                        return new InsetPrintIndex(InsetCommandParams("printindex"));
 
                case LFUN_TOC_INSERT:
@@ -144,5 +160,3 @@ Inset * createInset(FuncRequest const & cmd)
        }
        return 0;
 }
-
-