author | harlekin <harlekin> | 2002-10-24 20:52:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-24 20:52:03 (UTC) |
commit | 83bbc4077376e433f40f2632181a97e5ff8892b1 (patch) (unidiff) | |
tree | b663506b4621f351320adc097410de9d1492eda4 | |
parent | 1a6931804e0b1d838f365f75385a462110da3972 (diff) | |
download | opie-83bbc4077376e433f40f2632181a97e5ff8892b1.zip opie-83bbc4077376e433f40f2632181a97e5ff8892b1.tar.gz opie-83bbc4077376e433f40f2632181a97e5ff8892b1.tar.bz2 |
disable at config widget for now
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index c37fafd..da5db83 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,168 +1,169 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qhbox.h> | 6 | #include <qhbox.h> |
7 | #include <qregexp.h> | 7 | #include <qregexp.h> |
8 | 8 | ||
9 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
10 | #include "dialdialog.h" | 10 | #include "dialdialog.h" |
11 | 11 | ||
12 | namespace { | 12 | namespace { |
13 | void setCurrent( const QString& str, QComboBox* bo ) { | 13 | void setCurrent( const QString& str, QComboBox* bo ) { |
14 | uint b = bo->count(); | 14 | uint b = bo->count(); |
15 | for (int i = 0; i < bo->count(); i++ ) { | 15 | for (int i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 16 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 17 | bo->setCurrentItem( i ); |
18 | return; | 18 | return; |
19 | } | 19 | } |
20 | } | 20 | } |
21 | bo->insertItem( str ); | 21 | bo->insertItem( str ); |
22 | bo->setCurrentItem( b ); | 22 | bo->setCurrentItem( b ); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | 26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
27 | const char* na ) | 27 | const char* na ) |
28 | : ProfileDialogConnectionWidget( name, parent, na ) { | 28 | : ProfileDialogConnectionWidget( name, parent, na ) { |
29 | 29 | ||
30 | m_lay = new QVBoxLayout( this ); | 30 | m_lay = new QVBoxLayout( this ); |
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 | QPushButton *atButton = new QPushButton( buttonBox ); | 39 | QPushButton *atButton = new QPushButton( buttonBox ); |
40 | atButton->setText( tr( "AT commands" ) ); | 40 | atButton->setText( tr( "AT commands" ) ); |
41 | atButton->hide(); | ||
41 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 42 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
42 | 43 | ||
43 | QPushButton *dialButton = new QPushButton( buttonBox ); | 44 | QPushButton *dialButton = new QPushButton( buttonBox ); |
44 | dialButton->setText( tr( "Enter number" ) ); | 45 | dialButton->setText( tr( "Enter number" ) ); |
45 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 46 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
46 | 47 | ||
47 | 48 | ||
48 | m_base = new IOLayerBase( this, "base" ); | 49 | m_base = new IOLayerBase( this, "base" ); |
49 | 50 | ||
50 | m_lay->addWidget( m_device ); | 51 | m_lay->addWidget( m_device ); |
51 | m_lay->addWidget( m_deviceCmb ); | 52 | m_lay->addWidget( m_deviceCmb ); |
52 | m_lay->addWidget( telLabel ); | 53 | m_lay->addWidget( telLabel ); |
53 | m_lay->addWidget( m_telNumber ); | 54 | m_lay->addWidget( m_telNumber ); |
54 | m_lay->addWidget( buttonBox ); | 55 | m_lay->addWidget( buttonBox ); |
55 | m_lay->addWidget( m_base ); | 56 | m_lay->addWidget( m_base ); |
56 | 57 | ||
57 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 58 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
58 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 59 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
59 | m_deviceCmb->insertItem( "/dev/ttyS2" ); | 60 | m_deviceCmb->insertItem( "/dev/ttyS2" ); |
60 | 61 | ||
61 | atConf = new ATConfigDialog( this, "ATConfig", true ); | 62 | atConf = new ATConfigDialog( this, "ATConfig", true ); |
62 | } | 63 | } |
63 | 64 | ||
64 | ModemConfigWidget::~ModemConfigWidget() { | 65 | ModemConfigWidget::~ModemConfigWidget() { |
65 | 66 | ||
66 | } | 67 | } |
67 | void ModemConfigWidget::load( const Profile& prof ) { | 68 | void ModemConfigWidget::load( const Profile& prof ) { |
68 | 69 | ||
69 | int rad_flow = prof.readNumEntry( "Flow" ); | 70 | int rad_flow = prof.readNumEntry( "Flow" ); |
70 | int rad_parity = prof.readNumEntry( "Parity" ); | 71 | int rad_parity = prof.readNumEntry( "Parity" ); |
71 | int speed = prof.readNumEntry( "Speed" ); | 72 | int speed = prof.readNumEntry( "Speed" ); |
72 | QString number = prof.readEntry( "Number" ); | 73 | QString number = prof.readEntry( "Number" ); |
73 | 74 | ||
74 | if ( !number.isEmpty() ) { | 75 | if ( !number.isEmpty() ) { |
75 | m_telNumber->setText( number ); | 76 | m_telNumber->setText( number ); |
76 | } | 77 | } |
77 | 78 | ||
78 | if ( rad_flow == 1 ) { | 79 | if ( rad_flow == 1 ) { |
79 | m_base->setFlow( IOLayerBase::Hardware ); | 80 | m_base->setFlow( IOLayerBase::Hardware ); |
80 | } else if (rad_flow == 2) { | 81 | } else if (rad_flow == 2) { |
81 | m_base->setFlow( IOLayerBase::Software ); | 82 | m_base->setFlow( IOLayerBase::Software ); |
82 | } else if (rad_flow == 0) { | 83 | } else if (rad_flow == 0) { |
83 | m_base->setFlow( IOLayerBase::None ); | 84 | m_base->setFlow( IOLayerBase::None ); |
84 | } | 85 | } |
85 | 86 | ||
86 | 87 | ||
87 | if ( rad_parity == 1 ) { | 88 | if ( rad_parity == 1 ) { |
88 | m_base->setParity( IOLayerBase::Even ); | 89 | m_base->setParity( IOLayerBase::Even ); |
89 | } else if ( rad_parity == 2 ){ | 90 | } else if ( rad_parity == 2 ){ |
90 | m_base->setParity( IOLayerBase::Odd ); | 91 | m_base->setParity( IOLayerBase::Odd ); |
91 | } else { | 92 | } else { |
92 | m_base->setParity( IOLayerBase::NonePar ); | 93 | m_base->setParity( IOLayerBase::NonePar ); |
93 | } | 94 | } |
94 | 95 | ||
95 | switch( speed ) { | 96 | switch( speed ) { |
96 | case 115200: | 97 | case 115200: |
97 | m_base->setSpeed( IOLayerBase::Baud_115200 ); | 98 | m_base->setSpeed( IOLayerBase::Baud_115200 ); |
98 | break; | 99 | break; |
99 | case 57600: | 100 | case 57600: |
100 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 101 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
101 | break; | 102 | break; |
102 | case 38400: | 103 | case 38400: |
103 | m_base->setSpeed( IOLayerBase::Baud_38400 ); | 104 | m_base->setSpeed( IOLayerBase::Baud_38400 ); |
104 | break; | 105 | break; |
105 | case 19200: | 106 | case 19200: |
106 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 107 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
107 | break; | 108 | break; |
108 | case 9600: | 109 | case 9600: |
109 | default: | 110 | default: |
110 | m_base->setSpeed( IOLayerBase::Baud_9600 ); | 111 | m_base->setSpeed( IOLayerBase::Baud_9600 ); |
111 | break; | 112 | break; |
112 | } | 113 | } |
113 | 114 | ||
114 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 115 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
115 | return; | 116 | return; |
116 | } | 117 | } |
117 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 118 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
118 | 119 | ||
119 | atConf->readConfig( prof ); | 120 | atConf->readConfig( prof ); |
120 | } | 121 | } |
121 | 122 | ||
122 | /* | 123 | /* |
123 | * save speed, | 124 | * save speed, |
124 | * flow, | 125 | * flow, |
125 | * parity | 126 | * parity |
126 | */ | 127 | */ |
127 | void ModemConfigWidget::save( Profile& prof ) { | 128 | void ModemConfigWidget::save( Profile& prof ) { |
128 | int flow, parity, speed; | 129 | int flow, parity, speed; |
129 | flow = parity = speed = 0; | 130 | flow = parity = speed = 0; |
130 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 131 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
131 | 132 | ||
132 | 133 | ||
133 | switch( m_base->flow() ) { | 134 | switch( m_base->flow() ) { |
134 | case IOLayerBase::None: | 135 | case IOLayerBase::None: |
135 | flow = 0; | 136 | flow = 0; |
136 | break; | 137 | break; |
137 | case IOLayerBase::Software: | 138 | case IOLayerBase::Software: |
138 | flow = 2; | 139 | flow = 2; |
139 | break; | 140 | break; |
140 | case IOLayerBase::Hardware: | 141 | case IOLayerBase::Hardware: |
141 | flow = 1; | 142 | flow = 1; |
142 | break; | 143 | break; |
143 | } | 144 | } |
144 | 145 | ||
145 | switch( m_base->parity() ) { | 146 | switch( m_base->parity() ) { |
146 | case IOLayerBase::Odd: | 147 | case IOLayerBase::Odd: |
147 | parity = 2; | 148 | parity = 2; |
148 | break; | 149 | break; |
149 | case IOLayerBase::Even: | 150 | case IOLayerBase::Even: |
150 | parity = 1; | 151 | parity = 1; |
151 | break; | 152 | break; |
152 | case IOLayerBase::NonePar: | 153 | case IOLayerBase::NonePar: |
153 | parity = 0; | 154 | parity = 0; |
154 | break; | 155 | break; |
155 | } | 156 | } |
156 | 157 | ||
157 | switch( m_base->speed() ) { | 158 | switch( m_base->speed() ) { |
158 | case IOLayerBase::Baud_115200: | 159 | case IOLayerBase::Baud_115200: |
159 | speed = 115200; | 160 | speed = 115200; |
160 | break; | 161 | break; |
161 | case IOLayerBase::Baud_57600: | 162 | case IOLayerBase::Baud_57600: |
162 | speed = 57600; | 163 | speed = 57600; |
163 | break; | 164 | break; |
164 | case IOLayerBase::Baud_38400: | 165 | case IOLayerBase::Baud_38400: |
165 | speed = 38400; | 166 | speed = 38400; |
166 | break; | 167 | break; |
167 | case IOLayerBase::Baud_19200: | 168 | case IOLayerBase::Baud_19200: |
168 | speed = 19200; | 169 | speed = 19200; |