commit b6880470b390accf104afd95560733f7abe62119
Author: Enrico Forestieri <[email protected]>
Date: Fri Dec 11 08:51:37 2015 +0100
Fix bug #9898: inset info cannot show specified icon
diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 6e21d9b..2f26c97 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -169,12 +169,20 @@ bool InsetInfo::validateModifyArgument(docstring const &
arg) const
case SHORTCUT_INFO:
case SHORTCUTS_INFO:
- case MENU_INFO:
- case ICON_INFO: {
+ case MENU_INFO: {
FuncRequest func = lyxaction.lookupFunc(name);
return func.action() != LFUN_UNKNOWN_ACTION;
}
+ case ICON_INFO: {
+ FuncCode const action = lyxaction.lookupFunc(name).action();
+ if (action == LFUN_UNKNOWN_ACTION) {
+ string dir = "images";
+ return !imageLibFileSearch(dir, name,
"svgz,png").empty();
+ }
+ return true;
+ }
+
case LYXRC_INFO: {
ostringstream oss;
lyxrc.write(oss, true, name);
diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h
index 66f6a86..1293202 100644
--- a/src/insets/InsetInfo.h
+++ b/src/insets/InsetInfo.h
@@ -56,7 +56,8 @@ menu: argument is the name of the LFUN such as "paste". The
syntax is the same
icon: argument is the name of the LFUN such as "paste". The syntax is the same
as what is used in the bind and ui files. The output is the icon use in
- the toolbar for this LFUN.
+ the toolbar for this LFUN. Alternatively, argument can be the icon path
+ without extension specified with respect to the images directory.
buffer: argument can be one of "name", "path", "class". This inset output the
filename, path, and textclass of this buffer.