#include <jsobjectproxy.h>
Inheritance diagram for KJSEmbed::JSObjectProxy:

Public Member Functions | |
| JSObjectProxy (KJSEmbedPart *part, QObject *target) | |
| JSObjectProxy (KJSEmbedPart *part, QObject *target, QObject *root) | |
| JSObjectProxy (KJSEmbedPart *part, QObject *target, QObject *root, const JSSecurityPolicy *sp) | |
| virtual | ~JSObjectProxy () |
| KJSEmbedPart * | part () const |
| KJS::Interpreter * | interpreter () const |
| QObject * | rootObject () const |
| QObject * | object () const |
| QWidget * | widget () const |
| void * | toVoidStar () |
| bool | inherits (const char *clazz) |
| const JSSecurityPolicy * | securityPolicy () const |
| void | setSecurityPolicy (const JSSecurityPolicy *sp) |
| virtual KJS::Value | get (KJS::ExecState *exec, const KJS::Identifier &p) const |
| virtual void | put (KJS::ExecState *exec, const KJS::Identifier &p, const KJS::Value &v, int attr=KJS::None) |
| virtual KJS::UString | toString (KJS::ExecState *exec) const |
| virtual void | addBindings (KJS::ExecState *exec, KJS::Object &object) |
Protected Member Functions | |
| void | addBindingsClass (KJS::ExecState *exec, KJS::Object &object) |
| void | addBindingsEnum (KJS::ExecState *exec, KJS::Object &object) |
| void | addBindingsSlots (KJS::ExecState *exec, KJS::Object &object) |
Friends | |
| class | Bindings::JSObjectProxyImp |
This class defines a that allows scripts to access the properties of a QObject. The scripts can also create child objects, load dialogs from .ui files created by Designer and navigate the object tree in a similar manner to the DCOP/QObject bridge.
The following example creates a that provides a binding to the properties of a . This binding is then used to create a property 'edit' for the object 'jsparent'.
QLineEdit *edit = new QLineEdit(); KJSEmbed::JSObjectProxy *proxy = new KJSEmbed::JSObjectProxy( js, edit ); jsparent.put( js->globalExec(), "edit", proxy );
Security Facilities
In order to ensure scripts don't run amok and to ensure the script interpreter used by KHTML remains secure, JSObjectProxy applies a security policy. Every time a script tries to access an object or property the following tests are performed:
|
||||||||||||
|
Create a JS binding to the target object. The binding will allow scripts to access any QObject that is descended the target and no others. |
|
||||||||||||||||
|
Create a JS binding to the target object. The binding will allow scripts to access any QObject that is descended from the specified root. If the specified root is 0 then access is granted to all objects. |
|
||||||||||||||||||||
|
Create a JS binding to the target object. The binding will allow scripts to access any QObject that is descended from the specified root, according to the specified JSSecurityPolicy . If the specified root is 0 then access is granted to all objects. |
|
|
|
|
||||||||||||
|
||||||||||||
|
|
|
||||||||||||
|
Adds bindings for the constants defined by enums of the target.
|
|
||||||||||||
|
Adds bindings for slots defined by the target of the proxy.
|
|
||||||||||||
|
Reimplemented to return the value of the specified property if present.
|
|
|
Returns true iff the content of this proxy inherits the specified base-class.
Reimplemented from KJSEmbed::JSProxy. |
|
|
Returns the interpreter in which this proxy lives.
|
|
|
Returns the QObject the proxy is attached to.
|
|
|
Returns the KJSEmbedPart in which this proxy lives.
|
|
||||||||||||||||||||
|
Reimplemented to set the value of the specified property if possible.
|
|
|
Returns the root object that defines the limit of the scope of this proxy.
|
|
|
Returns the JSSecurityPolicy of the proxy.
|
|
|
Specifies the JSSecurityPolicy that should be applied to this proxy. Setting the policy to 0 restores the default policy. |
|
|
Reimplemented to return the name and class of the target.
|
|
|
Returns the contents of this proxy as a void * pointer. This method should be virtual, but is not for b/c. Reimplemented from KJSEmbed::JSProxy. |
|
|
Returns the associated QWidget, or 0 if the object is not a widget.
|
|
|
|
1.3.2