3007 R_QTN_EJECTING_MEMORY_NAME_WAIT ); |
3125 R_QTN_EJECTING_MEMORY_NAME_WAIT ); |
3008 iSysApWaitNote = CSysApWaitNote::NewL( |
3126 iSysApWaitNote = CSysApWaitNote::NewL( |
3009 iSysApFeatureManager->CoverDisplaySupported() ); |
3127 iSysApFeatureManager->CoverDisplaySupported() ); |
3010 iSysApWaitNote->ShowNoteL( EClosingApplicationsNote, text ); |
3128 iSysApWaitNote->ShowNoteL( EClosingApplicationsNote, text ); |
3011 CleanupStack::PopAndDestroy( text ); |
3129 CleanupStack::PopAndDestroy( text ); |
3012 }*/ |
3130 */ } |
|
3131 |
|
3132 // ---------------------------------------------------------------------------- |
|
3133 // CSysApAppUi::IsEjectQueryVisible |
|
3134 // ---------------------------------------------------------------------------- |
|
3135 |
|
3136 TBool CSysApAppUi::IsEjectQueryVisible() |
|
3137 { |
|
3138 // if ( !iSysApConfirmationQuery ) |
|
3139 { |
|
3140 return EFalse; |
|
3141 } |
|
3142 // TInt queryId( iSysApConfirmationQuery->CurrentQuery() ); |
|
3143 // return ( queryId == ESysApEjectMmcQuery || queryId == ESysApRemoveMmcNote ); |
|
3144 } |
|
3145 |
|
3146 // ---------------------------------------------------------------------------- |
|
3147 // CSysApAppUi::UpdateInsertedMemoryCardsL |
|
3148 // ---------------------------------------------------------------------------- |
|
3149 |
|
3150 void CSysApAppUi::UpdateInsertedMemoryCardsL() |
|
3151 { |
|
3152 // Update inserted memory cards |
|
3153 iSysApDriveList->GetMemoryCardsL( |
|
3154 iInsertedMemoryCards, CSysApDriveList::EIncludeInserted ); |
|
3155 |
|
3156 // Update memory card indicator status |
|
3157 // SetMemoryCardIndicatorL(); |
|
3158 |
|
3159 // Handle unlock |
|
3160 RunUnlockNotifierL(); |
|
3161 } |
|
3162 |
|
3163 // ---------------------------------------------------------------------------- |
|
3164 // CSysApAppUi::EjectUsed |
|
3165 // ---------------------------------------------------------------------------- |
|
3166 |
|
3167 void CSysApAppUi::EjectUsed( TInt aDrive ) |
|
3168 { |
|
3169 // Check drive inserted before starting eject confirm query |
|
3170 TInt insertedIndex( CSysApDriveList::Find( iInsertedMemoryCards, aDrive ) ); |
|
3171 |
|
3172 TRACES( RDebug::Print( |
|
3173 _L( "CSysApAppUi::EjectUsed: drive: %d, index: %d" ), |
|
3174 aDrive, insertedIndex ) ); |
|
3175 |
|
3176 if ( insertedIndex == KErrNotFound ) |
|
3177 { |
|
3178 return; |
|
3179 } |
|
3180 |
|
3181 iMMCEjectUsed = ETrue; |
|
3182 iDriveToEject = aDrive; |
|
3183 iSysApDriveList->ResetDrivesToEject(); |
|
3184 TRAPD( err, EjectMMCL() ); |
|
3185 if ( err != KErrNone ) |
|
3186 { |
|
3187 TRACES( RDebug::Print( |
|
3188 _L( "CSysApAppUi::EjectUsed: err: %d" ), err ) ); |
|
3189 iMMCEjectUsed = EFalse; |
|
3190 } |
|
3191 } |
|
3192 #endif // RD_MULTIPLE_DRIVE |
|
3193 |
|
3194 |
|
3195 // ---------------------------------------------------------------------------- |
|
3196 // CSysApAppUi::EjectMMCCanceled |
|
3197 // ---------------------------------------------------------------------------- |
|
3198 |
|
3199 void CSysApAppUi::EjectMMCCanceled() |
|
3200 { |
|
3201 // Called from eject confirm query, reset eject status |
|
3202 #ifdef RD_MULTIPLE_DRIVE |
|
3203 iMMCEjectUsed = EFalse; |
|
3204 #endif // RD_MULTIPLE_DRIVE |
|
3205 } |
|
3206 |
|
3207 |
|
3208 |
|
3209 #ifndef RD_MULTIPLE_DRIVE |
|
3210 // ---------------------------------------------------------------------------- |
|
3211 // CSysApAppUi::MountMMC() |
|
3212 // ---------------------------------------------------------------------------- |
|
3213 |
|
3214 TInt CSysApAppUi::MountMMC() |
|
3215 { |
|
3216 TRACES( RDebug::Print( _L("CSysApAppUi::MountMMC") ) ); |
|
3217 TInt err ( KErrNotSupported ); |
|
3218 if ( iSysApFeatureManager->MmcSupported() ) |
|
3219 { |
|
3220 #ifdef __WINS__ // Let's sleep a second in WINS |
|
3221 User::After( 1000000 ); |
|
3222 #endif |
|
3223 err = iEikonEnv->FsSession().MountFileSystem( KFSName, KMMCDrive ); |
|
3224 TRACES( RDebug::Print( _L("CSysApAppUi::MountMMC: RFs::MountFileSystem() returned: %d"), err ) ); |
|
3225 if ( err == KErrInUse ) |
|
3226 { |
|
3227 User::After( 1000000 ); |
|
3228 err = iEikonEnv->FsSession().MountFileSystem( KFSName, KMMCDrive ); |
|
3229 TRACES( RDebug::Print( _L("CSysApAppUi::MountMMC: RFs::MountFileSystem() returned: %d"), err ) ); |
|
3230 } |
|
3231 } |
|
3232 return err; |
|
3233 } |
|
3234 |
|
3235 // ---------------------------------------------------------------------------- |
|
3236 // CSysApAppUi::DismountMMC() |
|
3237 // ---------------------------------------------------------------------------- |
|
3238 |
|
3239 TInt CSysApAppUi::DismountMMC() |
|
3240 { |
|
3241 TRACES( RDebug::Print( _L("CSysApAppUi::DismountMMC") ) ); |
|
3242 #ifdef __WINS__ // Let's sleep a second in WINS |
|
3243 User::After( 1000000 ); |
|
3244 #endif |
|
3245 |
|
3246 TInt err ( KErrNotSupported ); |
|
3247 if ( iSysApFeatureManager->MmcSupported() ) |
|
3248 { |
|
3249 err = iEikonEnv->FsSession().DismountFileSystem( KFSName, KMMCDrive ); |
|
3250 TRACES( RDebug::Print( _L("CSysApAppUi::DismountMMC: RFs::DismountFileSystem() returned: %d"), err ) ); |
|
3251 } |
|
3252 return err; |
|
3253 } |
|
3254 |
|
3255 // ---------------------------------------------------------------------------- |
|
3256 // CSysApAppUi::EjectMMCL() |
|
3257 // ---------------------------------------------------------------------------- |
|
3258 |
|
3259 void CSysApAppUi::EjectMMCL() |
|
3260 { |
|
3261 TRACES( RDebug::Print( _L("CSysApAppUi::EjectMMCL") ) ); |
|
3262 iMMCEjectUsed = ETrue; |
|
3263 iMMCPowerMenuEjectUsed = ETrue; |
|
3264 iTimeToKill = EFalse; |
|
3265 iApplicationScanningRoundNumber = 0; |
|
3266 CloseUIAppsInHotSwapL(); |
|
3267 } |
|
3268 |
|
3269 #else // RD_MULTIPLE_DRIVE |
|
3270 |
|
3271 // ---------------------------------------------------------------------------- |
|
3272 // CSysApAppUi::EjectMMCL() |
|
3273 // ---------------------------------------------------------------------------- |
|
3274 |
|
3275 void CSysApAppUi::EjectMMCL() |
|
3276 { |
|
3277 // Called from eject confirm query, check drive inserted before start |
|
3278 TInt insertedIndex( CSysApDriveList::Find( |
|
3279 iInsertedMemoryCards, iDriveToEject ) ); |
|
3280 |
|
3281 TRACES( RDebug::Print( |
|
3282 _L( "CSysApAppUi::EjectMMCL: iMMCEjectUsed: %d, drive: %d, index: %d "), |
|
3283 iMMCEjectUsed, iDriveToEject, insertedIndex ) ); |
|
3284 |
|
3285 if ( insertedIndex != KErrNotFound ) |
|
3286 { |
|
3287 iSysApDriveList->MarkDriveToEject( |
|
3288 iDriveToEject, CSysApDriveList::EEjectFromMenu ); |
|
3289 iSysApDriveEjectHandler->StartEject(); |
|
3290 } |
|
3291 iMMCEjectUsed = EFalse; |
|
3292 } |
|
3293 |
|
3294 #endif // RD_MULTIPLE_DRIVE |
|
3295 |
|
3296 #ifndef RD_MULTIPLE_DRIVE |
|
3297 // ---------------------------------------------------------------------------- |
|
3298 // CSysApAppUi::RunUnlockNotifierL() |
|
3299 // ---------------------------------------------------------------------------- |
|
3300 |
|
3301 void CSysApAppUi::RunUnlockNotifierL( TSysApMemoryCardStatus aMemoryCardStatus ) |
|
3302 { |
|
3303 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: START") ) ); |
|
3304 if ( iSysApFeatureManager->MmcSupported() ) |
|
3305 { |
|
3306 if ( UiReady() ) |
|
3307 { |
|
3308 TSysApMemoryCardStatus memoryCardStatus; |
|
3309 if ( aMemoryCardStatus == ESysApMemoryCardStatusNotKnown ) |
|
3310 { |
|
3311 memoryCardStatus = iSysApMMCObserver->MemoryCardStatus(); |
|
3312 } |
|
3313 else |
|
3314 { |
|
3315 memoryCardStatus = aMemoryCardStatus; |
|
3316 } |
|
3317 |
|
3318 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: memoryCardStatus=%d"), memoryCardStatus ) ); |
|
3319 |
|
3320 switch ( memoryCardStatus ) |
|
3321 { |
|
3322 case ESysApMemoryCardInserted: |
|
3323 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL MMC inserted") ) ); |
|
3324 if ( aMemoryCardStatus == ESysApMemoryCardInserted ) |
|
3325 { |
|
3326 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
|
3327 } |
|
3328 break; |
|
3329 case ESysApMemoryCardLocked: |
|
3330 { |
|
3331 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL MMC locked") ) ); |
|
3332 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3333 TInt callState = StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ); |
|
3334 |
|
3335 if ( (! ( iDeviceLockEnabled || iKeyLockEnabled ) ) && |
|
3336 callState != EPSCTsyCallStateRinging && // We don't want to see the MMC passwd query |
|
3337 callState != EPSCTsyCallStateAlerting ) // when the user is e.g. making an emergency call |
|
3338 { |
|
3339 if ( iSysApFeatureManager->MemoryCardLockSupported() ) |
|
3340 { |
|
3341 if ( ! iMemoryCardDialog ) |
|
3342 { |
|
3343 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: ACTIVATE MMC passwd query") ) ); |
|
3344 CAknMemoryCardDialog* mmcDialog = CAknMemoryCardDialog::NewLC( this ); |
|
3345 iMemoryCardDialog = mmcDialog; // temporary variable used for hiding codescanner error |
|
3346 iMemoryCardDialog->SetSelfPointer( &iMemoryCardDialog ); |
|
3347 iMemoryCardDialog->UnlockCardLD(); // when UnlockCardLD completes it calls UnlockComplete() |
|
3348 } |
|
3349 } |
|
3350 else |
|
3351 { |
|
3352 // Since locked cards are not supported, notify user that card is locked. |
|
3353 ShowQueryL( ESysApMemoryCardLockedNote ); |
|
3354 } |
|
3355 } |
|
3356 } |
|
3357 break; |
|
3358 |
|
3359 case ESysApMemoryCardNotInserted: |
|
3360 default: |
|
3361 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL MMC not inserted") ) ); |
|
3362 if ( aMemoryCardStatus == ESysApMemoryCardNotInserted ) |
|
3363 { |
|
3364 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3365 } |
|
3366 } |
|
3367 } |
|
3368 } |
|
3369 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: END") ) ); |
|
3370 } |
|
3371 |
|
3372 // ---------------------------------------------------------------------------- |
|
3373 // CSysApAppUi::UnlockComplete() from MAknMemoryCardDialogObserver |
|
3374 // ---------------------------------------------------------------------------- |
|
3375 |
|
3376 void CSysApAppUi::UnlockComplete( TInt aResult ) |
|
3377 { |
|
3378 TRACES( RDebug::Print( _L("CSysApAppUi::UnlockComplete result: %d"), aResult ) ); |
|
3379 if ( aResult == KErrNone ) |
|
3380 { |
|
3381 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
|
3382 } |
|
3383 } |
|
3384 |
|
3385 // ---------------------------------------------------------------------------- |
|
3386 // CSysApAppUi::MMCStatusChangedL() from MSysApMemoryCardObserver |
|
3387 // ---------------------------------------------------------------------------- |
|
3388 |
|
3389 void CSysApAppUi::MMCStatusChangedL() |
|
3390 { |
|
3391 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL START: iMMCInserted: %d, iMMCEjectUsed: %d, iHideFirstBeep: %d, iHideNextBeep: %d" ), iMMCInserted, iMMCEjectUsed, iHideFirstBeep, iHideNextBeep ) ); |
|
3392 |
|
3393 if ( iSysApFeatureManager->MmcSupported() && !iShutdownStarted ) |
|
3394 { |
|
3395 TSysApMemoryCardStatus memoryCardStatus = iSysApMMCObserver->MemoryCardStatus(); |
|
3396 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL memoryCardStatus=%d" ), memoryCardStatus ) ); |
|
3397 |
|
3398 switch ( memoryCardStatus ) |
|
3399 { |
|
3400 case ESysApMemoryCardInserted: |
|
3401 case ESysApMemoryCardLocked: |
|
3402 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: MMC drive mounted" ) ) ); |
|
3403 if ( ! iMMCInserted ) // MMC was not inserted before |
|
3404 { |
|
3405 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: MMC newly inserted" ) ) ); |
|
3406 CancelWaitNote(); // just to be sure, the user might keep on closing and opening the MMC latch |
|
3407 // An MMC has been newly inserted, so play a sound and check if its password protected |
|
3408 |
|
3409 if ( UiReady() ) |
|
3410 { |
|
3411 if ( !iHideFirstBeep && !iHideNextBeep ) // starting up |
|
3412 { |
|
3413 Beep(); |
|
3414 // Switch lights on |
|
3415 iSysApLightsController->MemoryCardInsertedL(); |
|
3416 } |
|
3417 iHideNextBeep = EFalse; |
|
3418 } |
|
3419 |
|
3420 iMMCPowerMenuEjectUsed = EFalse; |
|
3421 iMMCEjectUsed = EFalse; |
|
3422 iMMCInserted = ETrue; |
|
3423 |
|
3424 // No need to show ESysApRemoveMmcNote after MMC already mounted |
|
3425 if ( iSysApConfirmationQuery ) |
|
3426 { |
|
3427 if ( iSysApConfirmationQuery->CurrentQuery() == ESysApRemoveMmcNote ) |
|
3428 { |
|
3429 iSysApConfirmationQuery->Cancel(); |
|
3430 } |
|
3431 } |
|
3432 |
|
3433 // Check if the MMC is locked and unlock it if necessary |
|
3434 RunUnlockNotifierL( memoryCardStatus ); |
|
3435 } |
|
3436 break; |
|
3437 default: |
|
3438 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: MMC drive not mounted" ) ) ); |
|
3439 delete iMemoryCardDialog; // sets itself to null |
|
3440 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3441 if ( iMMCInserted ) |
|
3442 { |
|
3443 // No need to show ESysApEjectMmcQuery after MMC already removed |
|
3444 if ( iSysApConfirmationQuery ) |
|
3445 { |
|
3446 if ( iSysApConfirmationQuery->CurrentQuery() == ESysApEjectMmcQuery ) |
|
3447 { |
|
3448 iSysApConfirmationQuery->Cancel(); |
|
3449 } |
|
3450 } |
|
3451 |
|
3452 iMMCInserted = EFalse; |
|
3453 |
|
3454 TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) ); |
|
3455 if ( !iMMCEjectUsed && propertyValue != KUsbPersonalityIdMS ) |
|
3456 { |
|
3457 // if USB file transfer active, do not close applications |
|
3458 // if eject selected in MMC App, MMC App takes care of the following and |
|
3459 // if eject selected from powerkeymenu, applications have already been shutdown |
|
3460 iTimeToKill = EFalse; |
|
3461 iApplicationScanningRoundNumber = 0; |
|
3462 CloseUIAppsInHotSwapL(); |
|
3463 } |
|
3464 } |
|
3465 else |
|
3466 { |
|
3467 // If MMC was not previously inserted and eject was chosed from power key menu, attempt to remount. |
|
3468 if ( iMMCPowerMenuEjectUsed ) |
|
3469 { |
|
3470 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL: Attempt to remount" ) ) ); |
|
3471 MountMMC(); |
|
3472 // If mount was successful, unnecessary note will be canceled in insert notification handling. |
|
3473 } |
|
3474 } |
|
3475 break; |
|
3476 } |
|
3477 |
|
3478 // Update memory card indicator status |
|
3479 SetMemoryCardIndicatorL(); |
|
3480 } |
|
3481 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCStatusChangedL END: iMMCInserted: %d, iMMCEjectUsed: %d, iHideFirstBeep: %d, iHideNextBeep: %d" ), iMMCInserted, iMMCEjectUsed, iHideFirstBeep, iHideNextBeep ) ); |
|
3482 } |
|
3483 |
|
3484 // ---------------------------------------------------------------------------- |
|
3485 // CSysApAppUi::ShowMMCDismountedDialogL() |
|
3486 // ---------------------------------------------------------------------------- |
|
3487 |
|
3488 void CSysApAppUi::ShowMMCDismountedDialogL() |
|
3489 { |
|
3490 TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) ); |
|
3491 |
|
3492 // Do not show any note if USB file transfer is active. |
|
3493 if ( propertyValue != KUsbPersonalityIdMS ) |
|
3494 { |
|
3495 if ( iSysApFeatureManager->MemoryCardHatchSupported() ) |
|
3496 { // MMC hatch has been opened and MMC has been dismounted |
|
3497 TRACES( RDebug::Print( _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: Remove MMC and press OK." ) ) ); |
|
3498 ShowQueryL( ESysApRemoveMmcNote ); |
|
3499 } |
|
3500 else |
|
3501 { |
|
3502 // MMC has been removed and dismounted |
|
3503 TRACES( RDebug::Print( _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: You might have lost some data." ) ) ); |
|
3504 // No confirmation but let's set this true to enable MMC passwd query |
|
3505 ShowUiNoteL( EMemoryCardRemovedWithoutEjectNote ); |
|
3506 } |
|
3507 } |
|
3508 else |
|
3509 { |
|
3510 TRACES( RDebug::Print( _L( "CSysApAppUi::ShowMMCDismountedDialogL: No note shown, USB file transfer caused dismount." ) ) ); |
|
3511 } |
|
3512 } |
|
3513 |
|
3514 // ---------------------------------------------------------------------------- |
|
3515 // CSysApAppUi::MMCDismountedDialogConfirmed |
|
3516 // ---------------------------------------------------------------------------- |
|
3517 |
|
3518 void CSysApAppUi::MMCDismountedDialogConfirmed() |
|
3519 { |
|
3520 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCDismountedDialogConfirmed") ) ); |
|
3521 |
|
3522 // Try to remount just in case when eject was chosen from power key menu |
|
3523 if ( iMMCPowerMenuEjectUsed ) |
|
3524 { |
|
3525 iMMCPowerMenuEjectUsed = EFalse; |
|
3526 |
|
3527 if ( MountMMC() == KErrLocked ) // In case a locked card was not removed after all |
|
3528 { |
|
3529 TRAPD( err, MMCStatusChangedL() ); // This will update power menu and memory card icon. Also memory card password is requeried. |
|
3530 if ( err != KErrNone ) |
|
3531 { |
|
3532 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCDismountedDialogConfirmed: MMCStatusChangedL failed, err=%d"), err ) ); |
|
3533 } |
|
3534 } |
|
3535 } |
|
3536 |
|
3537 } |
|
3538 |
|
3539 #else // RD_MULTIPLE_DRIVE |
|
3540 |
|
3541 // ---------------------------------------------------------------------------- |
|
3542 // CSysApAppUi::MMCInsertedL |
|
3543 // ---------------------------------------------------------------------------- |
|
3544 |
|
3545 void CSysApAppUi::MMCInsertedL() |
|
3546 { |
|
3547 TRACES( RDebug::Print( _L( "CSysApAppUi::MMCInsertedL") ) ); |
|
3548 |
|
3549 if ( iSysApFeatureManager->MmcSupported() && !iShutdownStarted ) |
|
3550 { |
|
3551 TBool normalState( UiReady() ); |
|
3552 |
|
3553 if ( normalState ) |
|
3554 { |
|
3555 TInt defaultMemoryCard( iSysApDriveList->DefaultMemoryCard() ); |
|
3556 TSysApMemoryCardStatus memoryCardStatus( iSysApDriveList->MemoryCardStatus( defaultMemoryCard ) ); |
|
3557 |
|
3558 TRACES( RDebug::Print( |
|
3559 _L( "CSysApAppUi::MMCInsertedL: drive: %d, memoryCardStatus: %d" ), defaultMemoryCard, memoryCardStatus ) ); |
|
3560 |
|
3561 switch ( memoryCardStatus ) |
|
3562 { |
|
3563 case ESysApMemoryCardInserted: // Fall through |
|
3564 case ESysApMemoryCardLocked: |
|
3565 { |
|
3566 // Reset eject and unlock of inserted memory card |
|
3567 iSysApDriveList->ResetDriveToEject( defaultMemoryCard ); |
|
3568 iSysApDriveList->ResetDriveUnlockQueryShown( defaultMemoryCard ); |
|
3569 |
|
3570 // CancelWaitNote(); |
|
3571 |
|
3572 if ( memoryCardStatus == ESysApMemoryCardInserted ) |
|
3573 { |
|
3574 TRACES( RDebug::Print( |
|
3575 _L( "CSysApAppUi::MMCInsertedL: memoryCardStatus ESysApMemoryCardInserted: %d" ), memoryCardStatus ) ); |
|
3576 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
|
3577 } |
|
3578 else |
|
3579 { |
|
3580 TRACES( RDebug::Print( |
|
3581 _L( "CSysApAppUi::MMCInsertedL: memoryCardStatus ESysApMemoryCardLocked: %d" ), memoryCardStatus ) ); |
|
3582 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3583 } |
|
3584 break; |
|
3585 } |
|
3586 case ESysApMemoryCardNotInserted: |
|
3587 { |
|
3588 // Always reset eject and unlock of removed memory card |
|
3589 TBool isEject( iSysApDriveList->IsDriveToEject( defaultMemoryCard ) ); |
|
3590 |
|
3591 TRACES( RDebug::Print( |
|
3592 _L( "CSysApAppUi::MMCInsertedL: isEject: %d, drive: %d" ), |
|
3593 isEject, defaultMemoryCard ) ); |
|
3594 |
|
3595 iSysApDriveList->ResetDriveToEject( defaultMemoryCard ); |
|
3596 iSysApDriveList->ResetDriveUnlockQueryShown( defaultMemoryCard ); |
|
3597 |
|
3598 TRACES( RDebug::Print( |
|
3599 _L( "SysApAppUi::MMCInsertedL: memoryCardStatus ESysApMemoryCardNotInserted: %d" ), memoryCardStatus ) ); |
|
3600 |
|
3601 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3602 break; |
|
3603 } |
|
3604 case ESysApMemoryCardStatusNotKnown: // Fall through |
|
3605 default: |
|
3606 { |
|
3607 break; |
|
3608 } |
|
3609 } |
|
3610 RunUnlockNotifierL(); |
|
3611 } |
|
3612 } |
|
3613 } |
|
3614 |
|
3615 |
|
3616 // ---------------------------------------------------------------------------- |
|
3617 // CSysApAppUi::RunUnlockNotifierL() |
|
3618 // ---------------------------------------------------------------------------- |
|
3619 |
|
3620 void CSysApAppUi::RunUnlockNotifierL() |
|
3621 { |
|
3622 TRACES( RDebug::Print( |
|
3623 _L("CSysApAppUi::RunUnlockNotifierL: START iDeviceLockEnabled: %d, iKeyLockEnabled: %d" ), |
|
3624 iDeviceLockEnabled, iKeyLockEnabled ) ); |
|
3625 |
|
3626 if ( !iSysApFeatureManager->MmcSupported() || |
|
3627 iDeviceLockEnabled || |
|
3628 iKeyLockEnabled || |
|
3629 !UiReady() ) |
|
3630 { |
|
3631 TRACES( RDebug::Print( _L("CSysApAppUi::RunUnlockNotifierL: END") ) ); |
|
3632 return; |
|
3633 } |
|
3634 |
|
3635 // We don't want to see the MMC passwd query |
|
3636 // when the user is e.g. making an emergency call |
|
3637 TInt callState( StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) ); |
|
3638 if ( callState != EPSCTsyCallStateRinging && |
|
3639 callState != EPSCTsyCallStateAlerting ) |
|
3640 { |
|
3641 TInt defaultMemoryCard( iSysApDriveList->DefaultMemoryCard() ); |
|
3642 TSysApMemoryCardStatus memoryCardStatus( iSysApDriveList->MemoryCardStatus( defaultMemoryCard ) ); |
|
3643 if ( memoryCardStatus == ESysApMemoryCardLocked) |
|
3644 { |
|
3645 iSysApDriveUnlockHandler->StartUnlock(); |
|
3646 } |
|
3647 } |
|
3648 |
|
3649 TRACES( RDebug::Print( |
|
3650 _L("CSysApAppUi::RunUnlockNotifierL: END callState: %d"), callState ) ); |
|
3651 } |
|
3652 |
|
3653 // ---------------------------------------------------------------------------- |
|
3654 // CSysApAppUi::MMCStatusChangedL() from MSysApMemoryCardObserver |
|
3655 // ---------------------------------------------------------------------------- |
|
3656 |
|
3657 void CSysApAppUi::MMCStatusChangedL( TInt aDrive ) |
|
3658 { |
|
3659 TRACES( RDebug::Print( |
|
3660 _L( "CSysApAppUi::MMCStatusChangedL START: MMCCount: %d, iMMCEjectUsed: %d" ), |
|
3661 iInsertedMemoryCards.Count(), iMMCEjectUsed ) ); |
|
3662 |
|
3663 if ( iShutdownStarted || !iSysApFeatureManager->MmcSupported() ) |
|
3664 { |
|
3665 TRACES( RDebug::Print( |
|
3666 _L( "CSysApAppUi::MMCStatusChangedL iShutdownStarted: %d END" ), |
|
3667 iShutdownStarted ) ); |
|
3668 return; |
|
3669 } |
|
3670 |
|
3671 TBool normalState( UiReady() ); |
|
3672 |
|
3673 TInt defaultMemoryCard( iSysApDriveList->DefaultMemoryCard() ); |
|
3674 TSysApMemoryCardStatus memoryCardStatus( iSysApDriveList->MemoryCardStatus( aDrive ) ); |
|
3675 TInt insertedIndex( CSysApDriveList::Find( iInsertedMemoryCards, aDrive ) ); |
|
3676 |
|
3677 TRACES( RDebug::Print( |
|
3678 _L( "CSysApAppUi::MMCStatusChangedL: normalState: %d, index: %d, drive: %d, memoryCardStatus: %d" ), |
|
3679 normalState, insertedIndex, aDrive, memoryCardStatus ) ); |
|
3680 |
|
3681 switch ( memoryCardStatus ) |
|
3682 { |
|
3683 case ESysApMemoryCardInserted: // Fall through |
|
3684 case ESysApMemoryCardLocked: |
|
3685 { |
|
3686 if ( insertedIndex == KErrNotFound ) // Not inserted before |
|
3687 { |
|
3688 // Reset eject and unlock of inserted memory card |
|
3689 iSysApDriveList->ResetDriveToEject( aDrive ); |
|
3690 iSysApDriveList->ResetDriveUnlockQueryShown( aDrive ); |
|
3691 |
|
3692 // CancelWaitNote(); |
|
3693 |
|
3694 if ( aDrive == defaultMemoryCard ) |
|
3695 { |
|
3696 if ( memoryCardStatus == ESysApMemoryCardInserted ) |
|
3697 { |
|
3698 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
|
3699 } |
|
3700 else |
|
3701 { |
|
3702 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3703 } |
|
3704 } |
|
3705 |
|
3706 if ( normalState ) |
|
3707 { |
|
3708 // Ignore extra beep from USB file transfer |
|
3709 TBool ignoreBeep( |
|
3710 iSysApDriveList->IsDriveInsertBeepIgnored( aDrive ) ); |
|
3711 |
|
3712 TRACES( RDebug::Print( |
|
3713 _L( "CSysApAppUi::MMCStatusChangedL: ignoreBeep: %d, drive: %d" ), |
|
3714 ignoreBeep, aDrive ) ); |
|
3715 |
|
3716 if ( !ignoreBeep ) |
|
3717 { |
|
3718 // Beep(); |
|
3719 iSysApLightsController->MemoryCardInsertedL(); |
|
3720 } |
|
3721 |
|
3722 iSysApDriveList->ResetDriveInsertBeepIgnored( aDrive ); |
|
3723 |
|
3724 // Keep ignoring extra beep if USB file transfer is active |
|
3725 TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) ); |
|
3726 |
|
3727 TRACES( RDebug::Print( |
|
3728 _L( "CSysApAppUi::MMCStatusChangedL: usbState: %d" ), propertyValue ) ); |
|
3729 |
|
3730 if ( propertyValue == KUsbPersonalityIdMS ) |
|
3731 { |
|
3732 iSysApDriveList->MarkDriveInsertBeepIgnored( aDrive ); |
|
3733 } |
|
3734 } |
|
3735 |
|
3736 // if ( iDriveToDismount == aDrive && iSysApConfirmationQuery ) |
|
3737 { |
|
3738 // if ( iSysApConfirmationQuery->CurrentQuery() == ESysApRemoveMmcNote ) |
|
3739 { |
|
3740 // User put back ejected memory card or did not remove it |
|
3741 // iSysApConfirmationQuery->Cancel(); |
|
3742 } |
|
3743 } |
|
3744 RunUnlockNotifierL(); |
|
3745 } |
|
3746 break; |
|
3747 } |
|
3748 case ESysApMemoryCardNotInserted: |
|
3749 { |
|
3750 // Always reset eject and unlock of removed memory card |
|
3751 TBool isEject( iSysApDriveList->IsDriveToEject( aDrive ) ); |
|
3752 |
|
3753 TRACES( RDebug::Print( |
|
3754 _L( "CSysApAppUi::MMCStatusChangedL: isEject: %d, drive: %d" ), |
|
3755 isEject, aDrive ) ); |
|
3756 |
|
3757 iSysApDriveList->ResetDriveToEject( aDrive ); |
|
3758 iSysApDriveList->ResetDriveUnlockQueryShown( aDrive ); |
|
3759 |
|
3760 if ( insertedIndex != KErrNotFound ) // Inserted before |
|
3761 { |
|
3762 if ( memoryCardStatus == ESysApMemoryCardNotInserted ) |
|
3763 { |
|
3764 // Reset extra beep ignore if memory card was removed without eject |
|
3765 iSysApDriveList->ResetDriveInsertBeepIgnored( aDrive ); |
|
3766 } |
|
3767 |
|
3768 // CancelGlobalListQuery(); // Cancel power menu |
|
3769 |
|
3770 if ( aDrive == defaultMemoryCard ) |
|
3771 { |
|
3772 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
|
3773 } |
|
3774 |
|
3775 // if ( iSysApConfirmationQuery ) |
|
3776 { |
|
3777 // if ( iSysApConfirmationQuery->CurrentQuery() == ESysApEjectMmcQuery ) |
|
3778 { |
|
3779 // User removed memory card too early |
|
3780 // iSysApConfirmationQuery->Cancel(); |
|
3781 // Allow application closing to execute. |
|
3782 // Also FileManager is closed in this case, regardless where the eject was initiated from. |
|
3783 iMMCEjectUsed = EFalse; |
|
3784 } |
|
3785 } |
|
3786 |
|
3787 // Stop unlock of removed memory card |
|
3788 iSysApDriveUnlockHandler->StopUnlock( aDrive ); |
|
3789 |
|
3790 if ( !iMMCEjectUsed && !isEject ) |
|
3791 { |
|
3792 TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) ); |
|
3793 |
|
3794 TRACES( RDebug::Print( |
|
3795 _L( "CSysApAppUi::MMCStatusChangedL: usbState: %d" ), propertyValue ) ); |
|
3796 |
|
3797 if ( propertyValue != KUsbPersonalityIdMS ) |
|
3798 { |
|
3799 if ( iSysApFeatureManager->MemoryCardHatchSupported() ) |
|
3800 { |
|
3801 // Store drive removed without eject and start eject handling |
|
3802 iSysApDriveList->MarkDriveToEject( |
|
3803 aDrive, CSysApDriveList::EEjectRemovedWithoutEject ); |
|
3804 iSysApDriveEjectHandler->StartEject(); |
|
3805 } |
|
3806 else |
|
3807 { |
|
3808 // Just show the note |
|
3809 ShowUiNoteL( EMemoryCardRemovedWithoutEjectNote ); |
|
3810 } |
|
3811 } |
|
3812 } |
|
3813 iMMCEjectUsed = EFalse; |
|
3814 } |
|
3815 break; |
|
3816 } |
|
3817 case ESysApMemoryCardStatusNotKnown: // Fall through |
|
3818 default: |
|
3819 { |
|
3820 break; |
|
3821 } |
|
3822 } |
|
3823 |
|
3824 // Update inserted memory cards |
|
3825 iSysApDriveList->GetMemoryCardsL( |
|
3826 iInsertedMemoryCards, CSysApDriveList::EIncludeInserted ); |
|
3827 |
|
3828 // Update memory card indicator status |
|
3829 // SetMemoryCardIndicatorL(); |
|
3830 |
|
3831 TRACES( RDebug::Print( |
|
3832 _L( "CSysApAppUi::MMCStatusChangedL END: MMCCount: %d, iMMCEjectUsed: %d" ), |
|
3833 iInsertedMemoryCards.Count(), iMMCEjectUsed ) ); |
|
3834 } |
|
3835 |
|
3836 // ---------------------------------------------------------------------------- |
|
3837 // CSysApAppUi::ShowMMCDismountedDialogL() |
|
3838 // ---------------------------------------------------------------------------- |
|
3839 |
|
3840 TBool CSysApAppUi::ShowMMCDismountedDialogL( |
|
3841 TInt aDrive, CSysApDriveList::TDriveEjectType aEjectType ) |
|
3842 { |
|
3843 TRACES( RDebug::Print( |
|
3844 _L( "CSysApAppUi::ShowMMCDismountedDialogL: aDrive: %d, aEjectType: %d" ), |
|
3845 aDrive, aEjectType ) ); |
|
3846 |
|
3847 TBool ret( EFalse ); |
|
3848 iDriveToDismount = aDrive; |
|
3849 HBufC* driveName = iSysApDriveList->GetFormattedDriveNameLC( |
|
3850 aDrive, |
|
3851 R_QTN_EJECT_REMOVE_MEMORY_INFO ); |
|
3852 |
|
3853 if ( aEjectType == CSysApDriveList::EEjectFromMenu ) |
|
3854 { |
|
3855 TRACES( RDebug::Print( |
|
3856 _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: Remove MMC and press OK...." ) ) ); |
|
3857 ShowQueryL( ESysApRemoveMmcNote, *driveName ); |
|
3858 ret = ETrue; |
|
3859 } |
|
3860 else |
|
3861 { |
|
3862 // Memory card was removed without eject |
|
3863 TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) ); |
|
3864 |
|
3865 // Do not show any note if USB file transfer is active. |
|
3866 if ( propertyValue != KUsbPersonalityIdMS ) |
|
3867 { |
|
3868 if ( iSysApFeatureManager->MemoryCardHatchSupported() ) |
|
3869 { |
|
3870 // MMC hatch has been opened and MMC has been dismounted |
|
3871 TRACES( RDebug::Print( |
|
3872 _L( "CSysApAppUi::ShowMMCDismountedDialogL: Show note: Remove MMC and press OK." ) ) ); |
|
3873 ShowQueryL( ESysApRemoveMmcNote, *driveName ); |
|
3874 ret = ETrue; |
|
3875 } |
|
3876 else |
|
3877 { |
|
3878 iSysApDriveList->ResetDrivesToEject(); |
|
3879 |
|
3880 // MMC has been removed and dismounted |
|
3881 TRACES( RDebug::Print( _L( |
|
3882 "CSysApAppUi::ShowMMCDismountedDialogL: Show note: You might have lost some data." ) ) ); |
|
3883 |
|
3884 // No confirmation but let's set this true to enable MMC passwd query |
|
3885 ShowUiNoteL( EMemoryCardRemovedWithoutEjectNote ); |
|
3886 } |
|
3887 } |
|
3888 else |
|
3889 { |
|
3890 iSysApDriveList->ResetDrivesToEject(); |
|
3891 TRACES( RDebug::Print( |
|
3892 _L( "CSysApAppUi::ShowMMCDismountedDialogL: No note shown, USB file transfer caused dismount." ) ) ); |
|
3893 } |
|
3894 } |
|
3895 |
|
3896 CleanupStack::PopAndDestroy( driveName ); |
|
3897 |
|
3898 TRACES( RDebug::Print( |
|
3899 _L( "CSysApAppUi::ShowMMCDismountedDialogL: ret: %d" ), ret ) ); |
|
3900 |
|
3901 return ret; |
|
3902 } |
|
3903 |
|
3904 // ---------------------------------------------------------------------------- |
|
3905 // CSysApAppUi::MMCDismountedDialogConfirmed |
|
3906 // ---------------------------------------------------------------------------- |
|
3907 |
|
3908 void CSysApAppUi::MMCDismountedDialogConfirmed() |
|
3909 { |
|
3910 TRACES( RDebug::Print( |
|
3911 _L( "CSysApAppUi::MMCDismountedDialogConfirmed: iDriveToDismount: %d" ), |
|
3912 iDriveToDismount ) ); |
|
3913 |
|
3914 // Try remount to check if drive was put back |
|
3915 iSysApDriveList->MountDrive( iDriveToDismount ); |
|
3916 if ( !iSysApDriveEjectHandler->CompleteDismount( iDriveToDismount ) ) |
|
3917 { |
|
3918 // When ready, check for locked memory cards and update indicators |
|
3919 // TRAP_IGNORE( SetMemoryCardIndicatorL() ); |
|
3920 TRAP_IGNORE( RunUnlockNotifierL() ); |
|
3921 } |
|
3922 } |
|
3923 |
|
3924 #endif // RD_MULTIPLE_DRIVE |
3013 |
3925 |
3014 |
3926 |
3015 // ---------------------------------------------------------------------------- |
3927 // ---------------------------------------------------------------------------- |
3016 // CSysApAppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent) |
3928 // CSysApAppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent) |
3017 // ---------------------------------------------------------------------------- |
3929 // ---------------------------------------------------------------------------- |