1
// =============================================================================
3
// --- kvi_process_kde.cpp ---
5
// This file is part of the KVIrc IRC client distribution
6
// Copyright (C) 2003 Robin Verduijn <robin@debian.org>
8
// This program is FREE software. You can redistribute it and/or
9
// modify it under the terms of the GNU General Public License
10
// as published by the Free Software Foundation; either version 2
11
// of the License, or (at your opinion) any later version.
13
// This program is distributed in the HOPE that it will be USEFUL,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
// See the GNU General Public License for more details.
18
// You should have received a copy of the GNU General Public License
19
// along with this program. If not, write to the Free Software Foundation,
20
// Inc, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
// =============================================================================
26
#include <qfileinfo.h>
27
#include <qstringlist.h>
29
#include "kvi_process_kde.h"
31
QString KviProcess::m_szShellName("");
33
KviProcess::KviProcess()
36
connect(this, SIGNAL( processExited(KProcess *)), this, SLOT( processExited(KProcess *)));
37
connect(this, SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(receivedStdout(KProcess *, char *, int)));
38
connect(this, SIGNAL(receivedStderr(KProcess *, char *, int)), this, SLOT(receivedStderr(KProcess *, char *, int)));
41
KviProcess::~KviProcess()
46
// TODO: kill-on-close parameter is ignored for now
47
bool KviProcess::run(const char *commandline, bool bCommunicate, bool /* ignored */, bool bExecInSubshell)
49
QStringList args = QStringList::split(' ', commandline);
50
for( QStringList::Iterator iter = args.begin(); iter != args.end(); ++iter )
52
setUseShell(bExecInSubshell);
54
return start(NotifyOnExit, bCommunicate ? All : NoCommunication);
57
const QString KviProcess::findShell()
59
if( !m_szShellName.isEmpty() )
62
QString tmp = getenv("SHELL");
63
if( !tmp.isEmpty() ) {
65
if( f.isExecutable() ) {
70
m_szShellName = "/bin/sh";
74
void KviProcess::processExited(KProcess *proc)
76
emit processExited((KviProcess *) proc);
79
void KviProcess::receivedStdout(KProcess *proc, char *buffer, int len)
81
emit receivedStdout((KviProcess *) proc, buffer, len);
84
void KviProcess::receivedStderr(KProcess *proc, char *buffer, int len)
86
emit receivedStderr((KviProcess *) proc, buffer, len);
89
#include "m_kvi_process_kde.moc"