author | mickeyl <mickeyl> | 2005-06-25 15:28:21 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-25 15:28:21 (UTC) |
commit | 3d434ac35915afe7f7035468ca18656264a91c52 (patch) (side-by-side diff) | |
tree | f71edcbb83d4566f098da4de68f77a2f6058062f /noncore/applets/pcmcia | |
parent | 3ec008c17167a17f89cc096779113c6b8369b257 (diff) | |
download | opie-3d434ac35915afe7f7035468ca18656264a91c52.zip opie-3d434ac35915afe7f7035468ca18656264a91c52.tar.gz opie-3d434ac35915afe7f7035468ca18656264a91c52.tar.bz2 |
fix enable/disable logic for menu entries in popup
-rw-r--r-- | noncore/applets/pcmcia/configdialog.cpp | 10 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 22 |
2 files changed, 18 insertions, 14 deletions
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp index f94edde..3b1b40c 100644 --- a/noncore/applets/pcmcia/configdialog.cpp +++ b/noncore/applets/pcmcia/configdialog.cpp @@ -48,5 +48,5 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) { gbDetails->setTitle( QString( "Details for card in socket #%1" ).arg( card->number() ) ); - txtCardName->setText( card->productIdentity().join( " " ) ); + txtCardName->setText( card->productIdentity() ); txtManfid->setText( card->manufacturerIdentity() ); txtFunction->setText( card->function() ); @@ -55,6 +55,6 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) QString resumeAction = preferredAction( card, "resume" ); - odebug << "pcmcia: preferred insertion action for card '" << card->name() << "' seems to be '" << insertAction << "'" << oendl; - odebug << "pcmcia: preferred resume action for card '" << card->name() << "' seems to be '" << resumeAction << "'" << oendl; + odebug << "pcmcia: preferred insertion action for card '" << card->productIdentity() << "' seems to be '" << insertAction << "'" << oendl; + odebug << "pcmcia: preferred resume action for card '" << card->productIdentity() << "' seems to be '" << resumeAction << "'" << oendl; if ( !insertAction.isEmpty() ) @@ -133,5 +133,5 @@ void ConfigDialog::writeConfigEntry( const OPcmciaSocket* card, const QString& k cfg.setGroup( "Global" ); int nCards = cfg.readNumEntry( "nCards", 0 ); - QString cardName = card->productIdentity().join( " " ).stripWhiteSpace(); + QString cardName = card->productIdentity(); QString action; @@ -155,5 +155,5 @@ QString ConfigDialog::readConfigEntry( const OPcmciaSocket* card, const QString& cfg.setGroup( "Global" ); int nCards = cfg.readNumEntry( "nCards", 0 ); - QString cardName = card->productIdentity().join( " " ).stripWhiteSpace(); + QString cardName = card->productIdentity(); QString value; diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index af23f58..c6386cb 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp @@ -77,5 +77,5 @@ PcmciaManager::PcmciaManager( QWidget * parent ) : QWidget( parent ), popupMenu( setFixedWidth ( AppLnk::smallIconSize() ); setFixedHeight ( AppLnk::smallIconSize() ); - pm = Opie::Core::OResource::loadPixmap( "pcmcia/pcmcia", Opie::Core::OResource::SmallIcon ); + pm = Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ); configuring = false; @@ -164,9 +164,13 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) submenu->insertItem( "&Configure", CONFIGURE+i*100 ); - submenu->setItemEnabled( EJECT+i*100, !it.current()->isEmpty() ); - submenu->setItemEnabled( INSERT+i*100, it.current()->isEmpty() ); - submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); - submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); - submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() && !configuring ); + bool isSuspended = it.current()->isSuspended(); + bool isEmpty = it.current()->isEmpty(); + + submenu->setItemEnabled( EJECT+i*100, !isEmpty ); + submenu->setItemEnabled( INSERT+i*100, isEmpty ); + submenu->setItemEnabled( SUSPEND+i*100, !isEmpty && !isSuspended ); + submenu->setItemEnabled( RESUME+i*100, !isEmpty && isSuspended ); + submenu->setItemEnabled( RESET+i*100, !isEmpty && !isSuspended ); + submenu->setItemEnabled( CONFIGURE+i*100, !isEmpty && !configuring ); connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); @@ -214,5 +218,5 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) { theCard = it.current(); - QString cardName = theCard->productIdentity().join( " " ).stripWhiteSpace(); + QString cardName = theCard->productIdentity(); for ( int i = 0; i < nCards; ++i ) { @@ -235,5 +239,5 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) { odebug << "pcmcia: unconfigured card detected" << oendl; - QString newCardName = theCard->productIdentity().join( " " ).stripWhiteSpace(); + QString newCardName = theCard->productIdentity(); int result = QMessageBox::information( qApp->desktop(), tr( "PCMCIA/CF Subsystem" ), @@ -262,5 +266,5 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) QString entryCard = QString( "card \"%1\"" ).arg( newCardName ); QString entryVersion( " version " ); - for ( QStringList::Iterator it = theCard->productIdentity().begin(); it != theCard->productIdentity().end(); ++it ) + for ( QStringList::Iterator it = theCard->productIdentityVector().begin(); it != theCard->productIdentityVector().end(); ++it ) { entryVersion += QString( "\"%1\", " ).arg( *it ); |