.TH "KScriptClientInterface" kde3 "11 Jun 2005" "Version Version 3.4.1" "interfaces Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KScriptClientInterface \- This class is used for allowing feedback to the main system.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <scriptclientinterface.h>\fP
.PP
Inherited by \fBKScriptManager\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBResult\fP { \fBResultSuccess\fP, \fBResultFailure\fP, \fBResultContinue\fP, \fBResultBreak\fP }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBerror\fP (const \fBQString\fP &msg)=0"
.br
.ti -1c
.RI "virtual void \fBwarning\fP (const \fBQString\fP &msg)=0"
.br
.ti -1c
.RI "virtual void \fBoutput\fP (const \fBQString\fP &msg)=0"
.br
.ti -1c
.RI "virtual void \fBprogress\fP (int percent)=0"
.br
.ti -1c
.RI "virtual void \fBdone\fP (KScriptClientInterface::Result result, const \fBQVariant\fP &returned)=0"
.br
.in -1c
.SH "Detailed Description"
.PP 
This class is used for allowing feedback to the main system. 

\fBAuthor:\fP
.RS 4
Ian Reinhart Geiser <geiseri@kde.org>
.RE
.PP
To implement KScript in your application you would use this class to interface with the scripting engine. There are currently a few implementations of script managers around but developers can implement their own custom interfaces with this class. 
.PP
.nf
    class MyScript : public QObject, public KScriptClientInterface {
    Q_OBJECT
    public:

    MyScript(QObject *parent)
    {
        // Create your @ref KScriptInterface here.
        m_interface = KParts::ComponentFactory::createInstanceFromQuery<KScriptInterface>( 
            'KScriptRunner/KScriptRunner', '([X-KDE-Script-Runner] == 'bash/shell')', this );
    }

    virtual ~KScriptAction()
    {
        delete m_interface;
    }

    signals:
    void error ( const QString &msg );
    void warning ( const QString &msg );
    void output ( const QString &msg );
    void progress ( int percent );
    void done ( KScriptClientInterface::Result result, const QVariant &returned );

    public slots:
    void activate(const QVariant &args)
    {
        m_interface->run(parent(), args);
    }

    private:

    KScriptInterface *m_interface;
    };

.fi
.PP
 Things to note about this example are that it only handles a single script type and instance. You may wish to extend this. 
.PP
Definition at line 73 of file scriptclientinterface.h.
.SH "Member Function Documentation"
.PP 
.SS "virtual void KScriptClientInterface::error (const \fBQString\fP & msg)\fC [pure virtual]\fP"
.PP
This function will allow the main application of any errors that have occurred during processing of the script. 
.PP
For script clients its best to implement this as a signal so feedback can be sent to the main application.
.PP
Implemented in \fBKScriptManager\fP.
.SS "virtual void KScriptClientInterface::warning (const \fBQString\fP & msg)\fC [pure virtual]\fP"
.PP
This function will allow the main application of any warnings that have occurred during the processing of the script. 
.PP
For script clients its best to implement this as a signal so feedback can be sent to the main application.
.PP
Implemented in \fBKScriptManager\fP.
.SS "virtual void KScriptClientInterface::output (const \fBQString\fP & msg)\fC [pure virtual]\fP"
.PP
This function will allow the main application of any normal output that has occurred during the processing of the script. 
.PP
For script clients its best to implement this as a signal so feedback can be sent to the main application.
.PP
Implemented in \fBKScriptManager\fP.
.SS "virtual void KScriptClientInterface::progress (int percent)\fC [pure virtual]\fP"
.PP
This function will allow feedback to any progress bars in the main application as to how far along the script is. 
.PP
This is very useful when a script is processing files or doing some long operation that is of a known duration.] For script clients its best to implement this as a signal so feedback can be sent to the main application.
.PP
Implemented in \fBKScriptManager\fP.
.SS "virtual void KScriptClientInterface::done (KScriptClientInterface::Result result, const \fBQVariant\fP & returned)\fC [pure virtual]\fP"
.PP
This function will allow feedback on completion of the script. 
.PP
It turns the result as a KScriptInteface::Result, and a return value as a \fBQVariant\fP For script clients its best to implement this as a signal so feedback can be sent to the main application.
.PP
Implemented in \fBKScriptManager\fP.

.SH "Author"
.PP 
Generated automatically by Doxygen for interfaces Library from the source code.
