From 1af1f1d9f398d38a2bc666cd2edff5725da7a770 Mon Sep 17 00:00:00 2001 From: mickeyl Date: Wed, 29 Oct 2003 18:18:19 +0000 Subject: mrege noncore/net/* --- (limited to 'noncore/net/opietooth') diff --git a/noncore/net/opietooth/blue-pin/blue-pin.pro b/noncore/net/opietooth/blue-pin/blue-pin.pro index 102a937..fbf9dbe 100644 --- a/noncore/net/opietooth/blue-pin/blue-pin.pro +++ b/noncore/net/opietooth/blue-pin/blue-pin.pro @@ -1,6 +1,4 @@ -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = pindlg.h SOURCES = main.cc pindlg.cc INCLUDEPATH += $(OPIEDIR)/include @@ -8,8 +6,7 @@ INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe INTERFACES = pindlgbase.ui -DESTDIR = $(OPIEDIR)/bin -TARGET = bluepin +TARGET = bluepin TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ ../../../../i18n/nl/bluepin.ts \ @@ -30,5 +27,4 @@ TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ ../../../../i18n/zh_TW/bluepin.ts - include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/manager/.cvsignore b/noncore/net/opietooth/manager/.cvsignore index 3fb67fe..19c03a7 100644 --- a/noncore/net/opietooth/manager/.cvsignore +++ b/noncore/net/opietooth/manager/.cvsignore @@ -7,3 +7,7 @@ devicedialog.h moc_* scandialog.cpp scandialog.h +rfcommassigndialogbase.cpp +rfcommassigndialogbase.h +rfcommdialogitembase.cpp +rfcommdialogitembase.h diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 54808fa..2e68984 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -20,6 +20,7 @@ #include "hciconfwrapper.h" #include "devicehandler.h" #include "btconnectionitem.h" +#include "rfcommassigndialogimpl.h" #include #include @@ -59,7 +60,9 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); - // not good since lib is async + + connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); +// not good since lib is async // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); connect( ListView2, SIGNAL( clicked( QListViewItem* )), @@ -222,7 +225,7 @@ void BlueBase::initGui() { QString BlueBase::status()const{ QString infoString = tr( "Device name : Ipaq" ); infoString += QString( "
" + tr( "MAC adress: " ) +" No idea" ); - infoString += QString( "
" + tr( "Class" ) + " PDA" ); + infoString += QString( "
" + tr( "Class" ) + " PDA" ); return (infoString); } @@ -245,6 +248,20 @@ void BlueBase::applyConfigChanges() { } /** + * Launch Rfcomm Bind dialog + * + */ +void BlueBase::rfcommDialog() { + RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); + + rfcommAssign.showMaximized(); + + if ( rfcommAssign.exec() == QDialog::Accepted ) { + rfcommAssign.saveConfig(); + } +} + +/** * Add fresh found devices from scan dialog to the listing * */ diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 743062c..a8ab3db 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -40,13 +40,16 @@ namespace OpieTooth { public: BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~BlueBase(); + + static QString appName() { return QString::fromLatin1("bluetooth-manager"); } protected: private slots: void startScan(); - + + private: bool find( const RemoteDevice& device ); void readConfig(); @@ -89,6 +92,7 @@ namespace OpieTooth { void applyConfigChanges(); void addSignalStrength(); void addSignalStrength( const QString& mac, const QString& strengh ); + void rfcommDialog(); }; diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 9ff970f..bb906a1 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui @@ -11,8 +11,8 @@ 0 0 - 224 - 320 + 258 + 407 @@ -25,371 +25,419 @@ layoutSpacing - + + QTabWidget - margin - 0 + name + Status - spacing - 0 + geometry + + 1 + 1 + 245 + 289 + + + + layoutMargin + + + layoutSpacing - QTabWidget + QWidget name - Status - - - layoutMargin - - - layoutSpacing + tab - - QWidget + + title + Devices + + - name - tab + margin + 2 - - title - Devices - - + + spacing + 2 + + + QListView + + + text + Device Name + + + clickable + true + + + resizeable + true + + + + + text + Online + + + clickable + true + + + resizeable + true + + - margin - 2 + name + ListView2 + + + QPushButton - spacing - 2 + name + PushButton2 - - QListView - - - text - Device Name - - - clickable - true - - - resizeable - true - - - - - text - Online - - - clickable - true - - - resizeable - true - - - - name - ListView2 + + sizePolicy + + 0 + 0 + + + + text + Scan for Devices + + + + + + QWidget + + name + tab + + + title + Connections + + + + margin + 2 + + + spacing + 2 + + + QListView + + + text + Device Name - - - QPushButton - - name - PushButton2 + + clickable + true - - sizePolicy - - 0 - 0 - + + resizeable + true - + + + text - Scan for Devices + Connection type - - - - - QWidget - - name - tab - - - title - Connections - - - - margin - 2 - + + clickable + true + + + resizeable + true + + + + + text + Signal + + + clickable + true + + + resizeable + true + + - spacing - 2 + name + ListView4 - - QListView - - - text - Device Name - - - clickable - true - - - resizeable - true - - - - - text - Connection type - - - clickable - true - - - resizeable - true - - - - - text - Signal - - - clickable - true - - - resizeable - true - - - - name - ListView4 - - - - - - QWidget + + + + + QWidget + + name + tab + + + title + Config + + + + margin + 11 + - name - tab + spacing + 6 - - title - Config - - + + QGroupBox - margin - 2 + name + GroupBox1 - spacing - 2 + title + Bluetooh Basic Config - - QLayoutWidget + - name - Layout2 + margin + 11 - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - deviceNameLabel - - - text - Device Name - - - - QLineEdit - - name - deviceNameLine - - - - - - QLayoutWidget - name - Layout3 + spacing + 6 - - - margin - 0 - + + QLayoutWidget - spacing - 6 + name + Layout7 - - QLabel + - name - passkeyLabel + margin + 0 - text - Default Passkey + spacing + 6 - - - QLineEdit + + QLayoutWidget + + name + Layout6 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + deviceNameLabel + + + text + Device Name + + + + QLabel + + name + passkeyLabel + + + text + Default Passkey + + + + + + QLayoutWidget + + name + Layout5 + + + + margin + 0 + + + spacing + 6 + + + QLineEdit + + name + deviceNameLine + + + + QLineEdit + + name + passkeyLine + + + echoMode + Password + + + + + + + + QLayoutWidget + + name + Layout5 + + - name - passkeyLine + margin + 0 - echoMode - Password + spacing + 6 - - - - - QLayoutWidget - - name - Layout5 - - + + QCheckBox + + name + authCheckBox + + + text + enable authentification + + + + QCheckBox + + name + cryptCheckBox + + + text + enable encryption + + + + QCheckBox + + name + pagescanCheckBox + + + text + Enable Page scan + + + + QCheckBox + + name + inquiryscanCheckBox + + + text + Enable Inquiry scan + + + + + + QPushButton - margin - 0 + name + configApplyButton - spacing - 6 + text + Apply - - QCheckBox - - name - authCheckBox - - - text - enable authentification - - - - QCheckBox - - name - cryptCheckBox - - - text - enable encryption - - - - QCheckBox - - name - pagescanCheckBox - - - text - Enable Page scan - - - - QCheckBox - - name - inquiryscanCheckBox - - - text - Enable Inquiry scan - - - - - - QPushButton - - name - configApplyButton - - - text - Apply - - - - - - QWidget + + + + + QPushButton + + name + rfcommBindButton + + + text + Rfcomm Bind Table + + + + + + QWidget + + name + tab + + + title + Status + + - name - tab + margin + 2 - - title - Status - - + + spacing + 2 + + + QLabel - margin - 2 + name + StatusLabel - spacing - 2 + text + Status Label - - QLabel - - name - StatusLabel - - - text - Status Label - - - - + + - + diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp index a86e36d..82aeebd 100644 --- a/noncore/net/opietooth/manager/main.cpp +++ b/noncore/net/opietooth/manager/main.cpp @@ -19,20 +19,7 @@ #include "bluebase.h" #include +#include - -QPEApplication *BluetoothApp; - -int main( int argc, char ** argv ) { - QPEApplication a(argc, argv); - BluetoothApp=&a; - - OpieTooth::BlueBase t; - - // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") ); - a.showMainWidget(&t); - - return a.exec(); -} - +OPIE_EXPORT_APP( OApplicationFactory ) diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 9841740..6ff4ebb 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -1,14 +1,13 @@ -TEMPLATE = app -CONFIG = qt warn_on debug -#CONFIG = qt warn_on release +CONFIG = qt warn_on release quick-app HEADERS = btconnectionitem.h btdeviceitem.h \ btserviceitem.h stdpopups.h \ popuphelper.h bluebase.h \ scandialog.h btlistitem.h \ hciconfwrapper.h bticonloader.h \ pppdialog.h obexdialog.h \ + rfcommassigndialogimpl.h rfcommassigndialogitem.h \ devicehandler.h rfcpopup.h obexpopup.h \ - rfcommhelper.h panpopup.h dunpopup.h + rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ btserviceitem.cpp stdpopups.cpp \ @@ -16,16 +15,17 @@ SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ bluebase.cpp scandialog.cpp \ btlistitem.cpp hciconfwrapper.cpp \ bticonloader.cpp pppdialog.cpp \ + rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ obexdialog.cpp devicehandler.cpp \ rfcpopup.cpp obexpopup.cpp \ - rfcommhelper.cpp panpopup.cpp dunpopup.cpp + rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopietooth -lopie -INTERFACES = bluetoothbase.ui devicedialog.ui -DESTDIR = $(OPIEDIR)/bin -TARGET = bluetooth-manager +INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui + +TARGET = bluetooth-manager TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ ../../../../i18n/nl/bluetooth-manager.ts \ diff --git a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui new file mode 100644 index 0000000..aefa698 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui @@ -0,0 +1,44 @@ + +RfcommAssignDialogBase + + QDialog + + name + RfcommAssignDialogBase + + + geometry + + 0 + 0 + 444 + 343 + + + + caption + Rfcomm Bind + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + TextLabel1 + + + text + Bind device to a interface + + + + + diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp new file mode 100644 index 0000000..b5cc074 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp @@ -0,0 +1,120 @@ + +#include "rfcommassigndialogimpl.h" +#include "rfcommassigndialogitem.h" +#include "rfcommconfhandler.h" + +#include + +#include + +using namespace OpieTooth; + +// TODO: write only the file in bluebase? +// muss rfcommd dann neu gestartet werden +// sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? + + +RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) + : RfcommAssignDialogBase( parent, name, modal, fl ) { + + m_range = 5; + + m_scrollView = new QScrollView( this ); + m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); + m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); + + RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); + + m_box = new QVBox( m_scrollView->viewport() ); + m_scrollView->addChild( m_box ); + + confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); + + loadConfig(); +} + +RfcommAssignDialog::~RfcommAssignDialog() { + if ( confHandler ) { + delete confHandler; + } +} + + +void RfcommAssignDialog::newDevice( const QString & mac ) { + + for ( int i = 0 ; i < m_range; i++ ) { + + QMap::Iterator it; + it = confHandler->foundEntries().find( QString("%1").arg( i ) ); + // make sure that rfcommX is not assigned yet + if ( it == confHandler->foundEntries().end() ) { + QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); + dialog.showMaximized(); + RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); + newDev->setIdent( i ); + newDev->setMac( mac ); + + if ( dialog.exec() == QDialog::Accepted ) { + RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); + m_itemList.insert( i , rfcomm ); + rfcomm->setIdent( i ); + rfcomm->setMac( mac ); + rfcomm->setChannel( newDev->channel() ); + rfcomm->setComment( newDev->comment() ); + qDebug( "New device set up" ); + } + } + } +} + +void RfcommAssignDialog::loadConfig() { + + //Config cfg( "bluetoothmanager-rfcommbind" ); + + for ( int i = 0 ; i < m_range; i++ ) { + // cfg.setGroup( QString("%1").arg( i ) ); + RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); + m_itemList.insert( i , rfcomm ); + rfcomm->setIdent( i ); + QMap::Iterator it; + it = confHandler->foundEntries().find( QString("%1").arg( i ) ); + if ( it != confHandler->foundEntries().end() ) { + qDebug( "Found key in foundEntries() " ); + rfcomm->setMac( it.data()->mac() ); + rfcomm->setChannel( it.data()->channel() ); + rfcomm->setComment( it.data()->comment() ); + } + /* Use rfcomm.conf directly for now + * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); + * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); + * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); + */ + } +} + + +void RfcommAssignDialog::saveConfig() { + + //Config cfg( "bluetoothmanager-rfcommbind" ); + + QMap< int, RfcommDialogItem*>::Iterator it; + + QMap< QString, RfCommConfObject*> outMap; + + for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) { + + //cfg.setGroup( QString("%1").arg( it.key() ) ); + RfcommDialogItem *rfcomm = it.data(); + + + outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); + + + //cfg.writeEntry( "mac", rfcomm->mac() ); + //cfg.writeEntry( "channel", rfcomm->channel() ); + //cfg.writeEntry( "comment", rfcomm->comment() ); + } + + confHandler->save( outMap ); + +} diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.h b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h new file mode 100644 index 0000000..9983632 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h @@ -0,0 +1,39 @@ +#ifndef RFCOMMASSIGN +#define RFCOMMASSIGN + +#include "rfcommassigndialogbase.h" +#include "rfcommassigndialogitem.h" +#include "rfcommconfhandler.h" + +#include +#include +#include + +namespace OpieTooth { + + class RfcommAssignDialog: public RfcommAssignDialogBase { + + Q_OBJECT + + public: + + RfcommAssignDialog( QWidget* parent = 0, const char* name = 0,bool modal = 0, WFlags fl = 0 ); + ~RfcommAssignDialog(); + + void loadConfig(); + void saveConfig(); + + void newDevice( const QString & mac ); + + private: + QScrollView *m_scrollView; + // how many rfcomm devices are possible + int m_range; + QMap< int, RfcommDialogItem* > m_itemList; + QVBox *m_box; + RfCommConfHandler *confHandler; +}; + +} + +#endif diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp new file mode 100644 index 0000000..1e7130f --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp @@ -0,0 +1,54 @@ + +#include "rfcommassigndialogitem.h" + +#include +#include +#include +#include + +using namespace OpieTooth; + + +RfcommDialogItem::RfcommDialogItem( QWidget* parent, const char* name, WFlags fl ) + : RfcommDialogItemBase( parent, name, fl ) { + +} + +RfcommDialogItem::~RfcommDialogItem() { +} + + +int RfcommDialogItem::ident() { + return m_ident; +} + +QString RfcommDialogItem::mac() { + return m_macAddress->text(); +} + +int RfcommDialogItem::channel() { + return m_channelDropdown->currentItem(); +} + +QString RfcommDialogItem::comment() { + return m_commentLine->text(); +} + +void RfcommDialogItem::setIdent( int ident ) { + m_ident = ident; + m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) ); +} + +void RfcommDialogItem::setMac( const QString &mac ) { + m_macAddress->setText( mac ); +} + +void RfcommDialogItem::setChannel( int channel ) { + m_channelDropdown->setCurrentItem( channel ); +} + +void RfcommDialogItem::setComment( const QString &comment ) { + m_commentLine->setText( comment ); +} + + diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.h b/noncore/net/opietooth/manager/rfcommassigndialogitem.h new file mode 100644 index 0000000..34a794f --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.h @@ -0,0 +1,40 @@ +#ifndef RFCOMMDIALOGITEM +#define RFCOMMDIALOGITEM + +#include "rfcommdialogitembase.h" + +#include + +namespace OpieTooth { + + class RfcommDialogItem : public RfcommDialogItemBase { + + Q_OBJECT + + public: + RfcommDialogItem( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~RfcommDialogItem(); + + // number if the rfcomm device + int ident(); + // devices mac address + QString mac(); + int channel(); + QString comment(); + + void setIdent( int ident ); + void setMac( const QString& mac ); + void setChannel( int channel ); + void setComment( const QString& comment ); + + private: + + + int m_ident; + +}; + + +} + +#endif diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp new file mode 100644 index 0000000..20453e8 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp @@ -0,0 +1,114 @@ + +#include + +#include "rfcommconfhandler.h" + + +using namespace OpieTooth; + +// move to lib + + +RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { + m_number = number; + m_mac = mac; + m_channel = channel; + m_comment = comment; + // m_foundEntries = 0; +} + +void RfCommConfObject::setNumber( int number ) { + m_number = number; +} + +void RfCommConfObject::setMac( QString mac ) { + m_mac = mac; +} + +void RfCommConfObject::setChannel( int channel ) { + m_channel = channel; +} + +void RfCommConfObject::setComment( QString comment ) { + m_comment = comment; +} + + +RfCommConfObject::~RfCommConfObject() { +} + + +RfCommConfHandler::RfCommConfHandler( const QString & filename ) { + + m_filename = filename; + load(); +} + +RfCommConfHandler::~RfCommConfHandler() { + +} + +void RfCommConfHandler::save( QMap devices ) { + + QFile rfCommConf( "/tmp/test" ); + QTextStream outStream( &rfCommConf ); + if ( rfCommConf.open( IO_WriteOnly ) ) { + + QMap::Iterator it; + for( it = devices.begin(); it != devices.end(); ++it ) { + outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; + outStream << " device " + it.data()->mac() + ";\n"; + outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; + outStream << " comment \"" + it.data()->comment() + "\";\n"; + outStream << "}\n\n"; + } + + rfCommConf.close(); + } +} + + +QMap RfCommConfHandler::foundEntries() { + return m_foundEntries; +} + +void RfCommConfHandler::load() { + + QFile rfCommConf( m_filename ); + if ( rfCommConf.open( IO_ReadOnly ) ) { + + QStringList list; + QTextStream inStream( &rfCommConf ); + list = QStringList::split( "\n", inStream.read() ); + + QString number; + QString mac; + QString channel; + QString comment; + + for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { + + QString tmpLine = ( *line ).stripWhiteSpace(); + + if ( tmpLine.startsWith("rfcomm") ) { + QString number = tmpLine.mid( 6,1 ); + qDebug( tmpLine ); + qDebug( "TEST " + number ); + } else if ( tmpLine.startsWith( "}" ) ) { + m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); + } else if ( tmpLine.startsWith( "device" ) ) { + mac = tmpLine.mid( 7, 17 ); + qDebug( "mac" + mac ); + } else if ( tmpLine.startsWith( "channel" ) ) { + channel = tmpLine.mid( 8, 1 ); + qDebug ( "Channel :" + channel ); + } else if ( tmpLine.startsWith( "comment" ) ) { + comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); + qDebug( "Comment: " + comment ); + } + } + rfCommConf.close(); + } + save( m_foundEntries ); + qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) ); +} diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.h b/noncore/net/opietooth/manager/rfcommconfhandler.h new file mode 100644 index 0000000..e13c833 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommconfhandler.h @@ -0,0 +1,54 @@ +#ifndef RFCOMMCONFHANDLER +#define RFCOMMCONFHANDLER + +#include +#include +#include +#include + +namespace OpieTooth { + + class RfCommConfObject { + + public: + RfCommConfObject( int number, QString mac, int channel, QString comment ); + ~RfCommConfObject(); + + void setNumber( int number ); + int number() { return m_number; }; + void setMac( QString mac ); + QString mac() { return m_mac; }; + void setChannel( int channel ); + int channel() { return m_channel; }; + void setComment( QString comment ); + QString comment() { return m_comment; }; + + + private: + int m_number; + QString m_mac; + int m_channel; + QString m_comment; + + }; + + class RfCommConfHandler { + + public: + RfCommConfHandler( const QString & filename ); + ~RfCommConfHandler(); + + void save( QMap devices ); + + QMap foundEntries(); + + private: + void load(); + + QString m_filename; + QMap m_foundEntries; + }; + +} + +#endif diff --git a/noncore/net/opietooth/manager/rfcommdialogitembase.ui b/noncore/net/opietooth/manager/rfcommdialogitembase.ui new file mode 100644 index 0000000..dafca52 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommdialogitembase.ui @@ -0,0 +1,216 @@ + +RfcommDialogItemBase + + QWidget + + name + RfcommDialogItemBase + + + geometry + + 0 + 0 + 345 + 95 + + + + caption + Form2 + + + layoutMargin + + + layoutSpacing + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + m_identLabel + + + layoutMargin + + + layoutSpacing + + + + margin + 5 + + + spacing + 5 + + + QLayoutWidget + + name + Layout3 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel4 + + + text + Mac + + + + QLineEdit + + name + m_macAddress + + + + QLabel + + name + TextLabel5 + + + text + Channel + + + + QComboBox + + + text + 0 + + + + + text + 1 + + + + + text + 2 + + + + + text + 3 + + + + + text + 4 + + + + + text + 5 + + + + + text + 6 + + + + + text + 7 + + + + + text + 8 + + + + + text + 9 + + + + + text + 10 + + + + name + m_channelDropdown + + + + + + QLayoutWidget + + name + Layout4 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel3 + + + text + Comment: + + + + QLineEdit + + name + m_commentLine + + + + + + + + + diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index cc87b6c..d95f14b 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp @@ -3,18 +3,22 @@ #include "pppdialog.h" #include "rfcpopup.h" +#include "rfcommassigndialogimpl.h" using namespace OpieTooth; /* * c'tor init the QAction */ -RfcCommPopup::RfcCommPopup() +RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { qWarning("RfcCommPopup c'tor"); QAction* a; + + m_item = item; + /* connect action */ a = new QAction( ); // so it's get deleted a->setText("Connect"); @@ -33,10 +37,10 @@ RfcCommPopup::RfcCommPopup() /* foo action */ a = new QAction( ); - a->setText("Foo"); + a->setText("Bind table"); a->addTo( this ); connect( a, SIGNAL( activated() ), - this, SLOT( slotFoo() ) ); + this, SLOT( slotBind() ) ); /* bar action */ @@ -74,8 +78,15 @@ void RfcCommPopup::slotDisconnect() { } -void RfcCommPopup::slotFoo() { - qWarning("slotFoo"); +void RfcCommPopup::slotBind() { + RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); + + rfcommAssign.showMaximized(); + rfcommAssign.newDevice( m_item->mac() ); + + if ( rfcommAssign.exec() == QDialog::Accepted ) { + rfcommAssign.saveConfig(); + } } diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h index c388f65..74b9117 100644 --- a/noncore/net/opietooth/manager/rfcpopup.h +++ b/noncore/net/opietooth/manager/rfcpopup.h @@ -4,6 +4,8 @@ #include #include +#include "btdeviceitem.h" + namespace OpieTooth { /** * A simple reference implementation for @@ -16,19 +18,20 @@ namespace OpieTooth { class RfcCommPopup : public QPopupMenu { Q_OBJECT public: - RfcCommPopup(); + RfcCommPopup( OpieTooth::BTDeviceItem* ); ~RfcCommPopup(); private: QAction* m_con; QAction* m_dis; - QAction* m_foo; + QAction* m_bind; QAction* m_bar; + OpieTooth::BTDeviceItem *m_item; private slots: void slotConnect(); void slotDisconnect(); - void slotFoo(); + void slotBind(); void slotBar(); }; }; diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index 38b8ee7..e1f8396 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp @@ -9,7 +9,7 @@ extern "C" { QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { - return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters + return new OpieTooth::RfcCommPopup(/* servive,*/ item ); // fix spellin RfComm vs. RfcComm and paramaters //return 0l; } QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { -- cgit v0.9.0.2