author | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-25 18:48:25 (UTC) |
commit | 4151cc12a6c37cbec4bb6883204703eec2fb8648 (patch) (unidiff) | |
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 | |||
@@ -31,33 +31,33 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | |||
31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); | 31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
32 | m_deviceCmb = new QComboBox(this ); | 32 | m_deviceCmb = new QComboBox(this ); |
33 | m_deviceCmb->setEditable( TRUE ); | 33 | m_deviceCmb->setEditable( TRUE ); |
34 | 34 | ||
35 | QLabel* telLabel = new QLabel( this ); | 35 | QLabel* telLabel = new QLabel( this ); |
36 | telLabel->setText( tr( "Enter telefon number here:" ) ); | 36 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
37 | m_telNumber = new QLineEdit( this ); | 37 | // m_telNumber = new QLineEdit( this ); |
38 | QHBox *buttonBox = new QHBox( this ); | 38 | QHBox *buttonBox = new QHBox( this ); |
39 | m_telNumber = new QLineEdit( buttonBox ); | ||
39 | QPushButton *atButton = new QPushButton( buttonBox ); | 40 | QPushButton *atButton = new QPushButton( buttonBox ); |
40 | atButton->setText( tr( "AT commands" ) ); | 41 | atButton->setText( tr( "AT commands" ) ); |
41 | // disabled for now | 42 | // disabled for now |
42 | atButton->hide(); | 43 | atButton->hide(); |
43 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 44 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
44 | 45 | ||
45 | QPushButton *dialButton = new QPushButton( buttonBox ); | 46 | QPushButton *dialButton = new QPushButton( buttonBox ); |
46 | dialButton->setText( tr( "Enter number" ) ); | 47 | dialButton->setText( tr( "Enter number" ) ); |
47 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 48 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
48 | 49 | ||
49 | |||
50 | m_base = new IOLayerBase( this, "base" ); | 50 | m_base = new IOLayerBase( this, "base" ); |
51 | 51 | ||
52 | m_lay->addWidget( m_device ); | 52 | m_lay->addWidget( m_device ); |
53 | m_lay->addWidget( m_deviceCmb ); | 53 | m_lay->addWidget( m_deviceCmb ); |
54 | m_lay->addWidget( telLabel ); | 54 | m_lay->addWidget( telLabel ); |
55 | m_lay->addWidget( m_telNumber ); | ||
56 | m_lay->addWidget( buttonBox ); | 55 | m_lay->addWidget( buttonBox ); |
57 | m_lay->addWidget( m_base ); | 56 | m_lay->addWidget( m_base ); |
57 | m_lay->addStretch( 0 ); | ||
58 | 58 | ||
59 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 59 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); | 61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); |
62 | 62 | ||
63 | atConf = new ATConfigDialog( this, "ATConfig", true ); | 63 | atConf = new ATConfigDialog( this, "ATConfig", true ); |
@@ -68,12 +68,14 @@ ModemConfigWidget::~ModemConfigWidget() { | |||
68 | } | 68 | } |
69 | void ModemConfigWidget::load( const Profile& prof ) { | 69 | void ModemConfigWidget::load( const Profile& prof ) { |
70 | 70 | ||
71 | int rad_flow = prof.readNumEntry( "Flow" ); | 71 | int rad_flow = prof.readNumEntry( "Flow" ); |
72 | int rad_parity = prof.readNumEntry( "Parity" ); | 72 | int rad_parity = prof.readNumEntry( "Parity" ); |
73 | int speed = prof.readNumEntry( "Speed" ); | 73 | int speed = prof.readNumEntry( "Speed" ); |
74 | int dbits = prof.readNumEntry("DataBits"); | ||
75 | int sbits = prof.readNumEntry("StopBits"); | ||
74 | QString number = prof.readEntry( "Number" ); | 76 | QString number = prof.readEntry( "Number" ); |
75 | 77 | ||
76 | if ( !number.isEmpty() ) { | 78 | if ( !number.isEmpty() ) { |
77 | m_telNumber->setText( number ); | 79 | m_telNumber->setText( number ); |
78 | } | 80 | } |
79 | 81 | ||
@@ -110,12 +112,33 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
110 | case 9600: | 112 | case 9600: |
111 | default: | 113 | default: |
112 | m_base->setSpeed( IOLayerBase::Baud_9600 ); | 114 | m_base->setSpeed( IOLayerBase::Baud_9600 ); |
113 | break; | 115 | break; |
114 | } | 116 | } |
115 | 117 | ||
118 | |||
119 | if ( dbits == 5) { | ||
120 | m_base->setData( IOLayerBase::Data_Five ); | ||
121 | } else if (rad_flow == 6) { | ||
122 | m_base->setData( IOLayerBase::Data_Six ); | ||
123 | } else if (rad_flow == 7) { | ||
124 | m_base->setData( IOLayerBase::Data_Seven ); | ||
125 | } else { | ||
126 | m_base->setData( IOLayerBase::Data_Eight ); | ||
127 | } | ||
128 | |||
129 | if ( sbits == 2) { | ||
130 | m_base->setStop( IOLayerBase::Stop_Two ); | ||
131 | } else if ( sbits == 15 ) { | ||
132 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | ||
133 | } else { | ||
134 | m_base->setStop( IOLayerBase::Stop_One ); | ||
135 | } | ||
136 | |||
137 | |||
138 | |||
116 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 139 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
117 | return; | 140 | return; |
118 | } | 141 | } |
119 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 142 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
120 | 143 | ||
121 | atConf->readConfig( prof ); | 144 | atConf->readConfig( prof ); |
@@ -124,14 +147,14 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
124 | /* | 147 | /* |
125 | * save speed, | 148 | * save speed, |
126 | * flow, | 149 | * flow, |
127 | * parity | 150 | * parity |
128 | */ | 151 | */ |
129 | void ModemConfigWidget::save( Profile& prof ) { | 152 | void ModemConfigWidget::save( Profile& prof ) { |
130 | int flow, parity, speed; | 153 | int flow, parity, speed, data, stop; |
131 | flow = parity = speed = 0; | 154 | flow = parity = speed = data = stop = 0; |
132 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 155 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
133 | 156 | ||
134 | 157 | ||
135 | switch( m_base->flow() ) { | 158 | switch( m_base->flow() ) { |
136 | case IOLayerBase::None: | 159 | case IOLayerBase::None: |
137 | flow = 0; | 160 | flow = 0; |
@@ -171,15 +194,44 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
171 | break; | 194 | break; |
172 | case IOLayerBase::Baud_9600: | 195 | case IOLayerBase::Baud_9600: |
173 | speed = 9600; | 196 | speed = 9600; |
174 | break; | 197 | break; |
175 | } | 198 | } |
176 | 199 | ||
200 | switch( m_base->data() ) { | ||
201 | case IOLayerBase::Data_Five: | ||
202 | data = 5; | ||
203 | break; | ||
204 | case IOLayerBase::Data_Six: | ||
205 | data = 6; | ||
206 | break; | ||
207 | case IOLayerBase::Data_Seven: | ||
208 | data = 7; | ||
209 | break; | ||
210 | case IOLayerBase::Data_Eight: | ||
211 | data = 8; | ||
212 | break; | ||
213 | } | ||
214 | |||
215 | switch( m_base->stop() ) { | ||
216 | case IOLayerBase::Stop_One: | ||
217 | stop = 1; | ||
218 | break; | ||
219 | case IOLayerBase::Stop_OnePointFive: | ||
220 | stop = 15; | ||
221 | break; | ||
222 | case IOLayerBase::Stop_Two: | ||
223 | stop = 2; | ||
224 | break; | ||
225 | } | ||
226 | |||
177 | prof.writeEntry( "Flow", flow ); | 227 | prof.writeEntry( "Flow", flow ); |
178 | prof.writeEntry( "Parity", parity ); | 228 | prof.writeEntry( "Parity", parity ); |
179 | prof.writeEntry( "Speed", speed ); | 229 | prof.writeEntry( "Speed", speed ); |
230 | prof.writeEntry("DataBits", data); | ||
231 | prof.writeEntry("StopBits", stop); | ||
180 | prof.writeEntry( "Number", m_telNumber->text() ); | 232 | prof.writeEntry( "Number", m_telNumber->text() ); |
181 | 233 | ||
182 | 234 | ||
183 | atConf->writeConfig(prof); | 235 | atConf->writeConfig(prof); |
184 | } | 236 | } |
185 | 237 | ||