Diffstat (limited to 'noncore/applets/pcmcia/pcmcia.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 54 |
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 | |||
@@ -178,65 +178,83 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | |||
178 | OPcmciaSystem::instance()->synchronize(); | 178 | OPcmciaSystem::instance()->synchronize(); |
179 | 179 | ||
180 | if ( !OPcmciaSystem::instance()->cardCount() ) return; | 180 | if ( !OPcmciaSystem::instance()->cardCount() ) return; |
181 | 181 | ||
182 | OConfig cfg( "PCMCIA" ); | 182 | OConfig cfg( "PCMCIA" ); |
183 | cfg.setGroup( "Global" ); | 183 | cfg.setGroup( "Global" ); |
184 | int nCards = cfg.readNumEntry( "nCards", 0 ); | 184 | int nCards = cfg.readNumEntry( "nCards", 0 ); |
185 | 185 | ||
186 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 186 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
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 | ||
234 | void PcmciaManager::paintEvent( QPaintEvent * ) | 252 | void PcmciaManager::paintEvent( QPaintEvent * ) |
235 | { | 253 | { |
236 | QPainter p( this ); | 254 | QPainter p( this ); |
237 | qDebug( "count = %d", (OPcmciaSystem::instance()->count() ) ); | 255 | qDebug( "count = %d", (OPcmciaSystem::instance()->count() ) ); |
238 | if ( OPcmciaSystem::instance()->count() ) | 256 | if ( OPcmciaSystem::instance()->count() ) |
239 | { | 257 | { |
240 | p.drawPixmap( 0, 0, pm ); | 258 | p.drawPixmap( 0, 0, pm ); |
241 | show(); | 259 | show(); |
242 | } | 260 | } |