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.cpp40
1 files changed, 26 insertions, 14 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
@@ -203,31 +203,42 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
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();
226 }
227 else
228 {
229 odebug << "card has not been configured this time. leaving as unknown card" << oendl;
230 }
222 } 231 }
223 else 232 else
224 { 233 {
225 odebug << "pcmcia: user doesn't want to configure " << theCard->productIdentity().join( " " ) << " now." << oendl; 234 odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl;
226 } 235 }
227 } 236 }
228 else 237 else // it's an already configured card
229 { 238 {
230 odebug << "pcmcia: card has been previously inserted" << oendl; 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}
@@ -284,13 +295,14 @@ void PcmciaManager::userCardAction( int action )
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