summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/BUGS9
-rw-r--r--noncore/apps/opie-console/MyPty.cpp23
-rw-r--r--noncore/apps/opie-console/MyPty.h2
-rw-r--r--noncore/apps/opie-console/io_layer.h14
-rw-r--r--noncore/apps/opie-console/io_serial.cpp7
-rw-r--r--noncore/apps/opie-console/io_serial.h4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp10
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp15
-rw-r--r--noncore/apps/opie-console/session.cpp6
-rw-r--r--noncore/apps/opie-console/session.h1
-rw-r--r--noncore/apps/opie-console/tabwidget.cpp1
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
@@ -116,12 +116,15 @@ void MyPty::donePty()
if (m_cpid) {
kill(m_cpid, SIGHUP);
//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);
}
@@ -184,12 +187,13 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int)
exit(-1);
}
// 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()));
return 0;
}
@@ -220,9 +224,9 @@ int MyPty::openPty()
}
#endif
if ( ptyfd < 0 ) {
- qApp->exit(1);
+// qApp->exit(1);
return -1;
}
return ptyfd;
@@ -233,8 +237,9 @@ int MyPty::openPty()
*/
MyPty::MyPty(const Profile&) : m_cpid(0)
{
m_sn_e = 0l;
+ m_sn_r = 0l;
m_fd = openPty();
ProcCtl* ctl = ProcCtl::self();
}
@@ -253,13 +258,17 @@ QString MyPty::identifier()const {
QString MyPty::name()const{
return identifier();
}
bool MyPty::open() {
+ if (m_fd < 0)
+ m_fd = openPty();
+
start();
return true;
}
void MyPty::close() {
donePty();
+ m_fd = openPty();
}
void MyPty::reload( const Profile& ) {
}
@@ -285,9 +294,8 @@ void MyPty::readPty()
int len = ::read( m_fd, buf.data(), 4096 );
if (len == -1 || len == 0) {
donePty();
- delete sender();
return;
}
if (len < 0)
@@ -305,5 +313,12 @@ void MyPty::readPty()
printf("\n");
#endif
}
+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
@@ -40,8 +40,9 @@ public:
QString identifier()const;
QString name()const;
+ QBitArray supports()const;
public slots:
/*!
having a `run' separate from the constructor allows to make
@@ -91,7 +92,8 @@ private:
char m_ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..."
int m_fd;
int m_cpid;
QSocketNotifier* m_sn_e;
+ QSocketNotifier* m_sn_r;
};
#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 @@
#ifndef OPIE_IO_LAYER_H
#define OPIE_IO_LAYER_H
+#include <qbitarray.h>
#include <qobject.h>
+
+
#include <qpe/config.h>
#include "profile.h"
@@ -22,8 +25,13 @@ public:
ClosedError =3,
Terminate = 4
/* add more errors here */
};
+ enum Feature {
+ AutoConnect = 0,
+ TransferFile =1,
+ Close =2
+ };
/**
* a small c'tor
*/
IOLayer();
@@ -64,8 +72,13 @@ public:
* and will listen to it's data again...
*/
virtual void closeRawIO(int);
+ /**
+ * What does the IOLayer support?
+ * Bits are related to features
+ */
+ virtual QBitArray supports()const = 0;
signals:
/**
* received input as QCString
@@ -78,8 +91,9 @@ signals:
* and QString for a text
*/
virtual void error( int, const QString& );
+ virtual void closed();
public slots:
/**
* send a QCString to the device
*/
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) {
connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
::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
@@ -36,11 +36,13 @@ public:
QString identifier() const;
QString name() const;
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 &);
bool open();
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() {
void MainWindow::slotClose() {
if (!currentSession() )
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() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
@@ -394,9 +395,9 @@ void MainWindow::create( const Profile& prof ) {
if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
{
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;
}
@@ -432,8 +433,9 @@ void MainWindow::slotOpenKeb(bool state) {
else m_keyBar->hide();
}
void MainWindow::slotSessionChanged( Session* ses ) {
+ qWarning("changed!");
if ( ses ) {
m_curSession = ses;
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 @@
#include <stdio.h>
#include <stdlib.h>
#include <qfile.h>
+#include <qhbox.h>
#include <qlayout.h>
#include <qwidgetstack.h>
#include <qpe/config.h>
@@ -84,21 +85,13 @@ Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
prof) );
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();
return session;
}
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() {
}
EmulationHandler* Session::emulationHandler() {
return m_emu;
}
+QWidget* Session::widget() {
+ if (!m_emu )
+ return 0l;
+
+ return m_emu->widget();
+}
/*
WidgetLayer* Session::emulationWidget() {
return m_widLay;
}
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:
*
* semi modal == SessionModal
*/
QWidgetStack* widgetStack();
+ QWidget* widget();
/**
* return the layer
*/
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 )
TabWidget::~TabWidget() {
}
void TabWidget::add( Session* ses ) {
+ qWarning("session ses " + ses->name() );
if ( !ses->widgetStack() ) return;
//reparent( ses->widgetStack(), QPoint() );
addTab( ses->widgetStack(), "console/konsole", ses->name() );
//addTab( ses->widgetStack(), ses->name() );