summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/config.in2
-rw-r--r--core/applets/irdaapplet/irda.cpp14
-rw-r--r--core/applets/irdaapplet/irdaapplet.pro2
-rw-r--r--core/applets/irdaapplet/opie-irdaapplet.control2
4 files changed, 11 insertions, 9 deletions
diff --git a/core/applets/irdaapplet/config.in b/core/applets/irdaapplet/config.in
index 0976e8f..49f55ef 100644
--- a/core/applets/irdaapplet/config.in
+++ b/core/applets/irdaapplet/config.in
@@ -1,4 +1,4 @@
1 config IRDAAPPLET 1 config IRDAAPPLET
2 boolean "opie-irdaapplet (applet for IR beaming/discovery)" 2 boolean "opie-irdaapplet (applet for IR beaming/discovery)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index 7709bed..cea836e 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,368 +1,370 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org> 2** Copyright (C) 2002 David Woodhouse <dwmw2@infradead.org>
3** Max Reiss <harlekin@handhelds.org> [trivial stuff] 3** Max Reiss <harlekin@handhelds.org> [trivial stuff]
4** Robert Griebl <sandman@handhelds.org> 4** Robert Griebl <sandman@handhelds.org>
5** Holger Freyther <zecke@handhelds.org> QCOP Interface 5** Holger Freyther <zecke@handhelds.org> QCOP Interface
6** 6**
7** This file may be distributed and/or modified under the terms of the 7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 10** packaging of this file.
11** 11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "irda.h" 17#include "irda.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <opie2/oresource.h>
20#include <opie2/otaskbarapplet.h> 21#include <opie2/otaskbarapplet.h>
22
21#include <qpe/applnk.h> 23#include <qpe/applnk.h>
22#include <qpe/resource.h>
23#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
24#include <qpe/ir.h> 25#include <qpe/ir.h>
25 26
26 27
27/* QT */ 28/* QT */
28#include <qpainter.h> 29#include <qpainter.h>
29#include <qfile.h> 30#include <qfile.h>
30#include <qtimer.h> 31#include <qtimer.h>
31#include <qtextstream.h> 32#include <qtextstream.h>
32 33
33/* STD */ 34/* STD */
34#include <unistd.h> 35#include <unistd.h>
35#include <net/if.h> 36#include <net/if.h>
36#include <netinet/in.h> 37#include <netinet/in.h>
37#include <sys/types.h> 38#include <sys/types.h>
38#include <sys/socket.h> 39#include <sys/socket.h>
39#include <sys/ioctl.h> 40#include <sys/ioctl.h>
40 41
41//=========================================================================== 42//===========================================================================
42 43
43IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 44IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
44 : QWidget ( parent, name ) 45 : QWidget ( parent, name )
45{ 46{
46 setFixedHeight( AppLnk::smallIconSize() ); 47 setFixedHeight( AppLnk::smallIconSize() );
47 setFixedWidth( AppLnk::smallIconSize() ); 48 setFixedWidth( AppLnk::smallIconSize() );
48 49
49 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 50 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
50 51
51 m_irdaOnPixmap = Resource::loadImage( "irdaapplet/irdaon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); 52 m_irdaOnPixmap = Opie::Core::OResource::loadPixmap( "irdaapplet/irdaon", Opie::Core::OResource::SmallIcon );
52 m_irdaOffPixmap = Resource::loadImage( "irdaapplet/irdaoff" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); 53 m_irdaOffPixmap = Opie::Core::OResource::loadPixmap( "irdaapplet/irdaoff", Opie::Core::OResource::SmallIcon );
53 m_irdaDiscoveryOnPixmap = Resource::loadImage( "irdaapplet/magglass" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); 54 m_irdaDiscoveryOnPixmap = Opie::Core::OResource::loadPixmap( "irdaapplet/magglass", Opie::Core::OResource::SmallIcon );
54 m_receiveActivePixmap = Resource::loadImage( "irdaapplet/receive" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); 55 m_receiveActivePixmap = Opie::Core::OResource::loadPixmap( "irdaapplet/receive", Opie::Core::OResource::SmallIcon );
55 56
56 m_irda_active = false; 57 m_irda_active = false;
57 m_irda_discovery_active = false; 58 m_irda_discovery_active = false;
58 m_receive_active = false; 59 m_receive_active = false;
59 m_receive_state_changed = false; 60 m_receive_state_changed = false;
60 m_popup = 0; 61 m_popup = 0;
61 m_wasOn = false; 62 m_wasOn = false;
62 m_wasDiscover = false; 63 m_wasDiscover = false;
63 64
64 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 65 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
65 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 66 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
66 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); 67 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
67} 68}
68 69
69int IrdaApplet::position() 70int IrdaApplet::position()
70{ 71{
71 return 6; 72 return 6;
72} 73}
73 74
74void IrdaApplet::show() 75void IrdaApplet::show()
75{ 76{
76 QWidget::show ( ); 77 QWidget::show ( );
77 startTimer ( 2000 ); 78 startTimer ( 2000 );
78} 79}
79 80
80IrdaApplet::~IrdaApplet() 81IrdaApplet::~IrdaApplet()
81{ 82{
82 if ( m_sockfd >= 0 ) 83 if ( m_sockfd >= 0 )
83 ::close ( m_sockfd ); 84 ::close ( m_sockfd );
84} 85}
85 86
86void IrdaApplet::popup ( QString message, QString icon ) 87void IrdaApplet::popup ( QString message, QString icon )
87{ 88{
88 if ( !m_popup ) 89 if ( !m_popup )
89 m_popup = new QPopupMenu ( this ); 90 m_popup = new QPopupMenu ( this );
90 91
91 m_popup-> clear ( ); 92 m_popup-> clear ( );
92 93
93 if ( icon. isEmpty ( )) 94 if ( icon. isEmpty ( ))
94 m_popup-> insertItem ( message, 0 ); 95 m_popup-> insertItem ( message, 0 );
95 else 96 else
96 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 97 m_popup-> insertItem ( QIconSet ( Opie::Core::OResource::loadPixmap ( icon, Opie::Core::OResource::SmallIcon )),
98 message, 0 );
97 99
98 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 100 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
99 QSize s = m_popup-> sizeHint ( ); 101 QSize s = m_popup-> sizeHint ( );
100 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 102 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
101 p. y ( ) - s. height ( ))); 103 p. y ( ) - s. height ( )));
102 104
103 QTimer::singleShot ( 2000, this, SLOT( popupTimeout())); 105 QTimer::singleShot ( 2000, this, SLOT( popupTimeout()));
104} 106}
105 107
106void IrdaApplet::popupTimeout ( ) 108void IrdaApplet::popupTimeout ( )
107{ 109{
108 m_popup-> hide ( ); 110 m_popup-> hide ( );
109} 111}
110 112
111bool IrdaApplet::checkIrdaStatus ( ) 113bool IrdaApplet::checkIrdaStatus ( )
112{ 114{
113 struct ifreq ifr; 115 struct ifreq ifr;
114 strcpy ( ifr. ifr_name, "irda0" ); 116 strcpy ( ifr. ifr_name, "irda0" );
115 117
116 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 118 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
117 return false; 119 return false;
118 120
119 return ( ifr. ifr_flags & IFF_UP ); 121 return ( ifr. ifr_flags & IFF_UP );
120} 122}
121 123
122bool IrdaApplet::setIrdaStatus ( bool b ) 124bool IrdaApplet::setIrdaStatus ( bool b )
123{ 125{
124 struct ifreq ifr; 126 struct ifreq ifr;
125 strcpy ( ifr. ifr_name, "irda0" ); 127 strcpy ( ifr. ifr_name, "irda0" );
126 128
127 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 129 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
128 return false; 130 return false;
129 131
130 if ( b ) { 132 if ( b ) {
131 ifr. ifr_flags |= IFF_UP; 133 ifr. ifr_flags |= IFF_UP;
132 } 134 }
133 else { 135 else {
134 setIrdaDiscoveryStatus ( 0 ); 136 setIrdaDiscoveryStatus ( 0 );
135 setIrdaReceiveStatus ( 0 ); 137 setIrdaReceiveStatus ( 0 );
136 ifr. ifr_flags &= ~IFF_UP; 138 ifr. ifr_flags &= ~IFF_UP;
137 } 139 }
138 140
139 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 ) 141 if ( ::ioctl ( m_sockfd, SIOCSIFFLAGS, &ifr ) < 0 )
140 return false; 142 return false;
141 143
142 return true; 144 return true;
143} 145}
144 146
145bool IrdaApplet::checkIrdaDiscoveryStatus ( ) 147bool IrdaApplet::checkIrdaDiscoveryStatus ( )
146{ 148{
147 QFile discovery ( "/proc/sys/net/irda/discovery" ); 149 QFile discovery ( "/proc/sys/net/irda/discovery" );
148 150
149 QString streamIn = "0"; 151 QString streamIn = "0";
150 152
151 if ( discovery. open ( IO_ReadOnly )) { 153 if ( discovery. open ( IO_ReadOnly )) {
152 QTextStream stream ( &discovery ); 154 QTextStream stream ( &discovery );
153 streamIn = stream. read ( ); 155 streamIn = stream. read ( );
154 } 156 }
155 157
156 return streamIn. toInt ( ) > 0; 158 return streamIn. toInt ( ) > 0;
157} 159}
158 160
159 161
160bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) 162bool IrdaApplet::setIrdaDiscoveryStatus ( bool d )
161{ 163{
162 QFile discovery ( "/proc/sys/net/irda/discovery" ); 164 QFile discovery ( "/proc/sys/net/irda/discovery" );
163 165
164 if ( discovery. open ( IO_WriteOnly | IO_Raw )) { 166 if ( discovery. open ( IO_WriteOnly | IO_Raw )) {
165 discovery.putch ( d ? '1' : '0' ); 167 discovery.putch ( d ? '1' : '0' );
166 return true; 168 return true;
167 } 169 }
168 return false; 170 return false;
169} 171}
170 172
171 173
172bool IrdaApplet::setIrdaReceiveStatus ( bool d ) 174bool IrdaApplet::setIrdaReceiveStatus ( bool d )
173{ 175{
174 QCopEnvelope e ( "QPE/Obex", "receive(int)" ); 176 QCopEnvelope e ( "QPE/Obex", "receive(int)" );
175 e << ( d ? 1 : 0 ); 177 e << ( d ? 1 : 0 );
176 178
177 m_receive_active = d; 179 m_receive_active = d;
178 m_receive_state_changed = true; 180 m_receive_state_changed = true;
179 181
180 return true; 182 return true;
181} 183}
182 184
183 185
184void IrdaApplet::showDiscovered ( ) 186void IrdaApplet::showDiscovered ( )
185{ 187{
186 //static Sound snd_found ( "irdaapplet/irdaon" ); 188 //static Sound snd_found ( "irdaapplet/irdaon" );
187 //static Sound snd_lost ( "irdaapplet/irdaoff" ); 189 //static Sound snd_lost ( "irdaapplet/irdaoff" );
188 190
189 QFile discovery ( "/proc/net/irda/discovery" ); 191 QFile discovery ( "/proc/net/irda/discovery" );
190 192
191 if ( discovery. open ( IO_ReadOnly )) { 193 if ( discovery. open ( IO_ReadOnly )) {
192 bool qcopsend = false; 194 bool qcopsend = false;
193 195
194 QString discoveredDevice; 196 QString discoveredDevice;
195 QString deviceAddr; 197 QString deviceAddr;
196 198
197 // since it is /proc we _must_ use QTextStream 199 // since it is /proc we _must_ use QTextStream
198 QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); 200 QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( ));
199 201
200 QMap <QString, QString>::Iterator it; 202 QMap <QString, QString>::Iterator it;
201 203
202 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) 204 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it )
203 it. data ( ). prepend ( "+++" ); 205 it. data ( ). prepend ( "+++" );
204 206
205 for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { 207 for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) {
206 const QString &line = *lit; 208 const QString &line = *lit;
207 209
208 if ( line. startsWith ( "nickname:" )) { 210 if ( line. startsWith ( "nickname:" )) {
209 discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); 211 discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 );
210 deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); 212 deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 );
211 213
212 // odebug << discoveredDevice + "(" + deviceAddr + ")" << oendl; 214 // odebug << discoveredDevice + "(" + deviceAddr + ")" << oendl;
213 215
214 if ( !m_devices. contains ( deviceAddr )) { 216 if ( !m_devices. contains ( deviceAddr )) {
215 popup ( tr( "Found:" ) + " " + discoveredDevice ); 217 popup ( tr( "Found:" ) + " " + discoveredDevice );
216 //snd_found. play ( ); 218 //snd_found. play ( );
217 qcopsend = true; 219 qcopsend = true;
218 } 220 }
219 m_devices. replace ( deviceAddr, discoveredDevice ); 221 m_devices. replace ( deviceAddr, discoveredDevice );
220 } 222 }
221 } 223 }
222 224
223 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { 225 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) {
224 // odebug << "IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?" << oendl; 226 // odebug << "IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?" << oendl;
225 227
226 if ( it. data ( ). left ( 3 ) == "+++" ) { 228 if ( it. data ( ). left ( 3 ) == "+++" ) {
227 popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); 229 popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 ));
228 //snd_lost. play ( ); 230 //snd_lost. play ( );
229 231
230 QMap <QString, QString>::Iterator tmp = it; 232 QMap <QString, QString>::Iterator tmp = it;
231 tmp++; 233 tmp++;
232 m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator 234 m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator
233 it = tmp; 235 it = tmp;
234 236
235 qcopsend = true; 237 qcopsend = true;
236 } 238 }
237 else 239 else
238 it++; 240 it++;
239 } 241 }
240 // XXX if( qcopsend ) { 242 // XXX if( qcopsend ) {
241 QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); 243 QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" );
242 e << ( m_devices. count ( ) > 0 ); 244 e << ( m_devices. count ( ) > 0 );
243 // } 245 // }
244 } 246 }
245} 247}
246 248
247void IrdaApplet::mousePressEvent ( QMouseEvent * ) 249void IrdaApplet::mousePressEvent ( QMouseEvent * )
248{ 250{
249 QPopupMenu *menu = new QPopupMenu ( this ); 251 QPopupMenu *menu = new QPopupMenu ( this );
250 QString cmd; 252 QString cmd;
251 253
252 /* Refresh active state */ 254 /* Refresh active state */
253 timerEvent ( 0 ); 255 timerEvent ( 0 );
254 256
255 //menu->insertItem( tr("More..."), 4 ); 257 //menu->insertItem( tr("More..."), 4 );
256 258
257 if ( m_irda_active && !m_devices. isEmpty ( )) { 259 if ( m_irda_active && !m_devices. isEmpty ( )) {
258 menu-> insertItem ( tr( "Discovered Device:" ), 9 ); 260 menu-> insertItem ( tr( "Discovered Device:" ), 9 );
259 261
260 for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) 262 for ( QMap<QString, QString>::Iterator it = m_devices. begin ( ); it != m_devices. end ( ); ++it )
261 menu-> insertItem ( *it ); 263 menu-> insertItem ( *it );
262 264
263 menu-> insertSeparator ( ); 265 menu-> insertSeparator ( );
264 } 266 }
265 267
266 menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 ); 268 menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 );
267 269
268 if ( m_irda_active ) { 270 if ( m_irda_active ) {
269 menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); 271 menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 );
270 272
271 /* Only Receive if OBEX is installed */ 273 /* Only Receive if OBEX is installed */
272 if( Ir::supported() ) 274 if( Ir::supported() )
273 menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); 275 menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 );
274 } 276 }
275 277
276 QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); 278 QPoint p = mapToGlobal ( QPoint ( 0, 0 ) );
277 QSize s = menu-> sizeHint ( ); 279 QSize s = menu-> sizeHint ( );
278 280
279 p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); 281 p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ));
280 282
281 switch ( menu-> exec ( p )) { 283 switch ( menu-> exec ( p )) {
282 case 0: 284 case 0:
283 setIrdaStatus ( !m_irda_active ); 285 setIrdaStatus ( !m_irda_active );
284 timerEvent ( 0 ); 286 timerEvent ( 0 );
285 break; 287 break;
286 case 1: 288 case 1:
287 setIrdaDiscoveryStatus ( !m_irda_discovery_active ); 289 setIrdaDiscoveryStatus ( !m_irda_discovery_active );
288 timerEvent ( 0 ); 290 timerEvent ( 0 );
289 break; 291 break;
290 case 2: 292 case 2:
291 setIrdaReceiveStatus ( !m_receive_active ); 293 setIrdaReceiveStatus ( !m_receive_active );
292 timerEvent( 0 ); 294 timerEvent( 0 );
293 break; 295 break;
294 } 296 }
295 297
296 delete menu; 298 delete menu;
297} 299}
298 300
299void IrdaApplet::timerEvent ( QTimerEvent * ) 301void IrdaApplet::timerEvent ( QTimerEvent * )
300{ 302{
301 bool oldactive = m_irda_active; 303 bool oldactive = m_irda_active;
302 bool olddiscovery = m_irda_discovery_active; 304 bool olddiscovery = m_irda_discovery_active;
303 bool receiveUpdate = false; 305 bool receiveUpdate = false;
304 306
305 if ( m_receive_state_changed ) { 307 if ( m_receive_state_changed ) {
306 receiveUpdate = true; 308 receiveUpdate = true;
307 m_receive_state_changed = false; 309 m_receive_state_changed = false;
308 } 310 }
309 311
310 m_irda_active = checkIrdaStatus ( ); 312 m_irda_active = checkIrdaStatus ( );
311 m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); 313 m_irda_discovery_active = checkIrdaDiscoveryStatus ( );
312 314
313 if ( m_irda_discovery_active ) 315 if ( m_irda_discovery_active )
314 showDiscovered ( ); 316 showDiscovered ( );
315 317
316 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) 318 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate )
317 update ( ); 319 update ( );
318} 320}
319 321
320void IrdaApplet::paintEvent ( QPaintEvent * ) 322void IrdaApplet::paintEvent ( QPaintEvent * )
321{ 323{
322 QPainter p( this ); 324 QPainter p( this );
323 325
324 p.drawPixmap( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); 326 p.drawPixmap( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap );
325 327
326 if ( m_irda_discovery_active ) 328 if ( m_irda_discovery_active )
327 p.drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); 329 p.drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap );
328 330
329 if ( m_receive_active ) 331 if ( m_receive_active )
330 p.drawPixmap( 0, 1, m_receiveActivePixmap ); 332 p.drawPixmap( 0, 1, m_receiveActivePixmap );
331} 333}
332/* 334/*
333 * We know 3 calls 335 * We know 3 calls
334 * a) enable 336 * a) enable
335 * b) disable 337 * b) disable
336 * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on 338 * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on
337 * c) listDevices: We will return a list of known devices 339 * c) listDevices: We will return a list of known devices
338 */ 340 */
339void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ) { 341void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ) {
340 if ( str == "enableIrda()") { 342 if ( str == "enableIrda()") {
341 m_wasOn = checkIrdaStatus(); 343 m_wasOn = checkIrdaStatus();
342 m_wasDiscover = checkIrdaDiscoveryStatus(); 344 m_wasDiscover = checkIrdaDiscoveryStatus();
343 if (!m_wasOn) { 345 if (!m_wasOn) {
344 setIrdaStatus( true ); 346 setIrdaStatus( true );
345 } 347 }
346 if ( !m_wasDiscover ) { 348 if ( !m_wasDiscover ) {
347 setIrdaDiscoveryStatus ( true ); 349 setIrdaDiscoveryStatus ( true );
348 } 350 }
349 } else if ( str == "disableIrda()") { 351 } else if ( str == "disableIrda()") {
350 if (!m_wasOn) { 352 if (!m_wasOn) {
351 setIrdaStatus( false ); 353 setIrdaStatus( false );
352 } 354 }
353 if ( !m_wasDiscover ) { 355 if ( !m_wasDiscover ) {
354 setIrdaDiscoveryStatus ( false ); 356 setIrdaDiscoveryStatus ( false );
355 } 357 }
356 } else if ( str == "listDevices()") { 358 } else if ( str == "listDevices()") {
357 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); 359 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)");
358 360
359 QStringList list; 361 QStringList list;
360 QMap<QString, QString>::Iterator it; 362 QMap<QString, QString>::Iterator it;
361 for (it = m_devices.begin(); it != m_devices.end(); ++it ) 363 for (it = m_devices.begin(); it != m_devices.end(); ++it )
362 list << (*it); 364 list << (*it);
363 365
364 e << list; 366 e << list;
365 } 367 }
366} 368}
367 369
368EXPORT_OPIE_APPLET_v1( IrdaApplet ) 370EXPORT_OPIE_APPLET_v1( IrdaApplet )
diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro
index 095c13c..f1145e1 100644
--- a/core/applets/irdaapplet/irdaapplet.pro
+++ b/core/applets/irdaapplet/irdaapplet.pro
@@ -1,13 +1,13 @@
1 TEMPLATE = lib 1 TEMPLATE = lib
2 CONFIG += qt plugin warn_on 2 CONFIG += qt plugin warn_on
3 HEADERS = irda.h 3 HEADERS = irda.h
4 SOURCES = irda.cpp 4 SOURCES = irda.cpp
5 TARGET = irdaapplet 5 TARGET = irdaapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7 INCLUDEPATH+= $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
8DEPENDPATH += 8DEPENDPATH +=
9LIBS += -lqpe 9LIBS += -lqpe -lopiecore2
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12include( $(OPIEDIR)/include.pro ) 12include( $(OPIEDIR)/include.pro )
13target.path = $$prefix/plugins/applets 13target.path = $$prefix/plugins/applets
diff --git a/core/applets/irdaapplet/opie-irdaapplet.control b/core/applets/irdaapplet/opie-irdaapplet.control
index bcc6603..ef2eaef 100644
--- a/core/applets/irdaapplet/opie-irdaapplet.control
+++ b/core/applets/irdaapplet/opie-irdaapplet.control
@@ -1,10 +1,10 @@
1Package: opie-irdaapplet 1Package: opie-irdaapplet
2Files: plugins/applets/libirdaapplet.so* pics/irdaapplet/* sounds/irdaapplet/*.wav 2Files: plugins/applets/libirdaapplet.so* pics/irdaapplet/* sounds/irdaapplet/*.wav
3Priority: optional 3Priority: optional
4Section: opie/applets 4Section: opie/applets
5Maintainer: David Woodhouse <dwmw2@infradead.org> 5Maintainer: David Woodhouse <dwmw2@infradead.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, libopieobex1 7Depends: task-opie-minimal, libopieobex1, libopiecore2
8Description: IrDA Applet 8Description: IrDA Applet
9 An IrDA taskbar applet for the Opie environment 9 An IrDA taskbar applet for the Opie environment
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION