author | mickeyl <mickeyl> | 2005-06-17 13:29:56 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-17 13:29:56 (UTC) |
commit | 0e11eb29a20ff6bff533a07ff604ed858237f82b (patch) (unidiff) | |
tree | bd1ef20d6771064973297bfea7b0bffc2271ab87 | |
parent | 8af66795130275b1337f8ae06d249649ac273d0d (diff) | |
download | opie-0e11eb29a20ff6bff533a07ff604ed858237f82b.zip opie-0e11eb29a20ff6bff533a07ff604ed858237f82b.tar.gz opie-0e11eb29a20ff6bff533a07ff604ed858237f82b.tar.bz2 |
make reset, eject, suspend, resume, insert work
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index fac7065..aea699f 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp | |||
@@ -174,63 +174,63 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | |||
174 | OPcmciaSocket* theCard = 0; | 174 | OPcmciaSocket* theCard = 0; |
175 | 175 | ||
176 | while ( it.current() && newCard ) | 176 | while ( it.current() && newCard ) |
177 | { | 177 | { |
178 | if ( it.current()->isEmpty() ) | 178 | if ( it.current()->isEmpty() ) |
179 | { | 179 | { |
180 | odebug << "skipping empty card in socket " << it.current()->number() << oendl; | 180 | odebug << "skipping empty card in socket " << it.current()->number() << oendl; |
181 | ++it; | 181 | ++it; |
182 | continue; | 182 | continue; |
183 | } | 183 | } |
184 | else | 184 | else |
185 | { | 185 | { |
186 | OPcmciaSocket* theCard = it.current(); | 186 | theCard = it.current(); |
187 | QString cardName = theCard->identity(); | 187 | QString cardName = theCard->productIdentity().join( " " ); |
188 | for ( int i = 0; i < nCards; ++i ) | 188 | for ( int i = 0; i < nCards; ++i ) |
189 | { | 189 | { |
190 | QString cardSection = QString( "Card_%1" ).arg( i ); | 190 | QString cardSection = QString( "Card_%1" ).arg( i ); |
191 | cfg.setGroup( cardSection ); | 191 | cfg.setGroup( cardSection ); |
192 | QString name = cfg.readEntry( "name" ); | 192 | QString name = cfg.readEntry( "name" ); |
193 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; | 193 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; |
194 | if ( cardName == name ) | 194 | if ( cardName == name ) |
195 | { | 195 | { |
196 | newCard = false; | 196 | newCard = false; |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | if ( !newCard ) ++it; else break; | 200 | if ( !newCard ) ++it; else break; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | if ( newCard ) | 203 | if ( newCard ) |
204 | { | 204 | { |
205 | odebug << "pcmcia: new card detected" << oendl; | 205 | odebug << "pcmcia: new card detected" << oendl; |
206 | cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); | 206 | cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); |
207 | cfg.writeEntry( "name", theCard->identity() ); | 207 | cfg.writeEntry( "name", theCard->productIdentity().join( " " ) ); |
208 | cfg.writeEntry( "insert", "suspend" ); | 208 | cfg.writeEntry( "insert", "suspend" ); |
209 | cfg.setGroup( "Global" ); | 209 | cfg.setGroup( "Global" ); |
210 | cfg.writeEntry( "nCards", nCards+1 ); | 210 | cfg.writeEntry( "nCards", nCards+1 ); |
211 | cfg.write(); | 211 | cfg.write(); |
212 | 212 | ||
213 | int result = QMessageBox::information( qApp->desktop(), | 213 | int result = QMessageBox::information( qApp->desktop(), |
214 | tr( "PCMCIA/CF Subsystem" ), | 214 | tr( "PCMCIA/CF Subsystem" ), |
215 | tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->identity() ), | 215 | tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->productIdentity().join( " " ) ), |
216 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); | 216 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); |
217 | odebug << "result = " << result << oendl; | 217 | odebug << "result = " << result << oendl; |
218 | if ( result == 0 ) | 218 | if ( result == 0 ) |
219 | { | 219 | { |
220 | configure( theCard ); | 220 | configure( theCard ); |
221 | } | 221 | } |
222 | else | 222 | else |
223 | { | 223 | { |
224 | odebug << "pcmcia: user doesn't want to configure " << theCard->identity() << " now." << oendl; | 224 | odebug << "pcmcia: user doesn't want to configure " << theCard->productIdentity().join( " " ) << " now." << oendl; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | else | 227 | else |
228 | { | 228 | { |
229 | odebug << "pcmcia: card has been previously inserted" << oendl; | 229 | odebug << "pcmcia: card has been previously inserted" << oendl; |
230 | } | 230 | } |
231 | repaint( true ); | 231 | repaint( true ); |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | void PcmciaManager::paintEvent( QPaintEvent * ) | 235 | void PcmciaManager::paintEvent( QPaintEvent * ) |
236 | { | 236 | { |
@@ -254,30 +254,42 @@ int PcmciaManager::position() | |||
254 | } | 254 | } |
255 | 255 | ||
256 | void PcmciaManager::execCommand( const QStringList &strList ) | 256 | void PcmciaManager::execCommand( const QStringList &strList ) |
257 | { | 257 | { |
258 | } | 258 | } |
259 | 259 | ||
260 | void PcmciaManager::userCardAction( int action ) | 260 | void PcmciaManager::userCardAction( int action ) |
261 | { | 261 | { |
262 | odebug << "user action requested. action = " << action << oendl; | 262 | odebug << "user action requested. action = " << action << oendl; |
263 | 263 | ||
264 | int socket = action / 100; | 264 | int socket = action / 100; |
265 | int what = action % 100; | 265 | int what = action % 100; |
266 | bool success = false; | ||
266 | 267 | ||
267 | switch ( what ) | 268 | switch ( what ) |
268 | { | 269 | { |
269 | case CONFIGURE: configure( OPcmciaSystem::instance()->socket( socket ) ); break; | 270 | case CONFIGURE: configure( OPcmciaSystem::instance()->socket( socket ) ); success = true; break; |
270 | default: odebug << "not yet implemented"; | 271 | case EJECT: success = OPcmciaSystem::instance()->socket( socket )->eject(); break; |
272 | case INSERT: success = OPcmciaSystem::instance()->socket( socket )->insert(); break; | ||
273 | case SUSPEND: success = OPcmciaSystem::instance()->socket( socket )->suspend(); break; | ||
274 | case RESUME: success = OPcmciaSystem::instance()->socket( socket )->resume(); break; | ||
275 | case RESET: success = OPcmciaSystem::instance()->socket( socket )->reset(); break; | ||
276 | default: odebug << "not yet implemented" << oendl; | ||
271 | } | 277 | } |
278 | |||
279 | if ( !success ) | ||
280 | { | ||
281 | owarn << "couldn't perform user action" << oendl; | ||
282 | } | ||
283 | |||
272 | } | 284 | } |
273 | 285 | ||
274 | void PcmciaManager::configure( OPcmciaSocket* card ) | 286 | void PcmciaManager::configure( OPcmciaSocket* card ) |
275 | { | 287 | { |
276 | configuring = true; | 288 | configuring = true; |
277 | ConfigDialog dialog( card, qApp->desktop() ); | 289 | ConfigDialog dialog( card, qApp->desktop() ); |
278 | int configresult = QPEApplication::execDialog( &dialog, false ); | 290 | int configresult = QPEApplication::execDialog( &dialog, false ); |
279 | configuring = false; | 291 | configuring = false; |
280 | odebug << "pcmcia: configresult = " << configresult << oendl; | 292 | odebug << "pcmcia: configresult = " << configresult << oendl; |
281 | } | 293 | } |
282 | 294 | ||
283 | 295 | ||