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