summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp40
-rw-r--r--noncore/net/opietooth/manager/bluebase.h1
-rw-r--r--noncore/net/opietooth/manager/hciconfwrapper.cpp4
3 files changed, 25 insertions, 20 deletions
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 <qlistview.h>
#include <qdir.h>
#include <qpopupmenu.h>
+#include <qtimer.h>
#include <qpe/resource.h>
#include <qpe/config.h>
@@ -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<QListViewItem*> tmpList;
- //while( myChild ) {
- // tmpList.append(myChild);
- // myChild = myChild->nextSibling();
- // }
-
-
QValueList<OpieTooth::Services>::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<OpieTooth::Connection>::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();
}
-
}