[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/interfaces/kscript/sample
From:       Ian Reinhart Geiser <geiseri () kde ! org>
Date:       2005-02-18 4:38:48
Message-ID: 20050218043848.CA0731D02F () office ! kde ! org
[Download RAW message or body]

CVS commit by geiseri: 

fixed feedback from the shell interface to the main application


  M +11 -25    shellscript.cpp   1.10
  M +1 -0      shellscript.h   1.7


--- kdelibs/interfaces/kscript/sample/shellscript.cpp  #1.9:1.10
@@ -29,7 +29,6 @@ typedef KGenericFactory<ShellScript, KSc
 K_EXPORT_COMPONENT_FACTORY( libshellscript, ShellScriptFactory( "ShellScript" ) )
 
-ShellScript::ShellScript(KScriptClientInterface *parent, const char *name, const \
QStringList &args ) +ShellScript::ShellScript(KScriptClientInterface *parent, const \
char *, const QStringList & ) : ScriptClientInterface(parent)  {
-        ScriptClientInterface = parent;
         m_script =  new KProcess();
         connect ( m_script, SIGNAL(processExited(KProcess *)), SLOT(Exit(KProcess \
*))); @@ -37,23 +36,20 @@ ShellScript::ShellScript(KScriptClientIn
         connect ( m_script, SIGNAL(receivedStderr(KProcess *, char *, int)), \
SLOT(stdErr(KProcess *, char *, int )));  // Connect feedback signals and slots
-        kdDebug() << "Building new script engine" << endl;
+        //kdDebug() << "Building new script engine" << endl;
 }
 
 ShellScript::~ShellScript()
 {
-        kdDebug() << "Destroying script engine" << endl;
 }
 
 QString ShellScript::script() const
 {
-//      return m_script;
-        kdDebug() << "return script path" << endl;
-        return QString::null;
+        return m_scriptName;
 }
 
 void ShellScript::setScript( const QString &scriptFile  )
 {
-        kdDebug() << "set script " << kapp->dcopClient()->appId() << " " << \
                scriptFile << endl;
-        *m_script << "sh" << scriptFile << kapp->dcopClient()->appId();
+        m_scriptName = scriptFile;
+        *m_script << "sh" << m_scriptName << kapp->dcopClient()->appId();
 }
 
@@ -63,7 +59,6 @@ void ShellScript::setScript( const QStri
 }
 
-void ShellScript::run(QObject *context, const QVariant &arg)
+void ShellScript::run(QObject *, const QVariant &)
 {
-        kdDebug() << "running the script" << endl;
          m_script->start(KProcess::NotifyOnExit,KProcess::All);
 }
@@ -76,23 +71,14 @@ void ShellScript::kill()
 void ShellScript::Exit(KProcess *proc)
 {
-        kdDebug () << "Done processing..." << endl;
-//      ScriptClientInteface->done(proc->exitStatus());
+        ScriptClientInterface->done((KScriptClientInterface::Result)proc->exitStatus(), \
"");  }
 
-void ShellScript::stdErr(KProcess *proc, char *buffer, int buflen)
+void ShellScript::stdErr(KProcess *, char *buffer, int)
 {
-        kdDebug() << "Error" << endl;
-        char *data = (char *) malloc(buflen);
-        //kdDebug() << data << endl;
-        free(data);
+        ScriptClientInterface->error(buffer);
 }
-void ShellScript::stdOut(KProcess *proc, char *buffer, int buflen)
+void ShellScript::stdOut(KProcess *, char *buffer, int)
 {
-        kdDebug() << "Feedback" << endl;
-        char *data = (char *) malloc(buflen);
-        //kdDebug() << data << endl;
-        ScriptClientInterface->output("data");
-        free(data);
-
+        ScriptClientInterface->output(buffer);
 }
 

--- kdelibs/interfaces/kscript/sample/shellscript.h  #1.6:1.7
@@ -43,4 +43,5 @@ private:
         KProcess *m_script;
         KScriptClientInterface *ScriptClientInterface;
+        QString m_scriptName;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic