Diffstat (limited to 'noncore/apps/opie-console/btconfigwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index 232e497..f2ed558 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp | |||
@@ -1,35 +1,25 @@ | |||
1 | #include "btconfigwidget.h" | ||
2 | #include "iolayerbase.h" | ||
3 | #include "comboboxhelper.h" | ||
4 | |||
1 | #include <qlabel.h> | 5 | #include <qlabel.h> |
2 | #include <qlayout.h> | 6 | #include <qlayout.h> |
3 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
4 | #include <qcombobox.h> | 8 | #include <qcombobox.h> |
5 | #include <qhbox.h> | 9 | #include <qhbox.h> |
6 | #include <qradiobutton.h> | 10 | #include <qradiobutton.h> |
7 | 11 | ||
8 | #include "iolayerbase.h" | ||
9 | #include "btconfigwidget.h" | ||
10 | 12 | ||
11 | namespace { | 13 | |
12 | void setCurrent( const QString& str, QComboBox* bo ) { | ||
13 | uint b = bo->count(); | ||
14 | for (int i = 0; i < bo->count(); i++ ) { | ||
15 | if ( bo->text(i) == str ) { | ||
16 | bo->setCurrentItem( i ); | ||
17 | return; | ||
18 | } | ||
19 | } | ||
20 | bo->insertItem( str ); | ||
21 | bo->setCurrentItem( b ); | ||
22 | } | ||
23 | } | ||
24 | 14 | ||
25 | BTConfigWidget::BTConfigWidget( const QString& name, | 15 | BTConfigWidget::BTConfigWidget( const QString& name, |
26 | QWidget* parent, | 16 | QWidget* parent, |
27 | const char* na ) | 17 | const char* na ) |
28 | : ProfileDialogConnectionWidget( name, parent, na ) { | 18 | : ProfileDialogConnectionWidget( name, parent, na ) { |
29 | 19 | ||
30 | m_lay = new QVBoxLayout( this ); | 20 | m_lay = new QVBoxLayout( this ); |
31 | 21 | ||
32 | m_device = new QLabel( tr( "Device" ), this ); | 22 | m_device = new QLabel( tr( "Device" ), this ); |
33 | QHBox *deviceBox = new QHBox( this ); | 23 | QHBox *deviceBox = new QHBox( this ); |
34 | m_devRadio = new QRadioButton( deviceBox ); | 24 | m_devRadio = new QRadioButton( deviceBox ); |
35 | connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) ); | 25 | connect( m_devRadio, SIGNAL( toggled(bool) ), this, SLOT( slotDevRadio(bool) ) ); |
@@ -106,25 +96,25 @@ void BTConfigWidget::load( const Profile& prof ) { | |||
106 | m_base->setSpeed( IOLayerBase::Baud_2400 ); | 96 | m_base->setSpeed( IOLayerBase::Baud_2400 ); |
107 | break; | 97 | break; |
108 | case 1200: | 98 | case 1200: |
109 | m_base->setSpeed( IOLayerBase::Baud_1200 ); | 99 | m_base->setSpeed( IOLayerBase::Baud_1200 ); |
110 | break; | 100 | break; |
111 | case 9600: | 101 | case 9600: |
112 | default: | 102 | default: |
113 | m_base->setSpeed(IOLayerBase::Baud_9600 ); | 103 | m_base->setSpeed(IOLayerBase::Baud_9600 ); |
114 | break; | 104 | break; |
115 | } | 105 | } |
116 | 106 | ||
117 | if ( prof.readEntry("Device").isEmpty() ) return; | 107 | if ( prof.readEntry("Device").isEmpty() ) return; |
118 | setCurrent( prof.readEntry("Device"), m_deviceCmb ); | 108 | ComboboxHelper::setCurrent( prof.readEntry("Device"), m_deviceCmb ); |
119 | 109 | ||
120 | } | 110 | } |
121 | /* | 111 | /* |
122 | * save speed, | 112 | * save speed, |
123 | * flow, | 113 | * flow, |
124 | * parity | 114 | * parity |
125 | */ | 115 | */ |
126 | void BTConfigWidget::save( Profile& prof ) { | 116 | void BTConfigWidget::save( Profile& prof ) { |
127 | int flow, parity, speed; | 117 | int flow, parity, speed; |
128 | flow = parity = speed = 0; | 118 | flow = parity = speed = 0; |
129 | prof.writeEntry("Device", m_deviceCmb->currentText() ); | 119 | prof.writeEntry("Device", m_deviceCmb->currentText() ); |
130 | 120 | ||