Diffstat (limited to 'noncore/settings/networksettings2/bluetooth') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.cpp | 42 |
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 | |||
@@ -1,6 +1,16 @@ | |||
1 | #include <qapplication.h> | 1 | #include <qapplication.h> |
2 | #include <resources.h> | 2 | #include <resources.h> |
3 | |||
4 | #include <OTPeer.h> | ||
3 | #include <OTDevice.h> | 5 | #include <OTDevice.h> |
4 | #include <OTGateway.h> | 6 | #include <OTGateway.h> |
7 | #include <Opietooth.h> | ||
8 | |||
9 | #include <qlistbox.h> | ||
10 | #include <qframe.h> | ||
11 | #include <qlabel.h> | ||
12 | #include <qlayout.h> | ||
13 | #include <qdialog.h> | ||
14 | |||
5 | #include "bluetoothRFCOMMrun.h" | 15 | #include "bluetoothRFCOMMrun.h" |
6 | 16 | ||
@@ -8,4 +18,6 @@ using Opietooth2::OTGateway; | |||
8 | using Opietooth2::OTDevice; | 18 | using Opietooth2::OTDevice; |
9 | using Opietooth2::OTDeviceAddress; | 19 | using Opietooth2::OTDeviceAddress; |
20 | using Opietooth2::OTScan; | ||
21 | using Opietooth2::OTPeer; | ||
10 | 22 | ||
11 | BluetoothRFCOMMRun::~BluetoothRFCOMMRun( void ) { | 23 | BluetoothRFCOMMRun::~BluetoothRFCOMMRun( void ) { |
@@ -56,4 +68,7 @@ QString BluetoothRFCOMMRun::setMyState( NetworkSetup *, | |||
56 | << QString().setNum( Ch->Channel ); | 68 | << QString().setNum( Ch->Channel ); |
57 | 69 | ||
70 | // no longer needed | ||
71 | delete Ch; | ||
72 | |||
58 | if( Sys.runAsRoot( S ) ) { | 73 | if( Sys.runAsRoot( S ) ) { |
59 | return QString( "Error starting %1").arg(S.join(" ")); | 74 | return QString( "Error starting %1").arg(S.join(" ")); |
@@ -79,10 +94,4 @@ QString BluetoothRFCOMMRun::setMyState( NetworkSetup *, | |||
79 | } | 94 | } |
80 | 95 | ||
81 | #include <qlistbox.h> | ||
82 | #include <qframe.h> | ||
83 | #include <qlabel.h> | ||
84 | #include <qlayout.h> | ||
85 | #include <qdialog.h> | ||
86 | |||
87 | RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { | 96 | RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { |
88 | 97 | ||
@@ -93,4 +102,20 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { | |||
93 | 102 | ||
94 | RFCOMMChannel * Ch = 0; | 103 | RFCOMMChannel * Ch = 0; |
104 | |||
105 | if( Data->Devices.count() == 0 ) { | ||
106 | OTPeer * Peer; | ||
107 | int Channel; | ||
108 | |||
109 | if( OTScan::getDevice( Peer, Channel, OT ) == QDialog::Accepted ) { | ||
110 | Ch = new RFCOMMChannel; | ||
111 | Ch->BDAddress = Peer->address().toString(); | ||
112 | Ch->Name = Peer->name(); | ||
113 | Ch->Channel = Channel; | ||
114 | return Ch; | ||
115 | } | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
95 | QDialog * Dlg = new QDialog( qApp->mainWidget(), 0, TRUE ); | 120 | QDialog * Dlg = new QDialog( qApp->mainWidget(), 0, TRUE ); |
96 | QVBoxLayout * V = new QVBoxLayout( Dlg ); | 121 | QVBoxLayout * V = new QVBoxLayout( Dlg ); |
@@ -121,5 +146,8 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { | |||
121 | if( LB->isSelected(i) ) { | 146 | if( LB->isSelected(i) ) { |
122 | odebug << "Selected " << Data->Devices[i]->Name << oendl; | 147 | odebug << "Selected " << Data->Devices[i]->Name << oendl; |
123 | Ch = Data->Devices[i]; | 148 | Ch = new RFCOMMChannel; |
149 | Ch->BDAddress = Data->Devices[i]->BDAddress; | ||
150 | Ch->Name = Data->Devices[i]->Name; | ||
151 | Ch->Channel = Data->Devices[i]->Channel; | ||
124 | break; | 152 | break; |
125 | } | 153 | } |