-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 53497df..452339c 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -226,129 +226,129 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | f.close(); | 228 | f.close(); |
229 | 229 | ||
230 | if ( !showPopUp | 230 | if ( !showPopUp |
231 | && ( cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1 ) ) { | 231 | && ( cardWas0 != cardInPcmcia0 || cardWas1 != cardInPcmcia1 ) ) { |
232 | QString text = QString::null; | 232 | QString text = QString::null; |
233 | QString what = QString::null; | 233 | QString what = QString::null; |
234 | if ( cardWas0 != cardInPcmcia0 ) { | 234 | if ( cardWas0 != cardInPcmcia0 ) { |
235 | if ( cardInPcmcia0 ) { | 235 | if ( cardInPcmcia0 ) { |
236 | text += tr( "New card: " ); | 236 | text += tr( "New card: " ); |
237 | what = "on"; | 237 | what = "on"; |
238 | } else { | 238 | } else { |
239 | text += tr( "Ejected: " ); | 239 | text += tr( "Ejected: " ); |
240 | what = "off"; | 240 | what = "off"; |
241 | } | 241 | } |
242 | text += cardInPcmcia0Name; | 242 | text += cardInPcmcia0Name; |
243 | popUp( text, "cardmon/" + cardInPcmcia0Type ); | 243 | popUp( text, "cardmon/" + cardInPcmcia0Type ); |
244 | } | 244 | } |
245 | 245 | ||
246 | if ( cardWas1 != cardInPcmcia1 ) { | 246 | if ( cardWas1 != cardInPcmcia1 ) { |
247 | if ( cardInPcmcia1 ) { | 247 | if ( cardInPcmcia1 ) { |
248 | text += tr( "New card: " ); | 248 | text += tr( "New card: " ); |
249 | what = "on"; | 249 | what = "on"; |
250 | } else { | 250 | } else { |
251 | text += tr( "Ejected: " ); | 251 | text += tr( "Ejected: " ); |
252 | what = "off"; | 252 | what = "off"; |
253 | } | 253 | } |
254 | text += cardInPcmcia1Name; | 254 | text += cardInPcmcia1Name; |
255 | popUp( text, "cardmon/" + cardInPcmcia1Type ); | 255 | popUp( text, "cardmon/" + cardInPcmcia1Type ); |
256 | } | 256 | } |
257 | #ifndef QT_NO_SOUND | 257 | #ifndef QT_NO_SOUND |
258 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); | 258 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); |
259 | #endif | 259 | #endif |
260 | 260 | ||
261 | } | 261 | } |
262 | } else { | 262 | } else { |
263 | // no file found | 263 | // no file found |
264 | odebug << "no file found" << oendl; | 264 | odebug << "no file found" << oendl; |
265 | cardInPcmcia0 = FALSE; | 265 | cardInPcmcia0 = FALSE; |
266 | cardInPcmcia1 = FALSE; | 266 | cardInPcmcia1 = FALSE; |
267 | } | 267 | } |
268 | repaint( FALSE ); | 268 | repaint( FALSE ); |
269 | return ( ( cardWas0 == cardInPcmcia0 | 269 | return ( ( cardWas0 == cardInPcmcia0 |
270 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); | 270 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); |
271 | 271 | ||
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | bool CardMonitor::getStatusSd( int showPopUp ) { | 275 | bool CardMonitor::getStatusSd( int showPopUp ) { |
276 | 276 | ||
277 | bool cardWas = cardInSd; // remember last state | 277 | bool cardWas = cardInSd; // remember last state |
278 | cardInSd = FALSE; | 278 | cardInSd = FALSE; |
279 | 279 | ||
280 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 280 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
281 | 281 | ||
282 | struct mntent *me; | 282 | struct mntent *me; |
283 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 283 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
284 | 284 | ||
285 | if ( mntfp ) { | 285 | if ( mntfp ) { |
286 | while ( ( me = getmntent( mntfp ) ) != 0 ) { | 286 | while ( ( me = getmntent( mntfp ) ) != 0 ) { |
287 | QString fs = QFile::decodeName( me->mnt_fsname ); | 287 | QString fs = QFile::decodeName( me->mnt_fsname ); |
288 | //odebug << fs << oendl; | 288 | //odebug << fs << oendl; |
289 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" | 289 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" |
290 | || fs.left( 9 ) == "/dev/mmcd" ) { | 290 | || fs.left( 9 ) == "/dev/mmcd" || fs.left(11) == "/dev/mmcblk" ) { |
291 | cardInSd = TRUE; | 291 | cardInSd = TRUE; |
292 | cardSdName = fs; | 292 | cardSdName = fs; |
293 | show(); | 293 | show(); |
294 | } | 294 | } |
295 | // else { | 295 | // else { |
296 | // cardInSd = FALSE; | 296 | // cardInSd = FALSE; |
297 | // } | 297 | // } |
298 | } | 298 | } |
299 | endmntent( mntfp ); | 299 | endmntent( mntfp ); |
300 | } | 300 | } |
301 | 301 | ||
302 | if ( !showPopUp && cardWas != cardInSd ) { | 302 | if ( !showPopUp && cardWas != cardInSd ) { |
303 | QString text = QString::null; | 303 | QString text = QString::null; |
304 | QString what = QString::null; | 304 | QString what = QString::null; |
305 | if ( cardInSd ) { | 305 | if ( cardInSd ) { |
306 | text += tr("New card: SD/MMC"); | 306 | text += tr("New card: SD/MMC"); |
307 | what = "on"; | 307 | what = "on"; |
308 | } else { | 308 | } else { |
309 | text += tr("Ejected: SD/MMC"); | 309 | text += tr("Ejected: SD/MMC"); |
310 | what = "off"; | 310 | what = "off"; |
311 | } | 311 | } |
312 | //odebug << "TEXT: " + text << oendl; | 312 | //odebug << "TEXT: " + text << oendl; |
313 | #ifndef QT_NO_SOUND | 313 | #ifndef QT_NO_SOUND |
314 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); | 314 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); |
315 | #endif | 315 | #endif |
316 | 316 | ||
317 | popUp( text, "cardmon/ide" ); // XX add SD pic | 317 | popUp( text, "cardmon/ide" ); // XX add SD pic |
318 | } | 318 | } |
319 | #else | 319 | #else |
320 | #error "Not on Linux" | 320 | #error "Not on Linux" |
321 | #endif | 321 | #endif |
322 | repaint( FALSE ); | 322 | repaint( FALSE ); |
323 | return ( ( cardWas == cardInSd ) ? FALSE : TRUE ); | 323 | return ( ( cardWas == cardInSd ) ? FALSE : TRUE ); |
324 | } | 324 | } |
325 | 325 | ||
326 | void CardMonitor::paintEvent( QPaintEvent * ) { | 326 | void CardMonitor::paintEvent( QPaintEvent * ) { |
327 | 327 | ||
328 | QPainter p( this ); | 328 | QPainter p( this ); |
329 | 329 | ||
330 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { | 330 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) { |
331 | p.drawPixmap( 0, 0, pm ); | 331 | p.drawPixmap( 0, 0, pm ); |
332 | show(); | 332 | show(); |
333 | } else { | 333 | } else { |
334 | //p.eraseRect(rect()); | 334 | //p.eraseRect(rect()); |
335 | hide(); | 335 | hide(); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | int CardMonitor::position() { | 339 | int CardMonitor::position() { |
340 | return 7; | 340 | return 7; |
341 | } | 341 | } |
342 | 342 | ||
343 | void CardMonitor::execCommand( const QStringList &strList ) { | 343 | void CardMonitor::execCommand( const QStringList &strList ) { |
344 | delete m_process; | 344 | delete m_process; |
345 | m_process = 0; | 345 | m_process = 0; |
346 | 346 | ||
347 | if ( m_process == 0 ) { | 347 | if ( m_process == 0 ) { |
348 | m_process = new OProcess(); | 348 | m_process = new OProcess(); |
349 | 349 | ||
350 | 350 | ||
351 | for ( QStringList::ConstIterator it = strList.begin(); it != strList.end(); ++it ) { | 351 | for ( QStringList::ConstIterator it = strList.begin(); it != strList.end(); ++it ) { |
352 | *m_process << *it; | 352 | *m_process << *it; |
353 | } | 353 | } |
354 | 354 | ||