-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 @@ +Ok we all know we write perfect code +but sometimes the compiler produces bad code +and we need to work around some compiler bugs!! -zecke + +MyPty is broken in some ways + if you do connect/disconnect/connect sh will be executed in the + process of opie-console.... funny aye? + +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 @@ -118,8 +118,11 @@ void MyPty::donePty() //waitpid(m_cpid, &status, 0); delete m_sn_e; + delete m_sn_r; m_sn_e = 0l; + m_sn_r = 0l; } m_cpid = 0; + m_fd = -1; // emit done(status); } @@ -186,8 +189,9 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) // parent - continue as a widget - QSocketNotifier* sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); + delete m_sn_r; + m_sn_r = new QSocketNotifier(m_fd,QSocketNotifier::Read,this); delete m_sn_e; m_sn_e = new QSocketNotifier(m_fd,QSocketNotifier::Exception,this); - connect(sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); + connect(m_sn_r,SIGNAL(activated(int)),this,SLOT(readPty())); connect(m_sn_e,SIGNAL(activated(int)),this,SLOT(error())); @@ -222,5 +226,5 @@ int MyPty::openPty() if ( ptyfd < 0 ) { - qApp->exit(1); +// qApp->exit(1); return -1; } @@ -235,4 +239,5 @@ MyPty::MyPty(const Profile&) : m_cpid(0) { m_sn_e = 0l; + m_sn_r = 0l; m_fd = openPty(); ProcCtl* ctl = ProcCtl::self(); @@ -255,4 +260,7 @@ QString MyPty::name()const{ } bool MyPty::open() { + if (m_fd < 0) + m_fd = openPty(); + start(); return true; @@ -260,4 +268,5 @@ bool MyPty::open() { void MyPty::close() { donePty(); + m_fd = openPty(); } void MyPty::reload( const Profile& ) { @@ -287,5 +296,4 @@ void MyPty::readPty() if (len == -1 || len == 0) { donePty(); - delete sender(); return; } @@ -307,3 +315,10 @@ void MyPty::readPty() } +QBitArray MyPty::supports()const { + QBitArray ar(3); + ar[0] = 1; + ar[1] = 0; + ar[2] = 0; + return ar; +} 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 @@ -42,4 +42,5 @@ public: QString identifier()const; QString name()const; + QBitArray supports()const; public slots: @@ -93,4 +94,5 @@ private: int m_cpid; QSocketNotifier* m_sn_e; + QSocketNotifier* m_sn_r; }; 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 @@ -2,5 +2,8 @@ #define OPIE_IO_LAYER_H +#include <qbitarray.h> #include <qobject.h> + + #include <qpe/config.h> @@ -24,4 +27,9 @@ public: /* add more errors here */ }; + enum Feature { + AutoConnect = 0, + TransferFile =1, + Close =2 + }; /** * a small c'tor @@ -66,4 +74,9 @@ public: virtual void closeRawIO(int); + /** + * What does the IOLayer support? + * Bits are related to features + */ + virtual QBitArray supports()const = 0; signals: @@ -80,4 +93,5 @@ signals: virtual void error( int, const QString& ); + virtual void closed(); public slots: /** 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 @@ -188,2 +188,9 @@ void IOSerial::closeRawIO(int fd) { ::close( fd ); } +QBitArray IOSerial::supports()const { + QBitArray ar(3); + ar[0] = ar[2] = 0; + ar[1] = 1; + + return ar; +} 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 @@ -38,7 +38,9 @@ public: int rawIO()const; void closeRawIO(int fd ); -signals: + QBitArray supports()const; +/*signals: void received(const QByteArray &); void error(int, const QString &); +*/ public slots: void send(const QByteArray &); 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 @@ -361,9 +361,10 @@ void MainWindow::slotClose() { return; + Session* ses = currentSession(); + qWarning("removing! currentSession %s", currentSession()->name().latin1() ); tabWidget()->remove( currentSession() ); /*it's autodelete */ - m_sessions.remove( m_curSession ); - m_curSession = m_sessions.first(); - tabWidget()->setCurrent( m_curSession ); + m_sessions.remove( ses ); + qWarning("after remove!!"); if (!currentSession() ) { @@ -396,5 +397,5 @@ void MainWindow::create( const Profile& prof ) { QMessageBox::warning(this, QObject::tr("Session failed"), - QObject::tr("Cannot open session: Not all components were found.")); + QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); //if(ses) delete ses; return; @@ -434,4 +435,5 @@ void MainWindow::slotOpenKeb(bool state) { } void MainWindow::slotSessionChanged( Session* ses ) { + qWarning("changed!"); if ( ses ) { m_curSession = ses; 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 @@ -3,4 +3,5 @@ #include <qfile.h> +#include <qhbox.h> #include <qlayout.h> #include <qwidgetstack.h> @@ -86,17 +87,9 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { QWidgetStack *stack = new QWidgetStack( parent ); session->setWidgetStack( stack ); - QWidget* dummy = new QWidget( stack ); - QHBoxLayout* lay = new QHBoxLayout( dummy ); - stack->addWidget( dummy, 0 ); - stack->raiseWidget( 0 ); + QWidget* dummy = new QHBox( stack ); + stack->raiseWidget( dummy ); + EmulationHandler* handler = new EmulationHandler(prof,dummy ); session->setEmulationHandler( handler ); - lay->addWidget( handler->widget() ); -// WidgetLayer* wid = new EmulationWidget( prof, dummy ); -// lay->addWidget( wid ); - -// session->setEmulationWidget( wid ); -// session->setEmulationLayer( m_fact->newEmulationLayer( m_fact->external( prof.terminalName() ), -// wid ) ); session->connect(); 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 @@ -37,4 +37,10 @@ EmulationHandler* Session::emulationHandler() { return m_emu; } +QWidget* Session::widget() { + if (!m_emu ) + return 0l; + + return m_emu->widget(); +} /* WidgetLayer* Session::emulationWidget() { 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 @@ -35,4 +35,5 @@ public: */ QWidgetStack* widgetStack(); + QWidget* widget(); /** 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 @@ -12,4 +12,5 @@ TabWidget::~TabWidget() { void TabWidget::add( Session* ses ) { + qWarning("session ses " + ses->name() ); if ( !ses->widgetStack() ) return; //reparent( ses->widgetStack(), QPoint() ); |