author | harlekin <harlekin> | 2003-03-26 18:23:57 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-26 18:23:57 (UTC) |
commit | 8c1acc27882a79ea9f1ee9b9be708b9bbab052ba (patch) (unidiff) | |
tree | b906f762e28da948eaaa3ea0df5c81fdd9d41755 | |
parent | 88a93db37e001dc02f9edddf81919266fde0173c (diff) | |
download | opie-8c1acc27882a79ea9f1ee9b9be708b9bbab052ba.zip opie-8c1acc27882a79ea9f1ee9b9be708b9bbab052ba.tar.gz opie-8c1acc27882a79ea9f1ee9b9be708b9bbab052ba.tar.bz2 |
also activate discovery if not allready running - makes beaming with s45 easier
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 14 | ||||
-rw-r--r-- | core/applets/irdaapplet/irda.h | 1 |
2 files changed, 13 insertions, 2 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 | |||
@@ -49,24 +49,25 @@ IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) | |||
49 | 49 | ||
50 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); | 50 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); |
51 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); | 51 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); |
52 | m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); | 52 | m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); |
53 | m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); | 53 | m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); |
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 | ||
67 | void IrdaApplet::show() | 68 | void IrdaApplet::show() |
68 | { | 69 | { |
69 | QWidget::show ( ); | 70 | QWidget::show ( ); |
70 | startTimer ( 2000 ); | 71 | startTimer ( 2000 ); |
71 | } | 72 | } |
72 | 73 | ||
@@ -320,28 +321,37 @@ void IrdaApplet::paintEvent ( QPaintEvent * ) | |||
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 |
324 | * a) enable | 325 | * a) enable |
325 | * b) disable | 326 | * b) disable |
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 | */ |
329 | void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) { | 330 | void 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 ); |
336 | } | ||
337 | if ( !m_wasDiscover ) { | ||
338 | setIrdaDiscoveryStatus ( true ); | ||
339 | } | ||
334 | }else if ( str == "disableIrda()") { | 340 | }else if ( str == "disableIrda()") { |
335 | if (!m_wasOn) | 341 | if (!m_wasOn) { |
336 | setIrdaStatus( false ); | 342 | setIrdaStatus( false ); |
343 | } | ||
344 | if ( !m_wasDiscover ) { | ||
345 | setIrdaDiscoveryStatus ( false ); | ||
346 | } | ||
337 | }else if ( str == "listDevices()") { | 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); |
344 | 354 | ||
345 | e << list; | 355 | e << list; |
346 | } | 356 | } |
347 | } | 357 | } |
diff --git a/core/applets/irdaapplet/irda.h b/core/applets/irdaapplet/irda.h index 675f874..ec1d32c 100644 --- a/core/applets/irdaapplet/irda.h +++ b/core/applets/irdaapplet/irda.h | |||
@@ -60,16 +60,17 @@ private: | |||
60 | bool m_irda_active; | 60 | bool m_irda_active; |
61 | bool m_irda_discovery_active; | 61 | bool m_irda_discovery_active; |
62 | bool m_receive_active; | 62 | bool m_receive_active; |
63 | bool m_receive_state_changed; | 63 | bool m_receive_state_changed; |
64 | 64 | ||
65 | QPopupMenu *m_popup; | 65 | QPopupMenu *m_popup; |
66 | 66 | ||
67 | int m_sockfd; | 67 | int m_sockfd; |
68 | 68 | ||
69 | QMap <QString, QString> m_devices; | 69 | QMap <QString, QString> m_devices; |
70 | 70 | ||
71 | bool m_wasOn; // if IrDa was enabled | 71 | bool m_wasOn; // if IrDa was enabled |
72 | bool m_wasDiscover; | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | 75 | ||
75 | #endif // __OPIE_IRDA_APPLET_H__ | 76 | #endif // __OPIE_IRDA_APPLET_H__ |