summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-15 22:36:10 (UTC)
committer josef <josef>2002-10-15 22:36:10 (UTC)
commit65ef0e86a879332cbf8b1575886d3c36c7d2d9bd (patch) (side-by-side diff)
treeb0b3f192c52dc15d639977e1d592412531d826eb
parent626b45872e1774b694727792f7306a39277e413e (diff)
downloadopie-65ef0e86a879332cbf8b1575886d3c36c7d2d9bd.zip
opie-65ef0e86a879332cbf8b1575886d3c36c7d2d9bd.tar.gz
opie-65ef0e86a879332cbf8b1575886d3c36c7d2d9bd.tar.bz2
- 3 small fixes, please review:
- disable all relevant menu items when last session has been closed (but this might not be the correct bugfix, so consider it temporary) - don't set menu status to connected when connection fails - modem sessions: when user cancels connection, close serial connection first again, so we can reconnect (re-dial) later without problems
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_modem.cpp6
-rw-r--r--noncore/apps/opie-console/io_serial.cpp1
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp10
3 files changed, 13 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index 22a3673..41f553b 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -26,17 +26,21 @@ bool IOModem::open() {
Dialer d(m_profile);
int result = d.exec();
if(result == QDialog::Accepted)
{
return true;
}
- else return false;
+ else
+ {
+ close();
+ return false;
+ }
}
void IOModem::reload( const Profile &config ) {
m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE);
m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD);
m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY);
m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS);
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index b89a53b..cc63c58 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -41,16 +41,17 @@ void IOSerial::close() {
}
bool IOSerial::open() {
if (!m_fd) {
struct termios tty;
m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (m_fd < 0) {
emit error(CouldNotOpen, strerror(errno));
+ m_fd = 0;
return FALSE;
}
tcgetattr(m_fd, &tty);
/* Baud rate */
int speed = baud(m_baud);
if (speed == -1) {
emit error(Refuse, tr("Invalid baud rate"));
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 4326609..9ccefa0 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -313,18 +313,20 @@ void MainWindow::slotRunScript() {
}
void MainWindow::slotConnect() {
if ( currentSession() ) {
bool ret = currentSession()->layer()->open();
if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
QObject::tr("Failed"),
QObject::tr("Connecting failed for this session."));
- m_connect->setEnabled( false );
- m_disconnect->setEnabled( true );
+ else {
+ m_connect->setEnabled( false );
+ m_disconnect->setEnabled( true );
+ }
}
}
void MainWindow::slotDisconnect() {
if ( currentSession() ) {
currentSession()->layer()->close();
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
@@ -359,17 +361,19 @@ void MainWindow::slotConfigure() {
* and set the currentSession()
*/
void MainWindow::slotClose() {
if (!currentSession() )
return;
Session* ses = currentSession();
qWarning("removing! currentSession %s", currentSession()->name().latin1() );
- tabWidget()->remove( currentSession() );
+ /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
+ m_curSession = NULL;
+ tabWidget()->remove( /*currentSession()*/ses );
/*it's autodelete */
m_sessions.remove( ses );
qWarning("after remove!!");
if (!currentSession() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );