summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp54
1 files changed, 36 insertions, 18 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index 7f24371..a1deb6b 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -187,47 +187,65 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
187 OPcmciaSystem::CardIterator it = sys->iterator(); 187 OPcmciaSystem::CardIterator it = sys->iterator();
188 188
189 bool newCard = true; 189 bool newCard = true;
190 190 QString cardName;
191 while ( it.current() && !it.current()->isEmpty() && newCard ) 191
192 while ( it.current() && newCard )
192 { 193 {
193 QString name = it.current()->identity(); 194 if ( it.current()->isEmpty() )
194 for ( int i = 0; i < nCards; ++i ) 195 {
196 odebug << "skipping empty card in socket " << it.current()->number() << oendl;
197 ++it;
198 continue;
199 }
200 else
195 { 201 {
196 QString cardSection = QString( "Card_%1" ).arg( i ); 202 cardName = it.current()->identity();
197 cfg.setGroup( cardSection ); 203 for ( int i = 0; i < nCards; ++i )
198 QString cardName = cfg.readEntry( "name" );
199 odebug << "comparing card '" << name << "' with known card '" << cardName << "'" << oendl;
200 if ( cardName == name )
201 { 204 {
202 newCard = false; 205 QString cardSection = QString( "Card_%1" ).arg( i );
203 break; 206 cfg.setGroup( cardSection );
207 QString name = cfg.readEntry( "name" );
208 odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl;
209 if ( cardName == name )
210 {
211 newCard = false;
212 break;
213 }
204 } 214 }
215 if ( !newCard ) ++it; else break;
205 } 216 }
206 if ( !newCard ) ++it; else break;
207 } 217 }
208
209 if ( newCard ) 218 if ( newCard )
210 { 219 {
211 QString newCardName = it.current()->identity();
212 odebug << "pcmcia: new card detected" << oendl; 220 odebug << "pcmcia: new card detected" << oendl;
213 cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); 221 cfg.setGroup( QString( "Card_%1" ).arg( nCards ) );
214 cfg.writeEntry( "name", newCardName ); 222 cfg.writeEntry( "name", cardName );
215 cfg.setGroup( "Global" ); 223 cfg.setGroup( "Global" );
216 cfg.writeEntry( "nCards", nCards+1 ); 224 cfg.writeEntry( "nCards", nCards+1 );
217 cfg.write(); 225 cfg.write();
218 226
219 int result = QMessageBox::information( qApp->desktop(), 227 int result = QMessageBox::information( qApp->desktop(),
220 tr( "PCMCIA/CF Subsystem" ), 228 tr( "PCMCIA/CF Subsystem" ),
221 tr( "You have inserted a new card\n%1\nDo you want to configure this card?" ).arg( newCardName ), 229 tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( cardName ),
222 tr( "Yes" ), tr( "No" ), 0, 0, 1 ); 230 tr( "Yes" ), tr( "No" ), 0, 0, 1 );
223 odebug << "result = " << result << oendl; 231 odebug << "result = " << result << oendl;
224 232 if ( result == 0 )
233 {
234 QMessageBox::information( qApp->desktop(),
235 tr( "PCMCIA/CF Subsystem" ),
236 tr( "Sorry, not yet implemented...\n~lart mickeyl :D" ),
237 tr( "No Problem" ), 0, 0, 0 );
238 }
239 else
240 {
241 odebug << "pcmcia: user doesn't want to configure " << cardName << " now." << oendl;
242 }
225 } 243 }
226 else 244 else
227 { 245 {
228 odebug << "pcmcia: card has been previously inserted" << oendl; 246 odebug << "pcmcia: card has been previously inserted" << oendl;
229 } 247 }
230 repaint( TRUE ); 248 repaint( true );
231} 249}
232 250
233 251