summaryrefslogtreecommitdiff
path: root/noncore/applets/pcmcia/pcmcia.cpp
Unidiff
Diffstat (limited to 'noncore/applets/pcmcia/pcmcia.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index 187adc6..c639002 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -191,96 +191,102 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
191{ 191{
192 odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; 192 odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl;
193 if ( msg != "stabChanged()" ) return; 193 if ( msg != "stabChanged()" ) return;
194 194
195 /* check if a previously unknown card has been inserted */ 195 /* check if a previously unknown card has been inserted */
196 OPcmciaSystem::instance()->synchronize(); 196 OPcmciaSystem::instance()->synchronize();
197 197
198 if ( !OPcmciaSystem::instance()->cardCount() ) return; 198 if ( !OPcmciaSystem::instance()->cardCount() ) return;
199 199
200 OConfig cfg( "PCMCIA" ); 200 OConfig cfg( "PCMCIA" );
201 cfg.setGroup( "Global" ); 201 cfg.setGroup( "Global" );
202 int nCards = cfg.readNumEntry( "nCards", 0 ); 202 int nCards = cfg.readNumEntry( "nCards", 0 );
203 203
204 OPcmciaSystem* sys = OPcmciaSystem::instance(); 204 OPcmciaSystem* sys = OPcmciaSystem::instance();
205 OPcmciaSystem::CardIterator it = sys->iterator(); 205 OPcmciaSystem::CardIterator it = sys->iterator();
206 206
207 bool newCard = true; 207 bool newCard = true;
208 OPcmciaSocket* theCard = 0; 208 OPcmciaSocket* theCard = 0;
209 209
210 while ( it.current() && newCard ) 210 while ( it.current() && newCard )
211 { 211 {
212 if ( it.current()->isEmpty() ) 212 if ( it.current()->isEmpty() )
213 { 213 {
214 odebug << "pcmcia: skipping empty card in socket " << it.current()->number() << oendl; 214 odebug << "pcmcia: skipping empty card in socket " << it.current()->number() << oendl;
215 ++it; 215 ++it;
216 continue; 216 continue;
217 } 217 }
218 else 218 else
219 { 219 {
220 theCard = it.current(); 220 theCard = it.current();
221 QString cardName = theCard->productIdentity(); 221 QString cardName = theCard->productIdentity();
222 for ( int i = 0; i < nCards; ++i ) 222 for ( int i = 0; i < nCards; ++i )
223 { 223 {
224 QString cardSection = QString( "Card_%1" ).arg( i ); 224 QString cardSection = QString( "Card_%1" ).arg( i );
225 cfg.setGroup( cardSection ); 225 cfg.setGroup( cardSection );
226 QString name = cfg.readEntry( "name" ); 226 QString name = cfg.readEntry( "name" );
227 odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl; 227 odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl;
228 if ( cardName == name ) 228 if ( cardName == name )
229 { 229 {
230 newCard = false; 230 newCard = false;
231 odebug << "pcmcia: we have seen this card before" << oendl; 231 odebug << "pcmcia: we have seen this card before" << oendl;
232 executeAction( theCard, "insert" ); 232 executeAction( theCard, "insert" );
233 break; 233 break;
234 } 234 }
235 } 235 }
236 if ( !newCard ) ++it; else break; 236 if ( !newCard ) ++it; else break;
237 } 237 }
238 } 238 }
239
240 if ( !theCard ) {
241 owarn << "pcmcia: Finished working through cards in PCMCIA system but I do not have a valid card handle" << oendl;
242 return;
243 }
244
239 if ( newCard ) 245 if ( newCard )
240 { 246 {
241 odebug << "pcmcia: unconfigured card detected" << oendl; 247 odebug << "pcmcia: unconfigured card detected" << oendl;
242 QString newCardName = theCard->productIdentity(); 248 QString newCardName = theCard->productIdentity();
243 int result = QMessageBox::information( qApp->desktop(), 249 int result = QMessageBox::information( qApp->desktop(),
244 tr( "PCMCIA/CF Subsystem" ), 250 tr( "PCMCIA/CF Subsystem" ),
245 tr( "<qt>You have inserted the card<br/><b>%1</b><br/>This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ), 251 tr( "<qt>You have inserted the card<br/><b>%1</b><br/>This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ),
246 tr( "Yes" ), tr( "No" ), 0, 0, 1 ); 252 tr( "Yes" ), tr( "No" ), 0, 0, 1 );
247 odebug << "pcmcia: result = " << result << oendl; 253 odebug << "pcmcia: result = " << result << oendl;
248 if ( result == 0 ) 254 if ( result == 0 )
249 { 255 {
250 configure( theCard ); 256 configure( theCard );
251 } 257 }
252 else 258 else
253 { 259 {
254 odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl; 260 odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl;
255 } 261 }
256 } 262 }
257 else // it's an already configured card 263 else // it's an already configured card
258 { 264 {
259 odebug << "pcmcia: doing nothing... why do we come here?" << oendl; 265 odebug << "pcmcia: doing nothing... why do we come here?" << oendl;
260 } 266 }
261} 267}
262 268
263void PcmciaManager::paintEvent( QPaintEvent * ) 269void PcmciaManager::paintEvent( QPaintEvent * )
264{ 270{
265 QPainter p( this ); 271 QPainter p( this );
266 p.drawPixmap( 0, 0, pm ); 272 p.drawPixmap( 0, 0, pm );
267} 273}
268 274
269int PcmciaManager::position() 275int PcmciaManager::position()
270{ 276{
271 return 7; 277 return 7;
272} 278}
273 279
274void PcmciaManager::execCommand( const QStringList &strList ) 280void PcmciaManager::execCommand( const QStringList &strList )
275{ 281{
276} 282}
277 283
278void PcmciaManager::userCardAction( int action ) 284void PcmciaManager::userCardAction( int action )
279{ 285{
280 odebug << "pcmcia: user action on socket " << action / 100 << " requested. action = " << action << oendl; 286 odebug << "pcmcia: user action on socket " << action / 100 << " requested. action = " << action << oendl;
281 287
282 int socket = action / 100; 288 int socket = action / 100;
283 int what = action % 100; 289 int what = action % 100;
284 bool success = false; 290 bool success = false;
285 291
286 switch ( what ) 292 switch ( what )