summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialdialog.cpp8
-rw-r--r--noncore/apps/opie-console/dialdialog.h2
-rw-r--r--noncore/apps/opie-console/dialer.cpp5
-rw-r--r--noncore/apps/opie-console/io_modem.cpp8
-rw-r--r--noncore/apps/opie-console/io_modem.h2
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp5
6 files changed, 21 insertions, 9 deletions
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
@@ -63,33 +63,41 @@ DialDialog::DialDialog( QWidget* parent, const char* name, bool modal, WFlags f
y = 0;
}
}
connect( dialButtons, SIGNAL( clicked( int ) ), this, SLOT( slotEnterNumber( int ) ) );
mainLayout->addStretch( 0 );
mainLayout->addWidget( textLabel );
mainLayout->addWidget( LCD );
mainLayout->addStretch( 0 );
mainLayout->addLayout( layout );
mainLayout->addStretch( 0 );
}
void DialDialog::slotEnterNumber( int number ) {
// pretty stupid, just for testing .-)
m_number = ( m_number * 10 ) + number;
qDebug( QString("%1").arg( m_number ) );
LCD->display( m_number );
}
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
@@ -1,29 +1,31 @@
#ifndef DIALDIALOG_H
#define DIALDIALOG_H
#include <qdialog.h>
#include <qstring.h>
#include <qlcdnumber.h>
class DialDialog : public QDialog {
Q_OBJECT
public:
DialDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~DialDialog();
QString number();
+ void setNumber( int );
+
private:
float m_number;
QLCDNumber *LCD;
private slots:
void slotEnterNumber( int );
};
#endif
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
@@ -96,89 +96,90 @@ void Dialer::slotAutostart()
dial(m_profile.readEntry("Number"));
}
void Dialer::dial(const QString& number)
{
while(state != state_online)
{
if(!usercancel)
{
trydial(number);
}
else break;
}
if(usercancel)
{
reject();
}
}
void Dialer::trydial(const QString& number)
{
if(state != state_cancel)
{
switchState(state_preinit);
// ...
QString response = receive();
}
if(state != state_cancel)
{
switchState(state_init);
- send("ATZ");
+ //send("ATZ");
+ send(m_profile.readEntry("InitString"));
QString response2 = receive();
}
if(state != state_cancel)
{
switchState(state_options);
send("ATM0L0");
QString response3 = receive();
}
if(state != state_cancel)
{
switchState(state_dialtone);
send("ATX1");
QString response4 = receive();
}
if(state != state_cancel)
{
switchState(state_dialing);
- send(QString("ATDT %1").arg(number));
+ send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number));
QString response5 = receive();
}
if(state != state_cancel)
{
switchState(state_online);
}
}
void Dialer::send(const QString& msg)
{
QString m = msg;
int bytes;
QString termination;
termination = m_profile.readEntry("Termination");
if(termination == "\n") m = m + "\n";
else if(termination == "\r") m = m + "\r";
else m = m + "\r\n";
bytes = write(0, m.local8Bit(), strlen(m.local8Bit()));
if(bytes < 0)
{
reset();
}
}
QString Dialer::receive()
{
for(int i = 0; i < 200000;i++)
qApp->processEvents();
return QString::null;
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
@@ -1,61 +1,59 @@
#include "io_modem.h"
#include "dialer.h"
IOModem::IOModem( const Profile &profile )
- : IOSerial( profile ), m_profile( profile ) {
+ : IOSerial( profile ) {
+ m_profile = profile;
}
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)
{
return true;
}
else 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);
m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS);
m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW);
m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING );
m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING );
m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 );
m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 );
m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 );
m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 );
m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 );
m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 );
m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING );
m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING );
m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING );
m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME );
m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
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
@@ -32,40 +32,40 @@
#define MODEM_DEFAULT_DCD_LINES 1 //bool
#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
/* IOSerial implements a RS232 IO Layer */
class IOModem : public IOSerial {
Q_OBJECT
public:
IOModem(const Profile &);
~IOModem();
QString identifier() const;
QString name() const;
signals:
void received(const QByteArray &);
void error(int, const QString &);
public slots:
bool open();
void close();
void reload(const Profile &);
private:
QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2,
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);
};
#endif
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
@@ -1,39 +1,39 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qhbox.h>
-
+#include <qregexp.h>
#include "modemconfigwidget.h"
#include "dialdialog.h"
namespace {
void setCurrent( const QString& str, QComboBox* bo ) {
uint b = bo->count();
for (uint i = 0; i < bo->count(); i++ ) {
if ( bo->text(i) == str ) {
bo->setCurrentItem( i );
return;
}
}
bo->insertItem( str );
bo->setCurrentItem( b );
}
}
ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
const char* na )
: ProfileDialogConnectionWidget( name, parent, na ) {
m_lay = new QVBoxLayout( this );
m_device = new QLabel(tr( "Modem is attached to:" ), this );
m_deviceCmb = new QComboBox(this );
m_deviceCmb->setEditable( TRUE );
QLabel* telLabel = new QLabel( this );
telLabel->setText( tr( "Enter telefon number here:" ) );
m_telNumber = new QLineEdit( this );
QHBox *buttonBox = new QHBox( this );
QPushButton *atButton = new QPushButton( buttonBox );
@@ -158,37 +158,40 @@ void ModemConfigWidget::save( Profile& prof ) {
speed = 115200;
break;
case IOLayerBase::Baud_57600:
speed = 57600;
break;
case IOLayerBase::Baud_38400:
speed = 38400;
break;
case IOLayerBase::Baud_19200:
speed = 19200;
break;
case IOLayerBase::Baud_9600:
speed = 9600;
break;
}
prof.writeEntry( "Flow", flow );
prof.writeEntry( "Parity", parity );
prof.writeEntry( "Speed", speed );
prof.writeEntry( "Number", m_telNumber->text() );
}
void ModemConfigWidget::slotAT() {
// ATConfigDialog conf( this, "ATConfig", true );
atConf->showMaximized();
if ( atConf->exec() == QDialog::Accepted ) {
// atConf->writeConfig();
}
}
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() );
}
}