summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-13 21:10:15 (UTC)
committer harlekin <harlekin>2002-10-13 21:10:15 (UTC)
commit5a6ecdac2e62708b55300ca6eef8441fea0a7b05 (patch) (side-by-side diff)
tree003577346dc8f9c73f1d86d8dd9d5038d6995662
parent03c81e6d55d1a837e543a00f6e0a7334e96f1eef (diff)
downloadopie-5a6ecdac2e62708b55300ca6eef8441fea0a7b05.zip
opie-5a6ecdac2e62708b55300ca6eef8441fea0a7b05.tar.gz
opie-5a6ecdac2e62708b55300ca6eef8441fea0a7b05.tar.bz2
fixes to modem stuff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp41
-rw-r--r--noncore/apps/opie-console/atconfigdialog.h5
-rw-r--r--noncore/apps/opie-console/io_modem.cpp16
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp6
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp23
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.h6
6 files changed, 58 insertions, 39 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index ef6d1ae..87a08f6 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -106,77 +106,94 @@ QWidget* ATConfigDialog::tab1( QWidget* parent ) {
QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
dialTimeSpin = new QSpinBox( returnWidget );
layout->addWidget( dialTimeLabel, 0, 0 );
layout->addWidget( dialTimeSpin, 0, 1 );
QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
delayRedialSpin = new QSpinBox( returnWidget );
layout->addWidget( delayRedialLabel, 1, 0 );
layout->addWidget( delayRedialSpin, 1, 1 );
QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
numberTriesSpin = new QSpinBox( returnWidget );
layout->addWidget( numberTriesLabel, 2, 0 );
layout->addWidget( numberTriesSpin, 2, 1 );
QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
dtrDropTimeSpin = new QSpinBox( returnWidget );
layout->addWidget( dtrDropTimeLabel, 3, 0 );
layout->addWidget( dtrDropTimeSpin, 3, 1 );
QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
bpsDetectBox = new QComboBox( returnWidget );
layout->addWidget( bpsDetectLabel, 4, 0 );
layout->addWidget( bpsDetectBox, 4, 1 );
bpsDetectBox->insertItem( tr("No") );
bpsDetectBox->insertItem( tr("Yes") );
QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
dcdLinesBox = new QComboBox( returnWidget );
layout->addWidget( dcdLinesLabel, 5, 0 );
layout->addWidget( dcdLinesBox, 5, 1 );
dcdLinesBox->insertItem( tr("No") );
dcdLinesBox->insertItem( tr("Yes") );
QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
multiLineUntagBox = new QComboBox( returnWidget );
layout->addWidget( multiLineUntagLabel, 6, 0 );
layout->addWidget( multiLineUntagBox, 6, 1 );
multiLineUntagBox->insertItem( tr("No") );
multiLineUntagBox->insertItem( tr("Yes") );
return returnWidget;
}
-void ATConfigDialog::readConfig() {
-/*
+void ATConfigDialog::readConfig( const Profile& config ) {
+
initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
- connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) );
+ connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
- dialTimeSpin;
- delayRedialSpin;
- numberTriesSpin;
- dtrDropTimeSpin;
- bpsDetectBox;
- cdLinesBox;
- multiLineUntagBox;
-*/
+ dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
+ delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
+ numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
+ dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
+ bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
+ dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
+ multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
}
-void ATConfigDialog::writeConfig() {
+void ATConfigDialog::writeConfig( Profile& config ) {
+
+ config.writeEntry( "InitString", initStringLine->text() );
+ config.writeEntry( "ResetString", resetStringLine->text() );
+ config.writeEntry( "DialPrefix1", dialPref1Line->text() );
+ config.writeEntry( "DialSuffix1", dialSuf1Line->text() );
+ config.writeEntry( "DialPrefix2", dialPref2Line->text() );
+ config.writeEntry( "DialSuffix2", dialSuf2Line->text() );
+ config.writeEntry( "DialPrefix3", dialPref3Line->text() );
+ config.writeEntry( "DialSuffix3", dialSuf3Line->text() );
+ config.writeEntry( "DefaultConnect", connectLine->text() );
+ config.writeEntry( "HangupString", hangupLine->text() );
+ config.writeEntry( "DialTime", dialTimeSpin->value() );
+ config.writeEntry( "DelayRedial", delayRedialSpin->value() );
+ config.writeEntry( "NumberTries", numberTriesSpin->value() );
+ config.writeEntry( "DTRDRopTime", dtrDropTimeSpin->value() );
+ config.writeEntry( "BPSDetect", bpsDetectBox->currentItem() );
+ config.writeEntry( "DCDLines", dcdLinesBox->currentItem() );
+ config.writeEntry( "MultiLineUntag", multiLineUntagBox->currentItem() );
}
ATConfigDialog::~ATConfigDialog() {
}
diff --git a/noncore/apps/opie-console/atconfigdialog.h b/noncore/apps/opie-console/atconfigdialog.h
index 47ff01d..4dd033b 100644
--- a/noncore/apps/opie-console/atconfigdialog.h
+++ b/noncore/apps/opie-console/atconfigdialog.h
@@ -1,68 +1,69 @@
#ifndef ATCONFIGDIALOG_H
#define ATCONFIGDIALOG_H
#include <qdialog.h>
+#include "profile.h"
#define MODEM_DEFAULT_INIT_STRING "~^M~ATZ^M~"
#define MODEM_DEFAULT_RESET_STRING "~^M~ATZ^M~"
#define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT"
#define MODEM_DEFAULT_DIAL_SUFFIX1 "^M"
#define MODEM_DEFAULT_DIAL_PREFIX2 "ATDP"
#define MODEM_DEFAULT_DIAL_SUFFIX2 "^M"
#define MODEM_DEFAULT_DIAL_PREFIX3 "ATX1DT"
#define MODEM_DEFAULT_DIAL_SUFFIX3 ";X4D^M"
#define MODEM_DEFAULT_CONNECT_STRING "CONNECT"
#define MODEM_DEFAULT_HANGUP_STRING "~~+++~~ATH^M"
#define MODEM_DEFAULT_CANCEL_STRING "^M"
#define MODEM_DEFAULT_DIAL_TIME 45
#define MODEM_DEFAULT_DELAY_REDIAL 2
#define MODEM_DEFAULT_NUMBER_TRIES 10
#define MODEM_DEFAULT_DTR_DROP_TIME 1
#define MODEM_DEFAULT_BPS_DETECT 0 // bool
#define MODEM_DEFAULT_DCD_LINES 1 //bool
#define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool
class QLineEdit;
class QSpinBox;
class QComboBox;
class ATConfigDialog : public QDialog {
Q_OBJECT
public:
ATConfigDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~ATConfigDialog();
- void readConfig();
- void writeConfig();
+ void readConfig( const Profile& );
+ void writeConfig( Profile& );
private:
QWidget *tab0( QWidget* parent);
QWidget *tab1( QWidget* parent);
private:
QLineEdit *initStringLine;
QLineEdit *resetStringLine;
QLineEdit *dialPref1Line;
QLineEdit *dialSuf1Line;
QLineEdit *dialPref2Line;
QLineEdit *dialSuf2Line;
QLineEdit *dialPref3Line;
QLineEdit *dialSuf3Line;
QLineEdit *connectLine;
QLineEdit *hangupLine;
QSpinBox *dialTimeSpin;
QSpinBox *delayRedialSpin;
QSpinBox *numberTriesSpin;
QSpinBox *dtrDropTimeSpin;
QComboBox *bpsDetectBox;
QComboBox *dcdLinesBox;
QComboBox *multiLineUntagBox;
};
#endif
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp
index 41febfb..eb0aeb7 100644
--- a/noncore/apps/opie-console/io_modem.cpp
+++ b/noncore/apps/opie-console/io_modem.cpp
@@ -4,70 +4,70 @@
#include "dialer.h"
IOModem:IOModem( const Profile &config ) : IOSerial( config ) {
m_config = config;
}
IOModem::~IOModem() {
}
void IOModem::close() {
IOSerial::close();
}
bool IOModem::open() {
IOSerial::open();
Dialer d(m_profile);
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.readEntry("DialTime" MODEM_DEFAULT_DIAL_TIME );
- m_delayRedial = config.readEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL );
- m_numberTries = config.readEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES );
- m_dtrDropTime = config.readEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
- m_bpsDetect = config.readEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
- m_dcdLines = config.readEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
- m_multiLineUntag = config.readEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
+ 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 );
+ m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME );
+ m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT );
+ m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES );
+ m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG );
}
QString IOModem::identifier() const {
return "modem";
}
QString IOModem::name() const {
return "Modem IO Layer";
}
void IOIrda::slotExited(OProcess* proc ){
close();
}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index bfd1c2e..27bcc09 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -271,68 +271,68 @@ void MainWindow::slotConfigure() {
int ret = conf.exec();
if ( QDialog::Accepted == ret ) {
qWarning("conf %d", conf.list().count() );
manager()->setProfiles( conf.list() );
populateProfiles();
}
}
/*
* we will remove
* this window from the tabwidget
* remove it from the list
* delete it
* and set the currentSession()
*/
void MainWindow::slotClose() {
qWarning("close");
if (!currentSession() )
return;
tabWidget()->remove( currentSession() );
/*it's autodelete */
m_sessions.remove( m_curSession );
m_curSession = m_sessions.first();
tabWidget()->setCurrent( m_curSession );
}
/*
* We will get the name
* Then the profile
* and then we will make a profile
*/
void MainWindow::slotProfile( int id) {
Profile prof = manager()->profile( m_sessionsPop->text( id) );
create( prof );
}
void MainWindow::create( const Profile& prof ) {
Session *ses = manager()->fromProfile( prof, tabWidget() );
m_sessions.append( ses );
tabWidget()->add( ses );
m_curSession = ses;
}
void MainWindow::slotTransfer()
{
- if ( currentSession() ) {
+ // if ( currentSession() ) {
TransferDialog dlg(this);
- //dlg.showMaximized();
+ dlg.showMaximized();
dlg.exec();
- }
+ // }
}
void MainWindow::slotOpenKeb(bool state) {
if (state) m_keyBar->show();
else m_keyBar->hide();
}
void MainWindow::slotSessionChanged( Session* ses ) {
if ( ses ) {
qWarning("changing %s", ses->name().latin1() );
m_curSession = ses;
}
}
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 0968f62..ac62e45 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,187 +1,188 @@
#include <qlabel.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qhbox.h>
-#include "iolayerbase.h"
+
#include "modemconfigwidget.h"
-#include "atconfigdialog.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,
+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 );
atButton->setText( tr("AT commands") );
connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
QPushButton *dialButton = new QPushButton( buttonBox );
dialButton->setText( tr("Enter number") );
connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
m_base = new IOLayerBase(this, "base");
m_lay->addWidget( m_device );
m_lay->addWidget( m_deviceCmb );
m_lay->addWidget( telLabel );
m_lay->addWidget( m_telNumber );
m_lay->addWidget( buttonBox );
m_lay->addWidget( m_base );
m_deviceCmb->insertItem( "/dev/ttyS0" );
m_deviceCmb->insertItem( "/dev/ttyS1" );
m_deviceCmb->insertItem( "/dev/ttyS2" );
-
+ atConf = new ATConfigDialog( this, "ATConfig", true );
}
ModemConfigWidget::~ModemConfigWidget() {
}
void ModemConfigWidget::load( const Profile& prof ) {
int rad_flow = prof.readNumEntry("Flow");
int rad_parity = prof.readNumEntry("Parity");
int speed = prof.readNumEntry("Speed");
QString number = prof.readEntry("Number");
if (!number.isEmpty() ) {
m_telNumber->setText( number );
}
if (rad_flow == 1) {
m_base->setFlow( IOLayerBase::Hardware );
} else if (rad_flow == 2) {
m_base->setFlow( IOLayerBase::Software );
} else if (rad_flow == 0) {
m_base->setFlow( IOLayerBase::None );
}
if (rad_parity == 1) {
m_base->setParity( IOLayerBase::Even );
} else {
m_base->setParity( IOLayerBase::Odd );
}
switch( speed ) {
case 115200:
m_base->setSpeed(IOLayerBase::Baud_115200 );
break;
case 57600:
m_base->setSpeed( IOLayerBase::Baud_57600 );
break;
case 38400:
m_base->setSpeed(IOLayerBase::Baud_38400 );
break;
case 19200:
m_base->setSpeed( IOLayerBase::Baud_19200 );
break;
case 9600:
default:
m_base->setSpeed(IOLayerBase::Baud_9600 );
break;
}
- if ( prof.readEntry("Device").isEmpty() ) return;
+ if ( prof.readEntry( "Device" ).isEmpty() ) {
+ return;
+ }
setCurrent( prof.readEntry("Device"), m_deviceCmb );
+ atConf->readConfig( prof );
}
+
/*
* save speed,
* flow,
* parity
*/
void ModemConfigWidget::save( Profile& prof ) {
int flow, parity, speed;
prof.writeEntry("Device", m_deviceCmb->currentText() );
switch( m_base->flow() ) {
case IOLayerBase::None:
flow = 0;
break;
case IOLayerBase::Software:
flow = 2;
break;
case IOLayerBase::Hardware:
flow = 1;
break;
}
switch( m_base->parity() ) {
case IOLayerBase::Odd:
parity = 2;
break;
case IOLayerBase::Even:
parity = 1;
break;
}
switch( m_base->speed() ) {
case IOLayerBase::Baud_115200:
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 );
- conf.readConfig();
- conf.showMaximized();
- if ( conf.exec() == QDialog::Accepted ) {
- conf.writeConfig();
+ // ATConfigDialog conf( this, "ATConfig", true );
+ atConf->showMaximized();
+ if ( atConf->exec() == QDialog::Accepted ) {
+ // atConf->writeConfig();
}
}
void ModemConfigWidget::slotDial() {
DialDialog dial( this, "DialConfig", true );
dial.showMaximized();
if ( dial.exec() == QDialog::Accepted ) {
m_telNumber->setText( dial.number() );
}
}
diff --git a/noncore/apps/opie-console/modemconfigwidget.h b/noncore/apps/opie-console/modemconfigwidget.h
index 1363f78..4fdde0c 100644
--- a/noncore/apps/opie-console/modemconfigwidget.h
+++ b/noncore/apps/opie-console/modemconfigwidget.h
@@ -1,36 +1,36 @@
#ifndef OPIE_MODEM_CONFIG_WIDGET_H
#define OPIE_MODEM_CONFIG_WIDGET_H
#include "profiledialogwidget.h"
-
+#include "iolayerbase.h"
+#include "atconfigdialog.h"
class QVBoxLayout;
class QLabel;
class QComboBox;
class QLineEdit;
class IOLayerBase;
class ModemConfigWidget : public ProfileDialogConnectionWidget {
Q_OBJECT
public:
ModemConfigWidget( const QString& name, QWidget* parent, const char* name = 0l );
~ModemConfigWidget();
void load( const Profile& );
void save( Profile& );
private:
QVBoxLayout* m_lay;
QLabel* m_device;
QComboBox* m_deviceCmb;
IOLayerBase* m_base;
QLineEdit* m_telNumber;
-
-
+ ATConfigDialog *atConf;
private slots:
void slotAT();
void slotDial();
};
#endif