summaryrefslogtreecommitdiffstats
path: root/src/common/nokde/nokde_kprocess.h
blob: a18d5c5d2499c7c14224ffba11465a745bade62d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _KPROCESS_H_
#define _KPROCESS_H_

#include <tqdir.h>
#include "common/global/global.h"
#include "common/common/synchronous.h"
#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
class TQProcess;
#else
class Q3Process;
#endif

class KProcess : public TQObject
{
Q_OBJECT
  TQ_OBJECT
public:
  KProcess(TQObject *parent = 0, const char *name = 0);
  void clearArguments() { _arguments.clear(); }
  KProcess &operator<< (const TQString &arg) { _arguments += arg; return *this; }
  KProcess &operator<< (const TQStringList &args) { _arguments += args; return *this; }
  TQStringList args() const { return _arguments; }
  void setEnvironment(const TQString &name, const TQString &value) { _environment += name + "=" + value; }
  bool start();
  bool writeStdin(const char *buffer, int len);
  bool kill();
  bool kill(int n);
  int exitStatus() const;
  bool isRunning() const;
  void setWorkingDirectory(const TQDir &dir);
  void setUseShell(bool useShell);

signals:
  void processExited(KProcess *process);
  void receivedStdout(KProcess *process, char *buffer, int len);
  void receivedStderr(KProcess *process, char *buffer, int len);

private slots:
  void processExitedSlot();
  void readyReadStdoutSlot();
  void readyReadStderrSlot();

private:
#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
  TQProcess *_process;
#else
  Q3Process  *_process;
#endif
  TQStringList _arguments,_environment;
};

#endif