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.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp
index 0f0ce7c..878b0cf 100644
--- a/noncore/apps/opie-console/modemconfigwidget.cpp
+++ b/noncore/apps/opie-console/modemconfigwidget.cpp
@@ -1,55 +1,55 @@
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 7#include <qregexp.h>
8 8
9#include "modemconfigwidget.h" 9#include "modemconfigwidget.h"
10#include "dialdialog.h" 10#include "dialdialog.h"
11 11
12namespace { 12namespace {
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 (uint i = 0; i < bo->count(); i++ ) { 15 for (uint 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
26ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, 26ModemConfigWidget::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 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); 41 connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) );
42 42
43 QPushButton *dialButton = new QPushButton( buttonBox ); 43 QPushButton *dialButton = new QPushButton( buttonBox );
44 dialButton->setText( tr( "Enter number" ) ); 44 dialButton->setText( tr( "Enter number" ) );
45 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); 45 connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) );
46 46
47 47
48 m_base = new IOLayerBase( this, "base" ); 48 m_base = new IOLayerBase( this, "base" );
49 49
50 m_lay->addWidget( m_device ); 50 m_lay->addWidget( m_device );
51 m_lay->addWidget( m_deviceCmb ); 51 m_lay->addWidget( m_deviceCmb );
52 m_lay->addWidget( telLabel ); 52 m_lay->addWidget( telLabel );
53 m_lay->addWidget( m_telNumber ); 53 m_lay->addWidget( m_telNumber );
54 m_lay->addWidget( buttonBox ); 54 m_lay->addWidget( buttonBox );
55 m_lay->addWidget( m_base ); 55 m_lay->addWidget( m_base );
@@ -142,53 +142,56 @@ void ModemConfigWidget::save( Profile& prof ) {
142 } 142 }
143 143
144 switch( m_base->parity() ) { 144 switch( m_base->parity() ) {
145 case IOLayerBase::Odd: 145 case IOLayerBase::Odd:
146 parity = 2; 146 parity = 2;
147 break; 147 break;
148 case IOLayerBase::Even: 148 case IOLayerBase::Even:
149 parity = 1; 149 parity = 1;
150 break; 150 break;
151 case IOLayerBase::NonePar: 151 case IOLayerBase::NonePar:
152 parity = 0; 152 parity = 0;
153 break; 153 break;
154 } 154 }
155 155
156 switch( m_base->speed() ) { 156 switch( m_base->speed() ) {
157 case IOLayerBase::Baud_115200: 157 case IOLayerBase::Baud_115200:
158 speed = 115200; 158 speed = 115200;
159 break; 159 break;
160 case IOLayerBase::Baud_57600: 160 case IOLayerBase::Baud_57600:
161 speed = 57600; 161 speed = 57600;
162 break; 162 break;
163 case IOLayerBase::Baud_38400: 163 case IOLayerBase::Baud_38400:
164 speed = 38400; 164 speed = 38400;
165 break; 165 break;
166 case IOLayerBase::Baud_19200: 166 case IOLayerBase::Baud_19200:
167 speed = 19200; 167 speed = 19200;
168 break; 168 break;
169 case IOLayerBase::Baud_9600: 169 case IOLayerBase::Baud_9600:
170 speed = 9600; 170 speed = 9600;
171 break; 171 break;
172 } 172 }
173 173
174 prof.writeEntry( "Flow", flow ); 174 prof.writeEntry( "Flow", flow );
175 prof.writeEntry( "Parity", parity ); 175 prof.writeEntry( "Parity", parity );
176 prof.writeEntry( "Speed", speed ); 176 prof.writeEntry( "Speed", speed );
177 prof.writeEntry( "Number", m_telNumber->text() ); 177 prof.writeEntry( "Number", m_telNumber->text() );
178} 178}
179 179
180void ModemConfigWidget::slotAT() { 180void ModemConfigWidget::slotAT() {
181 // ATConfigDialog conf( this, "ATConfig", true ); 181 // ATConfigDialog conf( this, "ATConfig", true );
182 atConf->showMaximized(); 182 atConf->showMaximized();
183 if ( atConf->exec() == QDialog::Accepted ) { 183 if ( atConf->exec() == QDialog::Accepted ) {
184 // atConf->writeConfig(); 184 // atConf->writeConfig();
185 } 185 }
186} 186}
187 187
188void ModemConfigWidget::slotDial() { 188void ModemConfigWidget::slotDial() {
189 DialDialog dial( this, "DialConfig", true ); 189 DialDialog dial( this, "DialConfig", true );
190 if(!m_telNumber->text().isEmpty()) {
191 dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ ]"), "").toInt());
192 }
190 dial.showMaximized(); 193 dial.showMaximized();
191 if ( dial.exec() == QDialog::Accepted ) { 194 if ( dial.exec() == QDialog::Accepted ) {
192 m_telNumber->setText( dial.number() ); 195 m_telNumber->setText( dial.number() );
193 } 196 }
194} 197}