summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/MyPty.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/MyPty.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp23
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
@@ -117,10 +117,13 @@ void MyPty::donePty()
117 kill(m_cpid, SIGHUP); 117 kill(m_cpid, SIGHUP);
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}
126 129
@@ -185,10 +188,11 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
185 } 188 }
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
194 return 0; 198 return 0;
@@ -221,7 +225,7 @@ int MyPty::openPty()
221#endif 225#endif
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 }
227 231
@@ -234,6 +238,7 @@ int MyPty::openPty()
234MyPty::MyPty(const Profile&) : m_cpid(0) 238MyPty::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();
239} 244}
@@ -254,11 +259,15 @@ QString MyPty::name()const{
254 return identifier(); 259 return identifier();
255} 260}
256bool MyPty::open() { 261bool MyPty::open() {
262 if (m_fd < 0)
263 m_fd = openPty();
264
257 start(); 265 start();
258 return true; 266 return true;
259} 267}
260void MyPty::close() { 268void MyPty::close() {
261 donePty(); 269 donePty();
270 m_fd = openPty();
262} 271}
263void MyPty::reload( const Profile& ) { 272void MyPty::reload( const Profile& ) {
264 273
@@ -286,7 +295,6 @@ void MyPty::readPty()
286 295
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 }
292 300
@@ -306,4 +314,11 @@ void MyPty::readPty()
306#endif 314#endif
307 315
308} 316}
317QBitArray 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}