summaryrefslogtreecommitdiff
path: root/libopie/oprocess.cpp
authorsandman <sandman>2002-12-17 19:12:05 (UTC)
committer sandman <sandman>2002-12-17 19:12:05 (UTC)
commitb6a03145553d7f536b04fc3355718cfdd72c590d (patch) (side-by-side diff)
treecfadab49e69801a2000001f80d57ec081b2c5ea4 /libopie/oprocess.cpp
parent6bbe59222c6b439f2016d0a36a111f17d338d120 (diff)
downloadopie-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
Diffstat (limited to 'libopie/oprocess.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/oprocess.cpp94
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
@@ -96,18 +96,38 @@ public:
-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) {
@@ -474,2 +494,16 @@ bool OProcess::writeStdin(const char *buffer, int buflen)
+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()
@@ -890,33 +924,3 @@ bool OProcess::isExecutable(const QCString &filename)
-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"