summaryrefslogtreecommitdiff
path: root/noncore/applets/pcmcia/pcmcia.cpp
Unidiff
Diffstat (limited to 'noncore/applets/pcmcia/pcmcia.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index 99c1bc9..1a2b619 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -200,37 +200,48 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
200 } 200 }
201 if ( !newCard ) ++it; else break; 201 if ( !newCard ) ++it; else break;
202 } 202 }
203 } 203 }
204 if ( newCard ) 204 if ( newCard )
205 { 205 {
206 odebug << "pcmcia: new card detected" << oendl; 206 odebug << "pcmcia: unconfigured card detected" << oendl;
207 cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); 207 QString newCardName = theCard->productIdentity().join( " " ).stripWhiteSpace();
208 cfg.writeEntry( "name", theCard->productIdentity().join( " " ) );
209 cfg.writeEntry( "insert", "suspend" );
210 cfg.setGroup( "Global" );
211 cfg.writeEntry( "nCards", nCards+1 );
212 cfg.write();
213
214 int result = QMessageBox::information( qApp->desktop(), 208 int result = QMessageBox::information( qApp->desktop(),
215 tr( "PCMCIA/CF Subsystem" ), 209 tr( "PCMCIA/CF Subsystem" ),
216 tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->productIdentity().join( " " ) ), 210 tr( "<qt>You have inserted the card '%1'. This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ),
217 tr( "Yes" ), tr( "No" ), 0, 0, 1 ); 211 tr( "Yes" ), tr( "No" ), 0, 0, 1 );
218 odebug << "result = " << result << oendl; 212 odebug << "result = " << result << oendl;
219 if ( result == 0 ) 213 if ( result == 0 )
220 { 214 {
221 configure( theCard ); 215 bool configured = configure( theCard );
216
217 if ( configured )
218 {
219 odebug << "card has been configured. writing out to dabase" << oendl;
220 cfg.setGroup( QString( "Card_%1" ).arg( nCards ) );
221 cfg.writeEntry( "name", newCardName );
222 cfg.writeEntry( "insert", "suspend" );
223 cfg.setGroup( "Global" );
224 cfg.writeEntry( "nCards", nCards+1 );
225 cfg.write();
222 } 226 }
223 else 227 else
224 { 228 {
225 odebug << "pcmcia: user doesn't want to configure " << theCard->productIdentity().join( " " ) << " now." << oendl; 229 odebug << "card has not been configured this time. leaving as unknown card" << oendl;
226 } 230 }
227 } 231 }
228 else 232 else
229 { 233 {
230 odebug << "pcmcia: card has been previously inserted" << oendl; 234 odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl;
235 }
236 }
237 else // it's an already configured card
238 {
239 QString action = ConfigDialog::preferredAction( theCard );
240 odebug << "pcmcia: card has been previously configured" << oendl;
241 odebug << "pcmcia: need to perform action'" << action << "' now... sorry, not yet implemented..." << oendl;
231 } 242 }
232 repaint( true ); 243 repaint( true );
233} 244}
234 245
235 246
236void PcmciaManager::paintEvent( QPaintEvent * ) 247void PcmciaManager::paintEvent( QPaintEvent * )
@@ -281,18 +292,19 @@ void PcmciaManager::userCardAction( int action )
281 { 292 {
282 owarn << "couldn't perform user action (" << strerror( errno ) << ")" << oendl; 293 owarn << "couldn't perform user action (" << strerror( errno ) << ")" << oendl;
283 } 294 }
284 295
285} 296}
286 297
287void PcmciaManager::configure( OPcmciaSocket* card ) 298bool PcmciaManager::configure( OPcmciaSocket* card )
288{ 299{
289 configuring = true; 300 configuring = true;
290 ConfigDialog dialog( card, qApp->desktop() ); 301 ConfigDialog dialog( card, qApp->desktop() );
291 int configresult = QPEApplication::execDialog( &dialog, false ); 302 int configresult = QPEApplication::execDialog( &dialog, false );
292 configuring = false; 303 configuring = false;
293 odebug << "pcmcia: configresult = " << configresult << oendl; 304 odebug << "pcmcia: configresult = " << configresult << oendl;
305 return configresult;
294} 306}
295 307
296 308
297EXPORT_OPIE_APPLET_v1( PcmciaManager ) 309EXPORT_OPIE_APPLET_v1( PcmciaManager )
298 310