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