• 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;
28typedef KGenericFactory<ShellScript, KScriptClientInterface> ShellScriptFactory;
29K_EXPORT_COMPONENT_FACTORY( libshellscript, ShellScriptFactory( "ShellScript" ) )
30
31ShellScript::ShellScript(KScriptClientInterface *parent, const char *, const TQStringList & ) : ScriptClientInterface(parent)
32{
33 m_script = new TDEProcess();
34 connect ( m_script, TQ_SIGNAL(processExited(TDEProcess *)), TQ_SLOT(Exit(TDEProcess *)));
35 connect ( m_script, TQ_SIGNAL(receivedStdout(TDEProcess *, char *, int)), TQ_SLOT(stdOut(TDEProcess *, char *, int )));
36 connect ( m_script, TQ_SIGNAL(receivedStderr(TDEProcess *, char *, int)), TQ_SLOT(stdErr(TDEProcess *, char *, int )));
37 // Connect feedback signals and slots
38 //kdDebug() << "Building new script engine" << endl;
39}
40
41ShellScript::~ShellScript()
42{
43}
44
45TQString ShellScript::script() const
46{
47 return m_scriptName;
48}
49
50void ShellScript::setScript( const TQString &scriptFile )
51{
52 m_scriptName = scriptFile;
53 *m_script << "sh" << m_scriptName << tdeApp->dcopClient()->appId();
54}
55
56void ShellScript::setScript( const TQString &, const TQString & )
57{
58 // ### what is this?
59}
60
61void ShellScript::run(TQObject *, const TQVariant &)
62{
63 m_script->start(TDEProcess::NotifyOnExit,TDEProcess::All);
64}
65void ShellScript::kill()
66{
67 if (!m_script->kill()) // Kill the process
68 m_script->kill(9); // Kill it harder
69}
70
71void ShellScript::Exit(TDEProcess *proc)
72{
73 ScriptClientInterface->done((KScriptClientInterface::Result)proc->exitStatus(), "");
74}
75
76void ShellScript::stdErr(TDEProcess *, char *buffer, int)
77{
78 ScriptClientInterface->error(buffer);
79}
80void 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:74
TDEProcess
TDEProcess::exitStatus
int exitStatus() const
TDEProcess::NotifyOnExit
NotifyOnExit

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for interfaces by doxygen 1.9.4
This website is maintained by Timothy Pearson.