summaryrefslogtreecommitdiff
path: root/libopie/oprocess.cpp
Side-by-side diff
Diffstat (limited to 'libopie/oprocess.cpp') (more/less context) (ignore 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
@@ -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"