author | korovkin <korovkin> | 2006-07-07 04:52:18 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-07-07 04:52:18 (UTC) |
commit | 9fb74057cd43bf6ac0cb50c617f9146457367cbc (patch) (unidiff) | |
tree | 67571bdef0866d8b2dc281ed5814cd872edf5895 | |
parent | 060b467fb04094352343298688db04d89943f4b3 (diff) | |
download | opie-9fb74057cd43bf6ac0cb50c617f9146457367cbc.zip opie-9fb74057cd43bf6ac0cb50c617f9146457367cbc.tar.gz opie-9fb74057cd43bf6ac0cb50c617f9146457367cbc.tar.bz2 |
Fixed the typo in the Resource::loadImage function call.
Reformatted setBluezStatus function.
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 32560a1..91ab2e1 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -24,168 +24,168 @@ | |||
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 <opie2/oresource.h> |
37 | #include <opie2/oprocess.h> | 37 | #include <opie2/oprocess.h> |
38 | #include <qpe/version.h> | 38 | #include <qpe/version.h> |
39 | #include <qpe/applnk.h> | 39 | #include <qpe/applnk.h> |
40 | #include <qpe/qcopenvelope_qws.h> | 40 | #include <qpe/qcopenvelope_qws.h> |
41 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
42 | using namespace Opie::Core; | 42 | using namespace Opie::Core; |
43 | 43 | ||
44 | /* QT */ | 44 | /* QT */ |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qpoint.h> | 46 | #include <qpoint.h> |
47 | #include <qpainter.h> | 47 | #include <qpainter.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qframe.h> | 49 | #include <qframe.h> |
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qstring.h> | 51 | #include <qstring.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
55 | 55 | ||
56 | /* STD */ | 56 | /* STD */ |
57 | #include <device.h> | 57 | #include <device.h> |
58 | 58 | ||
59 | namespace OpieTooth { | 59 | namespace OpieTooth { |
60 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { | 60 | BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { |
61 | setFixedHeight( AppLnk::smallIconSize() ); | 61 | setFixedHeight( AppLnk::smallIconSize() ); |
62 | setFixedWidth( AppLnk::smallIconSize() ); | 62 | setFixedWidth( AppLnk::smallIconSize() ); |
63 | #if OPIE_VERSION < 102010 | 63 | #if OPIE_VERSION < 102010 |
64 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); | 64 | bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); |
65 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); | 65 | bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); |
66 | bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" ); | 66 | bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass.png" ); |
67 | bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" ); | 67 | bluezReceiveOnPixmap = Resource::loadPixmap( "bluetoothapplet/receive.png" ); |
68 | #else | 68 | #else |
69 | bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); | 69 | bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); |
70 | bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); | 70 | bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); |
71 | bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); | 71 | bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); |
72 | bluezReceiveOnPixmap = )Resource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon ); | 72 | bluezReceiveOnPixmap = Resource::loadImage( "bluetoothapplet/bluezonreceive", Opie::Core::OResource::SmallIcon ); |
73 | #endif | 73 | #endif |
74 | startTimer(2000); | 74 | startTimer(2000); |
75 | btDevice = 0; | 75 | btDevice = 0; |
76 | btManager = 0; | 76 | btManager = 0; |
77 | bluezactive = false; | 77 | bluezactive = false; |
78 | bluezDiscoveryActive = false; | 78 | bluezDiscoveryActive = false; |
79 | bluezReceiveActive = false; | 79 | bluezReceiveActive = false; |
80 | bluezReceiveChanged = false; | 80 | bluezReceiveChanged = false; |
81 | doListDevice = false; | 81 | doListDevice = false; |
82 | isScanning = false; | 82 | isScanning = false; |
83 | m_wasOn = false; | 83 | m_wasOn = false; |
84 | m_sync = false; | 84 | m_sync = false; |
85 | 85 | ||
86 | // TODO: determine whether this channel has to be closed at destruction time. | 86 | // TODO: determine whether this channel has to be closed at destruction time. |
87 | QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); | 87 | QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); |
88 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), | 88 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), |
89 | this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); | 89 | this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); |
90 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); | 90 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); |
91 | } | 91 | } |
92 | 92 | ||
93 | BluezApplet::~BluezApplet() { | 93 | BluezApplet::~BluezApplet() { |
94 | if ( btDevice ) { | 94 | if ( btDevice ) { |
95 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); | 95 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); |
96 | delete btDevice; | 96 | delete btDevice; |
97 | } | 97 | } |
98 | if ( btManager ) { | 98 | if ( btManager ) { |
99 | delete btManager; | 99 | delete btManager; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | int BluezApplet::position() | 103 | int BluezApplet::position() |
104 | { | 104 | { |
105 | return 6; | 105 | return 6; |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | bool BluezApplet::checkBluezStatus() { | 109 | bool BluezApplet::checkBluezStatus() { |
110 | if (btDevice) { | 110 | if (btDevice) { |
111 | if (btDevice->isLoaded() ) { | 111 | if (btDevice->isLoaded() ) { |
112 | odebug << "btDevice isLoaded" << oendl; | 112 | odebug << "btDevice isLoaded" << oendl; |
113 | return true; | 113 | return true; |
114 | } else { | 114 | } else { |
115 | odebug << "btDevice is NOT loaded" << oendl; | 115 | odebug << "btDevice is NOT loaded" << oendl; |
116 | return false; | 116 | return false; |
117 | } | 117 | } |
118 | } else { | 118 | } else { |
119 | odebug << "btDevice is ZERO" << oendl; | 119 | odebug << "btDevice is ZERO" << oendl; |
120 | return false; | 120 | return false; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | int BluezApplet::setBluezStatus(int c, bool sync) { | 124 | int BluezApplet::setBluezStatus(int c, bool sync) { |
125 | 125 | ||
126 | if ( c == 1 ) { | 126 | if ( c == 1 ) { |
127 | switch ( ODevice::inst()->model() ) { | 127 | switch ( ODevice::inst()->model() ) { |
128 | case Model_iPAQ_H39xx: | 128 | case Model_iPAQ_H39xx: |
129 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); | 129 | btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); |
130 | break; | 130 | break; |
131 | 131 | ||
132 | case Model_iPAQ_H5xxx: | 132 | case Model_iPAQ_H5xxx: |
133 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); | 133 | btDevice = new Device( "/dev/tts/1", "any", "921600" ); |
134 | break; | 134 | break; |
135 | 135 | ||
136 | #if OPIE_VERSION >= 102010 | 136 | #if OPIE_VERSION >= 102010 |
137 | case Model_MyPal_716: | 137 | case Model_MyPal_716: |
138 | btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" ); | 138 | btDevice = new Device( "/dev/ttyS1", "bcsp", "921600" ); |
139 | break; | 139 | break; |
140 | #endif | 140 | #endif |
141 | case Model_iPAQ_H22xx: | 141 | case Model_iPAQ_H22xx: |
142 | btDevice = new Device( "/dev/tts/3", "any", "921600" ); | 142 | btDevice = new Device( "/dev/tts/3", "any", "921600" ); |
143 | break; | 143 | break; |
144 | 144 | ||
145 | default: | 145 | default: |
146 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); | 146 | btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); |
147 | break; | 147 | break; |
148 | } | 148 | } |
149 | m_sync = sync; | 149 | m_sync = sync; |
150 | connect(btDevice, SIGNAL(device(const QString&, bool)), | 150 | connect(btDevice, SIGNAL(device(const QString&, bool)), |
151 | this, SLOT(slotDevice(const QString&, bool))); | 151 | this, SLOT(slotDevice(const QString&, bool))); |
152 | 152 | ||
153 | } else { | 153 | } else { |
154 | setObexRecieveStatus(0); | 154 | setObexRecieveStatus(0); |
155 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); | 155 | ::system("/etc/init.d/bluetooth stop >/dev/null 2>/dev/null"); |
156 | if ( btManager ) { | 156 | if ( btManager ) { |
157 | delete btManager; | 157 | delete btManager; |
158 | btManager = 0; | 158 | btManager = 0; |
159 | } | 159 | } |
160 | if ( btDevice ) { | 160 | if ( btDevice ) { |
161 | delete btDevice; | 161 | delete btDevice; |
162 | btDevice = 0; | 162 | btDevice = 0; |
163 | } | 163 | } |
164 | } | 164 | } |
165 | return 0; | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | int BluezApplet::checkBluezDiscoveryStatus() { | 168 | int BluezApplet::checkBluezDiscoveryStatus() { |
169 | return isScanning; | 169 | return isScanning; |
170 | } | 170 | } |
171 | 171 | ||
172 | int BluezApplet::setBluezDiscoveryStatus(int d) { | 172 | int BluezApplet::setBluezDiscoveryStatus(int d) { |
173 | return bluezDiscoveryActive = d; | 173 | return bluezDiscoveryActive = d; |
174 | } | 174 | } |
175 | 175 | ||
176 | int BluezApplet::setObexRecieveStatus(int d) { | 176 | int BluezApplet::setObexRecieveStatus(int d) { |
177 | { | 177 | { |
178 | QCopEnvelope e ( "QPE/Obex", "btreceive(int)" ); | 178 | QCopEnvelope e ( "QPE/Obex", "btreceive(int)" ); |
179 | e << ( d ? 1 : 0 ); | 179 | e << ( d ? 1 : 0 ); |
180 | } | 180 | } |
181 | bluezReceiveActive = (bool)(d != 0); | 181 | bluezReceiveActive = (bool)(d != 0); |
182 | bluezReceiveChanged = true; | 182 | bluezReceiveChanged = true; |
183 | return d; | 183 | return d; |
184 | } | 184 | } |
185 | 185 | ||
186 | // FIXME mbhaynie | 186 | // FIXME mbhaynie |
187 | // receiver for QCopChannel("QPE/Bluetooth") messages. | 187 | // receiver for QCopChannel("QPE/Bluetooth") messages. |
188 | void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) | 188 | void BluezApplet::slotMessage( const QCString& str, const QByteArray& ) |
189 | { | 189 | { |
190 | if ( str == "enableBluetooth()") { | 190 | if ( str == "enableBluetooth()") { |
191 | m_wasOn = checkBluezStatus(); | 191 | m_wasOn = checkBluezStatus(); |