summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp16
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 48698b6..e1c2341 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -1,114 +1,114 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> 3             .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can 5 _;:,     .>    :=|. This library is free software; you can
6.> <,   >  .   <= redistribute it and/or modify it under 6.> <,   >  .   <= redistribute it and/or modify it under
7:=1 )Y*s>-.--   : the terms of the GNU Library General Public 7:=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; version 2 of the License. 9 - .   .-<_>     .<> Foundation; version 2 of the License.
10     ._= =}       : 10     ._= =}       :
11    .%+i>       _;_. 11    .%+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that 12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details. 18++=   -.     .     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22   --        :-= this library; see the file COPYING.LIB. 22   --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29 29
30#include "bluezapplet.h" 30#include "bluezapplet.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/otaskbarapplet.h> 33#include <opie2/otaskbarapplet.h>
34#include <opie2/odevice.h> 34#include <opie2/odevice.h>
35#include <opie2/odebug.h> 35#include <opie2/odebug.h>
36#include <opie2/oresource.h>
36#include <qpe/applnk.h> 37#include <qpe/applnk.h>
37#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
38#include <qpe/config.h> 39#include <qpe/config.h>
39#include <qpe/resource.h>
40using namespace Opie::Core; 40using namespace Opie::Core;
41 41
42/* QT */ 42/* QT */
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qpoint.h> 44#include <qpoint.h>
45#include <qpainter.h> 45#include <qpainter.h>
46#include <qlayout.h> 46#include <qlayout.h>
47#include <qframe.h> 47#include <qframe.h>
48#include <qpixmap.h> 48#include <qpixmap.h>
49#include <qstring.h> 49#include <qstring.h>
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qpopupmenu.h> 51#include <qpopupmenu.h>
52 52
53/* STD */ 53/* STD */
54#include <device.h> 54#include <device.h>
55 55
56namespace OpieTooth { 56namespace OpieTooth {
57 57
58 BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { 58 BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) {
59 setFixedHeight( AppLnk::smallIconSize() ); 59 setFixedHeight( AppLnk::smallIconSize() );
60 setFixedWidth( AppLnk::smallIconSize() ); 60 setFixedWidth( AppLnk::smallIconSize() );
61 bluezOnPixmap = Resource::loadImage( "bluetoothapplet/bluezon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 61 bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon );
62 bluezOffPixmap = Resource::loadImage( "bluetoothapplet/bluezoff" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 62 bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon );
63 //bluezDiscoveryOnPixmap = Resource::loadImage( "bluetoothapplet/magglass" )smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); 63 bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon );
64 startTimer(4000); 64 startTimer(4000);
65 btDevice = 0; 65 btDevice = 0;
66 btManager = 0; 66 btManager = 0;
67 bluezactive = false; 67 bluezactive = false;
68 bluezDiscoveryActive = false; 68 bluezDiscoveryActive = false;
69 69
70 // TODO: determine whether this channel has to be closed at destruction time. 70 // TODO: determine whether this channel has to be closed at destruction time.
71 QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); 71 QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this );
72 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 72 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
73 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); 73 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
74 } 74 }
75 75
76 BluezApplet::~BluezApplet() { 76 BluezApplet::~BluezApplet() {
77 if ( btDevice ) { 77 if ( btDevice ) {
78 delete btDevice; 78 delete btDevice;
79 } 79 }
80 if ( btManager ) { 80 if ( btManager ) {
81 delete btManager; 81 delete btManager;
82 } 82 }
83 } 83 }
84 84
85int BluezApplet::position() 85int BluezApplet::position()
86{ 86{
87 return 6; 87 return 6;
88} 88}
89 89
90 90
91 bool BluezApplet::checkBluezStatus() { 91 bool BluezApplet::checkBluezStatus() {
92 if (btDevice) { 92 if (btDevice) {
93 if (btDevice->isLoaded() ) { 93 if (btDevice->isLoaded() ) {
94 return true; 94 return true;
95 } else { 95 } else {
96 return false; 96 return false;
97 } 97 }
98 } else { 98 } else {
99 return false; 99 return false;
100 } 100 }
101 } 101 }
102 102
103 int BluezApplet::setBluezStatus(int c) { 103 int BluezApplet::setBluezStatus(int c) {
104 104
105 if ( c == 1 ) { 105 if ( c == 1 ) {
106 switch ( ODevice::inst()->model() ) { 106 switch ( ODevice::inst()->model() ) {
107 case Model_iPAQ_H39xx: 107 case Model_iPAQ_H39xx:
108 btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); 108 btDevice = new Device( "/dev/tts/1", "bcsp", "921600" );
109 break; 109 break;
110 110
111 case Model_iPAQ_H5xxx: 111 case Model_iPAQ_H5xxx:
112 btDevice = new Device( "/dev/tts/1", "any", "921600" ); 112 btDevice = new Device( "/dev/tts/1", "any", "921600" );
113 break; 113 break;
114 114
@@ -225,61 +225,61 @@ int BluezApplet::position()
225 timerEvent( 0 ); 225 timerEvent( 0 );
226 break; 226 break;
227 case 4: 227 case 4:
228 setBluezDiscoveryStatus(1); 228 setBluezDiscoveryStatus(1);
229 timerEvent(0 ); 229 timerEvent(0 );
230 break; 230 break;
231 //case 7: 231 //case 7:
232 // With table of currently-detected devices. 232 // With table of currently-detected devices.
233 } 233 }
234 234
235 delete signal; 235 delete signal;
236 delete menu; 236 delete menu;
237 } 237 }
238 238
239 239
240/** 240/**
241 * Launches the bluetooth manager 241 * Launches the bluetooth manager
242 */ 242 */
243 void BluezApplet::launchManager() { 243 void BluezApplet::launchManager() {
244 QCopEnvelope e("QPE/System", "execute(QString)"); 244 QCopEnvelope e("QPE/System", "execute(QString)");
245 e << QString("bluetooth-manager"); 245 e << QString("bluetooth-manager");
246 } 246 }
247 247
248/** 248/**
249 * Refresh timer 249 * Refresh timer
250 * @param the timer event 250 * @param the timer event
251 */ 251 */
252 void BluezApplet::timerEvent( QTimerEvent * ) { 252 void BluezApplet::timerEvent( QTimerEvent * ) {
253 bool oldactive = bluezactive; 253 bool oldactive = bluezactive;
254 int olddiscovery = bluezDiscoveryActive; 254 int olddiscovery = bluezDiscoveryActive;
255 255
256 bluezactive = checkBluezStatus(); 256 bluezactive = checkBluezStatus();
257 bluezDiscoveryActive = checkBluezDiscoveryStatus(); 257 bluezDiscoveryActive = checkBluezDiscoveryStatus();
258 258
259 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { 259 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) {
260 update(); 260 update();
261 } 261 }
262 } 262 }
263 263
264/** 264/**
265 * Implementation of the paint event 265 * Implementation of the paint event
266 * @param the QPaintEvent 266 * @param the QPaintEvent
267 */ 267 */
268 void BluezApplet::paintEvent( QPaintEvent* ) { 268 void BluezApplet::paintEvent( QPaintEvent* ) {
269 QPainter p(this); 269 QPainter p(this);
270 odebug << "paint bluetooth pixmap" << oendl; 270 odebug << "paint bluetooth pixmap" << oendl;
271 271
272 if (bluezactive > 0) { 272 if (bluezactive > 0) {
273 p.drawPixmap( 0, 1, bluezOnPixmap ); 273 p.drawPixmap( 0, 0, bluezOnPixmap );
274 } else { 274 } else {
275 p.drawPixmap( 0, 1, bluezOffPixmap ); 275 p.drawPixmap( 0, 0, bluezOffPixmap );
276 } 276 }
277 277
278 if (bluezDiscoveryActive > 0) { 278 if (bluezDiscoveryActive > 0) {
279 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); 279 p.drawPixmap( 0, 0, bluezDiscoveryOnPixmap );
280 } 280 }
281 } 281 }
282}; 282};
283 283
284EXPORT_OPIE_APPLET_v1( OpieTooth::BluezApplet ) 284EXPORT_OPIE_APPLET_v1( OpieTooth::BluezApplet )
285 285
diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h
index 3b99c0f..c096e29 100644
--- a/noncore/net/opietooth/applet/bluezapplet.h
+++ b/noncore/net/opietooth/applet/bluezapplet.h
@@ -15,65 +15,65 @@
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details. 18++=   -.     .     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21  -_. . .   )=.  = Library General Public License along with
22    --        :-= this library; see the file COPYING.LIB. 22    --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#ifndef __BLUEZAPPLET_H__ 29#ifndef __BLUEZAPPLET_H__
30#define __BLUEZAPPLET_H__ 30#define __BLUEZAPPLET_H__
31 31
32#include <qwidget.h> 32#include <qwidget.h>
33#include <qpixmap.h> 33#include <qpixmap.h>
34#include <qtimer.h> 34#include <qtimer.h>
35#include <manager.h> 35#include <manager.h>
36 36
37namespace OpieTooth { 37namespace OpieTooth {
38 class Device; 38 class Device;
39 39
40 class BluezApplet : public QWidget { 40 class BluezApplet : public QWidget {
41 Q_OBJECT 41 Q_OBJECT
42 public: 42 public:
43 BluezApplet( QWidget *parent = 0, const char *name=0 ); 43 BluezApplet( QWidget *parent = 0, const char *name=0 );
44 ~BluezApplet(); 44 ~BluezApplet();
45 static int position(); 45 static int position();
46 protected: 46 protected:
47 void timerEvent(QTimerEvent *te ); 47 void timerEvent(QTimerEvent *te );
48 48
49public slots: 49public slots:
50 void fillList( const QString& device, RemoteDevice::ValueList list ); 50 void fillList( const QString& device, RemoteDevice::ValueList list );
51 51
52 private: 52 private:
53 void mousePressEvent( QMouseEvent * ); 53 void mousePressEvent( QMouseEvent * );
54 void paintEvent( QPaintEvent* ); 54 void paintEvent( QPaintEvent* );
55 void launchManager(); 55 void launchManager();
56 bool checkBluezStatus(); 56 bool checkBluezStatus();
57 int setBluezStatus(int); 57 int setBluezStatus(int);
58 int checkBluezDiscoveryStatus(); 58 int checkBluezDiscoveryStatus();
59 int setBluezDiscoveryStatus(int); 59 int setBluezDiscoveryStatus(int);
60 60
61 private: 61 private:
62 Device* btDevice; 62 Device* btDevice;
63 Manager *btManager; 63 Manager *btManager;
64 QPixmap bluezOnPixmap; 64 QPixmap bluezOnPixmap;
65 QPixmap bluezOffPixmap; 65 QPixmap bluezOffPixmap;
66 QPixmap bluezDiscoveryOnPixmap; 66 QPixmap bluezDiscoveryOnPixmap;
67 bool bluezactive; 67 bool bluezactive;
68 bool bluezDiscoveryActive; 68 bool bluezDiscoveryActive;
69 69
70private slots: 70private slots:
71 void slotMessage( const QCString& , const QByteArray& ); 71 void slotMessage( const QCString& , const QByteArray& );
72 72
73 73
74 }; 74 };
75}; 75};
76 76
77 77
78#endif 78#endif
79 79