Diffstat (limited to 'noncore/apps/opie-console/MyPty.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index b6ae1d9..565d03f 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp | |||
@@ -118,8 +118,11 @@ void MyPty::donePty() | |||
118 | //waitpid(m_cpid, &status, 0); | 118 | //waitpid(m_cpid, &status, 0); |
119 | delete m_sn_e; | 119 | delete m_sn_e; |
120 | delete m_sn_r; | ||
120 | m_sn_e = 0l; | 121 | m_sn_e = 0l; |
122 | m_sn_r = 0l; | ||
121 | } | 123 | } |
122 | 124 | ||
123 | m_cpid = 0; | 125 | m_cpid = 0; |
126 | m_fd = -1; | ||
124 | // emit done(status); | 127 | // emit done(status); |
125 | } | 128 | } |
@@ -186,8 +189,9 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
186 | 189 | ||
187 | // parent - continue as a widget | 190 | // parent - continue as a widget |
188 | QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); | 191 | delete m_sn_r; |
192 | m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); | ||
189 | delete m_sn_e; | 193 | delete m_sn_e; |
190 | m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); | 194 | m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); |
191 | connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); | 195 | connect(m_sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); |
192 | connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); | 196 | connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); |
193 | 197 | ||
@@ -222,5 +226,5 @@ int MyPty::openPty() | |||
222 | 226 | ||
223 | if ( ptyfd < 0 ) { | 227 | if ( ptyfd < 0 ) { |
224 | qApp->exit(1); | 228 | //qApp->exit(1); |
225 | return -1; | 229 | return -1; |
226 | } | 230 | } |
@@ -235,4 +239,5 @@ MyPty::MyPty(const Profile&) : m_cpid(0) | |||
235 | { | 239 | { |
236 | m_sn_e = 0l; | 240 | m_sn_e = 0l; |
241 | m_sn_r = 0l; | ||
237 | m_fd = openPty(); | 242 | m_fd = openPty(); |
238 | ProcCtl* ctl = ProcCtl::self(); | 243 | ProcCtl* ctl = ProcCtl::self(); |
@@ -255,4 +260,7 @@ QString MyPty::name()const{ | |||
255 | } | 260 | } |
256 | bool MyPty::open() { | 261 | bool MyPty::open() { |
262 | if (m_fd < 0) | ||
263 | m_fd = openPty(); | ||
264 | |||
257 | start(); | 265 | start(); |
258 | return true; | 266 | return true; |
@@ -260,4 +268,5 @@ bool MyPty::open() { | |||
260 | void MyPty::close() { | 268 | void MyPty::close() { |
261 | donePty(); | 269 | donePty(); |
270 | m_fd = openPty(); | ||
262 | } | 271 | } |
263 | void MyPty::reload( const Profile& ) { | 272 | void MyPty::reload( const Profile& ) { |
@@ -287,5 +296,4 @@ void MyPty::readPty() | |||
287 | if (len == -1 || len == 0) { | 296 | if (len == -1 || len == 0) { |
288 | donePty(); | 297 | donePty(); |
289 | delete sender(); | ||
290 | return; | 298 | return; |
291 | } | 299 | } |
@@ -307,3 +315,10 @@ void MyPty::readPty() | |||
307 | 315 | ||
308 | } | 316 | } |
317 | QBitArray MyPty::supports()const { | ||
318 | QBitArray ar(3); | ||
319 | ar[0] = 1; | ||
320 | ar[1] = 0; | ||
321 | ar[2] = 0; | ||
309 | 322 | ||
323 | return ar; | ||
324 | } | ||