Diffstat (limited to 'noncore/net/opietooth/applet/bluezapplet.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index f1618ae..39c15ab 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -26,35 +26,39 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | #include "bluezapplet.h" | 30 | #include "bluezapplet.h" |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | 37 | ||
38 | #include <opie/odevice.h> | ||
39 | |||
38 | #include <qpoint.h> | 40 | #include <qpoint.h> |
39 | #include <qpainter.h> | 41 | #include <qpainter.h> |
40 | #include <qlayout.h> | 42 | #include <qlayout.h> |
41 | #include <qframe.h> | 43 | #include <qframe.h> |
42 | #include <qpixmap.h> | 44 | #include <qpixmap.h> |
43 | #include <qstring.h> | 45 | #include <qstring.h> |
44 | #include <qtimer.h> | 46 | #include <qtimer.h> |
45 | #include <qpopupmenu.h> | 47 | #include <qpopupmenu.h> |
46 | 48 | ||
47 | #include <device.h> | 49 | #include <device.h> |
48 | 50 | ||
51 | using namespace Opie; | ||
52 | |||
49 | namespace OpieTooth { | 53 | namespace OpieTooth { |
50 | 54 | ||
51 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { | 55 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { |
52 | setFixedHeight( 18 ); | 56 | setFixedHeight( 18 ); |
53 | setFixedWidth( 14 ); | 57 | setFixedWidth( 14 ); |
54 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); | 58 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); |
55 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); | 59 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); |
56 | // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); | 60 | // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); |
57 | startTimer(4000); | 61 | startTimer(4000); |
58 | btDevice = 0; | 62 | btDevice = 0; |
59 | bluezactive = false; | 63 | bluezactive = false; |
60 | bluezDiscoveryActive = false; | 64 | bluezDiscoveryActive = false; |
@@ -73,25 +77,33 @@ namespace OpieTooth { | |||
73 | return true; | 77 | return true; |
74 | } else { | 78 | } else { |
75 | return false; | 79 | return false; |
76 | } | 80 | } |
77 | } else { | 81 | } else { |
78 | return false; | 82 | return false; |
79 | } | 83 | } |
80 | } | 84 | } |
81 | 85 | ||
82 | int BluezApplet::setBluezStatus(int c) { | 86 | int BluezApplet::setBluezStatus(int c) { |
83 | 87 | ||
84 | if (c == 1) { | 88 | if (c == 1) { |
89 | switch ( ODevice::inst()->model() ) { | ||
90 | case Model_iPAQ_H39xx: | ||
91 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); | ||
92 | break; | ||
93 | |||
94 | default: | ||
85 | btDevice = new Device("/dev/ttySB0", "bcsp", "230400" ); | 95 | btDevice = new Device("/dev/ttySB0", "bcsp", "230400" ); |
96 | break; | ||
97 | } | ||
86 | } else { | 98 | } else { |
87 | if (btDevice) { | 99 | if (btDevice) { |
88 | delete btDevice; | 100 | delete btDevice; |
89 | btDevice = 0; | 101 | btDevice = 0; |
90 | } | 102 | } |
91 | } | 103 | } |
92 | return 0; | 104 | return 0; |
93 | } | 105 | } |
94 | 106 | ||
95 | int BluezApplet::checkBluezDiscoveryStatus() { | 107 | int BluezApplet::checkBluezDiscoveryStatus() { |
96 | } | 108 | } |
97 | 109 | ||
@@ -108,26 +120,26 @@ namespace OpieTooth { | |||
108 | timerEvent( 0 ); | 120 | timerEvent( 0 ); |
109 | 121 | ||
110 | 122 | ||
111 | if (bluezactive) { | 123 | if (bluezactive) { |
112 | menu->insertItem( tr("Disable Bluetooth"), 0 ); | 124 | menu->insertItem( tr("Disable Bluetooth"), 0 ); |
113 | } else { | 125 | } else { |
114 | menu->insertItem( tr("Enable Bluetooth"), 1 ); | 126 | menu->insertItem( tr("Enable Bluetooth"), 1 ); |
115 | } | 127 | } |
116 | 128 | ||
117 | menu->insertItem( tr("Launch manager"), 2 ); | 129 | menu->insertItem( tr("Launch manager"), 2 ); |
118 | 130 | ||
119 | menu->insertSeparator(6); | 131 | menu->insertSeparator(6); |
120 | menu->insertItem( tr("Signal strength"), signal, 5); | 132 | //menu->insertItem( tr("Signal strength"), signal, 5); |
121 | menu->insertSeparator(8); | 133 | //menu->insertSeparator(8); |
122 | 134 | ||
123 | if (bluezDiscoveryActive) { | 135 | if (bluezDiscoveryActive) { |
124 | menu->insertItem( tr("Disable discovery"), 3 ); | 136 | menu->insertItem( tr("Disable discovery"), 3 ); |
125 | } else { | 137 | } else { |
126 | menu->insertItem( tr("Enable discovery"), 4 ); | 138 | menu->insertItem( tr("Enable discovery"), 4 ); |
127 | } | 139 | } |
128 | 140 | ||
129 | 141 | ||
130 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); | 142 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); |
131 | ret = menu->exec(p, 0); | 143 | ret = menu->exec(p, 0); |
132 | 144 | ||
133 | switch(ret) { | 145 | switch(ret) { |