Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members

# KJSEmbed::KJSEmbedPart Class Reference

A KPart for embedding KJS in an application. More...

`#include <kjsembedpart.h>`

List of all members.

## Public Slots

virtual KJSEmbed::JSConsoleWidget * | view ()
virtual bool | openURL (const KURL &url)
KJSEmbed::XMLActionClient * | actionClient () const
bool | loadActionSet (const QString &file)
KJS::Interpreter * | interpreter () const
KJS::ExecState * | globalExec () const
JSFactory * | factory () const
virtual KJS::Value | evaluate (const QString &script, const KJS::Value &self=KJS::Null())
bool | execute (const QString &script, const KJS::Value &self=KJS::Null())
virtual bool | execute (KJS::Completion &result, const QString &script, const KJS::Value &self)
virtual bool | runFile (const QString &filename, const KJS::Value &self=KJS::Null())
QString | loadFile (const QString &file)

## Public Methods

| KJSEmbedPart (QObject *parent=0, const char *name=0)
| KJSEmbedPart (QWidget *wparent, const char *wname=0, QObject *parent=0, const char *name=0)
| KJSEmbedPart (KJS::Interpreter *js, QWidget *wparent, const char *wname=0, QObject *parent=0, const char *name=0)
virtual | ~KJSEmbedPart ()
QCString | versionString () const
int | versionMajor () const
int | versionMinor () const
KJS::Object | globalObject () const
KJS::Completion | completion () const
KJS::Object | partObject () const
KJS::Object | addObject (QObject *obj, const char *name=0)
KJS::Object | addObject (QObject *obj, KJS::Object &parent, const char *name=0)
KJS::Object | bind (QObject *obj)
QStringList | constructorNames () const
KJS::Value | constructors () const
KJS::List | constructorList () const

## Protected Methods

void | createInterpreter ()
void | createBuiltIn (KJS::ExecState *exec, KJS::Object &parent)
void | createActionClient ()
virtual bool | openFile ()
virtual void | virtual_hook (int id, void *data)

## Detailed Description

A KPart for embedding KJS in an application.

Version:

Id:
  kjsembedpart.h,v 1.30 2004/01/11 01:38:04 rich Exp

Author:
  Richard Moore, rich@kde.org

## Constructor & Destructor Documentation

KJSEmbed::KJSEmbedPart::KJSEmbedPart | ( | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Create a KJSEmbedPart.

KJSEmbed::KJSEmbedPart::KJSEmbedPart | ( | QWidget * | wparent,
|  | const char * | wname = 0,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Creates a KJSEmbedPart for which the parents of the view and part are different. Caution! you cannot use parent = [KQ]Application and wparent = 0L. This will cause a crash on exit since the widget will not be destroyed but the part will get destroyed at the end of the QApplication constructor. This results in the widget trying to do GUI related things after the QPaint stuff is destroyed.

KJSEmbed::KJSEmbedPart::KJSEmbedPart | ( | KJS::Interpreter * | js,
|  | QWidget * | wparent,
|  | const char * | wname = 0,
|  | QObject * | parent = 0,
|  | const char * | name = 0
| ) |

| Create a KJSEmbedPart with the specified interpreter. See warning above.

virtual KJSEmbed::KJSEmbedPart::~KJSEmbedPart | ( |  | ) | `[virtual]`

| Cleans up.

## Member Function Documentation

KJSEmbed::XMLActionClient* KJSEmbed::KJSEmbedPart::actionClient | ( |  | ) | const`[inline, slot]`

| Returns the current XMLActionClient.

KJS::Object KJSEmbed::KJSEmbedPart::addObject | ( | QObject * | obj,
|  | KJS::Object & | parent,
|  | const char * | name = 0
| ) |

| Publishes 'obj' as property 'name' of object 'parent'. The binding is defined using JSObjectProxy, and is subject to the current default SecurityPolicy.

KJS::Object KJSEmbed::KJSEmbedPart::addObject | ( | QObject * | obj,
|  | const char * | name = 0
| ) |

| Publishes 'obj' as property 'name' of the global object. If 'name' is not specified then the name property of 'obj' is used instead.

KJS::Object KJSEmbed::KJSEmbedPart::bind | ( | QObject * | obj | ) |

| Returns a JS::Object that provides a binding to the specified QObject.

KJS::Completion KJSEmbed::KJSEmbedPart::completion | ( |  | ) | const`[inline]`

| Returns the completion object for the last script executed.

KJS::List KJSEmbed::KJSEmbedPart::constructorList | ( |  | ) |

| Returns a list of the constructors of this interpreter.

QStringList KJSEmbed::KJSEmbedPart::constructorNames | ( |  | ) |

| Returns a list of the names of the constructors of this interpreter.

KJS::Value KJSEmbed::KJSEmbedPart::constructors | ( |  | ) |

| Returns a JS Array of the constructors of this interpreter.

void KJSEmbed::KJSEmbedPart::createActionClient | ( |  | ) | `[protected]`

| Sets up the XMLActionClient.

void KJSEmbed::KJSEmbedPart::createBuiltIn | ( | KJS::ExecState * | exec,
|  | KJS::Object & | parent
| ) | `[protected]`

| Creates the built-in objects and methods in the specified parent object normally the global object of the interpreter. This method is called automatically unless you create the part with a custom interpreter, if you do then you have to call this method yourself if you want the built-ins to be available.

void KJSEmbed::KJSEmbedPart::createInterpreter | ( |  | ) | `[protected]`

| Creates the interpreter.

virtual KJS::Value KJSEmbed::KJSEmbedPart::evaluate | ( | const QString & | script,
|  | const KJS::Value & | self = KJS::Null()
| ) | `[virtual, slot]`

| Evaluates the specified string, with the specified value as 'this'.

virtual bool KJSEmbed::KJSEmbedPart::execute | ( | KJS::Completion & | result,
|  | const QString & | script,
|  | const KJS::Value & | self
| ) | `[virtual, slot]`

| Executes the specified string, with the specified value as 'this' and sets result to the completion object returned by the interpreter.

bool KJSEmbed::KJSEmbedPart::execute | ( | const QString & | script,
|  | const KJS::Value & | self = KJS::Null()
| ) | `[slot]`

| Executes the specified string, with the specified value as 'this'.

JSFactory* KJSEmbed::KJSEmbedPart::factory | ( |  | ) | const`[inline, slot]`

| Returns the current factory object.

KJS::ExecState* KJSEmbed::KJSEmbedPart::globalExec | ( |  | ) | const`[inline, slot]`

| Returns the execution context of the interpreter.

KJS::Object KJSEmbed::KJSEmbedPart::globalObject | ( |  | ) | const`[inline]`

| Returns the global object of the interpreter.

KJS::Interpreter* KJSEmbed::KJSEmbedPart::interpreter | ( |  | ) | const`[inline, slot]`

| Returns the current interpreter.

bool KJSEmbed::KJSEmbedPart::loadActionSet | ( | const QString & | file | ) | `[slot]`

| Loads the XML actions defined in the specified file to the default XMLActionClient.

QString KJSEmbed::KJSEmbedPart::loadFile | ( | const QString & | file | ) | `[slot]`

| Loads but does not execute the specified script file. If the first line of the file starts with the string '#!' then that line will be omitted from the returned string.

virtual bool KJSEmbed::KJSEmbedPart::openFile | ( |  | ) | `[inline, protected, virtual]`

| Reimplemented to disable file support.

virtual bool KJSEmbed::KJSEmbedPart::openURL | ( | const KURL & | url | ) | `[virtual, slot]`

| Opens a URL. If the URL has the protocol 'javascript' then it is executed.

KJS::Object KJSEmbed::KJSEmbedPart::partObject | ( |  | ) | const`[inline]`

| Returns the JS object of the part.

virtual bool KJSEmbed::KJSEmbedPart::runFile | ( | const QString & | filename,
|  | const KJS::Value & | self = KJS::Null()
| ) | `[virtual, slot]`

| Loads and runs the specified file.

int KJSEmbed::KJSEmbedPart::versionMajor | ( |  | ) |

| Returns the minor version number of KJSEmbed.

int KJSEmbed::KJSEmbedPart::versionMinor | ( |  | ) |

| Returns the major version number of KJSEmbed.

QCString KJSEmbed::KJSEmbedPart::versionString | ( |  | ) |

| Returns the version of KJSEmbed.

virtual KJSEmbed::JSConsoleWidget* KJSEmbed::KJSEmbedPart::view | ( |  | ) | `[virtual, slot]`

| Returns the view widget, creating one if required.

virtual void KJSEmbed::KJSEmbedPart::virtual_hook | ( | int | id,
|  | void * | data
| ) | `[protected, virtual]`

The documentation for this class was generated from the following file:

- kjsembedpart.h