author | harlekin <harlekin> | 2002-10-13 21:10:15 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-13 21:10:15 (UTC) |
commit | 5a6ecdac2e62708b55300ca6eef8441fea0a7b05 (patch) (unidiff) | |
tree | 003577346dc8f9c73f1d86d8dd9d5038d6995662 /noncore/apps/opie-console/modemconfigwidget.cpp | |
parent | 03c81e6d55d1a837e543a00f6e0a7334e96f1eef (diff) | |
download | opie-5a6ecdac2e62708b55300ca6eef8441fea0a7b05.zip opie-5a6ecdac2e62708b55300ca6eef8441fea0a7b05.tar.gz opie-5a6ecdac2e62708b55300ca6eef8441fea0a7b05.tar.bz2 |
fixes to modem stuff
Diffstat (limited to 'noncore/apps/opie-console/modemconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 0968f62..ac62e45 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -5,9 +5,8 @@ | |||
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qhbox.h> | 6 | #include <qhbox.h> |
7 | 7 | ||
8 | #include "iolayerbase.h" | 8 | |
9 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
10 | #include "atconfigdialog.h" | ||
11 | #include "dialdialog.h" | 10 | #include "dialdialog.h" |
12 | 11 | ||
13 | namespace { | 12 | namespace { |
@@ -24,30 +23,29 @@ namespace { | |||
24 | } | 23 | } |
25 | } | 24 | } |
26 | 25 | ||
27 | ModemConfigWidget::ModemConfigWidget( const QString& name, | 26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
28 | QWidget* parent, | ||
29 | const char* na ) | 27 | const char* na ) |
30 | : ProfileDialogConnectionWidget( name, parent, na ) { | 28 | : ProfileDialogConnectionWidget( name, parent, na ) { |
31 | 29 | ||
32 | m_lay = new QVBoxLayout(this ); | 30 | m_lay = new QVBoxLayout( this ); |
33 | m_device = new QLabel(tr("Modem is attached to:"), this ); | 31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
34 | m_deviceCmb = new QComboBox(this ); | 32 | m_deviceCmb = new QComboBox(this ); |
35 | m_deviceCmb->setEditable( TRUE ); | 33 | m_deviceCmb->setEditable( TRUE ); |
36 | 34 | ||
37 | QLabel* telLabel = new QLabel( this ); | 35 | QLabel* telLabel = new QLabel( this ); |
38 | telLabel->setText( tr("Enter telefon number here:") ); | 36 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
39 | m_telNumber = new QLineEdit( this ); | 37 | m_telNumber = new QLineEdit( this ); |
40 | QHBox *buttonBox = new QHBox( this ); | 38 | QHBox *buttonBox = new QHBox( this ); |
41 | QPushButton *atButton = new QPushButton( buttonBox ); | 39 | QPushButton *atButton = new QPushButton( buttonBox ); |
42 | atButton->setText( tr("AT commands") ); | 40 | atButton->setText( tr( "AT commands" ) ); |
43 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 41 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
44 | 42 | ||
45 | QPushButton *dialButton = new QPushButton( buttonBox ); | 43 | QPushButton *dialButton = new QPushButton( buttonBox ); |
46 | dialButton->setText( tr("Enter number") ); | 44 | dialButton->setText( tr( "Enter number" ) ); |
47 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 45 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
48 | 46 | ||
49 | 47 | ||
50 | m_base = new IOLayerBase(this, "base"); | 48 | m_base = new IOLayerBase( this, "base" ); |
51 | 49 | ||
52 | m_lay->addWidget( m_device ); | 50 | m_lay->addWidget( m_device ); |
53 | m_lay->addWidget( m_deviceCmb ); | 51 | m_lay->addWidget( m_deviceCmb ); |
@@ -60,7 +58,7 @@ ModemConfigWidget::ModemConfigWidget( const QString& name, | |||
60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 58 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); | 59 | m_deviceCmb->insertItem( "/dev/ttyS2" ); |
62 | 60 | ||
63 | 61 | atConf = new ATConfigDialog( this, "ATConfig", true ); | |
64 | } | 62 | } |
65 | 63 | ||
66 | ModemConfigWidget::~ModemConfigWidget() { | 64 | ModemConfigWidget::~ModemConfigWidget() { |
@@ -68,16 +66,16 @@ ModemConfigWidget::~ModemConfigWidget() { | |||
68 | } | 66 | } |
69 | void ModemConfigWidget::load( const Profile& prof ) { | 67 | void ModemConfigWidget::load( const Profile& prof ) { |
70 | 68 | ||
71 | int rad_flow = prof.readNumEntry("Flow"); | 69 | int rad_flow = prof.readNumEntry( "Flow" ); |
72 | int rad_parity = prof.readNumEntry("Parity"); | 70 | int rad_parity = prof.readNumEntry( "Parity" ); |
73 | int speed = prof.readNumEntry("Speed"); | 71 | int speed = prof.readNumEntry( "Speed" ); |
74 | QString number = prof.readEntry("Number"); | 72 | QString number = prof.readEntry( "Number" ); |
75 | 73 | ||
76 | if (!number.isEmpty() ) { | 74 | if ( !number.isEmpty() ) { |
77 | m_telNumber->setText( number ); | 75 | m_telNumber->setText( number ); |
78 | } | 76 | } |
79 | 77 | ||
80 | if (rad_flow == 1) { | 78 | if ( rad_flow == 1 ) { |
81 | m_base->setFlow( IOLayerBase::Hardware ); | 79 | m_base->setFlow( IOLayerBase::Hardware ); |
82 | } else if (rad_flow == 2) { | 80 | } else if (rad_flow == 2) { |
83 | m_base->setFlow( IOLayerBase::Software ); | 81 | m_base->setFlow( IOLayerBase::Software ); |
@@ -85,7 +83,7 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
85 | m_base->setFlow( IOLayerBase::None ); | 83 | m_base->setFlow( IOLayerBase::None ); |
86 | } | 84 | } |
87 | 85 | ||
88 | if (rad_parity == 1) { | 86 | if ( rad_parity == 1 ) { |
89 | m_base->setParity( IOLayerBase::Even ); | 87 | m_base->setParity( IOLayerBase::Even ); |
90 | } else { | 88 | } else { |
91 | m_base->setParity( IOLayerBase::Odd ); | 89 | m_base->setParity( IOLayerBase::Odd ); |
@@ -93,27 +91,31 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
93 | 91 | ||
94 | switch( speed ) { | 92 | switch( speed ) { |
95 | case 115200: | 93 | case 115200: |
96 | m_base->setSpeed(IOLayerBase::Baud_115200 ); | 94 | m_base->setSpeed( IOLayerBase::Baud_115200 ); |
97 | break; | 95 | break; |
98 | case 57600: | 96 | case 57600: |
99 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 97 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
100 | break; | 98 | break; |
101 | case 38400: | 99 | case 38400: |
102 | m_base->setSpeed(IOLayerBase::Baud_38400 ); | 100 | m_base->setSpeed( IOLayerBase::Baud_38400 ); |
103 | break; | 101 | break; |
104 | case 19200: | 102 | case 19200: |
105 | m_base->setSpeed( IOLayerBase::Baud_19200 ); | 103 | m_base->setSpeed( IOLayerBase::Baud_19200 ); |
106 | break; | 104 | break; |
107 | case 9600: | 105 | case 9600: |
108 | default: | 106 | default: |
109 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 107 | m_base->setSpeed( IOLayerBase::Baud_9600 ); |
110 | break; | 108 | break; |
111 | } | 109 | } |
112 | 110 | ||
113 | if ( prof.readEntry("Device").isEmpty() ) return; | 111 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
114 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 112 | return; |
113 | } | ||
114 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | ||
115 | 115 | ||
116 | atConf->readConfig( prof ); | ||
116 | } | 117 | } |
118 | |||
117 | /* | 119 | /* |
118 | * save speed, | 120 | * save speed, |
119 | * flow, | 121 | * flow, |
@@ -121,7 +123,7 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
121 | */ | 123 | */ |
122 | void ModemConfigWidget::save( Profile& prof ) { | 124 | void ModemConfigWidget::save( Profile& prof ) { |
123 | int flow, parity, speed; | 125 | int flow, parity, speed; |
124 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 126 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
125 | 127 | ||
126 | 128 | ||
127 | switch( m_base->flow() ) { | 129 | switch( m_base->flow() ) { |
@@ -163,18 +165,17 @@ void ModemConfigWidget::save( Profile& prof ) { | |||
163 | break; | 165 | break; |
164 | } | 166 | } |
165 | 167 | ||
166 | prof.writeEntry("Flow", flow); | 168 | prof.writeEntry( "Flow", flow ); |
167 | prof.writeEntry("Parity", parity); | 169 | prof.writeEntry( "Parity", parity ); |
168 | prof.writeEntry("Speed", speed); | 170 | prof.writeEntry( "Speed", speed ); |
169 | prof.writeEntry("Number", m_telNumber->text() ); | 171 | prof.writeEntry( "Number", m_telNumber->text() ); |
170 | } | 172 | } |
171 | 173 | ||
172 | void ModemConfigWidget::slotAT() { | 174 | void ModemConfigWidget::slotAT() { |
173 | ATConfigDialog conf( this, "ATConfig", true ); | 175 | // ATConfigDialog conf( this, "ATConfig", true ); |
174 | conf.readConfig(); | 176 | atConf->showMaximized(); |
175 | conf.showMaximized(); | 177 | if ( atConf->exec() == QDialog::Accepted ) { |
176 | if ( conf.exec() == QDialog::Accepted ) { | 178 | // atConf->writeConfig(); |
177 | conf.writeConfig(); | ||
178 | } | 179 | } |
179 | } | 180 | } |
180 | 181 | ||