summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/modemconfigwidget.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/modemconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/modemconfigwidget.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 3466e3a..9fdaf73 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,36 +1,39 @@
1#include "modemconfigwidget.h"
2#include "dialdialog.h"
1 3
4/* OPIE */
5#include <opie2/odebug.h>
2#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7using namespace Opie::Core;
3 8
9/* QT */
4#include <qlabel.h> 10#include <qlabel.h>
5#include <qlayout.h> 11#include <qlayout.h>
6#include <qcombobox.h> 12#include <qcombobox.h>
7#include <qpushbutton.h> 13#include <qpushbutton.h>
8#include <qhbox.h> 14#include <qhbox.h>
9 15
10#include "modemconfigwidget.h"
11#include "dialdialog.h"
12
13namespace { 16namespace {
14 void setCurrent( const QString& str, QComboBox* bo ) { 17 void setCurrent( const QString& str, QComboBox* bo ) {
15 uint b = bo->count(); 18 uint b = bo->count();
16 for (int i = 0; i < bo->count(); i++ ) { 19 for (int i = 0; i < bo->count(); i++ ) {
17 if ( bo->text(i) == str ) { 20 if ( bo->text(i) == str ) {
18 bo->setCurrentItem( i ); 21 bo->setCurrentItem( i );
19 return; 22 return;
20 } 23 }
21 } 24 }
22 bo->insertItem( str ); 25 bo->insertItem( str );
23 bo->setCurrentItem( b ); 26 bo->setCurrentItem( b );
24 } 27 }
25} 28}
26 29
27ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, 30ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent,
28 const char* na ) 31 const char* na )
29 : ProfileDialogConnectionWidget( name, parent, na ) { 32 : ProfileDialogConnectionWidget( name, parent, na ) {
30 33
31 m_lay = new QVBoxLayout( this ); 34 m_lay = new QVBoxLayout( this );
32 m_device = new QLabel(tr( "Modem is attached to:" ), this ); 35 m_device = new QLabel(tr( "Modem is attached to:" ), this );
33 m_deviceCmb = new QComboBox(this ); 36 m_deviceCmb = new QComboBox(this );
34 m_deviceCmb->setEditable( TRUE ); 37 m_deviceCmb->setEditable( TRUE );
35 38
36 QLabel* telLabel = new QLabel( this ); 39 QLabel* telLabel = new QLabel( this );
@@ -114,49 +117,49 @@ void ModemConfigWidget::load( const Profile& prof ) {
114 } 117 }
115 118
116 119
117 if ( dbits == 5) { 120 if ( dbits == 5) {
118 m_base->setData( IOLayerBase::Data_Five ); 121 m_base->setData( IOLayerBase::Data_Five );
119 } else if (rad_flow == 6) { 122 } else if (rad_flow == 6) {
120 m_base->setData( IOLayerBase::Data_Six ); 123 m_base->setData( IOLayerBase::Data_Six );
121 } else if (rad_flow == 7) { 124 } else if (rad_flow == 7) {
122 m_base->setData( IOLayerBase::Data_Seven ); 125 m_base->setData( IOLayerBase::Data_Seven );
123 } else { 126 } else {
124 m_base->setData( IOLayerBase::Data_Eight ); 127 m_base->setData( IOLayerBase::Data_Eight );
125 } 128 }
126 129
127 if ( sbits == 2) { 130 if ( sbits == 2) {
128 m_base->setStop( IOLayerBase::Stop_Two ); 131 m_base->setStop( IOLayerBase::Stop_Two );
129 } else if ( sbits == 15 ) { 132 } else if ( sbits == 15 ) {
130 m_base->setStop( IOLayerBase::Stop_OnePointFive ); 133 m_base->setStop( IOLayerBase::Stop_OnePointFive );
131 } else { 134 } else {
132 m_base->setStop( IOLayerBase::Stop_One ); 135 m_base->setStop( IOLayerBase::Stop_One );
133 } 136 }
134 137
135 138
136 atConf->readConfig( prof ); 139 atConf->readConfig( prof );
137 if ( prof.readEntry( "Device" ).isEmpty() ) { 140 if ( prof.readEntry( "Device" ).isEmpty() ) {
138 qWarning("device empty!"); 141 owarn << "device empty!" << oendl;
139 return; 142 return;
140 } 143 }
141 setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); 144 setCurrent( prof.readEntry( "Device" ), m_deviceCmb );
142 145
143 146
144} 147}
145 148
146/* 149/*
147 * save speed, 150 * save speed,
148 * flow, 151 * flow,
149 * parity 152 * parity
150 */ 153 */
151void ModemConfigWidget::save( Profile& prof ) { 154void ModemConfigWidget::save( Profile& prof ) {
152 int flow, parity, speed, data, stop; 155 int flow, parity, speed, data, stop;
153 flow = parity = speed = data = stop = 0; 156 flow = parity = speed = data = stop = 0;
154 prof.writeEntry( "Device", m_deviceCmb->currentText() ); 157 prof.writeEntry( "Device", m_deviceCmb->currentText() );
155 158
156 159
157 switch( m_base->flow() ) { 160 switch( m_base->flow() ) {
158 case IOLayerBase::None: 161 case IOLayerBase::None:
159 flow = 0; 162 flow = 0;
160 break; 163 break;
161 case IOLayerBase::Software: 164 case IOLayerBase::Software:
162 flow = 2; 165 flow = 2;