# jsconsolewidget.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002
    00003 /*
    00004  *  Copyright (C) 2001-2003, Richard J. Moore <rich@kde.org>
    00005  *
    00006  *  This library is free software; you can redistribute it and/or
    00007  *  modify it under the terms of the GNU Library General Public
    00008  *  License as published by the Free Software Foundation; either
    00009  *  version 2 of the License, or (at your option) any later version.
    00010  *
    00011  *  This library is distributed in the hope that it will be useful,
    00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  *  Library General Public License for more details.
    00015  *
    00016  *  You should have received a copy of the GNU Library General Public License
    00017  *  along with this library; see the file COPYING.LIB.  If not, write to
    00018  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019  *  Boston, MA 02111-1307, USA.
    00020  */
    00021
    00022 #ifndef KJSEMBEDJSCONSOLEWIDGET_H
    00023 #define KJSEMBEDJSCONSOLEWIDGET_H
    00024
    00025 #include <qframe.h>
    00026
    00027 class QPushButton;
    00028 class QHBox;
    00029
    00030 class KLineEdit;
    00031 class KPopupTitle;
    00032 class KProcess;
    00033 class KShellProcess;
    00034 class KTextEdit;
    00035
    00036 namespace KJS {
    00037     class Value;
    00038 }
    00039
    00040 namespace KJSEmbed {
    00041
    00042 class KJSEmbedPart;
    00043
    00061 class JSConsoleWidget : public QFrame
    00062 {
    00063     Q_OBJECT
    00064
    00065 public:
    00066     JSConsoleWidget( KJSEmbedPart *js, QWidget *parent=0, const char *name=0 );
    00067     virtual ~JSConsoleWidget();
    00068
    00069 public slots:
    00071     KJSEmbed::KJSEmbedPart *jscript() const { return js; }
    00072
    00074     KTextEdit *messages() const { return log; }
    00075
    00077     KPopupTitle *title() const { return ttl; }
    00078
    00084     QHBox *commandBox() const { return cmdBox; }
    00085
    00087     void invoke();
    00088
    00090     virtual bool execute( const QString &cmd );
    00091
    00092     bool execute( const QString &cmd, const KJS::Value &self );
    00093
    00095     virtual void println( const QString &text );
    00096
    00101     virtual void warn( const QString &text );
    00102
    00117     virtual bool run( const QString &shellCmd );
    00118
    00119 protected:
    00121     void createView();
    00122
    00123 protected slots:
    00125     void childExited();
    00126
    00128     void receivedStdOutput(KProcess *, char *, int);
    00129
    00131     void receivedStdError(KProcess *, char *, int);
    00132
    00133 private:
    00134     KJSEmbedPart *js;
    00135     KShellProcess *proc;
    00136
    00137     KTextEdit *log;
    00138     QHBox *cmdBox;
    00139     KLineEdit *cmd;
    00140     QPushButton *go;
    00141     KPopupTitle *ttl;
    00142
    00143     class JSConsoleWidgetPrivate *d;
    00144 };
    00145
    00146 } // namespace KJSEmbed
    00147
    00148 #endif // KJSEMBEDJSCONSOLEWIDGET_H
    00149
    00150 // Local Variables:
    00151 // c-basic-offset: 4
    00152 // End: