author | mickeyl <mickeyl> | 2005-06-19 22:02:38 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-19 22:02:38 (UTC) |
commit | 34ecdb361924656b758da2073ef6ac0c1bffd210 (patch) (side-by-side diff) | |
tree | dbc91b753acae2f9f6a62e922e6707cfef55e171 /noncore/applets/pcmcia/pcmcia.cpp | |
parent | 83fec70860e56af97d66e9505b913602505423d7 (diff) | |
download | opie-34ecdb361924656b758da2073ef6ac0c1bffd210.zip opie-34ecdb361924656b758da2073ef6ac0c1bffd210.tar.gz opie-34ecdb361924656b758da2073ef6ac0c1bffd210.tar.bz2 |
- s/new card/unconfigured card/
- add note about unrecognized cards in configuration dialog
- add ConfigDialog::preferredAction()
Diffstat (limited to 'noncore/applets/pcmcia/pcmcia.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index 99c1bc9..1a2b619 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp @@ -200,37 +200,48 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) } if ( !newCard ) ++it; else break; } } if ( newCard ) { - odebug << "pcmcia: new card detected" << oendl; - cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); - cfg.writeEntry( "name", theCard->productIdentity().join( " " ) ); - cfg.writeEntry( "insert", "suspend" ); - cfg.setGroup( "Global" ); - cfg.writeEntry( "nCards", nCards+1 ); - cfg.write(); - + odebug << "pcmcia: unconfigured card detected" << oendl; + QString newCardName = theCard->productIdentity().join( " " ).stripWhiteSpace(); int result = QMessageBox::information( qApp->desktop(), tr( "PCMCIA/CF Subsystem" ), - tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->productIdentity().join( " " ) ), + tr( "<qt>You have inserted the card '%1'. This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ); odebug << "result = " << result << oendl; if ( result == 0 ) { - configure( theCard ); + bool configured = configure( theCard ); + + if ( configured ) + { + odebug << "card has been configured. writing out to dabase" << oendl; + cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); + cfg.writeEntry( "name", newCardName ); + cfg.writeEntry( "insert", "suspend" ); + cfg.setGroup( "Global" ); + cfg.writeEntry( "nCards", nCards+1 ); + cfg.write(); + } + else + { + odebug << "card has not been configured this time. leaving as unknown card" << oendl; + } } else { - odebug << "pcmcia: user doesn't want to configure " << theCard->productIdentity().join( " " ) << " now." << oendl; + odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl; } } - else + else // it's an already configured card { - odebug << "pcmcia: card has been previously inserted" << oendl; + QString action = ConfigDialog::preferredAction( theCard ); + odebug << "pcmcia: card has been previously configured" << oendl; + odebug << "pcmcia: need to perform action'" << action << "' now... sorry, not yet implemented..." << oendl; } repaint( true ); } void PcmciaManager::paintEvent( QPaintEvent * ) @@ -281,18 +292,19 @@ void PcmciaManager::userCardAction( int action ) { owarn << "couldn't perform user action (" << strerror( errno ) << ")" << oendl; } } -void PcmciaManager::configure( OPcmciaSocket* card ) +bool PcmciaManager::configure( OPcmciaSocket* card ) { configuring = true; ConfigDialog dialog( card, qApp->desktop() ); int configresult = QPEApplication::execDialog( &dialog, false ); configuring = false; odebug << "pcmcia: configresult = " << configresult << oendl; + return configresult; } EXPORT_OPIE_APPLET_v1( PcmciaManager ) |