Diffstat (limited to 'core/applets/irdaapplet/irda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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 | |||
@@ -8,27 +8,28 @@ | |||
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> |
@@ -39,28 +40,28 @@ | |||
39 | #include <sys/ioctl.h> | 40 | #include <sys/ioctl.h> |
40 | 41 | ||
41 | //=========================================================================== | 42 | //=========================================================================== |
42 | 43 | ||
43 | IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) | 44 | IrdaApplet::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&) ) ); |
@@ -84,25 +85,26 @@ IrdaApplet::~IrdaApplet() | |||
84 | } | 85 | } |
85 | 86 | ||
86 | void IrdaApplet::popup ( QString message, QString icon ) | 87 | void 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 | ||
106 | void IrdaApplet::popupTimeout ( ) | 108 | void IrdaApplet::popupTimeout ( ) |
107 | { | 109 | { |
108 | m_popup-> hide ( ); | 110 | m_popup-> hide ( ); |