bool Image::prData() { qDebug("================Picture::prData()"); if (stringIsField(m_datasetField)) { qDebug("isField"); QString dataset; QString field; stringToField (m_datasetField, &dataset, &field); qDebug("dataset = %s, field=%s", qPrintable(dataset), qPrintable(field)); if (!m_image.loadFromData(ItemInterface::datasetField(dataset,field).toByteArray())) qDebug("ERROR loading image from field!!!"); } else qDebug("no field found"); return true; }
bool SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field, ExprDef *array_ndx, ExprDef *value, ActionsInfo *info) { unsigned action; enum action_field action_field; if (!stringToAction(elem, &action)) return false; if (!stringToField(field, &action_field)) { log_err(keymap->ctx, "\"%s\" is not a legal field name\n", field); return false; } return handleAction[action](keymap, &info->actions[action], action_field, array_ndx, value); }
bool SetActionField(struct xkb_context *ctx, ActionsInfo *info, struct xkb_mod_set *mods, const char *elem, const char *field, ExprDef *array_ndx, ExprDef *value) { enum xkb_action_type action; enum action_field action_field; if (!stringToAction(elem, &action)) return false; if (!stringToField(field, &action_field)) { log_err(ctx, "\"%s\" is not a legal field name\n", field); return false; } return handleAction[action](ctx, mods, &info->actions[action], action_field, array_ndx, value); }
bool HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, union xkb_action *action, ActionsInfo *info) { ExprDef *arg; const char *str; unsigned handler_type; if (def->expr.op != EXPR_ACTION_DECL) { log_err(keymap->ctx, "Expected an action definition, found %s\n", expr_op_type_to_string(def->expr.op)); return false; } str = xkb_atom_text(keymap->ctx, def->action.name); if (!stringToAction(str, &handler_type)) { log_err(keymap->ctx, "Unknown action %s\n", str); return false; } /* * Get the default values for this action type, as modified by * statements such as: * latchMods.clearLocks = True; */ *action = info->actions[handler_type]; /* * Now change the action properties as specified for this * particular instance, e.g. "modifiers" and "clearLocks" in: * SetMods(modifiers=Alt,clearLocks); */ for (arg = def->action.args; arg != NULL; arg = (ExprDef *) arg->common.next) { const ExprDef *value; ExprDef *field, *arrayRtrn; const char *elemRtrn, *fieldRtrn; enum action_field fieldNdx; if (arg->expr.op == EXPR_ASSIGN) { field = arg->binary.left; value = arg->binary.right; } else if (arg->expr.op == EXPR_NOT || arg->expr.op == EXPR_INVERT) { field = arg->unary.child; value = (const ExprDef *) &constFalse; } else { field = arg; value = (const ExprDef *) &constTrue; } if (!ExprResolveLhs(keymap->ctx, field, &elemRtrn, &fieldRtrn, &arrayRtrn)) return false; if (elemRtrn) { log_err(keymap->ctx, "Cannot change defaults in an action definition; " "Ignoring attempt to change %s.%s\n", elemRtrn, fieldRtrn); return false; } if (!stringToField(fieldRtrn, &fieldNdx)) { log_err(keymap->ctx, "Unknown field name %s\n", fieldRtrn); return false; } if (!handleAction[handler_type](keymap, action, fieldNdx, arrayRtrn, value)) return false; } return true; }