X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffactory.C;h=3509bc8150b612b3d2ce56836ecfd2f538778f7f;hb=498f06d43a0f2000c3f704db1ea39fda3c819fe6;hp=0efe69aa5d973e484c78ac0b5f1d8527e39d9c79;hpb=df71b75d4a19b80cd6f1b3359982a1c06fefe4b5;p=lyx.git diff --git a/src/factory.C b/src/factory.C index 0efe69aa5d..3509bc8150 100644 --- a/src/factory.C +++ b/src/factory.C @@ -8,6 +8,8 @@ * Full author contact details are available in file CREDITS */ +#include + #include "funcrequest.h" #include "bufferparams.h" #include "buffer.h" @@ -91,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; } @@ -123,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: @@ -153,5 +160,3 @@ Inset * createInset(FuncRequest const & cmd) } return 0; } - -