diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-03 02:35:45 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-04-03 02:35:45 +0000 |
commit | 7f4a6a18c55be5b74ab3782f63509157a9a25afc (patch) | |
tree | ca86feaa6b8f013654038663b113e106debdca00 /kdpkg-install/process.cpp | |
download | kdpkg-7f4a6a18c55be5b74ab3782f63509157a9a25afc.tar.gz kdpkg-7f4a6a18c55be5b74ab3782f63509157a9a25afc.zip |
Initial import of kdpkg Debian package installer
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdpkg@1110433 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdpkg-install/process.cpp')
-rw-r--r-- | kdpkg-install/process.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/kdpkg-install/process.cpp b/kdpkg-install/process.cpp new file mode 100644 index 0000000..9c02a77 --- /dev/null +++ b/kdpkg-install/process.cpp @@ -0,0 +1,63 @@ +#include "process.h" + + + + + Process::Process() + { + _buffer = QString::null; + _process = new KProcess(); + + connect(_process, SIGNAL(receivedStdout(KProcess*, char*, int)), + this, SLOT(slotProcessOutput(KProcess*, char*, int))); + + } + + Process::~Process() + { + } + + void Process::setCommand(QString command) + { + // make clean + _process->clearArguments(); + _buffer = QString::null; + + *_process << "/bin/sh"; + *_process << "-c"; + *_process << command; + } + + + void Process::start(bool block) + { + if( block ) + _process->start(KProcess::Block, KProcess::Stdout); + else + _process->start(KProcess::DontCare, KProcess::Stdout); + } + + QString Process::getBuffer() + { + return _buffer; + } + + int Process::exitStatus() + { + return _process->exitStatus(); + } + + bool Process::normalExit() + { + return _process->normalExit(); + } + + void Process::slotProcessOutput(KProcess* process, char* buffer, int len) + { + if (process != _process) return; + + _buffer.append(QString::fromLocal8Bit(buffer, len)); + } + + + |