Diffstat (limited to 'core/applets/irdaapplet/irda.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index a47f33d..afc0592 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp | |||
@@ -5,42 +5,45 @@ | |||
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 | 18 | ||
19 | /* OPIE */ | ||
20 | #include <opie2/otaskbarapplet.h> | ||
18 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
20 | 23 | ||
24 | /* QT */ | ||
21 | #include <qpainter.h> | 25 | #include <qpainter.h> |
22 | #include <qfile.h> | 26 | #include <qfile.h> |
23 | #include <qtimer.h> | 27 | #include <qtimer.h> |
24 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
25 | 29 | ||
30 | /* STD */ | ||
26 | #include <unistd.h> | 31 | #include <unistd.h> |
27 | #include <net/if.h> | 32 | #include <net/if.h> |
28 | #include <netinet/in.h> | 33 | #include <netinet/in.h> |
29 | #include <sys/types.h> | 34 | #include <sys/types.h> |
30 | #include <sys/socket.h> | 35 | #include <sys/socket.h> |
31 | #include <sys/ioctl.h> | 36 | #include <sys/ioctl.h> |
32 | 37 | ||
33 | #include "irda.h" | ||
34 | |||
35 | //=========================================================================== | 38 | //=========================================================================== |
36 | 39 | ||
37 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) | 40 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) |
38 | : QWidget ( parent, name ) | 41 | : QWidget ( parent, name ) |
39 | { | 42 | { |
40 | setFixedHeight ( 18 ); | 43 | setFixedHeight ( 18 ); |
41 | setFixedWidth ( 14 ); | 44 | setFixedWidth ( 14 ); |
42 | 45 | ||
43 | m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); | 46 | m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); |
44 | 47 | ||
45 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); | 48 | m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); |
46 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); | 49 | m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); |
@@ -51,24 +54,29 @@ IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) | |||
51 | m_irda_discovery_active = false; | 54 | m_irda_discovery_active = false; |
52 | m_receive_active = false; | 55 | m_receive_active = false; |
53 | m_receive_state_changed = false; | 56 | m_receive_state_changed = false; |
54 | m_popup = 0; | 57 | m_popup = 0; |
55 | m_wasOn = false; | 58 | m_wasOn = false; |
56 | m_wasDiscover = false; | 59 | m_wasDiscover = false; |
57 | 60 | ||
58 | QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); | 61 | QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); |
59 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), | 62 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), |
60 | this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); | 63 | this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); |
61 | } | 64 | } |
62 | 65 | ||
66 | int IrdaApplet::position() | ||
67 | { | ||
68 | return 6; | ||
69 | } | ||
70 | |||
63 | void IrdaApplet::show() | 71 | void IrdaApplet::show() |
64 | { | 72 | { |
65 | QWidget::show ( ); | 73 | QWidget::show ( ); |
66 | startTimer ( 2000 ); | 74 | startTimer ( 2000 ); |
67 | } | 75 | } |
68 | 76 | ||
69 | IrdaApplet::~IrdaApplet() | 77 | IrdaApplet::~IrdaApplet() |
70 | { | 78 | { |
71 | if ( m_sockfd >= 0 ) | 79 | if ( m_sockfd >= 0 ) |
72 | ::close ( m_sockfd ); | 80 | ::close ( m_sockfd ); |
73 | } | 81 | } |
74 | 82 | ||
@@ -341,12 +349,17 @@ void IrdaApplet::slotMessage( const QCString& str, const QByteArray& ar ) { | |||
341 | } | 349 | } |
342 | } else if ( str == "listDevices()") { | 350 | } else if ( str == "listDevices()") { |
343 | QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); | 351 | QCopEnvelope e("QPE/IrDaAppletBack", "devices(QStringList)"); |
344 | 352 | ||
345 | QStringList list; | 353 | QStringList list; |
346 | QMap<QString, QString>::Iterator it; | 354 | QMap<QString, QString>::Iterator it; |
347 | for (it = m_devices.begin(); it != m_devices.end(); ++it ) | 355 | for (it = m_devices.begin(); it != m_devices.end(); ++it ) |
348 | list << (*it); | 356 | list << (*it); |
349 | 357 | ||
350 | e << list; | 358 | e << list; |
351 | } | 359 | } |
352 | } | 360 | } |
361 | |||
362 | Q_EXPORT_INTERFACE() | ||
363 | { | ||
364 | Q_CREATE_INSTANCE( OTaskbarAppletWrapper<IrdaApplet> ); | ||
365 | } | ||