-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 19 | ||||
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.h | 3 |
2 files changed, 10 insertions, 12 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 8bb7a93..c0ad246 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -55,8 +55,10 @@ namespace OpieTooth { bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); startTimer(5000); btDevice = 0; + bluezactive = false; + bluezDiscoveryActive = false; } BluezApplet::~BluezApplet() { @@ -99,9 +101,9 @@ namespace OpieTooth { QPopupMenu *signal = new QPopupMenu(); int ret=0; /* Refresh active state */ - timerEvent(NULL); + timerEvent( 0 ); if (bluezactive) { menu->insertItem( tr("Disable Bluetooth"), 0 ); @@ -127,32 +129,31 @@ namespace OpieTooth { switch(ret) { case 0: setBluezStatus(0); - timerEvent(NULL); + timerEvent( 0 ); break; case 1: setBluezStatus(1); - timerEvent(NULL); + timerEvent( 0 ); break; case 2: // start bluetoothmanager launchManager(); - timerEvent(NULL); + timerEvent( 0 ); break; case 3: setBluezDiscoveryStatus(0); - timerEvent(NULL); + timerEvent( 0 ); break; case 4: setBluezDiscoveryStatus(1); - timerEvent(NULL); + timerEvent(0 ); break; //case 7: // With table of currently-detected devices. } - timerEvent(NULL); delete signal; delete menu; } @@ -176,9 +177,9 @@ namespace OpieTooth { bluezactive = checkBluezStatus(); bluezDiscoveryActive = checkBluezDiscoveryStatus(); if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { - paintEvent(NULL); + update(); } } /** @@ -188,10 +189,8 @@ namespace OpieTooth { void BluezApplet::paintEvent( QPaintEvent* ) { QPainter p(this); qDebug("paint bluetooth pixmap"); - p.eraseRect ( 0, 0, this->width(), this->height() ); - if (bluezactive > 0) { p.drawPixmap( 0, 1, bluezOnPixmap ); } else { p.drawPixmap( 0, 1, bluezOffPixmap ); diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h index 6a8a00e..a8d91a5 100644 --- a/noncore/net/opietooth/applet/bluezapplet.h +++ b/noncore/net/opietooth/applet/bluezapplet.h @@ -53,17 +53,16 @@ public slots: bool checkBluezStatus(); int setBluezStatus(int); int checkBluezDiscoveryStatus(); int setBluezDiscoveryStatus(int); - int sockfd; private: Device* btDevice; QPixmap bluezOnPixmap; QPixmap bluezOffPixmap; QPixmap bluezDiscoveryOnPixmap; bool bluezactive; - int bluezDiscoveryActive; + bool bluezDiscoveryActive; private slots: |