-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index c0a936f..74e8837 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp @@ -75,12 +75,12 @@ CardMonitor::~CardMonitor() { void CardMonitor::popUp( QString message, QString icon ) { if ( ! popupMenu ) { - popupMenu = new QPopupMenu(); + popupMenu = new QPopupMenu(); } popupMenu->clear(); if( icon.isEmpty() ) { - popupMenu->insertItem( message, 0 ); + popupMenu->insertItem( message, 0 ); } else { - popupMenu->insertItem( QIconSet ( Resource::loadPixmap ( icon ) ), message, 0 ); + popupMenu->insertItem( QIconSet ( Resource::loadPixmap ( icon ) ), message, 0 ); } @@ -114,5 +114,5 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) { if ( cardInPcmcia1 ) { menu->insertItem( QIconSet ( Resource::loadPixmap ( "cardmon/" + cardInPcmcia1Type ) ), - tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); + tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 ); } @@ -120,14 +120,14 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) { QSize s = menu->sizeHint (); int opt = menu->exec( QPoint ( - p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), - p. y ( ) - s. height ( ) ), 0); + p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), + p. y ( ) - s. height ( ) ), 0); if ( opt == 1 ) { cmd = "/sbin/cardctl eject 0"; - err = system( ( const char * ) cmd ); - if ( ( err == 127 ) || ( err < 0 ) ) { - qDebug( "Could not execute `/sbin/cardctl eject 0'! err=%d", err ); - popUp( tr( "CF/PCMCIA card eject failed!" ) ); - } + err = system( ( const char * ) cmd ); + if ( ( err == 127 ) || ( err < 0 ) ) { + qDebug( "Could not execute `/sbin/cardctl eject 0'! err=%d", err ); + popUp( tr( "CF/PCMCIA card eject failed!" ) ); + } } else if ( opt == 0 ) { if ( ODevice::inst()->system() == System_Familiar ) { @@ -148,8 +148,8 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) { cmd = "/sbin/cardctl eject 1"; err = system( ( const char *) cmd ); - if ( ( err == 127 ) || ( err < 0 ) ) { - qDebug( "Could not execute `/sbin/cardctl eject 1'! err=%d", err ); - popUp( tr( "CF/PCMCIA card eject failed!" ) ); - } + if ( ( err == 127 ) || ( err < 0 ) ) { + qDebug( "Could not execute `/sbin/cardctl eject 1'! err=%d", err ); + popUp( tr( "CF/PCMCIA card eject failed!" ) ); + } } delete menu; @@ -205,6 +205,6 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { show(); line++; - int pos=(*line).find('\t' ) + 1; - cardInPcmcia0Type = (*line).mid( pos, (*line).find( "\t" , pos) - pos ); + int pos=(*line).find('\t' ) + 1; + cardInPcmcia0Type = (*line).mid( pos, (*line).find( "\t" , pos) - pos ); } } else if( (*line).startsWith( "Socket 1:" ) ){ @@ -217,6 +217,6 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { show(); line++; - int pos=(*line).find('\t') + 1; - cardInPcmcia1Type = (*line).mid( pos, (*line).find("\t", pos) - pos ); + int pos=(*line).find('\t') + 1; + cardInPcmcia1Type = (*line).mid( pos, (*line).find("\t", pos) - pos ); } } @@ -236,5 +236,5 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { } text += cardInPcmcia0Name; - popUp( text, "cardmon/" + cardInPcmcia0Type ); + popUp( text, "cardmon/" + cardInPcmcia0Type ); } @@ -247,6 +247,6 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) { what = "off"; } - text += cardInPcmcia1Name; - popUp( text, "cardmon/" + cardInPcmcia1Type ); + text += cardInPcmcia1Name; + popUp( text, "cardmon/" + cardInPcmcia1Type ); } QSound::play( Resource::findSound( "cardmon/card" + what) ); @@ -265,4 +265,5 @@ bool CardMonitor::getStatusSd( int showPopUp ) { bool cardWas = cardInSd; // remember last state + cardInSd = FALSE; #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) @@ -277,7 +278,8 @@ bool CardMonitor::getStatusSd( int showPopUp ) { cardInSd = TRUE; show(); - } else { - cardInSd = FALSE; } +// else { +// cardInSd = FALSE; +// } } endmntent( mntfp ); |