#include <jsconsolewidget.h>
Public Slots | |
KJSEmbed::KJSEmbedPart * | jscript () const |
KTextEdit * | messages () const |
KPopupTitle * | title () const |
QHBox * | commandBox () const |
void | invoke () |
virtual bool | execute (const QString &cmd) |
bool | execute (const QString &cmd, const KJS::Value &self) |
virtual void | println (const QString &text) |
virtual void | warn (const QString &text) |
virtual bool | run (const QString &shellCmd) |
Public Member Functions | |
JSConsoleWidget (KJSEmbedPart *js, QWidget *parent=0, const char *name=0) | |
virtual | ~JSConsoleWidget () |
Protected Slots | |
void | childExited () |
void | receivedStdOutput (KProcess *, char *, int) |
void | receivedStdError (KProcess *, char *, int) |
Protected Member Functions | |
void | createView () |
Creating a JS console is easy, as you can see below:
KJS::Object global( new KJS::ObjectImp() ); KJS::Interpreter *js = new KJS::Interpreter( global ); KJSEmbed::JSConsoleWidget *win = new KJSEmbed::JSConsoleWidget( js ); win->addBindings( js->globalExec(), global );This example creates a console for a JS interpreter and adds a print function to the interpreter.
|
|
|
|
|
Called when the process exits.
|
|
Returns the QHBox used to layout the entry part of the console. This can be used by clients to hide and show the interactive parts of the console, or to add new buttons etc. |
|
Creates the console view.
|
|
|
|
Invokes the specified command string.
|
|
Invokes the content of the command entry field.
|
|
Returns the KJSEmbedPart the console is using.
|
|
Returns the message widget.
|
|
Prints the specified string to the console.
|
|
Called when the process sends message to stderr.
|
|
Called when the process sends message to stdout.
|
|
Runs the specified command using KShellProcess. The output of the command is displayed in the console. Any output sent to stdout is displayed as normal text, anything sent to stderr is displayed as a warning. Once the command has finished the exit status is printed if it is non-zero. Note that there is no extra layer of security to prevent this method being called from a script because in general a script that can access this object can also write content to a file then execute the file. If you intend to run untrusted scripts, it is your responsibility to ensure that you only expose safe objects and methods to the interpreter. |
|
Returns the title widget.
|
|
Prints the specified string to the console as a warning, the default implementation prints the text in red.
|