summaryrefslogtreecommitdiff
authorzecke <zecke>2003-02-16 10:01:34 (UTC)
committer zecke <zecke>2003-02-16 10:01:34 (UTC)
commitf1737ebd1afc35528c2452f6a281039c39a28f1f (patch) (unidiff)
tree4172f2e55f7986c52562bf152b0379ede66712a4
parent68675728278f9d47b200e6dd635d3bc1f524b5bf (diff)
downloadopie-f1737ebd1afc35528c2452f6a281039c39a28f1f.zip
opie-f1737ebd1afc35528c2452f6a281039c39a28f1f.tar.gz
opie-f1737ebd1afc35528c2452f6a281039c39a28f1f.tar.bz2
Add some QCOP methods for the new OBEX dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/irda.cpp76
-rw-r--r--core/applets/irdaapplet/irda.h17
2 files changed, 65 insertions, 28 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index c3ddff2..84c656f 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -1,96 +1,104 @@
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** 6**
6** 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
7** 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
8** Foundation and appearing in the file LICENSE.GPL included in the 9** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 10** packaging of this file.
10** 11**
11** 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
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 14**
14**********************************************************************/ 15**********************************************************************/
15 16
17#include <qcopchannel_qws.h>
18
16#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
17#include <qpe/resource.h> 20#include <qpe/resource.h>
18#include <qpe/ir.h> 21#include <qpe/ir.h>
19#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
20#include <qpe/sound.h> 23#include <qpe/sound.h>
21 24
22#include <qpainter.h> 25#include <qpainter.h>
23#include <qfile.h> 26#include <qfile.h>
24#include <qtimer.h> 27#include <qtimer.h>
25#include <qtextstream.h> 28#include <qtextstream.h>
26#include <qpopupmenu.h> 29#include <qpopupmenu.h>
27 30
28#include <unistd.h> 31#include <unistd.h>
29#include <net/if.h> 32#include <net/if.h>
30#include <netinet/in.h> 33#include <netinet/in.h>
31#include <sys/types.h> 34#include <sys/types.h>
32#include <sys/socket.h> 35#include <sys/socket.h>
33#include <sys/ioctl.h> 36#include <sys/ioctl.h>
34 37
35#include "irda.h" 38#include "irda.h"
36 39
37//=========================================================================== 40//===========================================================================
38 41
39IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 42IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
40 : QWidget ( parent, name ) 43 : QWidget ( parent, name )
41{ 44{
42 setFixedHeight ( 18 ); 45 setFixedHeight ( 18 );
43 setFixedWidth ( 14 ); 46 setFixedWidth ( 14 );
44 47
45 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 48 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
46 49
47 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); 50 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
48 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); 51 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
49 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); 52 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
50 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); 53 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
51 54
52 m_irda_active = false; 55 m_irda_active = false;
53 m_irda_discovery_active = false; 56 m_irda_discovery_active = false;
54 m_receive_active = false; 57 m_receive_active = false;
55 m_receive_state_changed = false; 58 m_receive_state_changed = false;
56 m_popup = 0; 59 m_popup = 0;
60 m_wasOn = false;
61
62 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
63 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
64 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) );
57} 65}
58 66
59void IrdaApplet::show() 67void IrdaApplet::show()
60{ 68{
61 QWidget::show ( ); 69 QWidget::show ( );
62 startTimer ( 2000 ); 70 startTimer ( 2000 );
63} 71}
64 72
65IrdaApplet::~IrdaApplet() 73IrdaApplet::~IrdaApplet()
66{ 74{
67 if ( m_sockfd >= 0 ) 75 if ( m_sockfd >= 0 )
68 ::close ( m_sockfd ); 76 ::close ( m_sockfd );
69} 77}
70 78
71void IrdaApplet::popup ( QString message, QString icon ) 79void IrdaApplet::popup ( QString message, QString icon )
72{ 80{
73 if ( !m_popup ) 81 if ( !m_popup )
74 m_popup = new QPopupMenu ( this ); 82 m_popup = new QPopupMenu ( this );
75 83
76 m_popup-> clear ( ); 84 m_popup-> clear ( );
77 85
78 if ( icon. isEmpty ( )) 86 if ( icon. isEmpty ( ))
79 m_popup-> insertItem ( message, 0 ); 87 m_popup-> insertItem ( message, 0 );
80 else 88 else
81 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 89 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
82 90
83 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 91 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
84 QSize s = m_popup-> sizeHint ( ); 92 QSize s = m_popup-> sizeHint ( );
85 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 93 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
86 p. y ( ) - s. height ( ))); 94 p. y ( ) - s. height ( )));
87 95
88 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); 96 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( )));
89} 97}
90 98
91void IrdaApplet::popupTimeout ( ) 99void IrdaApplet::popupTimeout ( )
92{ 100{
93 m_popup-> hide ( ); 101 m_popup-> hide ( );
94} 102}
95 103
96bool IrdaApplet::checkIrdaStatus ( ) 104bool IrdaApplet::checkIrdaStatus ( )
@@ -134,111 +142,111 @@ bool IrdaApplet::checkIrdaDiscoveryStatus ( )
134 QString streamIn = "0"; 142 QString streamIn = "0";
135 143
136 if ( discovery. open ( IO_ReadOnly )) { 144 if ( discovery. open ( IO_ReadOnly )) {
137 QTextStream stream ( &discovery ); 145 QTextStream stream ( &discovery );
138 streamIn = stream. read ( ); 146 streamIn = stream. read ( );
139 } 147 }
140 148
141 return streamIn. toInt ( ) > 0; 149 return streamIn. toInt ( ) > 0;
142} 150}
143 151
144 152
145bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) 153bool IrdaApplet::setIrdaDiscoveryStatus ( bool d )
146{ 154{
147 QFile discovery ( "/proc/sys/net/irda/discovery" ); 155 QFile discovery ( "/proc/sys/net/irda/discovery" );
148 156
149 if ( discovery. open ( IO_WriteOnly | IO_Raw )) { 157 if ( discovery. open ( IO_WriteOnly | IO_Raw )) {
150 discovery.putch ( d ? '1' : '0' ); 158 discovery.putch ( d ? '1' : '0' );
151 return true; 159 return true;
152 } 160 }
153 return false; 161 return false;
154} 162}
155 163
156 164
157bool IrdaApplet::setIrdaReceiveStatus ( bool d ) 165bool IrdaApplet::setIrdaReceiveStatus ( bool d )
158{ 166{
159 QCopEnvelope e ( "QPE/Obex", "receive(int)" ); 167 QCopEnvelope e ( "QPE/Obex", "receive(int)" );
160 e << ( d ? 1 : 0 ); 168 e << ( d ? 1 : 0 );
161 169
162 m_receive_active = d; 170 m_receive_active = d;
163 m_receive_state_changed = true; 171 m_receive_state_changed = true;
164 172
165 return true; 173 return true;
166} 174}
167 175
168 176
169void IrdaApplet::showDiscovered ( ) 177void IrdaApplet::showDiscovered ( )
170{ 178{
171 static Sound snd_found ( "irdaapplet/irdaon" ); 179 static Sound snd_found ( "irdaapplet/irdaon" );
172 static Sound snd_lost ( "irdaapplet/irdaoff" ); 180 static Sound snd_lost ( "irdaapplet/irdaoff" );
173 181
174 QFile discovery ( "/proc/net/irda/discovery" ); 182 QFile discovery ( "/proc/net/irda/discovery" );
175 183
176 if ( discovery. open ( IO_ReadOnly )) { 184 if ( discovery. open ( IO_ReadOnly )) {
177 bool qcopsend = false; 185 bool qcopsend = false;
178 186
179 QString discoveredDevice; 187 QString discoveredDevice;
180 QString deviceAddr; 188 QString deviceAddr;
181 189
182 // since it is /proc we _must_ use QTextStream 190 // since it is /proc we _must_ use QTextStream
183 QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); 191 QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( ));
184 192
185 QMap <QString, QString>::Iterator it; 193 QMap <QString, QString>::Iterator it;
186 194
187 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) 195 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it )
188 it. data ( ). prepend ( "+++" ); 196 it. data ( ). prepend ( "+++" );
189 197
190 for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { 198 for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) {
191 const QString &line = *lit; 199 const QString &line = *lit;
192 200
193 if ( line. startsWith ( "nickname:" )) { 201 if ( line. startsWith ( "nickname:" )) {
194 discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); 202 discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 );
195 deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); 203 deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 );
196 204
197 // qDebug(discoveredDevice + "(" + deviceAddr + ")"); 205 // qDebug(discoveredDevice + "(" + deviceAddr + ")");
198 206
199 if ( !m_devices. contains ( deviceAddr )) { 207 if ( !m_devices. contains ( deviceAddr )) {
200 popup ( tr( "Found:" ) + " " + discoveredDevice ); 208 popup ( tr( "Found:" ) + " " + discoveredDevice );
201 snd_found. play ( ); 209 snd_found. play ( );
202 qcopsend = true; 210 qcopsend = true;
203 } 211 }
204 m_devices. replace ( deviceAddr, discoveredDevice ); 212 m_devices. replace ( deviceAddr, discoveredDevice );
205 } 213 }
206 } 214 }
207 215
208 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { 216 for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) {
209 // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); 217 // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?");
210 218
211 if ( it. data ( ). left ( 3 ) == "+++" ) { 219 if ( it. data ( ). left ( 3 ) == "+++" ) {
212 popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); 220 popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 ));
213 snd_lost. play ( ); 221 snd_lost. play ( );
214 222
215 QMap <QString, QString>::Iterator tmp = it; 223 QMap <QString, QString>::Iterator tmp = it;
216 tmp++; 224 tmp++;
217 m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator 225 m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator
218 it = tmp; 226 it = tmp;
219 227
220 qcopsend = true; 228 qcopsend = true;
221 } 229 }
222 else 230 else
223 it++; 231 it++;
224 } 232 }
225 // XXX if( qcopsend ) { 233 // XXX if( qcopsend ) {
226 QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); 234 QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" );
227 e << ( m_devices. count ( ) > 0 ); 235 e << ( m_devices. count ( ) > 0 );
228 // } 236 // }
229 } 237 }
230} 238}
231 239
232void IrdaApplet::mousePressEvent ( QMouseEvent * ) 240void IrdaApplet::mousePressEvent ( QMouseEvent * )
233{ 241{
234 QPopupMenu *menu = new QPopupMenu ( this ); 242 QPopupMenu *menu = new QPopupMenu ( this );
235 QString cmd; 243 QString cmd;
236 244
237 /* Refresh active state */ 245 /* Refresh active state */
238 timerEvent ( 0 ); 246 timerEvent ( 0 );
239 247
240 //menu->insertItem( tr("More..."), 4 ); 248 //menu->insertItem( tr("More..."), 4 );
241 249
242 if ( m_irda_active && !m_devices. isEmpty ( )) { 250 if ( m_irda_active && !m_devices. isEmpty ( )) {
243 menu-> insertItem ( tr( "Discovered Device:" ), 9 ); 251 menu-> insertItem ( tr( "Discovered Device:" ), 9 );
244 252
@@ -246,68 +254,94 @@ void IrdaApplet::mousePressEvent ( QMouseEvent * )
246 menu-> insertItem ( *it ); 254 menu-> insertItem ( *it );
247 255
248 menu-> insertSeparator ( ); 256 menu-> insertSeparator ( );
249 } 257 }
250 258
251 menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 ); 259 menu-> insertItem ( m_irda_active ? tr( "Disable IrDA" ) : tr( "Enable IrDA" ), 0 );
252 260
253 if ( m_irda_active ) { 261 if ( m_irda_active ) {
254 menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 ); 262 menu-> insertItem ( m_irda_discovery_active ? tr( "Disable Discovery" ) : tr( "Enable Discovery" ), 1 );
255 menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 ); 263 menu-> insertItem ( m_receive_active ? tr( "Disable Receive" ) : tr( "Enable Receive" ), 2 );
256 } 264 }
257 265
258 QPoint p = mapToGlobal ( QPoint ( 0, 0 ) ); 266 QPoint p = mapToGlobal ( QPoint ( 0, 0 ) );
259 QSize s = menu-> sizeHint ( ); 267 QSize s = menu-> sizeHint ( );
260 268
261 p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )); 269 p = QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ));
262 270
263 switch ( menu-> exec ( p )) { 271 switch ( menu-> exec ( p )) {
264 case 0: 272 case 0:
265 setIrdaStatus ( !m_irda_active ); 273 setIrdaStatus ( !m_irda_active );
266 timerEvent ( 0 ); 274 timerEvent ( 0 );
267 break; 275 break;
268 case 1: 276 case 1:
269 setIrdaDiscoveryStatus ( !m_irda_discovery_active ); 277 setIrdaDiscoveryStatus ( !m_irda_discovery_active );
270 timerEvent ( 0 ); 278 timerEvent ( 0 );
271 break; 279 break;
272 case 2: 280 case 2:
273 setIrdaReceiveStatus ( !m_receive_active ); 281 setIrdaReceiveStatus ( !m_receive_active );
274 timerEvent( 0 ); 282 timerEvent( 0 );
275 break; 283 break;
276 } 284 }
277 285
278 delete menu; 286 delete menu;
279} 287}
280 288
281void IrdaApplet::timerEvent ( QTimerEvent * ) 289void IrdaApplet::timerEvent ( QTimerEvent * )
282{ 290{
283 bool oldactive = m_irda_active; 291 bool oldactive = m_irda_active;
284 bool olddiscovery = m_irda_discovery_active; 292 bool olddiscovery = m_irda_discovery_active;
285 bool receiveUpdate = false; 293 bool receiveUpdate = false;
286 294
287 if ( m_receive_state_changed ) { 295 if ( m_receive_state_changed ) {
288 receiveUpdate = true; 296 receiveUpdate = true;
289 m_receive_state_changed = false; 297 m_receive_state_changed = false;
290 } 298 }
291 299
292 m_irda_active = checkIrdaStatus ( ); 300 m_irda_active = checkIrdaStatus ( );
293 m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); 301 m_irda_discovery_active = checkIrdaDiscoveryStatus ( );
294 302
295 if ( m_irda_discovery_active ) 303 if ( m_irda_discovery_active )
296 showDiscovered ( ); 304 showDiscovered ( );
297 305
298 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) 306 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate )
299 update ( ); 307 update ( );
300} 308}
301 309
302void IrdaApplet::paintEvent ( QPaintEvent * ) 310void IrdaApplet::paintEvent ( QPaintEvent * )
303{ 311{
304 QPainter p ( this ); 312 QPainter p ( this );
305 313
306 p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); 314 p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap );
307 315
308 if ( m_irda_discovery_active ) 316 if ( m_irda_discovery_active )
309 p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); 317 p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap );
310 318
311 if ( m_receive_active ) 319 if ( m_receive_active )
312 p. drawPixmap( 0, 1, m_receiveActivePixmap ); 320 p. drawPixmap( 0, 1, m_receiveActivePixmap );
313} 321}
322/*
323 * We know 3 calls
324 * a) enable
325 * b) disable
326 * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on
327 * c) listDevices: We will return a list of known devices
328 */
329void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) {
330 if ( str == "enableIrda()") {
331 m_wasOn = checkIrdaStatus();
332 if (!m_wasOn)
333 setIrdaStatus( true );
334 }else if ( str == "disableIrda()") {
335 if (!m_wasOn)
336 setIrdaStatus( false );
337 }else if ( str == "listDevices()") {
338 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)");
339
340 QStringList list;
341 QMap<QString, QString>::Iterator it;
342 for (it = m_devices.begin(); it != m_devices.end(); ++it )
343 list << (*it);
344
345 e << list;
346 }
347}
diff --git a/core/applets/irdaapplet/irda.h b/core/applets/irdaapplet/irda.h
index 1b5faa6..675f874 100644
--- a/core/applets/irdaapplet/irda.h
+++ b/core/applets/irdaapplet/irda.h
@@ -11,62 +11,65 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef __OPIE_IRDA_APPLET_H__ 16#ifndef __OPIE_IRDA_APPLET_H__
17#define __OPIE_IRDA_APPLET_H__ 17#define __OPIE_IRDA_APPLET_H__
18 18
19#include <qwidget.h> 19#include <qwidget.h>
20#include <qpixmap.h> 20#include <qpixmap.h>
21#include <qpopupmenu.h> 21#include <qpopupmenu.h>
22#include <qmap.h> 22#include <qmap.h>
23 23
24class IrdaApplet : public QWidget 24class IrdaApplet : public QWidget
25{ 25{
26 Q_OBJECT 26 Q_OBJECT
27 27
28public: 28public:
29 IrdaApplet( QWidget *parent = 0, const char *name = 0 ); 29 IrdaApplet( QWidget *parent = 0, const char *name = 0 );
30 ~IrdaApplet(); 30 ~IrdaApplet();
31 31
32 virtual void show ( ); 32 virtual void show ( );
33 33
34protected: 34protected:
35 virtual void timerEvent ( QTimerEvent * ); 35 virtual void timerEvent ( QTimerEvent * );
36 virtual void mousePressEvent ( QMouseEvent * ); 36 virtual void mousePressEvent ( QMouseEvent * );
37 virtual void paintEvent ( QPaintEvent* ); 37 virtual void paintEvent ( QPaintEvent* );
38 38
39private slots: 39private slots:
40 void popupTimeout ( ); 40 void popupTimeout ( );
41 void slotMessage( const QCString& , const QByteArray& );
41 42
42private: 43private:
43 void popup( QString message, QString icon = QString::null ); 44 void popup( QString message, QString icon = QString::null );
44 45
45 bool checkIrdaStatus ( ); 46 bool checkIrdaStatus ( );
46 bool setIrdaStatus ( bool ); 47 bool setIrdaStatus ( bool );
47 bool checkIrdaDiscoveryStatus (); 48 bool checkIrdaDiscoveryStatus ();
48 bool setIrdaDiscoveryStatus ( bool ); 49 bool setIrdaDiscoveryStatus ( bool );
49 bool setIrdaReceiveStatus ( bool ); 50 bool setIrdaReceiveStatus ( bool );
50 51
51 void showDiscovered(); 52 void showDiscovered();
52 53
53private: 54private:
54 QPixmap m_irdaOnPixmap; 55 QPixmap m_irdaOnPixmap;
55 QPixmap m_irdaOffPixmap; 56 QPixmap m_irdaOffPixmap;
56 QPixmap m_irdaDiscoveryOnPixmap; 57 QPixmap m_irdaDiscoveryOnPixmap;
57 QPixmap m_receiveActivePixmap; 58 QPixmap m_receiveActivePixmap;
58 59
59 bool m_irda_active; 60 bool m_irda_active;
60 bool m_irda_discovery_active; 61 bool m_irda_discovery_active;
61 bool m_receive_active; 62 bool m_receive_active;
62 bool m_receive_state_changed; 63 bool m_receive_state_changed;
63 64
64 QPopupMenu *m_popup; 65 QPopupMenu *m_popup;
65 66
66 int m_sockfd; 67 int m_sockfd;
67 68
68 QMap <QString, QString> m_devices; 69 QMap <QString, QString> m_devices;
70
71 bool m_wasOn; // if IrDa was enabled
69}; 72};
70 73
71 74
72#endif // __OPIE_IRDA_APPLET_H__ 75#endif // __OPIE_IRDA_APPLET_H__