author | wimpie <wimpie> | 2005-01-12 01:40:53 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-12 01:40:53 (UTC) |
commit | f9a83585111afa08a47176097a150d9f468bfcdf (patch) (unidiff) | |
tree | 6d5a3b5f9716f7c6ca6e7fae8b0e2bac8d6c57da /noncore/settings/networksettings2/bluetooth | |
parent | b2e60aa0222b348f34aab501feb8bc854e94413c (diff) | |
download | opie-f9a83585111afa08a47176097a150d9f468bfcdf.zip opie-f9a83585111afa08a47176097a150d9f468bfcdf.tar.gz opie-f9a83585111afa08a47176097a150d9f468bfcdf.tar.bz2 |
*** empty log message ***
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,12 +1,24 @@ | |||
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 | ||
7 | using Opietooth2::OTGateway; | 17 | 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 ) { |
12 | if( OT ) { | 24 | if( OT ) { |
@@ -55,6 +67,9 @@ QString BluetoothRFCOMMRun::setMyState( NetworkSetup *, | |||
55 | << Ch->BDAddress | 67 | << Ch->BDAddress |
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(" ")); |
60 | } | 75 | } |
@@ -78,12 +93,6 @@ QString BluetoothRFCOMMRun::setMyState( NetworkSetup *, | |||
78 | return QString(); | 93 | return QString(); |
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 | ||
89 | if( Data->Devices.count() == 1 ) { | 98 | if( Data->Devices.count() == 1 ) { |
@@ -92,6 +101,22 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { | |||
92 | } | 101 | } |
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 ); |
97 | 122 | ||
@@ -120,7 +145,10 @@ RFCOMMChannel * BluetoothRFCOMMRun::getChannel( void ) { | |||
120 | for( i = 0; i < Data->Devices.count(); i ++ ) { | 145 | for( i = 0; i < Data->Devices.count(); i ++ ) { |
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 | } |
126 | } | 154 | } |