-rw-r--r-- | noncore/apps/opie-console/BUGS | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 23 | ||||
-rw-r--r-- | noncore/apps/opie-console/MyPty.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.h | 14 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.cpp | 1 |
11 files changed, 72 insertions, 20 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS new file mode 100644 index 0000000..ffaceef --- a/dev/null +++ b/noncore/apps/opie-console/BUGS | |||
@@ -0,0 +1,9 @@ | |||
1 | Ok we all know we write perfect code | ||
2 | but sometimes the compiler produces bad code | ||
3 | and we need to work around some compiler bugs!! -zecke | ||
4 | |||
5 | MyPty is broken in some ways | ||
6 | if you do connect/disconnect/connect sh will be executed in the | ||
7 | process of opie-console.... funny aye? | ||
8 | |||
9 | OTabWidget seems to give us problems too | ||
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 | |||
@@ -116,12 +116,15 @@ void MyPty::donePty() | |||
116 | if (m_cpid) { | 116 | if (m_cpid) { |
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 | ||
127 | 130 | ||
@@ -184,12 +187,13 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
184 | exit(-1); | 187 | exit(-1); |
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; |
195 | } | 199 | } |
@@ -220,9 +224,9 @@ int MyPty::openPty() | |||
220 | } | 224 | } |
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 | ||
228 | return ptyfd; | 232 | return ptyfd; |
@@ -233,8 +237,9 @@ int MyPty::openPty() | |||
233 | */ | 237 | */ |
234 | MyPty::MyPty(const Profile&) : m_cpid(0) | 238 | 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(); |
239 | } | 244 | } |
240 | 245 | ||
@@ -253,13 +258,17 @@ QString MyPty::identifier()const { | |||
253 | QString MyPty::name()const{ | 258 | QString MyPty::name()const{ |
254 | return identifier(); | 259 | return identifier(); |
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; |
259 | } | 267 | } |
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& ) { |
264 | 273 | ||
265 | } | 274 | } |
@@ -285,9 +294,8 @@ void MyPty::readPty() | |||
285 | int len = ::read( m_fd, buf.data(), 4096 ); | 294 | int len = ::read( m_fd, buf.data(), 4096 ); |
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 | ||
293 | if (len < 0) | 301 | if (len < 0) |
@@ -305,5 +313,12 @@ void MyPty::readPty() | |||
305 | printf("\n"); | 313 | printf("\n"); |
306 | #endif | 314 | #endif |
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 | } | ||
diff --git a/noncore/apps/opie-console/MyPty.h b/noncore/apps/opie-console/MyPty.h index 3166fa0..ad271df 100644 --- a/noncore/apps/opie-console/MyPty.h +++ b/noncore/apps/opie-console/MyPty.h | |||
@@ -40,8 +40,9 @@ public: | |||
40 | 40 | ||
41 | 41 | ||
42 | QString identifier()const; | 42 | QString identifier()const; |
43 | QString name()const; | 43 | QString name()const; |
44 | QBitArray supports()const; | ||
44 | 45 | ||
45 | public slots: | 46 | public slots: |
46 | /*! | 47 | /*! |
47 | having a `run' separate from the constructor allows to make | 48 | having a `run' separate from the constructor allows to make |
@@ -91,7 +92,8 @@ private: | |||
91 | char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." | 92 | char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." |
92 | int m_fd; | 93 | int m_fd; |
93 | int m_cpid; | 94 | int m_cpid; |
94 | QSocketNotifier* m_sn_e; | 95 | QSocketNotifier* m_sn_e; |
96 | QSocketNotifier* m_sn_r; | ||
95 | }; | 97 | }; |
96 | 98 | ||
97 | #endif | 99 | #endif |
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h index 5f2fa3c..4977e94 100644 --- a/noncore/apps/opie-console/io_layer.h +++ b/noncore/apps/opie-console/io_layer.h | |||
@@ -1,8 +1,11 @@ | |||
1 | #ifndef OPIE_IO_LAYER_H | 1 | #ifndef OPIE_IO_LAYER_H |
2 | #define OPIE_IO_LAYER_H | 2 | #define OPIE_IO_LAYER_H |
3 | 3 | ||
4 | #include <qbitarray.h> | ||
4 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | |||
7 | |||
5 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
6 | 9 | ||
7 | #include "profile.h" | 10 | #include "profile.h" |
8 | 11 | ||
@@ -22,8 +25,13 @@ public: | |||
22 | ClosedError =3, | 25 | ClosedError =3, |
23 | Terminate = 4 | 26 | Terminate = 4 |
24 | /* add more errors here */ | 27 | /* add more errors here */ |
25 | }; | 28 | }; |
29 | enum Feature { | ||
30 | AutoConnect = 0, | ||
31 | TransferFile =1, | ||
32 | Close =2 | ||
33 | }; | ||
26 | /** | 34 | /** |
27 | * a small c'tor | 35 | * a small c'tor |
28 | */ | 36 | */ |
29 | IOLayer(); | 37 | IOLayer(); |
@@ -64,8 +72,13 @@ public: | |||
64 | * and will listen to it's data again... | 72 | * and will listen to it's data again... |
65 | */ | 73 | */ |
66 | virtual void closeRawIO(int); | 74 | virtual void closeRawIO(int); |
67 | 75 | ||
76 | /** | ||
77 | * What does the IOLayer support? | ||
78 | * Bits are related to features | ||
79 | */ | ||
80 | virtual QBitArray supports()const = 0; | ||
68 | 81 | ||
69 | signals: | 82 | signals: |
70 | /** | 83 | /** |
71 | * received input as QCString | 84 | * received input as QCString |
@@ -78,8 +91,9 @@ signals: | |||
78 | * and QString for a text | 91 | * and QString for a text |
79 | */ | 92 | */ |
80 | virtual void error( int, const QString& ); | 93 | virtual void error( int, const QString& ); |
81 | 94 | ||
95 | virtual void closed(); | ||
82 | public slots: | 96 | public slots: |
83 | /** | 97 | /** |
84 | * send a QCString to the device | 98 | * send a QCString to the device |
85 | */ | 99 | */ |
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp index a4a6f0b..c10d5a8 100644 --- a/noncore/apps/opie-console/io_serial.cpp +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -186,4 +186,11 @@ void IOSerial::closeRawIO(int fd) { | |||
186 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); | 186 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); |
187 | 187 | ||
188 | ::close( fd ); | 188 | ::close( fd ); |
189 | } | 189 | } |
190 | QBitArray IOSerial::supports()const { | ||
191 | QBitArray ar(3); | ||
192 | ar[0] = ar[2] = 0; | ||
193 | ar[1] = 1; | ||
194 | |||
195 | return ar; | ||
196 | } | ||
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h index facbbc1..b1d1be1 100644 --- a/noncore/apps/opie-console/io_serial.h +++ b/noncore/apps/opie-console/io_serial.h | |||
@@ -36,11 +36,13 @@ public: | |||
36 | QString identifier() const; | 36 | QString identifier() const; |
37 | QString name() const; | 37 | QString name() const; |
38 | int rawIO()const; | 38 | int rawIO()const; |
39 | void closeRawIO(int fd ); | 39 | void closeRawIO(int fd ); |
40 | signals: | 40 | QBitArray supports()const; |
41 | /*signals: | ||
41 | void received(const QByteArray &); | 42 | void received(const QByteArray &); |
42 | void error(int, const QString &); | 43 | void error(int, const QString &); |
44 | */ | ||
43 | public slots: | 45 | public slots: |
44 | void send(const QByteArray &); | 46 | void send(const QByteArray &); |
45 | bool open(); | 47 | bool open(); |
46 | void close(); | 48 | void close(); |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 94c99bc..29dbcf3 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -359,13 +359,14 @@ void MainWindow::slotConfigure() { | |||
359 | void MainWindow::slotClose() { | 359 | void MainWindow::slotClose() { |
360 | if (!currentSession() ) | 360 | if (!currentSession() ) |
361 | return; | 361 | return; |
362 | 362 | ||
363 | Session* ses = currentSession(); | ||
364 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | ||
363 | tabWidget()->remove( currentSession() ); | 365 | tabWidget()->remove( currentSession() ); |
364 | /*it's autodelete */ | 366 | /*it's autodelete */ |
365 | m_sessions.remove( m_curSession ); | 367 | m_sessions.remove( ses ); |
366 | m_curSession = m_sessions.first(); | 368 | qWarning("after remove!!"); |
367 | tabWidget()->setCurrent( m_curSession ); | ||
368 | 369 | ||
369 | if (!currentSession() ) { | 370 | if (!currentSession() ) { |
370 | m_connect->setEnabled( false ); | 371 | m_connect->setEnabled( false ); |
371 | m_disconnect->setEnabled( false ); | 372 | m_disconnect->setEnabled( false ); |
@@ -394,9 +395,9 @@ void MainWindow::create( const Profile& prof ) { | |||
394 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 395 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
395 | { | 396 | { |
396 | QMessageBox::warning(this, | 397 | QMessageBox::warning(this, |
397 | QObject::tr("Session failed"), | 398 | QObject::tr("Session failed"), |
398 | QObject::tr("Cannot open session: Not all components were found.")); | 399 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
399 | //if(ses) delete ses; | 400 | //if(ses) delete ses; |
400 | return; | 401 | return; |
401 | } | 402 | } |
402 | 403 | ||
@@ -432,8 +433,9 @@ void MainWindow::slotOpenKeb(bool state) { | |||
432 | else m_keyBar->hide(); | 433 | else m_keyBar->hide(); |
433 | 434 | ||
434 | } | 435 | } |
435 | void MainWindow::slotSessionChanged( Session* ses ) { | 436 | void MainWindow::slotSessionChanged( Session* ses ) { |
437 | qWarning("changed!"); | ||
436 | if ( ses ) { | 438 | if ( ses ) { |
437 | m_curSession = ses; | 439 | m_curSession = ses; |
438 | 440 | ||
439 | if ( m_curSession->isConnected() ) { | 441 | if ( m_curSession->isConnected() ) { |
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index e5aedb6..7c15560 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -1,8 +1,9 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qhbox.h> | ||
5 | #include <qlayout.h> | 6 | #include <qlayout.h> |
6 | #include <qwidgetstack.h> | 7 | #include <qwidgetstack.h> |
7 | 8 | ||
8 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
@@ -84,21 +85,13 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { | |||
84 | prof) ); | 85 | prof) ); |
85 | 86 | ||
86 | QWidgetStack *stack = new QWidgetStack( parent ); | 87 | QWidgetStack *stack = new QWidgetStack( parent ); |
87 | session->setWidgetStack( stack ); | 88 | session->setWidgetStack( stack ); |
88 | QWidget* dummy = new QWidget( stack ); | 89 | QWidget* dummy = new QHBox( stack ); |
89 | QHBoxLayout* lay = new QHBoxLayout( dummy ); | 90 | stack->raiseWidget( dummy ); |
90 | stack->addWidget( dummy, 0 ); | 91 | |
91 | stack->raiseWidget( 0 ); | ||
92 | EmulationHandler* handler = new EmulationHandler(prof,dummy ); | 92 | EmulationHandler* handler = new EmulationHandler(prof,dummy ); |
93 | session->setEmulationHandler( handler ); | 93 | session->setEmulationHandler( handler ); |
94 | lay->addWidget( handler->widget() ); | ||
95 | // WidgetLayer* wid = new EmulationWidget( prof, dummy ); | ||
96 | // lay->addWidget( wid ); | ||
97 | |||
98 | // session->setEmulationWidget( wid ); | ||
99 | // session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ), | ||
100 | // wid ) ); | ||
101 | session->connect(); | 94 | session->connect(); |
102 | 95 | ||
103 | return session; | 96 | return session; |
104 | } | 97 | } |
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index e53dbc4..aad100d 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -35,8 +35,14 @@ IOLayer* Session::layer() { | |||
35 | } | 35 | } |
36 | EmulationHandler* Session::emulationHandler() { | 36 | EmulationHandler* Session::emulationHandler() { |
37 | return m_emu; | 37 | return m_emu; |
38 | } | 38 | } |
39 | QWidget* Session::widget() { | ||
40 | if (!m_emu ) | ||
41 | return 0l; | ||
42 | |||
43 | return m_emu->widget(); | ||
44 | } | ||
39 | /* | 45 | /* |
40 | WidgetLayer* Session::emulationWidget() { | 46 | WidgetLayer* Session::emulationWidget() { |
41 | return m_widLay; | 47 | return m_widLay; |
42 | } | 48 | } |
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h index a1121d3..ff92df3 100644 --- a/noncore/apps/opie-console/session.h +++ b/noncore/apps/opie-console/session.h | |||
@@ -33,8 +33,9 @@ public: | |||
33 | * | 33 | * |
34 | * semi modal == SessionModal | 34 | * semi modal == SessionModal |
35 | */ | 35 | */ |
36 | QWidgetStack* widgetStack(); | 36 | QWidgetStack* widgetStack(); |
37 | QWidget* widget(); | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | * return the layer | 40 | * return the layer |
40 | */ | 41 | */ |
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp index 8a691f9..419f8ac 100644 --- a/noncore/apps/opie-console/tabwidget.cpp +++ b/noncore/apps/opie-console/tabwidget.cpp | |||
@@ -10,8 +10,9 @@ TabWidget::TabWidget( QWidget* parent, const char* name ) | |||
10 | TabWidget::~TabWidget() { | 10 | TabWidget::~TabWidget() { |
11 | } | 11 | } |
12 | 12 | ||
13 | void TabWidget::add( Session* ses ) { | 13 | void TabWidget::add( Session* ses ) { |
14 | qWarning("session ses " + ses->name() ); | ||
14 | if ( !ses->widgetStack() ) return; | 15 | if ( !ses->widgetStack() ) return; |
15 | //reparent( ses->widgetStack(), QPoint() ); | 16 | //reparent( ses->widgetStack(), QPoint() ); |
16 | addTab( ses->widgetStack(), "console/konsole", ses->name() ); | 17 | addTab( ses->widgetStack(), "console/konsole", ses->name() ); |
17 | //addTab( ses->widgetStack(), ses->name() ); | 18 | //addTab( ses->widgetStack(), ses->name() ); |