summaryrefslogtreecommitdiff
path: root/core/applets/irdaapplet/irda.cpp
Unidiff
Diffstat (limited to 'core/applets/irdaapplet/irda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/irda.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index a5b4bfc..51c2ebf 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -54,13 +54,14 @@ IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
54 54
55 m_irda_active = false; 55 m_irda_active = false;
56 m_irda_discovery_active = false; 56 m_irda_discovery_active = false;
57 m_receive_active = false; 57 m_receive_active = false;
58 m_receive_state_changed = false; 58 m_receive_state_changed = false;
59 m_popup = 0; 59 m_popup = 0;
60 m_wasOn = false; 60 m_wasOn = false;
61 m_wasDiscover = false;
61 62
62 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 63 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
63 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 64 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
64 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); 65 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) );
65} 66}
66 67
@@ -285,22 +286,22 @@ void IrdaApplet::mousePressEvent ( QMouseEvent * )
285 286
286 delete menu; 287 delete menu;
287} 288}
288 289
289void IrdaApplet::timerEvent ( QTimerEvent * ) 290void IrdaApplet::timerEvent ( QTimerEvent * )
290{ 291{
291 bool oldactive = m_irda_active; 292 bool oldactive = m_irda_active;
292 bool olddiscovery = m_irda_discovery_active; 293 bool olddiscovery = m_irda_discovery_active;
293 bool receiveUpdate = false; 294 bool receiveUpdate = false;
294 295
295 if ( m_receive_state_changed ) { 296 if ( m_receive_state_changed ) {
296 receiveUpdate = true; 297 receiveUpdate = true;
297 m_receive_state_changed = false; 298 m_receive_state_changed = false;
298 } 299 }
299 300
300 m_irda_active = checkIrdaStatus ( ); 301 m_irda_active = checkIrdaStatus ( );
301 m_irda_discovery_active = checkIrdaDiscoveryStatus ( ); 302 m_irda_discovery_active = checkIrdaDiscoveryStatus ( );
302 303
303 if ( m_irda_discovery_active ) 304 if ( m_irda_discovery_active )
304 showDiscovered ( ); 305 showDiscovered ( );
305 306
306 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate ) 307 if (( m_irda_active != oldactive ) || ( m_irda_discovery_active != olddiscovery ) || receiveUpdate )
@@ -311,13 +312,13 @@ void IrdaApplet::paintEvent ( QPaintEvent * )
311{ 312{
312 QPainter p ( this ); 313 QPainter p ( this );
313 314
314 p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap ); 315 p. drawPixmap ( 0, 1, m_irda_active ? m_irdaOnPixmap : m_irdaOffPixmap );
315 316
316 if ( m_irda_discovery_active ) 317 if ( m_irda_discovery_active )
317 p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap ); 318 p. drawPixmap( 0, 1, m_irdaDiscoveryOnPixmap );
318 319
319 if ( m_receive_active ) 320 if ( m_receive_active )
320 p. drawPixmap( 0, 1, m_receiveActivePixmap ); 321 p. drawPixmap( 0, 1, m_receiveActivePixmap );
321} 322}
322/* 323/*
323 * We know 3 calls 324 * We know 3 calls
@@ -326,18 +327,27 @@ void IrdaApplet::paintEvent ( QPaintEvent * )
326 * a and b will temp enable the IrDa device and disable will disable it again if it wasn't on 327 * 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 * c) listDevices: We will return a list of known devices
328 */ 329 */
329void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) { 330void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) {
330 if ( str == "enableIrda()") { 331 if ( str == "enableIrda()") {
331 m_wasOn = checkIrdaStatus(); 332 m_wasOn = checkIrdaStatus();
332 if (!m_wasOn) 333 m_wasDiscover = checkIrdaDiscoveryStatus();
334 if (!m_wasOn) {
333 setIrdaStatus( true ); 335 setIrdaStatus( true );
334 }else if ( str == "disableIrda()") { 336 }
335 if (!m_wasOn) 337 if ( !m_wasDiscover ) {
338 setIrdaDiscoveryStatus ( true );
339 }
340 } else if ( str == "disableIrda()") {
341 if (!m_wasOn) {
336 setIrdaStatus( false ); 342 setIrdaStatus( false );
337 }else if ( str == "listDevices()") { 343 }
344 if ( !m_wasDiscover ) {
345 setIrdaDiscoveryStatus ( false );
346 }
347 } else if ( str == "listDevices()") {
338 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); 348 QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)");
339 349
340 QStringList list; 350 QStringList list;
341 QMap<QString, QString>::Iterator it; 351 QMap<QString, QString>::Iterator it;
342 for (it = m_devices.begin(); it != m_devices.end(); ++it ) 352 for (it = m_devices.begin(); it != m_devices.end(); ++it )
343 list << (*it); 353 list << (*it);