Diffstat (limited to 'noncore/apps/opie-console/serialconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp index c4c9c99..4efb286 100644 --- a/noncore/apps/opie-console/serialconfigwidget.cpp +++ b/noncore/apps/opie-console/serialconfigwidget.cpp @@ -1,34 +1,21 @@ -#include <qlabel.h> -#include <qlayout.h> -#include <qcombobox.h> - #include "iolayerbase.h" #include "serialconfigwidget.h" +#include "comboboxhelper.h" -namespace { - void setCurrent( const QString& str, QComboBox* bo ) { - uint b = bo->count(); - for (int i = 0; i < bo->count(); i++ ) { - if ( bo->text(i) == str ) { - bo->setCurrentItem( i ); - return; - } - } - bo->insertItem( str ); - bo->setCurrentItem( b ); - } +#include <qlabel.h> +#include <qlayout.h> +#include <qcombobox.h> -} SerialConfigWidget::SerialConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout(this ); m_device = new QLabel(tr("Device"), this ); m_deviceCmb = new QComboBox(this ); m_deviceCmb->setEditable( TRUE ); m_base = new IOLayerBase(this, "base"); @@ -107,25 +94,25 @@ void SerialConfigWidget::load( const Profile& prof ) { m_base->setData( IOLayerBase::Data_Eight ); } if ( sbits == 2) { m_base->setStop( IOLayerBase::Stop_Two ); } else if ( sbits == 15 ) { m_base->setStop( IOLayerBase::Stop_OnePointFive ); } else { m_base->setStop( IOLayerBase::Stop_One ); } if ( prof.readEntry("Device").isEmpty() ) return; - setCurrent( prof.readEntry("Device"), m_deviceCmb ); + ComboboxHelper::setCurrent( prof.readEntry("Device"), m_deviceCmb ); } /* * save speed, * flow, * parity */ void SerialConfigWidget::save( Profile& prof ) { int flow, parity, speed, data, stop; flow = parity = speed = data = stop = 0; prof.writeEntry("Device", m_deviceCmb->currentText() ); |