summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp24
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp2
2 files changed, 18 insertions, 8 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index 5183572..7f24371 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -91,135 +91,145 @@ void PcmciaManager::popUp( QString message, QString icon )
if ( icon.isEmpty() ) {
popupMenu->insertItem( message, 0 );
} else {
popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ),
message, 0 );
}
QPoint p = mapToGlobal( QPoint( 0, 0 ) );
QSize s = popupMenu->sizeHint();
popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
p.y() - s.height() ), 0 );
QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) );
}
void PcmciaManager::popupTimeout()
{
popupMenu->hide();
}
void PcmciaManager::mousePressEvent( QMouseEvent* )
{
- QPopupMenu * menu = new QPopupMenu( this );
+ QPopupMenu* menu = new QPopupMenu( this );
QStringList cmd;
bool execute = true;
OPcmciaSystem* sys = OPcmciaSystem::instance();
OPcmciaSystem::CardIterator it = sys->iterator();
if ( !sys->count() ) return;
int i = 0;
while ( it.current() )
{
- menu->insertItem( tr( "Eject card %1: %2" ).arg( i++ ).arg( it.currentKey() ), 1 );
+
+ QPopupMenu* submenu = new QPopupMenu( menu );
+ submenu->insertItem( "Eject" );
+ submenu->insertItem( "Insert" );
+ submenu->insertItem( "Suspend" );
+ submenu->insertItem( "Resume" );
+ submenu->insertItem( "Configure" );
+
+ menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 );
++it;
}
+
/* insert items depending on number of cards etc.
if ( cardInSd ) {
menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ),
tr( "Eject SD/MMC card" ), 0 );
}
-
+
if ( cardInPcmcia0 ) {
menu->
insertItem( QIconSet
( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia0Type, Opie::Core::OResource::SmallIcon ) ),
tr( "Eject card 0: %1" ).arg( cardInPcmcia0Name ), 1 );
}
if ( cardInPcmcia1 ) {
menu->
insertItem( QIconSet
( Opie::Core::OResource::loadPixmap( "cardmon/" + cardInPcmcia1Type, Opie::Core::OResource::SmallIcon ) ),
tr( "Eject card 1: %1" ).arg( cardInPcmcia1Name ), 2 );
}
*/
QPoint p = mapToGlobal( QPoint( 0, 0 ) );
QSize s = menu->sizeHint();
int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 );
qDebug( "pcmcia: menu result = %d", opt );
delete menu;
}
void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
{
odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl;
if ( msg != "stabChanged()" ) return;
/* check if a previously unknown card has been inserted */
OPcmciaSystem::instance()->synchronize();
- if ( !OPcmciaSystem::instance()->count() ) return;
+ 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;
- while ( it.current() && newCard )
+
+ while ( it.current() && !it.current()->isEmpty() && newCard )
{
- QString name = it.currentKey();
+ QString name = it.current()->identity();
for ( int i = 0; i < nCards; ++i )
{
QString cardSection = QString( "Card_%1" ).arg( i );
cfg.setGroup( cardSection );
QString cardName = cfg.readEntry( "name" );
odebug << "comparing card '" << name << "' with known card '" << cardName << "'" << oendl;
if ( cardName == name )
{
newCard = false;
break;
}
}
if ( !newCard ) ++it; else break;
}
- QString newCardName = it.currentKey();
if ( newCard )
{
+ QString newCardName = it.current()->identity();
odebug << "pcmcia: new card detected" << oendl;
cfg.setGroup( QString( "Card_%1" ).arg( nCards ) );
cfg.writeEntry( "name", newCardName );
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 this card?" ).arg( newCardName ),
tr( "Yes" ), tr( "No" ), 0, 0, 1 );
odebug << "result = " << result << oendl;
}
else
{
odebug << "pcmcia: card has been previously inserted" << oendl;
}
repaint( TRUE );
}
void PcmciaManager::paintEvent( QPaintEvent * )
{
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 945edea..4940286 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -187,49 +187,49 @@ void InputCategory::populate()
while ( it.current() )
{
new InputDevice( this, it.current()->identity() );
++it;
}
}
//=================================================================================================
CardsCategory::CardsCategory( DevicesView* parent )
:Category( parent, "3. Removable Cards" )
{
}
CardsCategory::~CardsCategory()
{
}
void CardsCategory::populate()
{
odebug << "CardsCategory::populate()" << oendl;
OPcmciaSystem* sys = OPcmciaSystem::instance();
OPcmciaSystem::CardIterator it = sys->iterator();
while ( it.current() )
{
- new CardDevice( this, (const char*) it.currentKey() );
+ new CardDevice( this, it.current()->identity() );
++it;
}
}
//=================================================================================================
UsbCategory::UsbCategory( DevicesView* parent )
:Category( parent, "4. Universal Serial Bus" )
{
}
UsbCategory::~UsbCategory()
{
}
void UsbCategory::populate()
{
odebug << "UsbCategory::populate()" << oendl;
QFile usbinfofile( "/proc/bus/usb/devices" );
if ( !usbinfofile.exists() || !usbinfofile.open( IO_ReadOnly ) )
{
new UsbDevice( this, "ERROR: /proc/bus/usb/devices not found or unaccessible" );
return;
}
QTextStream usbinfo( &usbinfofile );