\section{KScript\-Client\-Interface Class Reference}
\label{classKScriptClientInterface}\index{KScriptClientInterface@{KScriptClientInterface}}
This class is used for allowing feedback to the main system.  


{\tt \#include $<$scriptclientinterface.h$>$}

Inheritance diagram for KScript\-Client\-Interface:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=74pt]{classKScriptClientInterface__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Result} \{ {\bf Result\-Success}, 
{\bf Result\-Failure}, 
{\bf Result\-Continue}, 
{\bf Result\-Break}
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf error} (const {\bf QString} \&msg)=0
\item 
virtual void {\bf warning} (const {\bf QString} \&msg)=0
\item 
virtual void {\bf output} (const {\bf QString} \&msg)=0
\item 
virtual void {\bf progress} (int percent)=0
\item 
virtual void {\bf done} (KScript\-Client\-Interface::Result result, const {\bf QVariant} \&returned)=0
\end{CompactItemize}


\subsection{Detailed Description}
This class is used for allowing feedback to the main system. 

\begin{Desc}
\item[Author:]Ian Reinhart Geiser $<${\tt geiseri@kde.org}$>$\end{Desc}
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. 

\footnotesize\begin{verbatim}    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;
    };
\end{verbatim}
\normalsize
 Things to note about this example are that it only handles a single script type and instance. You may wish to extend this. 



Definition at line 73 of file scriptclientinterface.h.

\subsection{Member Function Documentation}
\index{KScriptClientInterface@{KScript\-Client\-Interface}!error@{error}}
\index{error@{error}!KScriptClientInterface@{KScript\-Client\-Interface}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KScript\-Client\-Interface::error (const {\bf QString} \& {\em msg})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKScriptClientInterface_a0}


This function will allow the main application of any errors that have occurred during processing of the script. 

For script clients its best to implement this as a signal so feedback can be sent to the main application.

Implemented in {\bf KScript\-Manager} {\rm (p.\,\pageref{classKScriptManager_a6})}.\index{KScriptClientInterface@{KScript\-Client\-Interface}!warning@{warning}}
\index{warning@{warning}!KScriptClientInterface@{KScript\-Client\-Interface}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KScript\-Client\-Interface::warning (const {\bf QString} \& {\em msg})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKScriptClientInterface_a1}


This function will allow the main application of any warnings that have occurred during the processing of the script. 

For script clients its best to implement this as a signal so feedback can be sent to the main application.

Implemented in {\bf KScript\-Manager} {\rm (p.\,\pageref{classKScriptManager_a7})}.\index{KScriptClientInterface@{KScript\-Client\-Interface}!output@{output}}
\index{output@{output}!KScriptClientInterface@{KScript\-Client\-Interface}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KScript\-Client\-Interface::output (const {\bf QString} \& {\em msg})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKScriptClientInterface_a2}


This function will allow the main application of any normal output that has occurred during the processing of the script. 

For script clients its best to implement this as a signal so feedback can be sent to the main application.

Implemented in {\bf KScript\-Manager} {\rm (p.\,\pageref{classKScriptManager_a8})}.\index{KScriptClientInterface@{KScript\-Client\-Interface}!progress@{progress}}
\index{progress@{progress}!KScriptClientInterface@{KScript\-Client\-Interface}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KScript\-Client\-Interface::progress (int {\em percent})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKScriptClientInterface_a3}


This function will allow feedback to any progress bars in the main application as to how far along the script is. 

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.

Implemented in {\bf KScript\-Manager} {\rm (p.\,\pageref{classKScriptManager_a9})}.\index{KScriptClientInterface@{KScript\-Client\-Interface}!done@{done}}
\index{done@{done}!KScriptClientInterface@{KScript\-Client\-Interface}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KScript\-Client\-Interface::done (KScript\-Client\-Interface::Result {\em result}, const {\bf QVariant} \& {\em returned})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKScriptClientInterface_a4}


This function will allow feedback on completion of the script. 

It turns the result as a KScript\-Inteface::Result, and a return value as a {\bf QVariant} For script clients its best to implement this as a signal so feedback can be sent to the main application.

Implemented in {\bf KScript\-Manager} {\rm (p.\,\pageref{classKScriptManager_a10})}.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
scriptclientinterface.h\end{CompactItemize}
