author | harlekin <harlekin> | 2002-10-15 22:03:01 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-15 22:03:01 (UTC) |
commit | ce953c24f809385088905ffd02f6d6187d0a4f12 (patch) (unidiff) | |
tree | 19f10579ebd5870cf38940d624c97111ea8137b3 | |
parent | 676be5604cbdb3213c00775e0ff66f4e766f8dcb (diff) | |
download | opie-ce953c24f809385088905ffd02f6d6187d0a4f12.zip opie-ce953c24f809385088905ffd02f6d6187d0a4f12.tar.gz opie-ce953c24f809385088905ffd02f6d6187d0a4f12.tar.bz2 |
next isConnected try
-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 | |||
@@ -47,25 +47,25 @@ public: | |||
47 | /*! | 47 | /*! |
48 | having a `run' separate from the constructor allows to make | 48 | having a `run' separate from the constructor allows to make |
49 | the necessary connections to the signals and slots of the | 49 | the necessary connections to the signals and slots of the |
50 | instance before starting the execution of the client. | 50 | instance before starting the execution of the client. |
51 | */ | 51 | */ |
52 | void start(); | 52 | void start(); |
53 | int run(const char* pgm, QStrList & args , const char* term, int addutmp); | 53 | int run(const char* pgm, QStrList & args , const char* term, int addutmp); |
54 | bool open(); | 54 | bool open(); |
55 | void close(); | 55 | void close(); |
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 | /*! |
63 | emitted when the client program terminates. | 63 | emitted when the client program terminates. |
64 | \param status the wait(2) status code of the terminated client program. | 64 | \param status the wait(2) status code of the terminated client program. |
65 | */ | 65 | */ |
66 | void done(int status); | 66 | void done(int status); |
67 | 67 | ||
68 | /*! | 68 | /*! |
69 | emitted when a new block of data comes in. | 69 | emitted when a new block of data comes in. |
70 | \param s - the data | 70 | \param s - the data |
71 | \param len - the length of the block | 71 | \param len - the length of the block |
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 | |||
@@ -41,25 +41,25 @@ extern "C" { | |||
41 | return new IOSerial( prof ); | 41 | return new IOSerial( prof ); |
42 | } | 42 | } |
43 | IOLayer* newBTLayer( const Profile& prof ) { | 43 | IOLayer* newBTLayer( const Profile& prof ) { |
44 | return new IOBt( prof ); | 44 | return new IOBt( prof ); |
45 | } | 45 | } |
46 | IOLayer* newIrDaLayer( const Profile& prof ) { | 46 | IOLayer* newIrDaLayer( const Profile& prof ) { |
47 | return new IOIrda( prof ); | 47 | return new IOIrda( prof ); |
48 | } | 48 | } |
49 | IOLayer* newModemLayer( const Profile& prof ) { | 49 | IOLayer* newModemLayer( const Profile& prof ) { |
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 |
57 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { | 57 | ProfileDialogWidget* newSerialWidget( const QString& str, QWidget* wid ) { |
58 | return new SerialConfigWidget( str, wid ); | 58 | return new SerialConfigWidget( str, wid ); |
59 | } | 59 | } |
60 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { | 60 | ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid ) { |
61 | return new IrdaConfigWidget( str, wid ); | 61 | return new IrdaConfigWidget( str, wid ); |
62 | } | 62 | } |
63 | ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { | 63 | ProfileDialogWidget* newModemWidget( const QString& str, QWidget* wid ) { |
64 | return new ModemConfigWidget(str, wid ); | 64 | return new ModemConfigWidget(str, wid ); |
65 | } | 65 | } |
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 | |||
@@ -70,24 +70,26 @@ public: | |||
70 | /** | 70 | /** |
71 | * will close the rawIO stuff | 71 | * will close the rawIO stuff |
72 | * and will listen to it's data again... | 72 | * and will listen to it's data again... |
73 | */ | 73 | */ |
74 | virtual void closeRawIO(int); | 74 | virtual void closeRawIO(int); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * What does the IOLayer support? | 77 | * What does the IOLayer support? |
78 | * Bits are related to features | 78 | * Bits are related to features |
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 |
85 | */ | 87 | */ |
86 | virtual void received( const QByteArray& ); | 88 | virtual void received( const QByteArray& ); |
87 | 89 | ||
88 | /** | 90 | /** |
89 | * an error occured | 91 | * an error occured |
90 | * int for the error number | 92 | * int for the error number |
91 | * and QString for a text | 93 | * and QString for a text |
92 | */ | 94 | */ |
93 | virtual void error( int, const QString& ); | 95 | virtual void error( int, const QString& ); |
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 | |||
@@ -1,47 +1,50 @@ | |||
1 | #include <fcntl.h> | 1 | #include <fcntl.h> |
2 | #include <termios.h> | 2 | #include <termios.h> |
3 | #include <errno.h> | 3 | #include <errno.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include "io_serial.h" | 5 | #include "io_serial.h" |
6 | 6 | ||
7 | IOSerial::IOSerial(const Profile &config) : IOLayer(config) { | 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 | ||
14 | 15 | ||
15 | IOSerial::~IOSerial() { | 16 | IOSerial::~IOSerial() { |
16 | if (m_fd) { | 17 | if (m_fd) { |
17 | close(); | 18 | close(); |
18 | } | 19 | } |
19 | } | 20 | } |
20 | 21 | ||
21 | void IOSerial::send(const QByteArray &data) { | 22 | void IOSerial::send(const QByteArray &data) { |
22 | if (m_fd) { | 23 | if (m_fd) { |
23 | write(m_fd, data.data(), data.size()); | 24 | write(m_fd, data.data(), data.size()); |
24 | } else { | 25 | } else { |
25 | emit error(Refuse, tr("Not connected")); | 26 | emit error(Refuse, tr("Not connected")); |
26 | } | 27 | } |
27 | } | 28 | } |
28 | 29 | ||
29 | void IOSerial::close() { | 30 | void IOSerial::close() { |
30 | if (m_fd) { | 31 | if (m_fd) { |
31 | delete m_read; | 32 | delete m_read; |
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 | } |
39 | 42 | ||
40 | bool IOSerial::open() { | 43 | bool IOSerial::open() { |
41 | if (!m_fd) { | 44 | if (!m_fd) { |
42 | struct termios tty; | 45 | struct termios tty; |
43 | m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK); | 46 | m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK); |
44 | if (m_fd < 0) { | 47 | if (m_fd < 0) { |
45 | emit error(CouldNotOpen, strerror(errno)); | 48 | emit error(CouldNotOpen, strerror(errno)); |
46 | return FALSE; | 49 | return FALSE; |
47 | } | 50 | } |
@@ -102,24 +105,25 @@ bool IOSerial::open() { | |||
102 | tty.c_cflag |= PARENB; | 105 | tty.c_cflag |= PARENB; |
103 | else if (m_parity & ParityOdd) | 106 | else if (m_parity & ParityOdd) |
104 | tty.c_cflag |= (PARENB | PARODD); | 107 | tty.c_cflag |= (PARENB | PARODD); |
105 | 108 | ||
106 | /* Set the changes */ | 109 | /* Set the changes */ |
107 | tcsetattr(m_fd, TCSANOW, &tty); | 110 | tcsetattr(m_fd, TCSANOW, &tty); |
108 | 111 | ||
109 | /* Notifications on read & errors */ | 112 | /* Notifications on read & errors */ |
110 | m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); | 113 | m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); |
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")); |
117 | m_fd = 0; | 121 | m_fd = 0; |
118 | return FALSE; | 122 | return FALSE; |
119 | } | 123 | } |
120 | } | 124 | } |
121 | 125 | ||
122 | void IOSerial::reload(const Profile &config) { | 126 | void IOSerial::reload(const Profile &config) { |
123 | m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); | 127 | m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); |
124 | m_baud = config.readNumEntry("Speed", SERIAL_DEFAULT_BAUD); | 128 | m_baud = config.readNumEntry("Speed", SERIAL_DEFAULT_BAUD); |
125 | m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY); | 129 | m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY); |
@@ -185,12 +189,16 @@ void IOSerial::closeRawIO(int fd) { | |||
185 | if (m_error ) | 189 | if (m_error ) |
186 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); | 190 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); |
187 | 191 | ||
188 | ::close( fd ); | 192 | ::close( fd ); |
189 | } | 193 | } |
190 | QBitArray IOSerial::supports()const { | 194 | QBitArray IOSerial::supports()const { |
191 | QBitArray ar(3); | 195 | QBitArray ar(3); |
192 | ar[0] = ar[2] = 0; | 196 | ar[0] = ar[2] = 0; |
193 | ar[1] = 1; | 197 | ar[1] = 1; |
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 | |||
@@ -29,39 +29,42 @@ public: | |||
29 | FlowHW = 0x01, | 29 | FlowHW = 0x01, |
30 | FlowSW = 0x02 | 30 | FlowSW = 0x02 |
31 | }; | 31 | }; |
32 | 32 | ||
33 | IOSerial(const Profile &); | 33 | IOSerial(const Profile &); |
34 | ~IOSerial(); | 34 | ~IOSerial(); |
35 | 35 | ||
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 | 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 &); |
44 | */ | 45 | */ |
45 | public slots: | 46 | public slots: |
46 | void send(const QByteArray &); | 47 | void send(const QByteArray &); |
47 | bool open(); | 48 | bool open(); |
48 | void close(); | 49 | void close(); |
49 | void reload(const Profile &); | 50 | void reload(const Profile &); |
50 | protected: | 51 | protected: |
51 | int baud(int baud) const; | 52 | int baud(int baud) const; |
52 | protected slots: | 53 | protected slots: |
53 | void dataArrived(); | 54 | void dataArrived(); |
54 | void errorOccured(); | 55 | void errorOccured(); |
55 | protected: | 56 | protected: |
56 | QSocketNotifier *m_read; | 57 | QSocketNotifier *m_read; |
57 | QSocketNotifier *m_error; | 58 | QSocketNotifier *m_error; |
58 | QString m_device; | 59 | QString m_device; |
59 | int m_baud; | 60 | int m_baud; |
60 | int m_parity; | 61 | int m_parity; |
61 | int m_dbits; | 62 | int m_dbits; |
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 | |||
@@ -196,25 +196,25 @@ void MainWindow::initUI() { | |||
196 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 196 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
197 | 197 | ||
198 | /* the settings menu */ | 198 | /* the settings menu */ |
199 | m_bar->insertItem( tr("Settings"), m_settings ); | 199 | m_bar->insertItem( tr("Settings"), m_settings ); |
200 | 200 | ||
201 | /* and the keyboard */ | 201 | /* and the keyboard */ |
202 | m_keyBar = new QToolBar(this); | 202 | m_keyBar = new QToolBar(this); |
203 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 203 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
204 | m_keyBar->setHorizontalStretchable( TRUE ); | 204 | m_keyBar->setHorizontalStretchable( TRUE ); |
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 | ||
212 | 212 | ||
213 | m_connect->setEnabled( false ); | 213 | m_connect->setEnabled( false ); |
214 | m_disconnect->setEnabled( false ); | 214 | m_disconnect->setEnabled( false ); |
215 | m_terminate->setEnabled( false ); | 215 | m_terminate->setEnabled( false ); |
216 | m_transfer->setEnabled( false ); | 216 | m_transfer->setEnabled( false ); |
217 | m_recordScript->setEnabled( false ); | 217 | m_recordScript->setEnabled( false ); |
218 | m_saveScript->setEnabled( false ); | 218 | m_saveScript->setEnabled( false ); |
219 | m_runScript->setEnabled( false ); | 219 | m_runScript->setEnabled( false ); |
220 | m_fullscreen->setEnabled( false ); | 220 | m_fullscreen->setEnabled( false ); |
@@ -430,26 +430,26 @@ void MainWindow::slotTransfer() | |||
430 | 430 | ||
431 | 431 | ||
432 | void MainWindow::slotOpenKeb(bool state) { | 432 | void MainWindow::slotOpenKeb(bool state) { |
433 | 433 | ||
434 | if (state) m_keyBar->show(); | 434 | if (state) m_keyBar->show(); |
435 | else m_keyBar->hide(); | 435 | else m_keyBar->hide(); |
436 | 436 | ||
437 | } | 437 | } |
438 | void MainWindow::slotSessionChanged( Session* ses ) { | 438 | 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 { |
447 | m_connect->setEnabled( true ); | 447 | m_connect->setEnabled( true ); |
448 | m_disconnect->setEnabled( false ); | 448 | m_disconnect->setEnabled( false ); |
449 | } | 449 | } |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | void MainWindow::slotFullscreen() { | 453 | void MainWindow::slotFullscreen() { |
454 | 454 | ||
455 | if ( m_isFullscreen ) { | 455 | if ( m_isFullscreen ) { |
@@ -480,15 +480,15 @@ void MainWindow::slotFullscreen() { | |||
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { | 483 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { |
484 | 484 | ||
485 | qWarning("received key event! relay to TE widget"); | 485 | qWarning("received key event! relay to TE widget"); |
486 | 486 | ||
487 | if ( m_curSession ) { | 487 | if ( m_curSession ) { |
488 | QKeyEvent ke(QEvent::KeyPress, q, u, 0); | 488 | QKeyEvent ke(QEvent::KeyPress, q, u, 0); |
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 | |||
@@ -42,39 +42,35 @@ QWidget* Session::widget() { | |||
42 | 42 | ||
43 | return m_emu->widget(); | 43 | return m_emu->widget(); |
44 | } | 44 | } |
45 | /* | 45 | /* |
46 | WidgetLayer* Session::emulationWidget() { | 46 | WidgetLayer* Session::emulationWidget() { |
47 | return m_widLay; | 47 | return m_widLay; |
48 | } | 48 | } |
49 | */ | 49 | */ |
50 | void Session::connect() { | 50 | 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&) ), |
59 | m_layer, SLOT(send(const QByteArray&) ) ); | 57 | m_layer, SLOT(send(const QByteArray&) ) ); |
60 | } | 58 | } |
61 | 59 | ||
62 | void Session::disconnect() { | 60 | void Session::disconnect() { |
63 | 61 | ||
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&) ), |
72 | m_layer, SLOT(send(const QByteArray&) ) ); | 68 | m_layer, SLOT(send(const QByteArray&) ) ); |
73 | } | 69 | } |
74 | 70 | ||
75 | void Session::setName( const QString& na){ | 71 | void Session::setName( const QString& na){ |
76 | m_name = na; | 72 | m_name = na; |
77 | } | 73 | } |
78 | 74 | ||
79 | void Session::setWidgetStack( QWidgetStack* wid ) { | 75 | void Session::setWidgetStack( QWidgetStack* wid ) { |
80 | delete m_emu; | 76 | delete m_emu; |
@@ -91,15 +87,12 @@ void Session::setIOLayer( IOLayer* lay ) { | |||
91 | 87 | ||
92 | void Session::setEmulationHandler( EmulationHandler* lay ) { | 88 | void Session::setEmulationHandler( EmulationHandler* lay ) { |
93 | delete m_emu; | 89 | delete m_emu; |
94 | m_emu = lay; | 90 | m_emu = lay; |
95 | } | 91 | } |
96 | /* | 92 | /* |
97 | void Session::setEmulationWidget( WidgetLayer* lay ) { | 93 | void Session::setEmulationWidget( WidgetLayer* lay ) { |
98 | delete m_widLay; | 94 | delete m_widLay; |
99 | m_widLay = lay; | 95 | m_widLay = 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 | |||
@@ -51,24 +51,22 @@ public: | |||
51 | 51 | ||
52 | /* | 52 | /* |
53 | * disconnect the dataflow | 53 | * disconnect the dataflow |
54 | * this will be done for ft | 54 | * this will be done for ft |
55 | */ | 55 | */ |
56 | void disconnect(); | 56 | void disconnect(); |
57 | 57 | ||
58 | void setWidgetStack( QWidgetStack* widget ); | 58 | void setWidgetStack( QWidgetStack* widget ); |
59 | void setEmulationHandler( EmulationHandler* lay ); | 59 | void setEmulationHandler( EmulationHandler* lay ); |
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; |
68 | IOLayer* m_layer; | 66 | IOLayer* m_layer; |
69 | EmulationHandler* m_emu; | 67 | EmulationHandler* m_emu; |
70 | bool m_connected; | 68 | bool m_connected; |
71 | 69 | ||
72 | }; | 70 | }; |
73 | 71 | ||
74 | #endif | 72 | #endif |