summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp20
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp2
2 files changed, 16 insertions, 6 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
@@ -120,17 +120,26 @@ void PcmciaManager::mousePressEvent( QMouseEvent* )
120 OPcmciaSystem::CardIterator it = sys->iterator(); 120 OPcmciaSystem::CardIterator it = sys->iterator();
121 if ( !sys->count() ) return; 121 if ( !sys->count() ) return;
122 122
123 int i = 0; 123 int i = 0;
124 while ( it.current() ) 124 while ( it.current() )
125 { 125 {
126 menu->insertItem( tr( "Eject card %1: %2" ).arg( i++ ).arg( it.currentKey() ), 1 ); 126
127 QPopupMenu* submenu = new QPopupMenu( menu );
128 submenu->insertItem( "Eject" );
129 submenu->insertItem( "Insert" );
130 submenu->insertItem( "Suspend" );
131 submenu->insertItem( "Resume" );
132 submenu->insertItem( "Configure" );
133
134 menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 );
127 ++it; 135 ++it;
128 } 136 }
129 137
130 138
139
131 /* insert items depending on number of cards etc. 140 /* insert items depending on number of cards etc.
132 141
133 if ( cardInSd ) { 142 if ( cardInSd ) {
134 menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ), 143 menu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( "cardmon/ide", Opie::Core::OResource::SmallIcon ) ),
135 tr( "Eject SD/MMC card" ), 0 ); 144 tr( "Eject SD/MMC card" ), 0 );
136 } 145 }
@@ -165,25 +174,26 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
165 odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; 174 odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl;
166 if ( msg != "stabChanged()" ) return; 175 if ( msg != "stabChanged()" ) return;
167 176
168 /* check if a previously unknown card has been inserted */ 177 /* check if a previously unknown card has been inserted */
169 OPcmciaSystem::instance()->synchronize(); 178 OPcmciaSystem::instance()->synchronize();
170 179
171 if ( !OPcmciaSystem::instance()->count() ) return; 180 if ( !OPcmciaSystem::instance()->cardCount() ) return;
172 181
173 OConfig cfg( "PCMCIA" ); 182 OConfig cfg( "PCMCIA" );
174 cfg.setGroup( "Global" ); 183 cfg.setGroup( "Global" );
175 int nCards = cfg.readNumEntry( "nCards", 0 ); 184 int nCards = cfg.readNumEntry( "nCards", 0 );
176 185
177 OPcmciaSystem* sys = OPcmciaSystem::instance(); 186 OPcmciaSystem* sys = OPcmciaSystem::instance();
178 OPcmciaSystem::CardIterator it = sys->iterator(); 187 OPcmciaSystem::CardIterator it = sys->iterator();
179 188
180 bool newCard = true; 189 bool newCard = true;
181 while ( it.current() && newCard ) 190
191 while ( it.current() && !it.current()->isEmpty() && newCard )
182 { 192 {
183 QString name = it.currentKey(); 193 QString name = it.current()->identity();
184 for ( int i = 0; i < nCards; ++i ) 194 for ( int i = 0; i < nCards; ++i )
185 { 195 {
186 QString cardSection = QString( "Card_%1" ).arg( i ); 196 QString cardSection = QString( "Card_%1" ).arg( i );
187 cfg.setGroup( cardSection ); 197 cfg.setGroup( cardSection );
188 QString cardName = cfg.readEntry( "name" ); 198 QString cardName = cfg.readEntry( "name" );
189 odebug << "comparing card '" << name << "' with known card '" << cardName << "'" << oendl; 199 odebug << "comparing card '" << name << "' with known card '" << cardName << "'" << oendl;
@@ -192,16 +202,16 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
192 newCard = false; 202 newCard = false;
193 break; 203 break;
194 } 204 }
195 } 205 }
196 if ( !newCard ) ++it; else break; 206 if ( !newCard ) ++it; else break;
197 } 207 }
198 QString newCardName = it.currentKey();
199 208
200 if ( newCard ) 209 if ( newCard )
201 { 210 {
211 QString newCardName = it.current()->identity();
202 odebug << "pcmcia: new card detected" << oendl; 212 odebug << "pcmcia: new card detected" << oendl;
203 cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); 213 cfg.setGroup( QString( "Card_%1" ).arg( nCards ) );
204 cfg.writeEntry( "name", newCardName ); 214 cfg.writeEntry( "name", newCardName );
205 cfg.setGroup( "Global" ); 215 cfg.setGroup( "Global" );
206 cfg.writeEntry( "nCards", nCards+1 ); 216 cfg.writeEntry( "nCards", nCards+1 );
207 cfg.write(); 217 cfg.write();
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
@@ -205,13 +205,13 @@ void CardsCategory::populate()
205{ 205{
206 odebug << "CardsCategory::populate()" << oendl; 206 odebug << "CardsCategory::populate()" << oendl;
207 OPcmciaSystem* sys = OPcmciaSystem::instance(); 207 OPcmciaSystem* sys = OPcmciaSystem::instance();
208 OPcmciaSystem::CardIterator it = sys->iterator(); 208 OPcmciaSystem::CardIterator it = sys->iterator();
209 while ( it.current() ) 209 while ( it.current() )
210 { 210 {
211 new CardDevice( this, (const char*) it.currentKey() ); 211 new CardDevice( this, it.current()->identity() );
212 ++it; 212 ++it;
213 } 213 }
214} 214}
215 215
216//================================================================================================= 216//=================================================================================================
217UsbCategory::UsbCategory( DevicesView* parent ) 217UsbCategory::UsbCategory( DevicesView* parent )