summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index fac7065..aea699f 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -162,124 +162,136 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
OPcmciaSystem::instance()->synchronize();
if ( !OPcmciaSystem::instance()->cardCount() ) return;
OConfig cfg( "PCMCIA" );
cfg.setGroup( "Global" );
int nCards = cfg.readNumEntry( "nCards", 0 );
OPcmciaSystem* sys = OPcmciaSystem::instance();
OPcmciaSystem::CardIterator it = sys->iterator();
bool newCard = true;
OPcmciaSocket* theCard = 0;
while ( it.current() && newCard )
{
if ( it.current()->isEmpty() )
{
odebug << "skipping empty card in socket " << it.current()->number() << oendl;
++it;
continue;
}
else
{
- OPcmciaSocket* theCard = it.current();
- QString cardName = theCard->identity();
+ theCard = it.current();
+ QString cardName = theCard->productIdentity().join( " " );
for ( int i = 0; i < nCards; ++i )
{
QString cardSection = QString( "Card_%1" ).arg( i );
cfg.setGroup( cardSection );
QString name = cfg.readEntry( "name" );
odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl;
if ( cardName == name )
{
newCard = false;
break;
}
}
if ( !newCard ) ++it; else break;
}
}
if ( newCard )
{
odebug << "pcmcia: new card detected" << oendl;
cfg.setGroup( QString( "Card_%1" ).arg( nCards ) );
- cfg.writeEntry( "name", theCard->identity() );
+ cfg.writeEntry( "name", theCard->productIdentity().join( " " ) );
cfg.writeEntry( "insert", "suspend" );
cfg.setGroup( "Global" );
cfg.writeEntry( "nCards", nCards+1 );
cfg.write();
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->identity() ),
+ tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->productIdentity().join( " " ) ),
tr( "Yes" ), tr( "No" ), 0, 0, 1 );
odebug << "result = " << result << oendl;
if ( result == 0 )
{
configure( theCard );
}
else
{
- odebug << "pcmcia: user doesn't want to configure " << theCard->identity() << " now." << oendl;
+ odebug << "pcmcia: user doesn't want to configure " << theCard->productIdentity().join( " " ) << " now." << oendl;
}
}
else
{
odebug << "pcmcia: card has been previously inserted" << oendl;
}
repaint( true );
}
void PcmciaManager::paintEvent( QPaintEvent * )
{
QPainter p( this );
odebug << "sockets = " << OPcmciaSystem::instance()->count() << ", cards = " << OPcmciaSystem::instance()->cardCount() << oendl;
if ( OPcmciaSystem::instance()->cardCount() )
{
p.drawPixmap( 0, 0, pm );
show();
}
else
{
hide();
}
}
int PcmciaManager::position()
{
return 7;
}
void PcmciaManager::execCommand( const QStringList &strList )
{
}
void PcmciaManager::userCardAction( int action )
{
odebug << "user action requested. action = " << action << oendl;
int socket = action / 100;
int what = action % 100;
+ bool success = false;
switch ( what )
{
- case CONFIGURE: configure( OPcmciaSystem::instance()->socket( socket ) ); break;
- default: odebug << "not yet implemented";
+ case CONFIGURE: configure( OPcmciaSystem::instance()->socket( socket ) ); success = true; break;
+ case EJECT: success = OPcmciaSystem::instance()->socket( socket )->eject(); break;
+ case INSERT: success = OPcmciaSystem::instance()->socket( socket )->insert(); break;
+ case SUSPEND: success = OPcmciaSystem::instance()->socket( socket )->suspend(); break;
+ case RESUME: success = OPcmciaSystem::instance()->socket( socket )->resume(); break;
+ case RESET: success = OPcmciaSystem::instance()->socket( socket )->reset(); break;
+ default: odebug << "not yet implemented" << oendl;
}
+
+ if ( !success )
+ {
+ owarn << "couldn't perform user action" << oendl;
+ }
+
}
void PcmciaManager::configure( OPcmciaSocket* card )
{
configuring = true;
ConfigDialog dialog( card, qApp->desktop() );
int configresult = QPEApplication::execDialog( &dialog, false );
configuring = false;
odebug << "pcmcia: configresult = " << configresult << oendl;
}
EXPORT_OPIE_APPLET_v1( PcmciaManager )