summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
index cd7bb4a..63b214e 100644
--- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
+++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp
@@ -2,4 +2,14 @@
#include <resources.h>
+
+#include <OTPeer.h>
#include <OTDevice.h>
#include <OTGateway.h>
+#include <Opietooth.h>
+
+#include <qlistbox.h>
+#include <qframe.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qdialog.h>
+
#include "bluetoothRFCOMMrun.h"
@@ -9,2 +19,4 @@ using Opietooth2::OTDevice;
using Opietooth2::OTDeviceAddress;
+using Opietooth2::OTScan;
+using Opietooth2::OTPeer;
@@ -57,2 +69,5 @@ QString BluetoothRFCOMMRun::setMyState( NetworkSetup *,
+ // no longer needed
+ delete Ch;
+
if( Sys.runAsRoot( S ) ) {
@@ -80,8 +95,2 @@ QString BluetoothRFCOMMRun::setMyState( NetworkSetup *,
-#include <qlistbox.h>
-#include <qframe.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qdialog.h>
-
RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) {
@@ -94,2 +103,18 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) {
RFCOMMChannel * Ch = 0;
+
+ if( Data->Devices.count() == 0 ) {
+ OTPeer * Peer;
+ int Channel;
+
+ if( OTScan::getDevice( Peer, Channel, OT ) == QDialog::Accepted ) {
+ Ch = new RFCOMMChannel;
+ Ch->BDAddress = Peer->address().toString();
+ Ch->Name = Peer->name();
+ Ch->Channel = Channel;
+ return Ch;
+ }
+
+ return 0;
+ }
+
QDialog * Dlg = new QDialog( qApp->mainWidget(), 0, TRUE );
@@ -122,3 +147,6 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) {
odebug << "Selected " << Data->Devices[i]->Name << oendl;
- Ch = Data->Devices[i];
+ Ch = new RFCOMMChannel;
+ Ch->BDAddress = Data->Devices[i]->BDAddress;
+ Ch->Name = Data->Devices[i]->Name;
+ Ch->Channel = Data->Devices[i]->Channel;
break;