author | zecke <zecke> | 2002-10-09 01:58:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-09 01:58:20 (UTC) |
commit | 849316bd18f06e43e7dfa2f107ad96d5bedbe7f1 (patch) (unidiff) | |
tree | f793cbfc60377d2dbb2cd5b1066bdadec5738dc4 /noncore/apps/opie-console | |
parent | a74bf68065b94efaacb73736c7127ccb74474645 (diff) | |
download | opie-849316bd18f06e43e7dfa2f107ad96d5bedbe7f1.zip opie-849316bd18f06e43e7dfa2f107ad96d5bedbe7f1.tar.gz opie-849316bd18f06e43e7dfa2f107ad96d5bedbe7f1.tar.bz2 |
IOSerial fixlet
if failed to ioctl m_fd is != 0
so set it 0
and initialize m_read, m_error properly
TabWidget was a OTabWidget again but there is a bug somewhere in the
removePage code. I hopefully kindly asked drw to take a look at it
MainWindiw
Close does not terminate
Screen is funny to look at... everytime a different background.
when using QTabWidget I see nothing when using OTabWidget i've vertical scrollbars and see the content
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp index b495f39..77ced85 100644 --- a/noncore/apps/opie-console/io_serial.cpp +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -1,19 +1,21 @@ | |||
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; | ||
9 | m_error = 0l; | ||
8 | m_fd = 0; | 10 | m_fd = 0; |
9 | reload(config); | 11 | reload(config); |
10 | } | 12 | } |
11 | 13 | ||
12 | 14 | ||
13 | IOSerial::~IOSerial() { | 15 | IOSerial::~IOSerial() { |
14 | if (m_fd) { | 16 | if (m_fd) { |
15 | close(); | 17 | close(); |
16 | } | 18 | } |
17 | } | 19 | } |
18 | 20 | ||
19 | void IOSerial::send(const QByteArray &data) { | 21 | void IOSerial::send(const QByteArray &data) { |
@@ -103,24 +105,25 @@ bool IOSerial::open() { | |||
103 | 105 | ||
104 | /* Set the changes */ | 106 | /* Set the changes */ |
105 | tcsetattr(m_fd, TCSANOW, &tty); | 107 | tcsetattr(m_fd, TCSANOW, &tty); |
106 | 108 | ||
107 | /* Notifications on read & errors */ | 109 | /* Notifications on read & errors */ |
108 | m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); | 110 | m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); |
109 | m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); | 111 | m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); |
110 | connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); | 112 | connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); |
111 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); | 113 | connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); |
112 | return TRUE; | 114 | return TRUE; |
113 | } else { | 115 | } else { |
114 | emit error(Refuse, tr("Device is already connected")); | 116 | emit error(Refuse, tr("Device is already connected")); |
117 | m_fd = 0; | ||
115 | return FALSE; | 118 | return FALSE; |
116 | } | 119 | } |
117 | } | 120 | } |
118 | 121 | ||
119 | void IOSerial::reload(const Profile &config) { | 122 | void IOSerial::reload(const Profile &config) { |
120 | m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); | 123 | m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); |
121 | m_baud = config.readNumEntry("Baud", SERIAL_DEFAULT_BAUD); | 124 | m_baud = config.readNumEntry("Baud", SERIAL_DEFAULT_BAUD); |
122 | m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY); | 125 | m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY); |
123 | m_dbits = config.readNumEntry("DataBits", SERIAL_DEFAULT_DBITS); | 126 | m_dbits = config.readNumEntry("DataBits", SERIAL_DEFAULT_DBITS); |
124 | m_sbits = config.readNumEntry("StopBits", SERIAL_DEFAULT_SBITS); | 127 | m_sbits = config.readNumEntry("StopBits", SERIAL_DEFAULT_SBITS); |
125 | m_flow = config.readNumEntry("Flow", SERIAL_DEFAULT_FLOW); | 128 | m_flow = config.readNumEntry("Flow", SERIAL_DEFAULT_FLOW); |
126 | } | 129 | } |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index aeb3742..0bd6a13 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -60,25 +60,25 @@ void MainWindow::initUI() { | |||
60 | m_disconnect = new QAction(); | 60 | m_disconnect = new QAction(); |
61 | m_disconnect->setText( tr("Disconnect") ); | 61 | m_disconnect->setText( tr("Disconnect") ); |
62 | m_disconnect->addTo( m_console ); | 62 | m_disconnect->addTo( m_console ); |
63 | connect(m_disconnect, SIGNAL(activated() ), | 63 | connect(m_disconnect, SIGNAL(activated() ), |
64 | this, SLOT(slotDisconnect() ) ); | 64 | this, SLOT(slotDisconnect() ) ); |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * terminate action | 67 | * terminate action |
68 | */ | 68 | */ |
69 | m_terminate = new QAction(); | 69 | m_terminate = new QAction(); |
70 | m_terminate->setText( tr("Terminate") ); | 70 | m_terminate->setText( tr("Terminate") ); |
71 | m_terminate->addTo( m_console ); | 71 | m_terminate->addTo( m_console ); |
72 | connect(m_disconnect, SIGNAL(activated() ), | 72 | connect(m_terminate, SIGNAL(activated() ), |
73 | this, SLOT(slotTerminate() ) ); | 73 | this, SLOT(slotTerminate() ) ); |
74 | 74 | ||
75 | a = new QAction(); | 75 | a = new QAction(); |
76 | a->setText( tr("Close Window") ); | 76 | a->setText( tr("Close Window") ); |
77 | a->addTo( m_console ); | 77 | a->addTo( m_console ); |
78 | connect(a, SIGNAL(activated() ), | 78 | connect(a, SIGNAL(activated() ), |
79 | this, SLOT(slotClose() ) ); | 79 | this, SLOT(slotClose() ) ); |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * the settings action | 82 | * the settings action |
83 | */ | 83 | */ |
84 | m_setProfiles = new QAction(); | 84 | m_setProfiles = new QAction(); |
@@ -179,32 +179,33 @@ void MainWindow::slotConfigure() { | |||
179 | manager()->setProfiles( conf.list() ); | 179 | manager()->setProfiles( conf.list() ); |
180 | populateProfiles(); | 180 | populateProfiles(); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | /* | 183 | /* |
184 | * we will remove | 184 | * we will remove |
185 | * this window from the tabwidget | 185 | * this window from the tabwidget |
186 | * remove it from the list | 186 | * remove it from the list |
187 | * delete it | 187 | * delete it |
188 | * and set the currentSession() | 188 | * and set the currentSession() |
189 | */ | 189 | */ |
190 | void MainWindow::slotClose() { | 190 | void MainWindow::slotClose() { |
191 | qWarning("close"); | ||
191 | if (!currentSession() ) | 192 | if (!currentSession() ) |
192 | return; | 193 | return; |
193 | 194 | ||
194 | tabWidget()->remove( currentSession() ); | 195 | tabWidget()->remove( currentSession() ); |
195 | tabWidget()->setCurrent( m_sessions.first() ); | 196 | /*it's autodelete */ |
196 | m_sessions.remove( m_curSession ); | 197 | m_sessions.remove( m_curSession ); |
197 | delete m_curSession; | ||
198 | m_curSession = m_sessions.first(); | 198 | m_curSession = m_sessions.first(); |
199 | tabWidget()->setCurrent( m_curSession ); | ||
199 | } | 200 | } |
200 | 201 | ||
201 | /* | 202 | /* |
202 | * We will get the name | 203 | * We will get the name |
203 | * Then the profile | 204 | * Then the profile |
204 | * and then we will make a profile | 205 | * and then we will make a profile |
205 | */ | 206 | */ |
206 | void MainWindow::slotProfile( int id) { | 207 | void MainWindow::slotProfile( int id) { |
207 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 208 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
208 | create( prof ); | 209 | create( prof ); |
209 | } | 210 | } |
210 | void MainWindow::create( const Profile& prof ) { | 211 | void MainWindow::create( const Profile& prof ) { |