author | harlekin <harlekin> | 2002-10-17 14:16:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 14:16:03 (UTC) |
commit | 6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494 (patch) (side-by-side diff) | |
tree | d75fbc71ac5d7ae09ad97aacfcd33e43da664f7a /noncore/apps/opie-console/btconfigwidget.cpp | |
parent | e5d66ce2f5939eeae922c4fda9cad084320e647c (diff) | |
download | opie-6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494.zip opie-6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494.tar.gz opie-6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494.tar.bz2 |
either device or mac address
Diffstat (limited to 'noncore/apps/opie-console/btconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/btconfigwidget.cpp | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/btconfigwidget.cpp b/noncore/apps/opie-console/btconfigwidget.cpp index 7673d0b..6246f92 100644 --- a/noncore/apps/opie-console/btconfigwidget.cpp +++ b/noncore/apps/opie-console/btconfigwidget.cpp @@ -2,6 +2,8 @@ #include <qlayout.h> #include <qlineedit.h> #include <qcombobox.h> +#include <qhbox.h> +#include <qradiobutton.h> #include "iolayerbase.h" #include "btconfigwidget.h" @@ -25,21 +27,28 @@ BTConfigWidget::BTConfigWidget( const QString& name, 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_lay = new QVBoxLayout( this ); + + m_device = new QLabel( tr( "Device" ), this ); + QHBox *deviceBox = new QHBox( this ); + m_devRadio = new QRadioButton( deviceBox ); + connect( m_devRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotDevRadio( bool ) ) ); + m_deviceCmb = new QComboBox( deviceBox ); m_deviceCmb->setEditable( TRUE ); QLabel *macLabel = new QLabel( this ); - macLabel->setText( tr("Enter peer mac address here:") ); - m_mac = new QLineEdit( this ); + macLabel->setText( tr( "Or peer mac address" ) ); + QHBox *macBox = new QHBox( this ); + m_macRadio = new QRadioButton( macBox ); + connect( m_macRadio, SIGNAL( toggled( bool ) ), this, SLOT( slotMacRadio( bool ) ) ); + m_mac = new QLineEdit( macBox ); m_base = new IOLayerBase(this, "base"); m_lay->addWidget( m_device ); - m_lay->addWidget( m_deviceCmb ); + m_lay->addWidget( deviceBox ); m_lay->addWidget( macLabel ); - m_lay->addWidget( m_mac ); + m_lay->addWidget( macBox ); m_lay->addWidget( m_base ); m_deviceCmb->insertItem( "/dev/ttyU0" ); @@ -57,6 +66,8 @@ void BTConfigWidget::load( const Profile& prof ) { if (!mac.isEmpty() ) { m_mac->setText( mac ); + } else { + m_devRadio->setChecked( true ); } if (rad_flow == 1) { @@ -155,3 +166,23 @@ void BTConfigWidget::save( Profile& prof ) { prof.writeEntry("Speed", speed); prof.writeEntry("Mac", m_mac->text() ); } + +void BTConfigWidget::slotMacRadio( bool on ) { + if ( on ) { + m_devRadio->setChecked( false ); + m_deviceCmb->setEnabled( false ); + m_mac->setEnabled( true ); + } else { + m_devRadio->setChecked( true ); + } +} + +void BTConfigWidget::slotDevRadio( bool on ) { + if ( on ) { + m_macRadio->setChecked( false ); + m_deviceCmb->setEnabled( true ); + m_mac->setEnabled( false ); + } else { + m_macRadio->setChecked( true ); + } +} |