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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index afc0592..dde8050 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -39,86 +39,86 @@
39 39
40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name ) 40IrdaApplet::IrdaApplet ( QWidget *parent, const char *name )
41 : QWidget ( parent, name ) 41 : QWidget ( parent, name )
42{ 42{
43 setFixedHeight ( 18 ); 43 setFixedHeight ( 18 );
44 setFixedWidth ( 14 ); 44 setFixedWidth ( 14 );
45 45
46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP ); 46 m_sockfd = ::socket ( PF_INET, SOCK_DGRAM, IPPROTO_IP );
47 47
48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" ); 48 m_irdaOnPixmap = Resource::loadPixmap( "irdaapplet/irdaon" );
49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" ); 49 m_irdaOffPixmap = Resource::loadPixmap( "irdaapplet/irdaoff" );
50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" ); 50 m_irdaDiscoveryOnPixmap = Resource::loadPixmap( "irdaapplet/magglass" );
51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" ); 51 m_receiveActivePixmap = Resource::loadPixmap( "irdaapplet/receive" );
52 52
53 m_irda_active = false; 53 m_irda_active = false;
54 m_irda_discovery_active = false; 54 m_irda_discovery_active = false;
55 m_receive_active = false; 55 m_receive_active = false;
56 m_receive_state_changed = false; 56 m_receive_state_changed = false;
57 m_popup = 0; 57 m_popup = 0;
58 m_wasOn = false; 58 m_wasOn = false;
59 m_wasDiscover = false; 59 m_wasDiscover = false;
60 60
61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this ); 61 QCopChannel* chan = new QCopChannel("QPE/IrDaApplet", this );
62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), 62 connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ),
63 this, SLOT(slotMessage(const QCString&, const QByteArray& ) ) ); 63 this, SLOT(slotMessage(const QCString&,const QByteArray&) ) );
64} 64}
65 65
66int IrdaApplet::position() 66int IrdaApplet::position()
67{ 67{
68 return 6; 68 return 6;
69} 69}
70 70
71void IrdaApplet::show() 71void IrdaApplet::show()
72{ 72{
73 QWidget::show ( ); 73 QWidget::show ( );
74 startTimer ( 2000 ); 74 startTimer ( 2000 );
75} 75}
76 76
77IrdaApplet::~IrdaApplet() 77IrdaApplet::~IrdaApplet()
78{ 78{
79 if ( m_sockfd >= 0 ) 79 if ( m_sockfd >= 0 )
80 ::close ( m_sockfd ); 80 ::close ( m_sockfd );
81} 81}
82 82
83void IrdaApplet::popup ( QString message, QString icon ) 83void IrdaApplet::popup ( QString message, QString icon )
84{ 84{
85 if ( !m_popup ) 85 if ( !m_popup )
86 m_popup = new QPopupMenu ( this ); 86 m_popup = new QPopupMenu ( this );
87 87
88 m_popup-> clear ( ); 88 m_popup-> clear ( );
89 89
90 if ( icon. isEmpty ( )) 90 if ( icon. isEmpty ( ))
91 m_popup-> insertItem ( message, 0 ); 91 m_popup-> insertItem ( message, 0 );
92 else 92 else
93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 ); 93 m_popup-> insertItem ( QIconSet ( Resource::loadPixmap ( icon )), message, 0 );
94 94
95 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 95 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
96 QSize s = m_popup-> sizeHint ( ); 96 QSize s = m_popup-> sizeHint ( );
97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), 97 m_popup-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ),
98 p. y ( ) - s. height ( ))); 98 p. y ( ) - s. height ( )));
99 99
100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout ( ))); 100 QTimer::singleShot ( 2000, this, SLOT( popupTimeout()));
101} 101}
102 102
103void IrdaApplet::popupTimeout ( ) 103void IrdaApplet::popupTimeout ( )
104{ 104{
105 m_popup-> hide ( ); 105 m_popup-> hide ( );
106} 106}
107 107
108bool IrdaApplet::checkIrdaStatus ( ) 108bool IrdaApplet::checkIrdaStatus ( )
109{ 109{
110 struct ifreq ifr; 110 struct ifreq ifr;
111 strcpy ( ifr. ifr_name, "irda0" ); 111 strcpy ( ifr. ifr_name, "irda0" );
112 112
113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 113 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )
114 return false; 114 return false;
115 115
116 return ( ifr. ifr_flags & IFF_UP ); 116 return ( ifr. ifr_flags & IFF_UP );
117} 117}
118 118
119bool IrdaApplet::setIrdaStatus ( bool b ) 119bool IrdaApplet::setIrdaStatus ( bool b )
120{ 120{
121 struct ifreq ifr; 121 struct ifreq ifr;
122 strcpy ( ifr. ifr_name, "irda0" ); 122 strcpy ( ifr. ifr_name, "irda0" );
123 123
124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 ) 124 if ( ::ioctl ( m_sockfd, SIOCGIFFLAGS, &ifr ) < 0 )