-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,88 +1,89 @@ | |||
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 ); |