author | sandman <sandman> | 2002-12-17 19:12:05 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-17 19:12:05 (UTC) |
commit | b6a03145553d7f536b04fc3355718cfdd72c590d (patch) (side-by-side diff) | |
tree | cfadab49e69801a2000001f80d57ec081b2c5ea4 /libopie/oprocess.cpp | |
parent | 6bbe59222c6b439f2016d0a36a111f17d338d120 (diff) | |
download | opie-b6a03145553d7f536b04fc3355718cfdd72c590d.zip opie-b6a03145553d7f536b04fc3355718cfdd72c590d.tar.gz opie-b6a03145553d7f536b04fc3355718cfdd72c590d.tar.bz2 |
- removed a the obsolete KShellProcess class
- added a few methods to OProcess to make it easier to port programs using
QProcess
-rw-r--r-- | libopie/oprocess.cpp | 94 |
1 files changed, 49 insertions, 45 deletions
diff --git a/libopie/oprocess.cpp b/libopie/oprocess.cpp index f3e52bd..5db2b6c 100644 --- a/libopie/oprocess.cpp +++ b/libopie/oprocess.cpp @@ -89,32 +89,52 @@ public: bool useShell; QMap<QString,QString> env; QString wd; QCString shell; }; -OProcess::OProcess() - : QObject(), - run_mode(NotifyOnExit), - runs(false), - pid_(0), - status(0), - keepPrivs(false), - innot(0), - outnot(0), - errnot(0), - communication(NoCommunication), - input_data(0), - input_sent(0), - input_total(0), - d(0) +OProcess::OProcess(QObject *parent, const char *name) + : QObject(parent, name) { + init ( ); +} + +OProcess::OProcess(const QString &arg0, QObject *parent, const char *name) + : QObject(parent, name) +{ + init ( ); + *this << arg0; +} + +OProcess::OProcess(const QStringList &args, QObject *parent, const char *name) + : QObject(parent, name) +{ + init ( ); + *this << args; +} + +void OProcess::init ( ) +{ + run_mode = NotifyOnExit; + runs = false; + pid_ = 0; + status = 0; + keepPrivs = false; + innot = 0; + outnot = 0; + errnot = 0; + communication = NoCommunication; + input_data = 0; + input_sent = 0; + input_total = 0; + d = 0; + if (0 == OProcessController::theOProcessController) { (void) new OProcessController(); CHECK_PTR(OProcessController::theOProcessController); } OProcessController::theOProcessController->addOProcess(this); out[0] = out[1] = -1; in[0] = in[1] = -1; @@ -467,16 +487,30 @@ bool OProcess::writeStdin(const char *buffer, int buflen) slotSendData(0); innot->setEnabled(true); rv = true; } else rv = false; return rv; } +void OProcess::flushStdin ( ) +{ + if ( !input_data || ( input_sent == input_total )) + return; + + int d1, d2; + + do { + d1 = input_total - input_sent; + slotSendData ( 0 ); + d2 = input_total - input_sent; + } while ( d2 <= d1 ); +} + void OProcess::suspend() { if ((communication & Stdout) && outnot) outnot->setEnabled(false); } void OProcess::resume() { @@ -883,40 +917,10 @@ bool OProcess::isExecutable(const QCString &filename) // CC: now check for permission to execute the file if (access(filename.data(), X_OK) != 0) return false; // CC: we've passed all the tests... return true; } -void OProcess::virtual_hook( int, void* ) -{ /*BASE::virtual_hook( id, data );*/ } - - -/////////////////////////// -// CC: Class KShellProcess -/////////////////////////// - -KShellProcess::KShellProcess(const char *shellname): - OProcess() -{ - setUseShell(true, shellname); -} - - -KShellProcess::~KShellProcess() { -} - -QString KShellProcess::quote(const QString &arg) -{ - return OProcess::quote(arg); -} - -bool KShellProcess::start(RunMode runmode, Communication comm) -{ - return OProcess::start(runmode, comm); -} -void KShellProcess::virtual_hook( int id, void* data ) -{ OProcess::virtual_hook( id, data ); } -//#include "kprocess.moc" |