|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
KProcessConnect.cpp - description
|
|
|
|
|
TDEProcessConnect.cpp - description
|
|
|
|
|
-------------------
|
|
|
|
|
begin : Tue May 2 2000
|
|
|
|
|
copyright : (C) 2000 by Martin Heni
|
|
|
|
@ -31,25 +31,25 @@
|
|
|
|
|
* *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "KProcessConnect.h"
|
|
|
|
|
#include "TDEProcessConnect.h"
|
|
|
|
|
|
|
|
|
|
#include "KProcessConnect.moc"
|
|
|
|
|
#include "TDEProcessConnect.moc"
|
|
|
|
|
|
|
|
|
|
KProcessConnect::KProcessConnect()
|
|
|
|
|
TDEProcessConnect::TDEProcessConnect()
|
|
|
|
|
: KChildConnect()
|
|
|
|
|
{
|
|
|
|
|
running=false;
|
|
|
|
|
process=0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KProcessConnect::~KProcessConnect()
|
|
|
|
|
TDEProcessConnect::~TDEProcessConnect()
|
|
|
|
|
{
|
|
|
|
|
Exit();
|
|
|
|
|
delete process;
|
|
|
|
|
// printf("DESTRUCTRING KPROCESSCONNECT\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KProcessConnect::Init(int id,KEMessage *msg)
|
|
|
|
|
bool TDEProcessConnect::Init(int id,KEMessage *msg)
|
|
|
|
|
{
|
|
|
|
|
int size;
|
|
|
|
|
char *p;
|
|
|
|
@ -73,19 +73,19 @@ bool KProcessConnect::Init(int id,KEMessage *msg)
|
|
|
|
|
if (running) Exit();
|
|
|
|
|
|
|
|
|
|
// create process
|
|
|
|
|
process=new KProcess;
|
|
|
|
|
process=new TDEProcess;
|
|
|
|
|
*process << processname;
|
|
|
|
|
connect(process, TQT_SIGNAL(receivedStdout(KProcess *, char *, int )),
|
|
|
|
|
this, TQT_SLOT(slotReceivedStdout(KProcess *, char * , int )));
|
|
|
|
|
connect(process, TQT_SIGNAL(processExited(KProcess *)),
|
|
|
|
|
this, TQT_SLOT(slotProcessExited(KProcess *)));
|
|
|
|
|
connect(process, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int )),
|
|
|
|
|
this, TQT_SLOT(slotReceivedStdout(TDEProcess *, char * , int )));
|
|
|
|
|
connect(process, TQT_SIGNAL(processExited(TDEProcess *)),
|
|
|
|
|
this, TQT_SLOT(slotProcessExited(TDEProcess *)));
|
|
|
|
|
/*
|
|
|
|
|
connect(process, TQT_SIGNAL(wroteStdin(KProcess *)),
|
|
|
|
|
this, TQT_SLOT(slotWroteStdin(KProcess *)));
|
|
|
|
|
connect(process, TQT_SIGNAL(wroteStdin(TDEProcess *)),
|
|
|
|
|
this, TQT_SLOT(slotWroteStdin(TDEProcess *)));
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// TRUE if ok
|
|
|
|
|
running=process->start(KProcess::NotifyOnExit,KProcess::All);
|
|
|
|
|
running=process->start(TDEProcess::NotifyOnExit,TDEProcess::All);
|
|
|
|
|
|
|
|
|
|
if (running && msg && msg->QueryNumberOfKeys()>0)
|
|
|
|
|
{
|
|
|
|
@ -95,7 +95,7 @@ bool KProcessConnect::Init(int id,KEMessage *msg)
|
|
|
|
|
return running;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KProcessConnect::slotReceivedStdout(KProcess *, char *buffer, int buflen)
|
|
|
|
|
void TDEProcessConnect::slotReceivedStdout(TDEProcess *, char *buffer, int buflen)
|
|
|
|
|
{
|
|
|
|
|
TQString s;
|
|
|
|
|
char c;
|
|
|
|
@ -134,19 +134,19 @@ void KProcessConnect::slotReceivedStdout(KProcess *, char *buffer, int buflen)
|
|
|
|
|
Receive(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void KProcessConnect::slotProcessExited(KProcess *)
|
|
|
|
|
void TDEProcessConnect::slotProcessExited(TDEProcess *)
|
|
|
|
|
{
|
|
|
|
|
running=false;
|
|
|
|
|
delete process;
|
|
|
|
|
process=0;
|
|
|
|
|
Init(QueryID());
|
|
|
|
|
}
|
|
|
|
|
void KProcessConnect::slotWroteStdin(KProcess *)
|
|
|
|
|
void TDEProcessConnect::slotWroteStdin(TDEProcess *)
|
|
|
|
|
{
|
|
|
|
|
printf("slotWroteStdin:: IS NEVER CALLED\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KProcessConnect::Exit()
|
|
|
|
|
bool TDEProcessConnect::Exit()
|
|
|
|
|
{
|
|
|
|
|
// kill process if running
|
|
|
|
|
if (running)
|
|
|
|
@ -159,12 +159,12 @@ bool KProcessConnect::Exit()
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KProcessConnect::Next()
|
|
|
|
|
bool TDEProcessConnect::Next()
|
|
|
|
|
{
|
|
|
|
|
bool result;
|
|
|
|
|
if (!running) return false;
|
|
|
|
|
// create and send message
|
|
|
|
|
// printf("+- KProcessConnect::ProcessNext\n");
|
|
|
|
|
// printf("+- TDEProcessConnect::ProcessNext\n");
|
|
|
|
|
KEMessage *msg=new KEMessage;
|
|
|
|
|
// User fills message
|
|
|
|
|
emit signalPrepareMove(msg,KG_INPUTTYPE_PROCESS);
|
|
|
|
@ -174,7 +174,7 @@ bool KProcessConnect::Next()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Send string to child
|
|
|
|
|
bool KProcessConnect::Send(TQString str)
|
|
|
|
|
bool TDEProcessConnect::Send(TQString str)
|
|
|
|
|
{
|
|
|
|
|
bool result;
|
|
|
|
|
// printf("****** PROCESS:SEND\n");
|
|
|
|
|