From fb99aec5215da635abfa28288d170f110114bba3 Mon Sep 17 00:00:00 2001 From: josef Date: Tue, 15 Oct 2002 21:10:29 +0000 Subject: - io_modem must keep copy of profile, otherwise it crashes (now it works - doh!) - try to use key/value pairs for dialing where currently possible (init string and dial sequence) - when editing telephone number, try to read in, including special chars stripping (-, /, whitespace) using QRegExp --- diff --git a/noncore/apps/opie-console/dialdialog.cpp b/noncore/apps/opie-console/dialdialog.cpp index 8bf32f9..0ace8f7 100644 --- a/noncore/apps/opie-console/dialdialog.cpp +++ b/noncore/apps/opie-console/dialdialog.cpp @@ -92,4 +92,12 @@ DialDialog::~DialDialog() { QString DialDialog::number() { return QString( "%1").arg( m_number ); + } + +void DialDialog::setNumber( int number ) +{ + m_number = number; + LCD->display( m_number ); +} + diff --git a/noncore/apps/opie-console/dialdialog.h b/noncore/apps/opie-console/dialdialog.h index 5c5b948..bec7b81 100644 --- a/noncore/apps/opie-console/dialdialog.h +++ b/noncore/apps/opie-console/dialdialog.h @@ -17,6 +17,8 @@ public: QString number(); + void setNumber( int ); + private: float m_number; QLCDNumber *LCD; diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 90e2b6c..89a0e8d 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp @@ -125,7 +125,8 @@ void Dialer::trydial(const QString& number) if(state != state_cancel) { switchState(state_init); - send("ATZ"); + //send("ATZ"); + send(m_profile.readEntry("InitString")); QString response2 = receive(); } @@ -149,7 +150,7 @@ void Dialer::trydial(const QString& number) { switchState(state_dialing); - send(QString("ATDT %1").arg(number)); + send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); QString response5 = receive(); } diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index d93dc5a..22a3673 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp @@ -4,7 +4,8 @@ #include "dialer.h" IOModem::IOModem( const Profile &profile ) - : IOSerial( profile ), m_profile( profile ) { + : IOSerial( profile ) { + m_profile = profile; } @@ -14,19 +15,16 @@ IOModem::~IOModem() { void IOModem::close() { + // maybe do a hangup here just in case...? IOSerial::close(); - } bool IOModem::open() { bool ret = IOSerial::open(); if(!ret) return false; - qWarning("IOModem::open continues..."); - Dialer d(m_profile); - qWarning("dialer created"); int result = d.exec(); if(result == QDialog::Accepted) diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index d681f66..8453b95 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h @@ -61,7 +61,7 @@ private: m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, m_bpsDetect, m_dcdLines, m_multiLineUntag; - const Profile& m_profile; + Profile m_profile; private slots: void slotExited(OProcess* proc); diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 0f0ce7c..878b0cf 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp @@ -4,7 +4,7 @@ #include #include #include - +#include #include "modemconfigwidget.h" #include "dialdialog.h" @@ -187,6 +187,9 @@ void ModemConfigWidget::slotAT() { void ModemConfigWidget::slotDial() { DialDialog dial( this, "DialConfig", true ); + if(!m_telNumber->text().isEmpty()) { + dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ ]"), "").toInt()); + } dial.showMaximized(); if ( dial.exec() == QDialog::Accepted ) { m_telNumber->setText( dial.number() ); -- cgit v0.9.0.2