-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 54 | ||||
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.h | 4 |
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 { bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" ); + bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" ); #else bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); + bluezReceiveOnPixmap = )Resource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon ); #endif startTimer(2000); @@ -75,4 +77,6 @@ namespace OpieTooth { bluezactive = false; bluezDiscoveryActive = false; + bluezReceiveActive = false; + bluezReceiveChanged = false; doListDevice = false; isScanning = false; @@ -135,8 +139,7 @@ namespace OpieTooth { break; #endif - - case Model_iPAQ_H22xx: - btDevice = new Device( "/dev/tts/3", "any", "921600" ); - break; + case Model_iPAQ_H22xx: + btDevice = new Device( "/dev/tts/3", "any", "921600" ); + break; default: @@ -149,4 +152,5 @@ namespace OpieTooth { } else { + setObexRecieveStatus(0); ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); if ( btManager ) { @@ -169,6 +173,16 @@ namespace OpieTooth { return bluezDiscoveryActive = d; } - - // FIXME mbhaynie + + int BluezApplet::setObexRecieveStatus(int d) { + { + QCopEnvelope e ( "QPE/Obex", "btreceive(int)" ); + e << ( d ? 1 : 0 ); + } + bluezReceiveActive = (bool)(d != 0); + bluezReceiveChanged = true; + return d; + } + + // FIXME mbhaynie // receiver for QCopChannel("QPE/Bluetooth") messages. void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) @@ -245,10 +259,11 @@ namespace OpieTooth { //menu->insertSeparator(8); - if (bluezDiscoveryActive) { - menu->insertItem( tr("Disable discovery"), 3 ); - } else { - menu->insertItem( tr("Enable discovery"), 4 ); - } - + if (bluezactive) { + if (bluezReceiveActive) { + menu->insertItem( tr("Disable receive"), 3 ); + } else { + menu->insertItem( tr("Enable receive"), 4 ); + } + } QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); @@ -271,10 +286,10 @@ namespace OpieTooth { break; case 3: - setBluezDiscoveryStatus(0); + setObexRecieveStatus(0); timerEvent( 0 ); break; case 4: - setBluezDiscoveryStatus(1); - timerEvent(0 ); + setObexRecieveStatus(1); + timerEvent( 0 ); break; //case 7: @@ -307,5 +322,6 @@ namespace OpieTooth { if ((bluezactive != oldactive) || - (bluezDiscoveryActive != olddiscovery)) + (bluezDiscoveryActive != olddiscovery) || + bluezReceiveChanged) update(); if (bluezactive && doListDevice) { @@ -313,4 +329,6 @@ namespace OpieTooth { slotMessage("listDevices()", arr); } + if (bluezReceiveChanged) + bluezReceiveChanged = false; } @@ -340,5 +358,9 @@ namespace OpieTooth { p.drawPixmap( 0, 0, bluezDiscoveryOnPixmap ); } + if (bluezReceiveActive) { + p.drawPixmap( 0, 0, bluezReceiveOnPixmap ); + } } + /** * 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: int checkBluezDiscoveryStatus(); int setBluezDiscoveryStatus(int); + int setObexRecieveStatus(int); private: @@ -66,6 +67,9 @@ public slots: QPixmap bluezOffPixmap; QPixmap bluezDiscoveryOnPixmap; + QPixmap bluezReceiveOnPixmap; bool bluezactive; bool bluezDiscoveryActive; + bool bluezReceiveActive; + bool bluezReceiveChanged; bool doListDevice; //If I have to list devices after bringing BT up? bool isScanning; //If I'm scanning devices |