-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index ed4bfc7..1ad8b55 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -327,101 +327,98 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) | |||
327 | #endif | 327 | #endif |
328 | 328 | ||
329 | } | 329 | } |
330 | } | 330 | } |
331 | else | 331 | else |
332 | { | 332 | { |
333 | // no file found | 333 | // no file found |
334 | qDebug( "no file found" ); | 334 | qDebug( "no file found" ); |
335 | cardInPcmcia0 = FALSE; | 335 | cardInPcmcia0 = FALSE; |
336 | cardInPcmcia1 = FALSE; | 336 | cardInPcmcia1 = FALSE; |
337 | } | 337 | } |
338 | repaint( FALSE ); | 338 | repaint( FALSE ); |
339 | return ( ( cardWas0 == cardInPcmcia0 | 339 | return ( ( cardWas0 == cardInPcmcia0 |
340 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); | 340 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); |
341 | 341 | ||
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | bool CardMonitor::getStatusSd( int showPopUp ) | 345 | bool CardMonitor::getStatusSd( int showPopUp ) |
346 | { | 346 | { |
347 | 347 | ||
348 | bool cardWas = cardInSd;// remember last state | 348 | bool cardWas = cardInSd;// remember last state |
349 | cardInSd = FALSE; | 349 | cardInSd = FALSE; |
350 | 350 | ||
351 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 351 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
352 | struct mntent *me; | 352 | struct mntent *me; |
353 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 353 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
354 | 354 | ||
355 | if ( mntfp ) | 355 | if ( mntfp ) |
356 | { | 356 | { |
357 | while ( ( me = getmntent( mntfp ) ) != 0 ) | 357 | while ( ( me = getmntent( mntfp ) ) != 0 ) |
358 | { | 358 | { |
359 | QString fs = me->mnt_fsname; | 359 | QString fs = me->mnt_fsname; |
360 | //qDebug( fs ); | 360 | //qDebug( fs ); |
361 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" | 361 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" |
362 | || fs.left( 9 ) == "/dev/mmcd" ) | 362 | || fs.left( 9 ) == "/dev/mmcd" ) |
363 | { | 363 | { |
364 | cardInSd = TRUE; | 364 | cardInSd = TRUE; |
365 | show(); | 365 | show(); |
366 | } | 366 | } |
367 | // else { | 367 | // else { |
368 | // cardInSd = FALSE; | 368 | // cardInSd = FALSE; |
369 | // } | 369 | // } |
370 | } | 370 | } |
371 | endmntent( mntfp ); | 371 | endmntent( mntfp ); |
372 | } | 372 | } |
373 | 373 | ||
374 | if ( !showPopUp && cardWas != cardInSd ) | 374 | if ( !showPopUp && cardWas != cardInSd ) |
375 | { | 375 | { |
376 | QString text = QString::null; | 376 | QString text = QString::null; |
377 | QString what = QString::null; | 377 | QString what = QString::null; |
378 | if ( cardInSd ) | 378 | if ( cardInSd ) |
379 | { | 379 | { |
380 | text += "New card: SD/MMC"; | 380 | text += "New card: SD/MMC"; |
381 | what = "on"; | 381 | what = "on"; |
382 | } | 382 | } |
383 | else | 383 | else |
384 | { | 384 | { |
385 | text += "Ejected: SD/MMC"; | 385 | text += "Ejected: SD/MMC"; |
386 | what = "off"; | 386 | what = "off"; |
387 | } | 387 | } |
388 | //qDebug("TEXT: " + text ); | 388 | //qDebug("TEXT: " + text ); |
389 | #ifndef QT_NO_SOUND | 389 | #ifndef QT_NO_SOUND |
390 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); | 390 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); |
391 | #endif | 391 | #endif |
392 | popUp( text, "cardmon/ide" );// XX add SD pic | 392 | popUp( text, "cardmon/ide" );// XX add SD pic |
393 | } | 393 | } |
394 | #else | 394 | #else |
395 | #error "Not on Linux" | 395 | #error "Not on Linux" |
396 | #endif | 396 | #endif |
397 | repaint( FALSE ); | 397 | repaint( FALSE ); |
398 | return ( ( cardWas == cardInSd ) ? FALSE : TRUE ); | 398 | return ( ( cardWas == cardInSd ) ? FALSE : TRUE ); |
399 | } | 399 | } |
400 | 400 | ||
401 | void CardMonitor::paintEvent( QPaintEvent * ) | 401 | void CardMonitor::paintEvent( QPaintEvent * ) |
402 | { | 402 | { |
403 | 403 | ||
404 | QPainter p( this ); | 404 | QPainter p( this ); |
405 | 405 | ||
406 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) | 406 | if ( cardInPcmcia0 || cardInPcmcia1 || cardInSd ) |
407 | { | 407 | { |
408 | p.drawPixmap( 0, 0, pm ); | 408 | p.drawPixmap( 0, 0, pm ); |
409 | show(); | 409 | show(); |
410 | } | 410 | } |
411 | else | 411 | else |
412 | { | 412 | { |
413 | //p.eraseRect(rect()); | 413 | //p.eraseRect(rect()); |
414 | hide(); | 414 | hide(); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | int CardMonitor::position() | 418 | int CardMonitor::position() |
419 | { | 419 | { |
420 | return 7; | 420 | return 7; |
421 | } | 421 | } |
422 | 422 | ||
423 | Q_EXPORT_INTERFACE() | 423 | EXPORT_OPIE_APPLET_v1( CardMonitor ) |
424 | { | ||
425 | Q_CREATE_INSTANCE( Opie::Ui::Private::OTaskbarAppletWrapper<CardMonitor> ); | ||
426 | } | ||
427 | 424 | ||