summaryrefslogtreecommitdiffstats
path: root/kdecore/tests/kprocesstest.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdecore/tests/kprocesstest.h
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/tests/kprocesstest.h')
-rw-r--r--kdecore/tests/kprocesstest.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/kdecore/tests/kprocesstest.h b/kdecore/tests/kprocesstest.h
new file mode 100644
index 000000000..193895510
--- /dev/null
+++ b/kdecore/tests/kprocesstest.h
@@ -0,0 +1,50 @@
+//
+// DUMMY -- A dummy class with a slot to demonstrate KProcess signals
+//
+// version 0.2, Aug 2nd 1997
+//
+// (C) Christian Czezatke
+// e9025461@student.tuwien.ac.at
+//
+
+
+#ifndef __DUMMY_H__
+#define __DUMMY_H__
+
+#include <stdio.h>
+#include <qobject.h>
+#include "kprocess.h"
+
+class Dummy : public QObject
+{
+ Q_OBJECT
+
+ public slots:
+ void printMessage(KProcess *proc)
+ {
+ printf("Process %d exited!\n", (int)proc->getPid());
+ }
+
+ void gotOutput(KProcess*, char *buffer, int len)
+ {
+ char result[1025]; // this is ugly since it relys on the internal buffer size of KProcess,
+ memcpy(result, buffer, len); // NEVER do that in your own application... ;-)
+ result[len] = '\0';
+ printf("OUTPUT>>%s", result);
+ }
+
+ void outputDone(KProcess *proc)
+ /*
+ Slot Procedure for the "sort" example. -- If it is indicated that the "sort" command has
+ absorbed all its input, we send an "EOF" to it to indicate that there is no more
+ data to be processed.
+ */
+ {
+ proc->closeStdin();
+ }
+
+};
+
+#endif
+
+