author | chicken <chicken> | 2004-02-25 11:18:56 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-02-25 11:18:56 (UTC) |
commit | 50aef52b265bc8c8e5e5c6a871affe94142d74fb (patch) (unidiff) | |
tree | e8dc208cfc4c57a30e81fb0311717405a7d83c68 | |
parent | 96ba6fcf27c785282c3fe05557df8b384df06852 (diff) | |
download | opie-50aef52b265bc8c8e5e5c6a871affe94142d74fb.zip opie-50aef52b265bc8c8e5e5c6a871affe94142d74fb.tar.gz opie-50aef52b265bc8c8e5e5c6a871affe94142d74fb.tar.bz2 |
correct h5xxx support, patch by bedboi
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 39c15ab..b76b397 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -30,128 +30,132 @@ | |||
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> | 38 | #include <opie/odevice.h> |
39 | 39 | ||
40 | #include <qpoint.h> | 40 | #include <qpoint.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qframe.h> | 43 | #include <qframe.h> |
44 | #include <qpixmap.h> | 44 | #include <qpixmap.h> |
45 | #include <qstring.h> | 45 | #include <qstring.h> |
46 | #include <qtimer.h> | 46 | #include <qtimer.h> |
47 | #include <qpopupmenu.h> | 47 | #include <qpopupmenu.h> |
48 | 48 | ||
49 | #include <device.h> | 49 | #include <device.h> |
50 | 50 | ||
51 | using namespace Opie; | 51 | using namespace Opie; |
52 | 52 | ||
53 | namespace OpieTooth { | 53 | namespace OpieTooth { |
54 | 54 | ||
55 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { | 55 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { |
56 | setFixedHeight( 18 ); | 56 | setFixedHeight( 18 ); |
57 | setFixedWidth( 14 ); | 57 | setFixedWidth( 14 ); |
58 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); | 58 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); |
59 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); | 59 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); |
60 | // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); | 60 | // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); |
61 | startTimer(4000); | 61 | startTimer(4000); |
62 | btDevice = 0; | 62 | btDevice = 0; |
63 | bluezactive = false; | 63 | bluezactive = false; |
64 | bluezDiscoveryActive = false; | 64 | bluezDiscoveryActive = false; |
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | BluezApplet::~BluezApplet() { | 68 | BluezApplet::~BluezApplet() { |
69 | if ( btDevice ) { | 69 | if ( btDevice ) { |
70 | delete btDevice; | 70 | delete btDevice; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | bool BluezApplet::checkBluezStatus() { | 74 | bool BluezApplet::checkBluezStatus() { |
75 | if (btDevice) { | 75 | if (btDevice) { |
76 | if (btDevice->isLoaded() ) { | 76 | if (btDevice->isLoaded() ) { |
77 | return true; | 77 | return true; |
78 | } else { | 78 | } else { |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | } else { | 81 | } else { |
82 | return false; | 82 | return false; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | int BluezApplet::setBluezStatus(int c) { | 86 | int BluezApplet::setBluezStatus(int c) { |
87 | 87 | ||
88 | if ( c == 1 ) { | 88 | if ( c == 1 ) { |
89 | switch ( ODevice::inst()->model() ) { | 89 | switch ( ODevice::inst()->model() ) { |
90 | case Model_iPAQ_H39xx: | 90 | case Model_iPAQ_H39xx: |
91 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); | 91 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); |
92 | break; | 92 | break; |
93 | 93 | ||
94 | case Model_iPAQ_H5xxx: | ||
95 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); | ||
96 | break; | ||
97 | |||
94 | default: | 98 | default: |
95 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); | 99 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); |
96 | break; | 100 | break; |
97 | } | 101 | } |
98 | } else { | 102 | } else { |
99 | if ( btDevice ) { | 103 | if ( btDevice ) { |
100 | delete btDevice; | 104 | delete btDevice; |
101 | btDevice = 0; | 105 | btDevice = 0; |
102 | } | 106 | } |
103 | } | 107 | } |
104 | return 0; | 108 | return 0; |
105 | } | 109 | } |
106 | 110 | ||
107 | int BluezApplet::checkBluezDiscoveryStatus() { | 111 | int BluezApplet::checkBluezDiscoveryStatus() { |
108 | } | 112 | } |
109 | 113 | ||
110 | int BluezApplet::setBluezDiscoveryStatus(int d) { | 114 | int BluezApplet::setBluezDiscoveryStatus(int d) { |
111 | } | 115 | } |
112 | 116 | ||
113 | void BluezApplet::mousePressEvent( QMouseEvent *) { | 117 | void BluezApplet::mousePressEvent( QMouseEvent *) { |
114 | 118 | ||
115 | QPopupMenu *menu = new QPopupMenu(); | 119 | QPopupMenu *menu = new QPopupMenu(); |
116 | QPopupMenu *signal = new QPopupMenu(); | 120 | QPopupMenu *signal = new QPopupMenu(); |
117 | int ret=0; | 121 | int ret=0; |
118 | 122 | ||
119 | /* Refresh active state */ | 123 | /* Refresh active state */ |
120 | timerEvent( 0 ); | 124 | timerEvent( 0 ); |
121 | 125 | ||
122 | 126 | ||
123 | if (bluezactive) { | 127 | if (bluezactive) { |
124 | menu->insertItem( tr("Disable Bluetooth"), 0 ); | 128 | menu->insertItem( tr("Disable Bluetooth"), 0 ); |
125 | } else { | 129 | } else { |
126 | menu->insertItem( tr("Enable Bluetooth"), 1 ); | 130 | menu->insertItem( tr("Enable Bluetooth"), 1 ); |
127 | } | 131 | } |
128 | 132 | ||
129 | menu->insertItem( tr("Launch manager"), 2 ); | 133 | menu->insertItem( tr("Launch manager"), 2 ); |
130 | 134 | ||
131 | menu->insertSeparator(6); | 135 | menu->insertSeparator(6); |
132 | //menu->insertItem( tr("Signal strength"), signal, 5); | 136 | //menu->insertItem( tr("Signal strength"), signal, 5); |
133 | //menu->insertSeparator(8); | 137 | //menu->insertSeparator(8); |
134 | 138 | ||
135 | if (bluezDiscoveryActive) { | 139 | if (bluezDiscoveryActive) { |
136 | menu->insertItem( tr("Disable discovery"), 3 ); | 140 | menu->insertItem( tr("Disable discovery"), 3 ); |
137 | } else { | 141 | } else { |
138 | menu->insertItem( tr("Enable discovery"), 4 ); | 142 | menu->insertItem( tr("Enable discovery"), 4 ); |
139 | } | 143 | } |
140 | 144 | ||
141 | 145 | ||
142 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); | 146 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); |
143 | ret = menu->exec(p, 0); | 147 | ret = menu->exec(p, 0); |
144 | 148 | ||
145 | switch(ret) { | 149 | switch(ret) { |
146 | case 0: | 150 | case 0: |
147 | setBluezStatus(0); | 151 | setBluezStatus(0); |
148 | timerEvent( 0 ); | 152 | timerEvent( 0 ); |
149 | break; | 153 | break; |
150 | case 1: | 154 | case 1: |
151 | setBluezStatus(1); | 155 | setBluezStatus(1); |
152 | timerEvent( 0 ); | 156 | timerEvent( 0 ); |
153 | break; | 157 | break; |
154 | case 2: | 158 | case 2: |
155 | // start bluetoothmanager | 159 | // start bluetoothmanager |
156 | launchManager(); | 160 | launchManager(); |
157 | timerEvent( 0 ); | 161 | timerEvent( 0 ); |