+ os << "Info\ntype \"" << infoType()
+ << "\"\narg " << Lexer::quoteString(name_);
+}
+
+
+bool InsetInfo::validateModifyArgument(docstring const & arg) const
+{
+ string type;
+ string const name = trim(split(to_utf8(arg), type, ' '));
+
+ switch (nameTranslator().find(type)) {
+ case UNKNOWN_INFO:
+ return false;
+
+ case SHORTCUT_INFO:
+ case SHORTCUTS_INFO:
+ case MENU_INFO:
+ case ICON_INFO: {
+ FuncRequest func = lyxaction.lookupFunc(name);
+ return func.action() != LFUN_UNKNOWN_ACTION;
+ }
+
+ case LYXRC_INFO: {
+ ostringstream oss;
+ lyxrc.write(oss, true, name);
+ return !oss.str().empty();
+ }
+
+ case PACKAGE_INFO:
+ case TEXTCLASS_INFO:
+ return true;
+
+ case BUFFER_INFO:
+ if (name == "name" || name == "path" || name == "class")
+ return true;
+ if (name == "vcs-revision" || name == "vcs-tree-revision" ||
+ name == "vcs-author" || name == "vcs-date" || name == "vcs-time")
+ return buffer().lyxvc().inUse();
+ return false;
+
+ case LYX_INFO:
+ return name == "version";
+ }
+
+ return false;
+}
+
+
+bool InsetInfo::showInsetDialog(BufferView * bv) const
+{
+ bv->showDialog("info");
+ return true;
+}
+
+
+bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
+{
+ switch (cmd.action()) {
+ case LFUN_INSET_SETTINGS:
+ return InsetCollapsable::getStatus(cur, cmd, flag);
+
+ case LFUN_INSET_DIALOG_UPDATE:
+ case LFUN_INSET_COPY_AS:
+ flag.setEnabled(true);
+ return true;
+
+ case LFUN_INSET_MODIFY:
+ if (validateModifyArgument(cmd.argument())) {
+ flag.setEnabled(true);
+ return true;
+ }
+ //fall through
+
+ default:
+ return false;
+ }