Diffstat (limited to 'core/applets/irdaapplet/irda.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index 84c656f..a5b4bfc 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp | |||
@@ -155,91 +155,91 @@ bool IrdaApplet::setIrdaDiscoveryStatus ( bool d ) | |||
155 | QFile discovery ( "/proc/sys/net/irda/discovery" ); | 155 | QFile discovery ( "/proc/sys/net/irda/discovery" ); |
156 | 156 | ||
157 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { | 157 | if ( discovery. open ( IO_WriteOnly | IO_Raw )) { |
158 | discovery.putch ( d ? '1' : '0' ); | 158 | discovery.putch ( d ? '1' : '0' ); |
159 | return true; | 159 | return true; |
160 | } | 160 | } |
161 | return false; | 161 | return false; |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) | 165 | bool IrdaApplet::setIrdaReceiveStatus ( bool d ) |
166 | { | 166 | { |
167 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); | 167 | QCopEnvelope e ( "QPE/Obex", "receive(int)" ); |
168 | e << ( d ? 1 : 0 ); | 168 | e << ( d ? 1 : 0 ); |
169 | 169 | ||
170 | m_receive_active = d; | 170 | m_receive_active = d; |
171 | m_receive_state_changed = true; | 171 | m_receive_state_changed = true; |
172 | 172 | ||
173 | return true; | 173 | return true; |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | void IrdaApplet::showDiscovered ( ) | 177 | void IrdaApplet::showDiscovered ( ) |
178 | { | 178 | { |
179 | static Sound snd_found ( "irdaapplet/irdaon" ); | 179 | //static Sound snd_found ( "irdaapplet/irdaon" ); |
180 | static Sound snd_lost ( "irdaapplet/irdaoff" ); | 180 | //static Sound snd_lost ( "irdaapplet/irdaoff" ); |
181 | 181 | ||
182 | QFile discovery ( "/proc/net/irda/discovery" ); | 182 | QFile discovery ( "/proc/net/irda/discovery" ); |
183 | 183 | ||
184 | if ( discovery. open ( IO_ReadOnly )) { | 184 | if ( discovery. open ( IO_ReadOnly )) { |
185 | bool qcopsend = false; | 185 | bool qcopsend = false; |
186 | 186 | ||
187 | QString discoveredDevice; | 187 | QString discoveredDevice; |
188 | QString deviceAddr; | 188 | QString deviceAddr; |
189 | 189 | ||
190 | // since it is /proc we _must_ use QTextStream | 190 | // since it is /proc we _must_ use QTextStream |
191 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); | 191 | QStringList list = QStringList::split ( "\n", QTextStream ( &discovery ). read ( )); |
192 | 192 | ||
193 | QMap <QString, QString>::Iterator it; | 193 | QMap <QString, QString>::Iterator it; |
194 | 194 | ||
195 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) | 195 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ++it ) |
196 | it. data ( ). prepend ( "+++" ); | 196 | it. data ( ). prepend ( "+++" ); |
197 | 197 | ||
198 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { | 198 | for ( QStringList::Iterator lit = list. begin ( ); lit != list. end ( ); ++lit ) { |
199 | const QString &line = *lit; | 199 | const QString &line = *lit; |
200 | 200 | ||
201 | if ( line. startsWith ( "nickname:" )) { | 201 | if ( line. startsWith ( "nickname:" )) { |
202 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); | 202 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); |
203 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); | 203 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); |
204 | 204 | ||
205 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); | 205 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); |
206 | 206 | ||
207 | if ( !m_devices. contains ( deviceAddr )) { | 207 | if ( !m_devices. contains ( deviceAddr )) { |
208 | popup ( tr( "Found:" ) + " " + discoveredDevice ); | 208 | popup ( tr( "Found:" ) + " " + discoveredDevice ); |
209 | snd_found. play ( ); | 209 | //snd_found. play ( ); |
210 | qcopsend = true; | 210 | qcopsend = true; |
211 | } | 211 | } |
212 | m_devices. replace ( deviceAddr, discoveredDevice ); | 212 | m_devices. replace ( deviceAddr, discoveredDevice ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { | 216 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { |
217 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); | 217 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); |
218 | 218 | ||
219 | if ( it. data ( ). left ( 3 ) == "+++" ) { | 219 | if ( it. data ( ). left ( 3 ) == "+++" ) { |
220 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); | 220 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); |
221 | snd_lost. play ( ); | 221 | //snd_lost. play ( ); |
222 | 222 | ||
223 | QMap <QString, QString>::Iterator tmp = it; | 223 | QMap <QString, QString>::Iterator tmp = it; |
224 | tmp++; | 224 | tmp++; |
225 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator | 225 | m_devices. remove ( it ); // in contrast to QValueListIterator this remove doesn't return the next Iterator |
226 | it = tmp; | 226 | it = tmp; |
227 | 227 | ||
228 | qcopsend = true; | 228 | qcopsend = true; |
229 | } | 229 | } |
230 | else | 230 | else |
231 | it++; | 231 | it++; |
232 | } | 232 | } |
233 | // XXX if( qcopsend ) { | 233 | // XXX if( qcopsend ) { |
234 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); | 234 | QCopEnvelope e ( "QPE/Network", "irdaSend(bool)" ); |
235 | e << ( m_devices. count ( ) > 0 ); | 235 | e << ( m_devices. count ( ) > 0 ); |
236 | // } | 236 | // } |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) | 240 | void IrdaApplet::mousePressEvent ( QMouseEvent * ) |
241 | { | 241 | { |
242 | QPopupMenu *menu = new QPopupMenu ( this ); | 242 | QPopupMenu *menu = new QPopupMenu ( this ); |
243 | QString cmd; | 243 | QString cmd; |
244 | 244 | ||
245 | /* Refresh active state */ | 245 | /* Refresh active state */ |