coreapplicationuis/SysAp/Src/SysApAppUi.cpp
branchRCL_3
changeset 2 7645e9ce10dc
parent 1 0fdb7f6b0309
child 3 096dad6e50a9
equal deleted inserted replaced
1:0fdb7f6b0309 2:7645e9ce10dc
   618             {
   618             {
   619             TRACES( RDebug::Print( _L("e_KEY_EVENT_SENDING 0") ) );
   619             TRACES( RDebug::Print( _L("e_KEY_EVENT_SENDING 0") ) );
   620             }
   620             }
   621 #endif // _DEBUG
   621 #endif // _DEBUG
   622 
   622 
       
   623         TBool haveStatusPane = ( StatusPane()== NULL ) ? EFalse : StatusPane()->IsVisible();
       
   624         TRACES( RDebug::Print( _L("CSysApAppUi::HandleKeyEventL: haveStatusPane = %d" ) ) );
       
   625         
   623         TKeyResponse response( EKeyWasNotConsumed );
   626         TKeyResponse response( EKeyWasNotConsumed );
   624         if (iSysApKeyManagement && aKeyEvent.iCode != EKeyPowerOff && aKeyEvent.iCode != 'E')
   627         if (iSysApKeyManagement && aKeyEvent.iCode != EKeyPowerOff && aKeyEvent.iCode != 'E')
   625             {
   628             {
   626             response = iSysApKeyManagement->HandleKeyEventL(aKeyEvent, aType );
   629             response = iSysApKeyManagement->HandleKeyEventL(aKeyEvent, aType );
   627             }
   630             }
   640                     iKeyBoardRepeatCount++;
   643                     iKeyBoardRepeatCount++;
   641                     if( aKeyEvent.iRepeats == 0 )
   644                     if( aKeyEvent.iRepeats == 0 )
   642                         {
   645                         {
   643                         TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, Short powerkey") ) );
   646                         TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, Short powerkey") ) );
   644                         iLastPowerKeyWasShort = ETrue;
   647                         iLastPowerKeyWasShort = ETrue;
   645                         HandleShortPowerKeyPressedL();
   648                         if ( iPowerKeyPopupMenuActive || !iSysApFeatureManager->PowerKeyIsLockKey() || (iSysApFeatureManager->PowerKeyIsLockKey() && haveStatusPane ))
       
   649                             {
       
   650                             //do this only if the power key menu is active (handles item navigation)
       
   651                             //or if the power key is not the lock key (default)
       
   652                              HandleShortPowerKeyPressedL();
       
   653                             }
       
   654                         
       
   655                         
   646                         iIgnoreNextPowerKeyRepeats = EFalse;
   656                         iIgnoreNextPowerKeyRepeats = EFalse;
   647                         }
   657                         }
   648                     //Long power key press
   658                     //Long power key press
   649                     else if( aKeyEvent.iRepeats > 0 && iKeyBoardRepeatCount >= iSysApCenRepController->GetInt( KCRUidCoreApplicationUIsSysAp, KSysApPowerkeyRepeatcount ))
   659                     else if( aKeyEvent.iRepeats > 0 && iKeyBoardRepeatCount >= iSysApCenRepController->GetInt( KCRUidCoreApplicationUIsSysAp, KSysApPowerkeyRepeatcount ))
   650                         {
   660                         {
   651                         iKeyBoardRepeatCount = -1;
   661                         iKeyBoardRepeatCount = -1;
   652                         TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, Long powerkey") ) );
   662                         TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, Long powerkey") ) );
   653                         iLastPowerKeyWasShort = EFalse;
   663                         iLastPowerKeyWasShort = EFalse;
   654                         HandleLongPowerKeyPressedL();
   664                         if ( !haveStatusPane && !iPowerKeyPopupMenuActive && iSysApFeatureManager->PowerKeyIsLockKey() && !iIgnoreNextPowerKeyRepeats )
       
   665                             {
       
   666                             if ( !iGlobalListQuery )
       
   667                                 {
       
   668                                 HandleShortPowerKeyPressedL();
       
   669                                 }
       
   670                             }
       
   671                         else
       
   672                             {
       
   673                             HandleLongPowerKeyPressedL();
       
   674                             }
       
   675                         
   655                         }
   676                         }
   656                     break;
   677                     break;
   657 
   678 
   658                 default:
   679                 default:
   659                 	{
   680                 	{
   669                         }
   690                         }
   670                 	}
   691                 	}
   671                     break;
   692                     break;
   672                 }
   693                 }
   673             }
   694             }
   674         else if( aType == EEventKeyUp )
   695         else if ( aType == EEventKeyUp )
   675             {
   696             {
   676             if( aKeyEvent.iScanCode == EStdKeyDevice2 )
   697             TRACES( RDebug::Print( _L( "CSysApAppUi::HandleKeyEventL(): aType == EEventKeyUp, PowerKeyIsLockKey = %d, iLastPowerKeyWasShort = %d, iPowerKeyPopupMenuActive = %d, iCharging = %d" ), iSysApFeatureManager->PowerKeyIsLockKey(), iLastPowerKeyWasShort, iPowerKeyPopupMenuActive, iCharging ) );
   677                 {
   698             if ( iSysApFeatureManager->PowerKeyIsLockKey()
   678                 if ( iIgnoreNextPowerKeyUpEvent )
   699                     && iLastPowerKeyWasShort && !iPowerKeyPopupMenuActive && !haveStatusPane )
       
   700                 {
       
   701                 //if the power key is the lock key && the last keypress was short && the power menu is not active
       
   702                 //then lock the phone
       
   703                 KeyLock().EnableWithoutNote();
       
   704                 }
       
   705             else
       
   706                 {
       
   707                 if ( aKeyEvent.iScanCode == EStdKeyDevice2 )
   679                     {
   708                     {
   680                     if ( !iPowerKeyPopupMenuDismissed ) // If the popup menu has been dismissed, do nothing
   709                     if ( iIgnoreNextPowerKeyUpEvent )
   681                         {
   710                         {
   682                         iPowerKeyPopupMenuActive = ETrue;
   711                         if ( !iPowerKeyPopupMenuDismissed ) // If the popup menu has been dismissed, do nothing
   683                         iIgnoreNextPowerKeyUpEvent = EFalse;
   712                             {
       
   713                             iPowerKeyPopupMenuActive = ETrue;
       
   714                             iIgnoreNextPowerKeyUpEvent = EFalse;
       
   715                             }
   684                         }
   716                         }
   685                     }
   717                     else if ( iLastPowerKeyWasShort )
   686                 else if( iLastPowerKeyWasShort )
       
   687                     {
       
   688                     if ( iPowerKeyPopupMenuActive )
       
   689                         {
   718                         {
   690                         if ( iGlobalListQuery )
   719                         if ( iPowerKeyPopupMenuActive )
   691                             {
   720                             {
   692                             if ( iSysApFeatureManager->NoPowerKeySupported() )
   721                             if ( iGlobalListQuery )
   693                                 {
   722                                 {
   694                             	CancelGlobalListQuery();
   723                                 if ( iSysApFeatureManager->NoPowerKeySupported() )
       
   724                                     {
       
   725                                     CancelGlobalListQuery();
       
   726                                     }
       
   727                                 else
       
   728                                     {
       
   729                                     iGlobalListQuery->MoveSelectionDown();
       
   730                                     }
   695                                 }
   731                                 }
   696                             else
       
   697                                 {
       
   698                                 iGlobalListQuery->MoveSelectionDown();	
       
   699                                 }                            
       
   700                             }
   732                             }
   701                         }
   733                         }
   702                     }
   734                     }
   703 
       
   704                 }
   735                 }
   705             }
   736             }
   706 
   737 
   707         TRACES( RDebug::Print( _L("CSysApAppUi::HandleKeyEventL:ended, aKeyEvent.iCode:%d, aKeyEvent.iScanCode:%d, aType:%d, iIgnoreNextPowerKeyUpEvent:%d, iPowerKeyPopupMenuActive:%d, iLastPowerKeyWasShort:%d, iPowerKeyPopupMenuDismissed:%d"),
   738         TRACES( RDebug::Print( _L("CSysApAppUi::HandleKeyEventL:ended, aKeyEvent.iCode:%d, aKeyEvent.iScanCode:%d, aType:%d, iIgnoreNextPowerKeyUpEvent:%d, iPowerKeyPopupMenuActive:%d, iLastPowerKeyWasShort:%d, iPowerKeyPopupMenuDismissed:%d"),
   708                                aKeyEvent.iCode, aKeyEvent.iScanCode, aType, iIgnoreNextPowerKeyUpEvent, iPowerKeyPopupMenuActive, iLastPowerKeyWasShort, iPowerKeyPopupMenuDismissed ) );
   739                                aKeyEvent.iCode, aKeyEvent.iScanCode, aType, iIgnoreNextPowerKeyUpEvent, iPowerKeyPopupMenuActive, iLastPowerKeyWasShort, iPowerKeyPopupMenuDismissed ) );
  3508 TInt CSysApAppUi::ActiveProfileId()
  3539 TInt CSysApAppUi::ActiveProfileId()
  3509     {
  3540     {
  3510     return iProfileEngine->ActiveProfileId();
  3541     return iProfileEngine->ActiveProfileId();
  3511     }
  3542     }
  3512 
  3543 
       
  3544 
       
  3545 // ----------------------------------------------------------------------------
       
  3546 // CSysApAppUi::AddMmcMenuItemsL()
       
  3547 // ----------------------------------------------------------------------------
       
  3548 //
       
  3549 void CSysApAppUi::AddMmcMenuItemsL( CDesCArray*& aProfileNameCDesCArray, RArray<TInt>& aItemIdArray,
       
  3550                                     TInt& aPowerMenuItemIndex )
       
  3551     {
       
  3552     TInt propertyValue( StateOfProperty( KPSUidUsbWatcher,
       
  3553             KUsbWatcherSelectedPersonality ) );
       
  3554 
       
  3555     HBufC* itemStringBuf;
       
  3556 #ifndef RD_MULTIPLE_DRIVE
       
  3557     iPowerkeyMenuEjectSelection = KErrAccessDenied;
       
  3558     if ( !IsEncryptionOperationOngoingL() )
       
  3559         {
       
  3560         if ( iSysApFeatureManager->MmcHotSwapSupported() &&
       
  3561                 iMMCInserted &&
       
  3562                 iSysApFeatureManager->EjectRequiredInPowerMenu() &&
       
  3563                 propertyValue != KUsbPersonalityIdMS )
       
  3564             {
       
  3565             iPowerkeyMenuEjectShown = ETrue;
       
  3566             TRACES( RDebug::Print(_L("CSysApAppUi::AddMmcMenuItemsL: adding \"Eject\"" ) ) );
       
  3567             itemStringBuf = StringLoader::LoadLC( R_QTN_PWRC_EJECT_MMC, iEikonEnv );
       
  3568             aProfileNameCDesCArray->AppendL( itemStringBuf->Des() );
       
  3569             CleanupStack::PopAndDestroy(); // itemStringBuf
       
  3570             if ( iSysApFeatureManager->CoverDisplaySupported() )
       
  3571                 {
       
  3572                 aItemIdArray.AppendL(SecondaryDisplay::EPwrMenuItemEjectMMC);
       
  3573                 }
       
  3574             iPowerkeyMenuEjectShown = ETrue;
       
  3575             iPowerkeyMenuEjectSelection = aPowerMenuItemIndex;
       
  3576             aPowerMenuItemIndex++;
       
  3577             }
       
  3578         }
       
  3579 
       
  3580 #else // RD_MULTIPLE_DRIVE
       
  3581     iPowerkeyMenuEjectSelectionBase = KErrAccessDenied;
       
  3582     if ( !IsEncryptionOperationOngoingL() )
       
  3583         {
       
  3584         if ( iSysApFeatureManager->MmcHotSwapSupported()
       
  3585                 && iSysApFeatureManager->EjectRequiredInPowerMenu()
       
  3586                 && propertyValue != KUsbPersonalityIdMS )
       
  3587             {
       
  3588             // Reset old eject status and dialog
       
  3589             iSysApDriveList->ResetDrivesToEject();
       
  3590             if ( iSysApConfirmationQuery )
       
  3591                 {
       
  3592                 if ( iSysApConfirmationQuery->CurrentQuery() == ESysApEjectMmcQuery )
       
  3593                     {
       
  3594                     iSysApConfirmationQuery->Cancel();
       
  3595                     }
       
  3596                 }
       
  3597 
       
  3598             // Append memory cards for eject selection
       
  3599             TInt count( iInsertedMemoryCards.Count() );
       
  3600             for ( TInt i( 0 ); i < count; ++i )
       
  3601                 {
       
  3602                 itemStringBuf = iSysApDriveList->GetFormattedDriveNameLC(
       
  3603                         iInsertedMemoryCards[ i ].iDrive,
       
  3604                         R_QTN_PWRC_EJECT_MEMORY_STORAGE );
       
  3605                 aProfileNameCDesCArray->AppendL( *itemStringBuf );
       
  3606                 CleanupStack::PopAndDestroy( itemStringBuf );
       
  3607 
       
  3608                 if ( iSysApFeatureManager->CoverDisplaySupported() )
       
  3609                     {
       
  3610                     aItemIdArray.AppendL(
       
  3611                             SecondaryDisplay::EPwrMenuItemEjectItemBase + i );
       
  3612                     }
       
  3613                 }
       
  3614             if ( count > 0 )
       
  3615                 {
       
  3616                 TRACES( RDebug::Print(_L("CSysApAppUi::AddMmcMenuItemsL: added \"Eject\"" ) ) );
       
  3617                 iPowerkeyMenuEjectShown = ETrue;
       
  3618                 iPowerkeyMenuEjectSelectionBase = aPowerMenuItemIndex;
       
  3619                 aPowerMenuItemIndex += count;
       
  3620                 }
       
  3621             }
       
  3622         }
       
  3623 #endif // RD_MULTIPLE_DRIVE
       
  3624     }
       
  3625 
       
  3626 
  3513 // ----------------------------------------------------------------------------
  3627 // ----------------------------------------------------------------------------
  3514 // CSysApAppUi::ShowPowerKeyPopUpMenuL()
  3628 // CSysApAppUi::ShowPowerKeyPopUpMenuL()
  3515 // ----------------------------------------------------------------------------
  3629 // ----------------------------------------------------------------------------
  3516 
  3630 
  3517 void CSysApAppUi::ShowPowerKeyPopUpMenuL()
  3631 void CSysApAppUi::ShowPowerKeyPopUpMenuL()
  3570 
  3684 
  3571         CleanupStack::PushL( profileNameCDesCArray );
  3685         CleanupStack::PushL( profileNameCDesCArray );
  3572         profileNameCDesCArray->Reset();
  3686         profileNameCDesCArray->Reset();
  3573         HBufC* itemStringBuf;
  3687         HBufC* itemStringBuf;
  3574 
  3688 
  3575         TInt powerMenuItemIndex( 0 );
  3689         TInt powerMenuItemIndex = 0;
  3576 
  3690 
  3577         // "Switch off" menu item
  3691         // "Switch off" menu item
  3578         if ( !IsEncryptionOperationOngoingL() )
  3692         if ( !IsEncryptionOperationOngoingL() )
  3579             {
  3693             {
  3580         itemStringBuf = StringLoader::LoadLC( R_QTN_PWRC_SWITCH_OFF, iEikonEnv );
  3694         itemStringBuf = StringLoader::LoadLC( R_QTN_PWRC_SWITCH_OFF, iEikonEnv );
  3628 					profileNameCDesCArray->AppendL( itemStringBuf->Des() );
  3742 					profileNameCDesCArray->AppendL( itemStringBuf->Des() );
  3629 					CleanupStack::PopAndDestroy(); // itemStringBuf
  3743 					CleanupStack::PopAndDestroy(); // itemStringBuf
  3630 					if ( iSysApFeatureManager->CoverDisplaySupported() )
  3744 					if ( iSysApFeatureManager->CoverDisplaySupported() )
  3631 						{
  3745 						{
  3632 						itemIdArray.AppendL(SecondaryDisplay::EPwrMenuItemLockKeypad);
  3746 						itemIdArray.AppendL(SecondaryDisplay::EPwrMenuItemLockKeypad);
  3633 						}
  3747                         }
  3634 					iPowerkeyMenuLockKeypadShown = ETrue;
  3748                     iPowerkeyMenuLockKeypadShown = ETrue;
  3635 					iPowerkeyMenuLockKeypadSelection = powerMenuItemIndex;
  3749                     iPowerkeyMenuLockKeypadSelection = powerMenuItemIndex;
  3636 					powerMenuItemIndex++;
  3750                     powerMenuItemIndex++;
  3637 					}
  3751                     }
  3638 				}
  3752                 }
  3639 			}
  3753             }
  3640 
  3754         if ( iSysApFeatureManager->PowerKeyIsLockKey() )
  3641         // "Exit SIM access profile" menu item
  3755             {
  3642 
  3756             AddMmcMenuItemsL( profileNameCDesCArray,
       
  3757                     itemIdArray, powerMenuItemIndex );
       
  3758             }
       
  3759 	    // "Exit SIM access profile" menu item
  3643         if ( BtSapEnabled() )
  3760         if ( BtSapEnabled() )
  3644             {
  3761             {
  3645             TRACES( RDebug::Print(_L( "CSysApAppUi::ShowPowerKeyPopUpMenuL: show \"Exit SIM access profile\" item" ) ) );
  3762             TRACES( RDebug::Print(_L( "CSysApAppUi::ShowPowerKeyPopUpMenuL: show \"Exit SIM access profile\" item" ) ) );
  3646             itemStringBuf = StringLoader::LoadLC( R_QTN_PWRC_EXIT_SIM_ACCESS, iEikonEnv );
  3763             itemStringBuf = StringLoader::LoadLC( R_QTN_PWRC_EXIT_SIM_ACCESS, iEikonEnv );
  3647             profileNameCDesCArray->AppendL( itemStringBuf->Des() );
  3764             profileNameCDesCArray->AppendL( itemStringBuf->Des() );
  3654             iPowerkeyMenuExitSapSelection = powerMenuItemIndex;
  3771             iPowerkeyMenuExitSapSelection = powerMenuItemIndex;
  3655             powerMenuItemIndex++;
  3772             powerMenuItemIndex++;
  3656             }
  3773             }
  3657 
  3774 
  3658         // Profile menu items
  3775         // Profile menu items
  3659 
  3776         iProfileItemsOffset = powerMenuItemIndex;
  3660         TInt arrayIndex ( 0 );
  3777         TInt arrayIndex( 0 );
  3661         TBufC<KMaxProfileNameLength> profileName;
  3778         TBufC<KMaxProfileNameLength> profileName;
  3662 
  3779 
  3663         for ( arrayIndex = 0; arrayIndex < iNumberOfProfileNamesInPowerKeyMenu; arrayIndex++ )
  3780         for ( arrayIndex = 0; arrayIndex < iNumberOfProfileNamesInPowerKeyMenu; arrayIndex++ )
  3664             {
  3781             {
  3665             profileName = iProfileNamesArray->MdcaPoint( arrayIndex );
  3782             profileName = iProfileNamesArray->MdcaPoint( arrayIndex );
  3696                 }
  3813                 }
  3697             iPowerkeyMenuLockSystemShown = ETrue;
  3814             iPowerkeyMenuLockSystemShown = ETrue;
  3698             iPowerkeyMenuLockSystemSelection = powerMenuItemIndex;
  3815             iPowerkeyMenuLockSystemSelection = powerMenuItemIndex;
  3699             powerMenuItemIndex++;
  3816             powerMenuItemIndex++;
  3700             }
  3817             }
  3701 
  3818         if ( !iSysApFeatureManager->PowerKeyIsLockKey() )
  3702         // "Eject MMC" menu item
  3819             {
  3703 
  3820                 AddMmcMenuItemsL( profileNameCDesCArray, itemIdArray, powerMenuItemIndex );
  3704         TInt propertyValue( StateOfProperty( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality ) );
  3821             }
  3705 
       
  3706 #ifndef RD_MULTIPLE_DRIVE
       
  3707 			if ( !IsEncryptionOperationOngoingL() )
       
  3708 			{
       
  3709         if ( iSysApFeatureManager->MmcHotSwapSupported() &&
       
  3710              iMMCInserted &&
       
  3711              iSysApFeatureManager->EjectRequiredInPowerMenu() &&
       
  3712              propertyValue != KUsbPersonalityIdMS )
       
  3713             {
       
  3714             iPowerkeyMenuEjectShown = ETrue;
       
  3715             TRACES( RDebug::Print(_L("CSysApAppUi::ShowPowerKeyPopUpMenuL: adding \"Eject\"" ) ) );
       
  3716             itemStringBuf = StringLoader::LoadLC( R_QTN_PWRC_EJECT_MMC, iEikonEnv );
       
  3717             profileNameCDesCArray->AppendL( itemStringBuf->Des() );
       
  3718             CleanupStack::PopAndDestroy(); // itemStringBuf
       
  3719             if ( iSysApFeatureManager->CoverDisplaySupported() )
       
  3720                 {
       
  3721                 itemIdArray.AppendL(SecondaryDisplay::EPwrMenuItemEjectMMC);
       
  3722                 }
       
  3723             iPowerkeyMenuEjectShown = ETrue;
       
  3724             iPowerkeyMenuEjectSelection = powerMenuItemIndex;
       
  3725             powerMenuItemIndex++;
       
  3726             }
       
  3727         }
       
  3728 
       
  3729 #else // RD_MULTIPLE_DRIVE
       
  3730 			if ( !IsEncryptionOperationOngoingL() )
       
  3731 			{
       
  3732         if ( iSysApFeatureManager->MmcHotSwapSupported() &&
       
  3733              iSysApFeatureManager->EjectRequiredInPowerMenu() &&
       
  3734              propertyValue != KUsbPersonalityIdMS )
       
  3735             {
       
  3736             // Reset old eject status and dialog
       
  3737             iSysApDriveList->ResetDrivesToEject();
       
  3738             if ( iSysApConfirmationQuery )
       
  3739                 {
       
  3740                 if ( iSysApConfirmationQuery->CurrentQuery() == ESysApEjectMmcQuery )
       
  3741                     {
       
  3742                     iSysApConfirmationQuery->Cancel();
       
  3743                     }
       
  3744                 }
       
  3745 
       
  3746             // Append memory cards for eject selection
       
  3747             TInt count( iInsertedMemoryCards.Count() );
       
  3748             for ( TInt i( 0 ); i < count; ++i )
       
  3749                 {
       
  3750                 itemStringBuf = iSysApDriveList->GetFormattedDriveNameLC(
       
  3751                     iInsertedMemoryCards[ i ].iDrive,
       
  3752                     R_QTN_PWRC_EJECT_MEMORY_STORAGE );
       
  3753                 profileNameCDesCArray->AppendL( *itemStringBuf );
       
  3754                 CleanupStack::PopAndDestroy( itemStringBuf );
       
  3755 
       
  3756                 if ( iSysApFeatureManager->CoverDisplaySupported() )
       
  3757                     {
       
  3758                     itemIdArray.AppendL( SecondaryDisplay::EPwrMenuItemEjectItemBase + i );
       
  3759                     }
       
  3760                 }
       
  3761             if ( count > 0 )
       
  3762                 {
       
  3763                 TRACES( RDebug::Print(_L("CSysApAppUi::ShowPowerKeyPopUpMenuL: added \"Eject\"" ) ) );
       
  3764                 iPowerkeyMenuEjectShown = ETrue;
       
  3765                 iPowerkeyMenuEjectSelectionBase = powerMenuItemIndex;
       
  3766                 powerMenuItemIndex += count;
       
  3767                 }
       
  3768             }
       
  3769 				}
       
  3770 #endif // RD_MULTIPLE_DRIVE
       
  3771         
  3822         
  3772         // Activate/deactive power save mode
  3823         // Activate/deactive power save mode
  3773         if ( iSysApPsmController ) // variable feature, not create if power save is not used
  3824         if ( iSysApPsmController ) // variable feature, not create if power save is not used
  3774             {
  3825             {
  3775             TBool showActivate = !(iSysApPsmController->FullPsmEnabled());
  3826             TBool showActivate = !(iSysApPsmController->FullPsmEnabled());
  3848         {
  3899         {
  3849         iIgnoreNextPowerKeyUpEvent = EFalse;
  3900         iIgnoreNextPowerKeyUpEvent = EFalse;
  3850         }
  3901         }
  3851     else
  3902     else
  3852         {
  3903         {
  3853         TInt firstProfileItemIndex( 1 + Max( 0, iPowerkeyMenuLockKeypadSelection, iPowerkeyMenuExitSapSelection ) ); // index of "General" profile
  3904         // first menu item <=> Switch off
  3854 
       
  3855         if ( aSelection == KPowerKeyMenuSelectionSwitchOff )
  3905         if ( aSelection == KPowerKeyMenuSelectionSwitchOff )
  3856             {
  3906             {
  3857             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Switch off\" selected" ) ) );
  3907             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Switch off\" selected" ) ) );
  3858             DoShutdownL( EFalse, KDummyReason );
  3908             DoShutdownL( EFalse, KDummyReason );
  3859             }
  3909             }
  3860 
  3910         // 2nd menu item: lock display & keys
  3861         else if ( iPowerkeyMenuLockKeypadShown && aSelection == iPowerkeyMenuLockKeypadSelection )
  3911         else if ( iPowerkeyMenuLockKeypadShown && aSelection == iPowerkeyMenuLockKeypadSelection )
  3862             {
  3912             {
  3863             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Lock keypad\" selected" ) ) );
  3913             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Lock keypad\" selected" ) ) );
  3864             KeyLock().EnableKeyLock();
  3914             KeyLock().EnableKeyLock();
  3865             }
  3915             }
  3866 
  3916         // BT
  3867         else if ( iPowerkeyMenuExitSapShown && aSelection == iPowerkeyMenuExitSapSelection )
  3917         else if ( iPowerkeyMenuExitSapShown && aSelection == iPowerkeyMenuExitSapSelection )
  3868             {
  3918             {
  3869             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Exit SAP\" selected" ) ) );
  3919             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Exit SAP\" selected" ) ) );
  3870             ShowQueryL( ESysApBtSapDisconnectQuery );
  3920             ShowQueryL( ESysApBtSapDisconnectQuery );
  3871             }
  3921             }
  3872 
  3922         // Profile Items
  3873         else if ( aSelection < firstProfileItemIndex + iNumberOfProfileNamesInPowerKeyMenu )
  3923         else if ( ( aSelection >= iProfileItemsOffset ) && ( aSelection < iProfileItemsOffset + iNumberOfProfileNamesInPowerKeyMenu ) )
  3874             {
  3924             {
  3875             __ASSERT_DEBUG( iProfileNamesArray, User::Invariant() );
  3925             __ASSERT_DEBUG( iProfileNamesArray, User::Invariant() );
  3876 
  3926 
  3877             if ( iProfileNamesArray )
  3927             if ( iProfileNamesArray )
  3878                 {
  3928                 {
  3879                 iProfileToBeActivated = ( iProfileNamesArray->ProfileName( aSelection - firstProfileItemIndex ) )->Id();
  3929                 iProfileToBeActivated = ( iProfileNamesArray->ProfileName( aSelection - iProfileItemsOffset ) )->Id();
  3880 
  3930 
  3881                 TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: profile id: %d selected" ), iProfileToBeActivated ) );
  3931                 TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: profile id: %d selected" ), iProfileToBeActivated ) );
  3882                 if ( ! iSysApOfflineModeController->OfflineModeActive() ||
  3932                 if ( ! iSysApOfflineModeController->OfflineModeActive() ||
  3883                     ( iProfileToBeActivated ) == KOfflineModeProfileId )
  3933                     ( iProfileToBeActivated ) == KOfflineModeProfileId )
  3884                     {
  3934                     {
  3889                     // iProfileToBeActivated profile will be activated from iSysApOfflineModeController if ok
  3939                     // iProfileToBeActivated profile will be activated from iSysApOfflineModeController if ok
  3890                     iSysApOfflineModeController->GoOnlineIfOkL();
  3940                     iSysApOfflineModeController->GoOnlineIfOkL();
  3891                     }
  3941                     }
  3892                 }
  3942                 }
  3893             }
  3943             }
  3894 
  3944         // device lock
  3895         else if ( iPowerkeyMenuLockSystemShown && aSelection == iPowerkeyMenuLockSystemSelection )
  3945         else if ( iPowerkeyMenuLockSystemShown && aSelection == iPowerkeyMenuLockSystemSelection )
  3896             {
  3946             {
  3897             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Lock system\" selected" ) ) );
  3947             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Lock system\" selected" ) ) );
  3898             iSysApSystemLock->SetLockedL();
  3948             iSysApSystemLock->SetLockedL();
  3899             }
  3949             }
  3900 #ifndef RD_MULTIPLE_DRIVE
  3950 #ifndef RD_MULTIPLE_DRIVE
       
  3951         //eject single MMC
  3901         else if ( iPowerkeyMenuEjectShown && aSelection == iPowerkeyMenuEjectSelection )
  3952         else if ( iPowerkeyMenuEjectShown && aSelection == iPowerkeyMenuEjectSelection )
  3902             {
  3953             {
  3903             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Eject\" selected" ) ) );
  3954             TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Eject\" selected" ) ) );
  3904             ShowQueryL( ESysApEjectMmcQuery );
  3955             ShowQueryL( ESysApEjectMmcQuery );
  3905             }
  3956             }
  3906 #else // RD_MULTIPLE_DRIVE
  3957 #else // RD_MULTIPLE_DRIVE
       
  3958         //eject nth MMC
  3907         else if ( iPowerkeyMenuEjectShown &&
  3959         else if ( iPowerkeyMenuEjectShown &&
  3908                 aSelection >= iPowerkeyMenuEjectSelectionBase &&
  3960                 aSelection >= iPowerkeyMenuEjectSelectionBase &&
  3909                 aSelection < iPowerkeyMenuEjectSelectionBase + iInsertedMemoryCards.Count() )
  3961                 aSelection < iPowerkeyMenuEjectSelectionBase + iInsertedMemoryCards.Count() )
  3910             {
  3962             {
  3911             iDriveToEject =
  3963             iDriveToEject =
  3927 
  3979 
  3928         }
  3980         }
  3929 
  3981 
  3930     delete iProfileNamesArray;
  3982     delete iProfileNamesArray;
  3931     iProfileNamesArray = NULL;
  3983     iProfileNamesArray = NULL;
       
  3984     delete iGlobalListQuery;
       
  3985     iGlobalListQuery = NULL;
  3932 
  3986 
  3933     TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: END" ) ) );
  3987     TRACES( RDebug::Print(_L("CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: END" ) ) );
  3934     }
  3988     }
  3935 
  3989 
  3936 // ----------------------------------------------------------------------------
  3990 // ----------------------------------------------------------------------------