summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp54
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.h4
2 files changed, 42 insertions, 16 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index a1d64a4..32560a1 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -65,8 +65,10 @@ namespace OpieTooth {
65 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); 65 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" );
66 bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" ); 66 bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" );
67 bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" );
67#else 68#else
68 bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); 69 bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon );
69 bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); 70 bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon );
70 bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); 71 bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon );
72 bluezReceiveOnPixmap = )Resource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon );
71#endif 73#endif
72 startTimer(2000); 74 startTimer(2000);
@@ -75,4 +77,6 @@ namespace OpieTooth {
75 bluezactive = false; 77 bluezactive = false;
76 bluezDiscoveryActive = false; 78 bluezDiscoveryActive = false;
79 bluezReceiveActive = false;
80 bluezReceiveChanged = false;
77 doListDevice = false; 81 doListDevice = false;
78 isScanning = false; 82 isScanning = false;
@@ -135,8 +139,7 @@ namespace OpieTooth {
135 break; 139 break;
136#endif 140#endif
137 141 case Model_iPAQ_H22xx:
138 case Model_iPAQ_H22xx: 142 btDevice = new Device( "/dev/tts/3", "any", "921600" );
139 btDevice = new Device( "/dev/tts/3", "any", "921600" ); 143 break;
140 break;
141 144
142 default: 145 default:
@@ -149,4 +152,5 @@ namespace OpieTooth {
149 152
150 } else { 153 } else {
154 setObexRecieveStatus(0);
151 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); 155 ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null");
152 if ( btManager ) { 156 if ( btManager ) {
@@ -169,6 +173,16 @@ namespace OpieTooth {
169 return bluezDiscoveryActive = d; 173 return bluezDiscoveryActive = d;
170 } 174 }
171 175
172 // FIXME mbhaynie 176 int BluezApplet::setObexRecieveStatus(int d) {
177 {
178 QCopEnvelope e ( "QPE/Obex", "btreceive(int)" );
179 e << ( d ? 1 : 0 );
180 }
181 bluezReceiveActive = (bool)(d != 0);
182 bluezReceiveChanged = true;
183 return d;
184 }
185
186 // FIXME mbhaynie
173 // receiver for QCopChannel("QPE/Bluetooth") messages. 187 // receiver for QCopChannel("QPE/Bluetooth") messages.
174 void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) 188 void BluezApplet::slotMessage( const QCString& str, const QByteArray& )
@@ -245,10 +259,11 @@ namespace OpieTooth {
245 //menu->insertSeparator(8); 259 //menu->insertSeparator(8);
246 260
247 if (bluezDiscoveryActive) { 261 if (bluezactive) {
248 menu->insertItem( tr("Disable discovery"), 3 ); 262 if (bluezReceiveActive) {
249 } else { 263 menu->insertItem( tr("Disable receive"), 3 );
250 menu->insertItem( tr("Enable discovery"), 4 ); 264 } else {
251 } 265 menu->insertItem( tr("Enable receive"), 4 );
252 266 }
267 }
253 268
254 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); 269 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) );
@@ -271,10 +286,10 @@ namespace OpieTooth {
271 break; 286 break;
272 case 3: 287 case 3:
273 setBluezDiscoveryStatus(0); 288 setObexRecieveStatus(0);
274 timerEvent( 0 ); 289 timerEvent( 0 );
275 break; 290 break;
276 case 4: 291 case 4:
277 setBluezDiscoveryStatus(1); 292 setObexRecieveStatus(1);
278 timerEvent(0 ); 293 timerEvent( 0 );
279 break; 294 break;
280 //case 7: 295 //case 7:
@@ -307,5 +322,6 @@ namespace OpieTooth {
307 322
308 if ((bluezactive != oldactive) || 323 if ((bluezactive != oldactive) ||
309 (bluezDiscoveryActive != olddiscovery)) 324 (bluezDiscoveryActive != olddiscovery) ||
325 bluezReceiveChanged)
310 update(); 326 update();
311 if (bluezactive && doListDevice) { 327 if (bluezactive && doListDevice) {
@@ -313,4 +329,6 @@ namespace OpieTooth {
313 slotMessage("listDevices()", arr); 329 slotMessage("listDevices()", arr);
314 } 330 }
331 if (bluezReceiveChanged)
332 bluezReceiveChanged = false;
315 } 333 }
316 334
@@ -340,5 +358,9 @@ namespace OpieTooth {
340 p.drawPixmap( 0, 0, bluezDiscoveryOnPixmap ); 358 p.drawPixmap( 0, 0, bluezDiscoveryOnPixmap );
341 } 359 }
360 if (bluezReceiveActive) {
361 p.drawPixmap( 0, 0, bluezReceiveOnPixmap );
362 }
342 } 363 }
364
343 /** 365 /**
344 * Reacts on device up 366 * Reacts on device up
diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h
index b79ed5b..9809d20 100644
--- a/noncore/net/opietooth/applet/bluezapplet.h
+++ b/noncore/net/opietooth/applet/bluezapplet.h
@@ -59,4 +59,5 @@ public slots:
59 int checkBluezDiscoveryStatus(); 59 int checkBluezDiscoveryStatus();
60 int setBluezDiscoveryStatus(int); 60 int setBluezDiscoveryStatus(int);
61 int setObexRecieveStatus(int);
61 62
62 private: 63 private:
@@ -66,6 +67,9 @@ public slots:
66 QPixmap bluezOffPixmap; 67 QPixmap bluezOffPixmap;
67 QPixmap bluezDiscoveryOnPixmap; 68 QPixmap bluezDiscoveryOnPixmap;
69 QPixmap bluezReceiveOnPixmap;
68 bool bluezactive; 70 bool bluezactive;
69 bool bluezDiscoveryActive; 71 bool bluezDiscoveryActive;
72 bool bluezReceiveActive;
73 bool bluezReceiveChanged;
70 bool doListDevice; //If I have to list devices after bringing BT up? 74 bool doListDevice; //If I have to list devices after bringing BT up?
71 bool isScanning; //If I'm scanning devices 75 bool isScanning; //If I'm scanning devices