author | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
commit | 4151cc12a6c37cbec4bb6883204703eec2fb8648 (patch) (side-by-side diff) | |
tree | f7e81dc7de747628225ae4627c7cf3028183441a /noncore/apps/opie-console/modemconfigwidget.cpp | |
parent | e8c4383915db7ed6f47899945404247b1fd5c3c4 (diff) | |
download | opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.zip opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.gz opie-4151cc12a6c37cbec4bb6883204703eec2fb8648.tar.bz2 |
added data bits and stop bits
Diffstat (limited to 'noncore/apps/opie-console/modemconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index ec83b9f..ce44dab 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp @@ -25,61 +25,63 @@ namespace { 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 ); + // m_telNumber = new QLineEdit( this ); QHBox *buttonBox = new QHBox( this ); + m_telNumber = new QLineEdit( buttonBox ); QPushButton *atButton = new QPushButton( buttonBox ); atButton->setText( tr( "AT commands" ) ); // disabled for now atButton->hide(); 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_lay->addStretch( 0 ); 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" ); + int dbits = prof.readNumEntry("DataBits"); + int sbits = prof.readNumEntry("StopBits"); 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 ); @@ -104,40 +106,61 @@ void ModemConfigWidget::load( const Profile& prof ) { 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 ( dbits == 5) { + m_base->setData( IOLayerBase::Data_Five ); + } else if (rad_flow == 6) { + m_base->setData( IOLayerBase::Data_Six ); + } else if (rad_flow == 7) { + m_base->setData( IOLayerBase::Data_Seven ); + } else { + m_base->setData( IOLayerBase::Data_Eight ); + } + + if ( sbits == 2) { + m_base->setStop( IOLayerBase::Stop_Two ); + } else if ( sbits == 15 ) { + m_base->setStop( IOLayerBase::Stop_OnePointFive ); + } else { + m_base->setStop( IOLayerBase::Stop_One ); + } + + + 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; - flow = parity = speed = 0; + int flow, parity, speed, data, stop; + flow = parity = speed = data = stop = 0; 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; @@ -165,27 +188,56 @@ void ModemConfigWidget::save( Profile& prof ) { break; case IOLayerBase::Baud_38400: speed = 38400; break; case IOLayerBase::Baud_19200: speed = 19200; break; case IOLayerBase::Baud_9600: speed = 9600; break; } + switch( m_base->data() ) { + case IOLayerBase::Data_Five: + data = 5; + break; + case IOLayerBase::Data_Six: + data = 6; + break; + case IOLayerBase::Data_Seven: + data = 7; + break; + case IOLayerBase::Data_Eight: + data = 8; + break; + } + + switch( m_base->stop() ) { + case IOLayerBase::Stop_One: + stop = 1; + break; + case IOLayerBase::Stop_OnePointFive: + stop = 15; + break; + case IOLayerBase::Stop_Two: + stop = 2; + break; + } + prof.writeEntry( "Flow", flow ); prof.writeEntry( "Parity", parity ); prof.writeEntry( "Speed", speed ); + prof.writeEntry("DataBits", data); + prof.writeEntry("StopBits", stop); prof.writeEntry( "Number", m_telNumber->text() ); atConf->writeConfig(prof); } void ModemConfigWidget::slotAT() { // ATConfigDialog conf( this, "ATConfig", true ); atConf->showMaximized(); if ( atConf->exec() != QDialog::Accepted ) { // reload old settings } |