-rw-r--r-- | noncore/apps/opie-console/MyPty.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_layer.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 2 |
8 files changed, 19 insertions, 15 deletions
diff --git a/noncore/apps/opie-console/MyPty.h b/noncore/apps/opie-console/MyPty.h index ad271df..81abad5 100644 --- a/noncore/apps/opie-console/MyPty.h +++ b/noncore/apps/opie-console/MyPty.h | |||
@@ -56,7 +56,7 @@ public: | |||
56 | void reload( const Profile& ); | 56 | void reload( const Profile& ); |
57 | void setSize(int lines, int columns); | 57 | void setSize(int lines, int columns); |
58 | void error(); | 58 | void error(); |
59 | 59 | bool isConnected() { return true; }; | |
60 | signals: | 60 | signals: |
61 | 61 | ||
62 | /*! | 62 | /*! |
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp index 64c9542..8b905e1 100644 --- a/noncore/apps/opie-console/default.cpp +++ b/noncore/apps/opie-console/default.cpp | |||
@@ -50,7 +50,7 @@ extern "C" { | |||
50 | return new IOModem( prof ); | 50 | return new IOModem( prof ); |
51 | } | 51 | } |
52 | IOLayer* newConsole( const Profile& prof ) { | 52 | IOLayer* newConsole( const Profile& prof ) { |
53 | return new MyPty(prof ); | 53 | return new MyPty( prof ); |
54 | } | 54 | } |
55 | 55 | ||
56 | // Connection Widgets | 56 | // Connection Widgets |
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h index 4977e94..d5f7eab 100644 --- a/noncore/apps/opie-console/io_layer.h +++ b/noncore/apps/opie-console/io_layer.h | |||
@@ -79,6 +79,8 @@ public: | |||
79 | */ | 79 | */ |
80 | virtual QBitArray supports()const = 0; | 80 | virtual QBitArray supports()const = 0; |
81 | 81 | ||
82 | virtual bool isConnected() = 0; | ||
83 | |||
82 | signals: | 84 | signals: |
83 | /** | 85 | /** |
84 | * received input as QCString | 86 | * received input as QCString |
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp index c10d5a8..b89a53b 100644 --- a/noncore/apps/opie-console/io_serial.cpp +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -8,6 +8,7 @@ IOSerial::IOSerial(const Profile &config) : IOLayer(config) { | |||
8 | m_read = 0l; | 8 | m_read = 0l; |
9 | m_error = 0l; | 9 | m_error = 0l; |
10 | m_fd = 0; | 10 | m_fd = 0; |
11 | m_connected = false; | ||
11 | reload(config); | 12 | reload(config); |
12 | } | 13 | } |
13 | 14 | ||
@@ -32,7 +33,9 @@ void IOSerial::close() { | |||
32 | delete m_error; | 33 | delete m_error; |
33 | ::close(m_fd); | 34 | ::close(m_fd); |
34 | m_fd = 0; | 35 | m_fd = 0; |
36 | m_connected = false; | ||
35 | } else { | 37 | } else { |
38 | m_connected = false; | ||
36 | emit error(Refuse, tr("Not connected")); | 39 | emit error(Refuse, tr("Not connected")); |
37 | } | 40 | } |
38 | } | 41 | } |
@@ -111,6 +114,7 @@ bool IOSerial::open() { | |||
111 | m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); | 114 | m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); |
112 | connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); | 115 | connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); |
113 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); | 116 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); |
117 | m_connected = false; | ||
114 | return TRUE; | 118 | return TRUE; |
115 | } else { | 119 | } else { |
116 | emit error(Refuse, tr("Device is already connected")); | 120 | emit error(Refuse, tr("Device is already connected")); |
@@ -194,3 +198,7 @@ QBitArray IOSerial::supports()const { | |||
194 | 198 | ||
195 | return ar; | 199 | return ar; |
196 | } | 200 | } |
201 | |||
202 | bool IOSerial::isConnected() { | ||
203 | return m_connected; | ||
204 | } | ||
diff --git a/noncore/apps/opie-console/io_serial.h b/noncore/apps/opie-console/io_serial.h index b1d1be1..7a1ea1d 100644 --- a/noncore/apps/opie-console/io_serial.h +++ b/noncore/apps/opie-console/io_serial.h | |||
@@ -38,6 +38,7 @@ public: | |||
38 | int rawIO()const; | 38 | int rawIO()const; |
39 | void closeRawIO(int fd ); | 39 | void closeRawIO(int fd ); |
40 | QBitArray supports()const; | 40 | QBitArray supports()const; |
41 | bool isConnected(); | ||
41 | /*signals: | 42 | /*signals: |
42 | void received(const QByteArray &); | 43 | void received(const QByteArray &); |
43 | void error(int, const QString &); | 44 | void error(int, const QString &); |
@@ -62,6 +63,8 @@ protected: | |||
62 | int m_sbits; | 63 | int m_sbits; |
63 | int m_flow; | 64 | int m_flow; |
64 | int m_fd; | 65 | int m_fd; |
66 | bool m_connected; | ||
67 | |||
65 | }; | 68 | }; |
66 | 69 | ||
67 | #endif /* OPIE_IO_SERIAL */ | 70 | #endif /* OPIE_IO_SERIAL */ |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index d3b6c8a..4326609 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -205,7 +205,7 @@ void MainWindow::initUI() { | |||
205 | m_keyBar->hide(); | 205 | m_keyBar->hide(); |
206 | 206 | ||
207 | m_kb = new FunctionKeyboard(m_keyBar); | 207 | m_kb = new FunctionKeyboard(m_keyBar); |
208 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 208 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), |
209 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 209 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); |
210 | 210 | ||
211 | 211 | ||
@@ -439,8 +439,8 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
439 | qWarning("changed!"); | 439 | qWarning("changed!"); |
440 | if ( ses ) { | 440 | if ( ses ) { |
441 | m_curSession = ses; | 441 | m_curSession = ses; |
442 | 442 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | |
443 | if ( m_curSession->isConnected() ) { | 443 | if ( m_curSession->layer()->isConnected() ) { |
444 | m_connect->setEnabled( false ); | 444 | m_connect->setEnabled( false ); |
445 | m_disconnect->setEnabled( true ); | 445 | m_disconnect->setEnabled( true ); |
446 | } else { | 446 | } else { |
@@ -489,6 +489,6 @@ void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { | |||
489 | 489 | ||
490 | ke.ignore(); | 490 | ke.ignore(); |
491 | // where should i send this event? doesnt work sending it here | 491 | // where should i send this event? doesnt work sending it here |
492 | QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke); | 492 | QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke); |
493 | } | 493 | } |
494 | } | 494 | } |
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index aad100d..2ce6872 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp | |||
@@ -51,8 +51,6 @@ void Session::connect() { | |||
51 | if ( !m_layer || !m_emu ) | 51 | if ( !m_layer || !m_emu ) |
52 | return; | 52 | return; |
53 | 53 | ||
54 | m_connected = true; | ||
55 | |||
56 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), | 54 | QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), |
57 | m_emu, SLOT(recv(const QByteArray&) ) ); | 55 | m_emu, SLOT(recv(const QByteArray&) ) ); |
58 | QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), | 56 | QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), |
@@ -64,8 +62,6 @@ void Session::disconnect() { | |||
64 | if ( !m_layer || !m_emu ) | 62 | if ( !m_layer || !m_emu ) |
65 | return; | 63 | return; |
66 | 64 | ||
67 | m_connected = false; | ||
68 | |||
69 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), | 65 | QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), |
70 | m_emu, SLOT(recv(const QByteArray&) ) ); | 66 | m_emu, SLOT(recv(const QByteArray&) ) ); |
71 | QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), | 67 | QObject::disconnect(m_emu, SIGNAL(send(const QByteArray&) ), |
@@ -100,6 +96,3 @@ void Session::setEmulationWidget( WidgetLayer* lay ) { | |||
100 | } | 96 | } |
101 | */ | 97 | */ |
102 | 98 | ||
103 | bool Session::isConnected() { | ||
104 | return m_connected; | ||
105 | } | ||
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h index ff92df3..83b2046 100644 --- a/noncore/apps/opie-console/session.h +++ b/noncore/apps/opie-console/session.h | |||
@@ -60,8 +60,6 @@ public: | |||
60 | void setIOLayer( IOLayer* ); | 60 | void setIOLayer( IOLayer* ); |
61 | void setName( const QString& ); | 61 | void setName( const QString& ); |
62 | 62 | ||
63 | bool isConnected(); | ||
64 | |||
65 | private: | 63 | private: |
66 | QString m_name; | 64 | QString m_name; |
67 | QWidgetStack* m_widget; | 65 | QWidgetStack* m_widget; |