Diffstat (limited to 'noncore/apps/opie-console/MyPty.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/MyPty.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/MyPty.h b/noncore/apps/opie-console/MyPty.h new file mode 100644 index 0000000..9231a8a --- a/dev/null +++ b/noncore/apps/opie-console/MyPty.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | ||
2 | /* */ | ||
3 | /* [MyPty.h] Pseudo Terminal Device */ | ||
4 | /* */ | ||
5 | /* -------------------------------------------------------------------------- */ | ||
6 | /* */ | ||
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | ||
8 | /* */ | ||
9 | /* This file is part of Konsole - an X terminal for KDE */ | ||
10 | /* */ | ||
11 | /* -------------------------------------------------------------------------- */ | ||
12 | /* */ | ||
13 | /* Ported Konsole to Qt/Embedded */ | ||
14 | /* */ | ||
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | ||
16 | /* */ | ||
17 | /* -------------------------------------------------------------------------- */ | ||
18 | |||
19 | /*! \file | ||
20 | */ | ||
21 | |||
22 | #ifndef MY_PTY_H | ||
23 | #define MY_PTY_H | ||
24 | |||
25 | #include <qobject.h> | ||
26 | #include <qstrlist.h> | ||
27 | |||
28 | #include "io_layer.h" | ||
29 | |||
30 | class Profile; | ||
31 | class MyPty : public IOLayer | ||
32 | { | ||
33 | Q_OBJECT | ||
34 | public: | ||
35 | |||
36 | MyPty(const Profile&); | ||
37 | ~MyPty(); | ||
38 | |||
39 | |||
40 | |||
41 | QString identifier()const; | ||
42 | QString name()const; | ||
43 | |||
44 | public slots: | ||
45 | /*! | ||
46 | having a `run' separate from the constructor allows to make | ||
47 | the necessary connections to the signals and slots of the | ||
48 | instance before starting the execution of the client. | ||
49 | */ | ||
50 | void start(); | ||
51 | int run(const char* pgm, QStrList & args , const char* term, int addutmp); | ||
52 | bool open(); | ||
53 | void close(); | ||
54 | void reload( const Profile& ); | ||
55 | void setSize(int lines, int columns); | ||
56 | void error(); | ||
57 | |||
58 | signals: | ||
59 | |||
60 | /*! | ||
61 | emitted when the client program terminates. | ||
62 | \param status the wait(2) status code of the terminated client program. | ||
63 | */ | ||
64 | void done(int status); | ||
65 | |||
66 | /*! | ||
67 | emitted when a new block of data comes in. | ||
68 | \param s - the data | ||
69 | \param len - the length of the block | ||
70 | */ | ||
71 | void received(const QByteArray&); | ||
72 | |||
73 | public slots: | ||
74 | |||
75 | void send(const QByteArray& ); | ||
76 | |||
77 | private: | ||
78 | const char* deviceName(); | ||
79 | |||
80 | protected slots: | ||
81 | void readPty(); | ||
82 | void donePty(); | ||
83 | |||
84 | private: | ||
85 | int openPty(); | ||
86 | |||
87 | private: | ||
88 | |||
89 | char m_ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx" | ||
90 | char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." | ||
91 | int m_fd; | ||
92 | int m_cpid; | ||
93 | }; | ||
94 | |||
95 | #endif | ||