• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • interfaces
 

interfaces

  • interfaces
  • tdescript
  • sample
shellscript.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2001 Ian Reinhart Geiser (geiseri@kde.org)
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "shellscript.h"
21 #include <kdebug.h>
22 #include <tdeapplication.h>
23 #include <dcopclient.h>
24 
25 #include <kgenericfactory.h>
26 #include <scriptclientinterface.h>
27 //using namespace KScriptInterface;
28 typedef KGenericFactory<ShellScript, KScriptClientInterface> ShellScriptFactory;
29 K_EXPORT_COMPONENT_FACTORY( libshellscript, ShellScriptFactory( "ShellScript" ) )
30 
31 ShellScript::ShellScript(KScriptClientInterface *parent, const char *, const TQStringList & ) : ScriptClientInterface(parent)
32 {
33  m_script = new TDEProcess();
34  connect ( m_script, TQT_SIGNAL(processExited(TDEProcess *)), TQT_SLOT(Exit(TDEProcess *)));
35  connect ( m_script, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), TQT_SLOT(stdOut(TDEProcess *, char *, int )));
36  connect ( m_script, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), TQT_SLOT(stdErr(TDEProcess *, char *, int )));
37  // Connect feedback signals and slots
38  //kdDebug() << "Building new script engine" << endl;
39 }
40 
41 ShellScript::~ShellScript()
42 {
43 }
44 
45 TQString ShellScript::script() const
46 {
47  return m_scriptName;
48 }
49 
50 void ShellScript::setScript( const TQString &scriptFile )
51 {
52  m_scriptName = scriptFile;
53  *m_script << "sh" << m_scriptName << kapp->dcopClient()->appId();
54 }
55 
56 void ShellScript::setScript( const TQString &, const TQString & )
57 {
58  // ### what is this?
59 }
60 
61 void ShellScript::run(TQObject *, const TQVariant &)
62 {
63  m_script->start(TDEProcess::NotifyOnExit,TDEProcess::All);
64 }
65 void ShellScript::kill()
66 {
67  if (!m_script->kill()) // Kill the process
68  m_script->kill(9); // Kill it harder
69 }
70 
71 void ShellScript::Exit(TDEProcess *proc)
72 {
73  ScriptClientInterface->done((KScriptClientInterface::Result)proc->exitStatus(), "");
74 }
75 
76 void ShellScript::stdErr(TDEProcess *, char *buffer, int)
77 {
78  ScriptClientInterface->error(buffer);
79 }
80 void ShellScript::stdOut(TDEProcess *, char *buffer, int)
81 {
82  ScriptClientInterface->output(buffer);
83 }
84 
85 #include "shellscript.moc"
KGenericFactory
KScriptClientInterface
This class is used for allowing feedback to the main system.
Definition: scriptclientinterface.h:73
TDEProcess

interfaces

Skip menu "interfaces"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

interfaces

Skip menu "interfaces"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for interfaces by doxygen 1.8.8
This website is maintained by Timothy Pearson.