From 05a76394214a0066325c71f91eb44ed7412df67c Mon Sep 17 00:00:00 2001 From: harlekin Date: Fri, 28 Jun 2002 21:53:42 +0000 Subject: connection view started --- (limited to 'noncore') diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 3e7e2ab..d023302 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -65,6 +66,8 @@ namespace OpieTooth { this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); connect( localDevice, SIGNAL( available( const QString&, bool ) ), this, SLOT( deviceActive( const QString& , bool ) ) ); + connect( localDevice, SIGNAL( connections( Connection::ValueList ) ), + this, SLOT( addConnectedDevices( Connection::ValueList ) ) ); //Load all icons needed @@ -92,6 +95,8 @@ namespace OpieTooth { (void) new BTListItem( topLV2, "Serial" ,"", "service" ); (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); writeToHciConfig(); + // search conncetions + addConnectedDevices(); } @@ -295,11 +300,6 @@ namespace OpieTooth { // look if device is avail. atm, async deviceActive( dev ); - // move into the c'tor - // deviceItem->setMac( dev->mac() ); - // what kind of entry is it. - //deviceItem->setType( "device"); - // ggf auch hier? addServicesToDevice( deviceItem ); } @@ -410,16 +410,6 @@ namespace OpieTooth { } } - - // empty entries - // QListViewItem * myChild = deviceItem->firstChild(); - //QList tmpList; - //while( myChild ) { - // tmpList.append(myChild); - // myChild = myChild->nextSibling(); - // } - - QValueList::Iterator it2; BTListItem * serviceItem; @@ -439,13 +429,29 @@ namespace OpieTooth { /** * Add the existing connections (pairs) to the connections tab. - * + * This one triggers the search */ void BlueBase::addConnectedDevices() { + localDevice->searchConnections(); + } - //mac address + void BlueBase::addConnectedDevices( Connection::ValueList connectionList ) { + + QValueList::Iterator it; + BTListItem * connectionItem; + + if ( !connectionList.isEmpty() ) { + + for (it = connectionList.begin(); it != connectionList.end(); ++it) { + connectionItem = new BTListItem( ListView4 , (*it).mac() , (*it).mac() , "connection" ); + } + } else { + connectionItem = new BTListItem( ListView4 , tr("No connections found"), "", "connection" ); + } + // recall connection search after some time + QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); } /** diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index ef67aa2..0516c16 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -69,6 +69,7 @@ namespace OpieTooth { void addServicesToDevice( BTListItem *item ); void addServicesToDevice( const QString& device, Services::ValueList ); void addConnectedDevices(); + void addConnectedDevices( Connection::ValueList ); void startServiceActionClicked( QListViewItem *item ); void startServiceActionHold( QListViewItem *, const QPoint &, int ); void deviceActive( const QString& mac, bool connected ); diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 7b2497a..2d6d7da 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp @@ -99,16 +99,14 @@ namespace OpieTooth { } else { str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); } - qDebug( str ); } - outstream << str << endl; } f.close(); + f2.flush(); f2.close(); } - } -- cgit v0.9.0.2