emailuis/emailui/src/FreestyleEmailUiShortcutBinding.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11  *
       
    12 * Contributors:
       
    13  *
       
    14 * Description: This file implements class CFSEmailUiShortcutBinding.
       
    15  *
       
    16  */
       
    17 
       
    18 
       
    19 #include "emailtrace.h"
       
    20 #include <PtiEngine.h>
       
    21 #include <PtiKeyMappings.h>
       
    22 #include <centralrepository.h>
       
    23 #include <AvkonInternalCRKeys.h>
       
    24 #include <eikmenup.h>
       
    25 
       
    26 #include "FreestyleEmailUiShortcutBinding.h"
       
    27 #include "FSEmail.pan"
       
    28 
       
    29 
       
    30 //////////////////////////////
       
    31 // The shortcut binding tables
       
    32 // ---------------------------
       
    33 // In case the same shortcut is assigned for multiple commands, the shortcut to 
       
    34 // command conversion will always return the first mapping.
       
    35 //
       
    36 // Shortcuts with modifiers must be listed before unmodifed shortcuts, at least when
       
    37 // the same key has different meaning as plain key and with modifier. Otherwise,
       
    38 // the unmodified mapping will be used also for the modified key.
       
    39 
       
    40 // Shortcuts for the mail list view
       
    41 const CFSEmailUiShortcutBinding::TShortcutBinding KMailListShortcuts[] = 
       
    42     {
       
    43         { 0,  'A', 0,     EFsEmailUiCmdActionsReplyAll },
       
    44         { 0,  'R', 0,     EFsEmailUiCmdActionsReply },
       
    45         { 0,  'F', 0,     EFsEmailUiCmdActionsForward }, 
       
    46         { 0,  'M', 0,     EFsEmailUiCmdActionsMove },
       
    47         { 0,    'Y', 0,     EFsEmailUiCmdActionsCopyMessage },
       
    48         { 0,    'D', 0,     EFsEmailUiCmdActionsDelete },
       
    49         { 0, EStdKeyBackspace, 0, EFsEmailUiCmdActionsDelete },
       
    50         { 0,  'T', 0,     EFsEmailUiCmdGoToTop },
       
    51         { 0,  'B', 0,     EFsEmailUiCmdGoToBottom },
       
    52         { 0,    'J', 0,     EFsEmailUiCmdPageUp },
       
    53         { 0,    'K', 0,     EFsEmailUiCmdPageDown },
       
    54         { 0,    'L', 0,     EFsEmailUiCmdActionsFlag },
       
    55         { 0,  'C', 0,     EFsEmailUiCmdCompose },
       
    56         { 0,    'E', 0,     EFsEmailUiCmdCalActionsAccept }, 
       
    57         { 0,    'G', 0,     EFsEmailUiCmdCalActionsTentative },
       
    58         { 0,    'V', 0,     EFsEmailUiCmdCalActionsDecline },
       
    59         { 0,    'O', 0,     EFsEmailUiCmdActionsOpen },
       
    60         { 0,  'Z', 0,     EFsEmailUiCmdSync },
       
    61         { 0,    'S', 0,     EFsEmailUiCmdSearch },
       
    62         { 0,    'Q', 0,     EFsEmailUiCmdGoToSwitchFolder },
       
    63         { 0,    'W', 0,     EFsEmailUiCmdGoToSwitchSorting },
       
    64         { 0,    'H', 0,     EFsEmailUiCmdHelp },
       
    65         
       
    66         { 0,  'U', 0,     EFsEmailUiCmdMarkAsReadUnreadToggle },
       
    67         { 0,  'U', 0,     EFsEmailUiCmdMarkAsRead },   
       
    68         { 0,  'U', 0,     EFsEmailUiCmdMarkAsUnread },
       
    69         
       
    70         { 0,    'I', 0,     EFsEmailUiCmdActionsCollapseExpandAllToggle },
       
    71         { 0,    'I', 0,     EFsEmailUiCmdActionsCollapseAll },
       
    72         { 0,    'I', 0,     EFsEmailUiCmdActionsExpandAll },
       
    73         
       
    74         { 0,  0, 0,       EFsEmailUiCmdMarkUnmarkToggle },
       
    75         { 0,  0, 0,       EFsEmailUiCmdMarkMark }, 
       
    76         { 0,  0, 0,       EFsEmailUiCmdMarkUnmark }
       
    77     };
       
    78 
       
    79 // Shortcuts for the mail viewer
       
    80 const CFSEmailUiShortcutBinding::TShortcutBinding KMailViewerShortcuts[] = 
       
    81     {
       
    82         { 0,    'C', EModifierCtrl, EFsEmailUiCmdActionsCopyToClipboard },
       
    83 
       
    84         { 0,  'A', 0,     EFsEmailUiCmdActionsReplyAll },
       
    85         { 0,  'R', 0,     EFsEmailUiCmdActionsReply },
       
    86         { 0,  'F', 0,     EFsEmailUiCmdActionsForward }, 
       
    87         { 0,  'F', 0,     EFsEmailUiCmdActionsForward2 }, 
       
    88         { 0,  'M', 0,     EFsEmailUiCmdActionsMoveMessage },
       
    89         { 0,    'Y', 0,     EFsEmailUiCmdActionsCopyMessage },
       
    90         { 0,    'D', 0,     EFsEmailUiCmdActionsDelete },
       
    91         { 0, EStdKeyBackspace, 0, EFsEmailUiCmdActionsDelete },
       
    92         { 0,  'T', 0,     EFsEmailUiCmdGoToTop },
       
    93         { 0,  'B', 0,     EFsEmailUiCmdGoToBottom },
       
    94         { 0,    'J', 0,     EFsEmailUiCmdPageUp },
       
    95         { 0,    'K', 0,     EFsEmailUiCmdPageDown },
       
    96         { 0,  'N', 0,     EFsEmailUiCmdNextMessage },
       
    97         { 0,  'P', 0,     EFsEmailUiCmdPreviousMessage },
       
    98         { 0,    'L', 0,     EFsEmailUiCmdActionsFlag },
       
    99         { 0,  'C', 0,     EFsEmailUiCmdCompose },
       
   100         { 0,    'H', 0,     EFsEmailUiCmdHelp },
       
   101         
       
   102         { 0,  'U', 0,     EFsEmailUiCmdMarkAsReadUnreadToggle },
       
   103         { 0,  'U', 0,     EFsEmailUiCmdMarkAsRead },   
       
   104         { 0,  'U', 0,     EFsEmailUiCmdMarkAsUnread }
       
   105     };
       
   106 
       
   107 // Shortcuts for the HTML viewer
       
   108 const CFSEmailUiShortcutBinding::TShortcutBinding KHtmlViewerShortcuts[] = 
       
   109     {
       
   110         { 0,  'A', 0,     EFsEmailUiCmdActionsReplyAll },
       
   111         { 0,  'R', 0,     EFsEmailUiCmdActionsReply },
       
   112         { 0,  'F', 0,     EFsEmailUiCmdActionsForward }, 
       
   113         { 0,    'D', 0,     EFsEmailUiCmdActionsDelete },
       
   114         { 0, EStdKeyBackspace, 0, EFsEmailUiCmdActionsDelete },
       
   115         { 0,    'H', 0,     EFsEmailUiCmdHelp },
       
   116         { 0,  '+', 0,     EFsEmailUiCmdZoomIn },
       
   117         { 0,  '-', 0,     EFsEmailUiCmdZoomOut }
       
   118     };
       
   119 
       
   120 // Shortcuts for the search results view    
       
   121 const CFSEmailUiShortcutBinding::TShortcutBinding KSearchResultsShortcuts[] = 
       
   122     {
       
   123         { 0,    'O', 0,     EFsEmailUiCmdOpen },
       
   124         { 0,    'S', 0,     EFsEmailUiCmdSearch },
       
   125         { 0,    'S', 0,     EFsEmailUiCmdNewSearch },
       
   126         { 0,    'H', 0,     EFsEmailUiCmdHelp },
       
   127         { 0,  'T', 0,     EFsEmailUiCmdGoToTop },
       
   128         { 0,  'B', 0,     EFsEmailUiCmdGoToBottom },
       
   129         { 0,    'J', 0,     EFsEmailUiCmdPageUp },
       
   130         { 0,    'K', 0,     EFsEmailUiCmdPageDown },
       
   131         { 0,  'A', 0,     EFsEmailUiCmdActionsReplyAll },
       
   132         { 0,  'R', 0,     EFsEmailUiCmdActionsReply },
       
   133         { 0,  'F', 0,     EFsEmailUiCmdActionsForward }, 
       
   134         { 0,    'D', 0,     EFsEmailUiCmdActionsDelete },
       
   135         { 0, EStdKeyBackspace, 0, EFsEmailUiCmdActionsDelete },
       
   136         { 0,    'E', 0,     EFsEmailUiCmdCalActionsAccept }, 
       
   137         { 0,    'G', 0,     EFsEmailUiCmdCalActionsTentative },
       
   138         { 0,    'V', 0,     EFsEmailUiCmdCalActionsDecline },        
       
   139         { 0,  'U', 0,     EFsEmailUiCmdMarkAsReadUnreadToggle },
       
   140         { 0,  'U', 0,     EFsEmailUiCmdMarkAsRead },   
       
   141         { 0,  'U', 0,     EFsEmailUiCmdMarkAsUnread }
       
   142     };
       
   143 
       
   144 // Shortcuts for generic list views. These are used with Mail details, attachment list, etc.    
       
   145 const CFSEmailUiShortcutBinding::TShortcutBinding KGenericListShortcuts[] = 
       
   146     {
       
   147         { 0,    'C', EModifierCtrl, EFsEmailUiCmdActionsCopyToClipboard },
       
   148 
       
   149         { 0,    'O', 0,     EFsEmailUiCmdOpen },
       
   150         { 0,    'D', 0,     EFsEmailUiCmdActionsDelete },
       
   151         { 0, EStdKeyBackspace, 0, EFsEmailUiCmdActionsDelete },
       
   152         { 0,  'T', 0,     EFsEmailUiCmdGoToTop },
       
   153         { 0,  'B', 0,     EFsEmailUiCmdGoToBottom },
       
   154         { 0,    'J', 0,     EFsEmailUiCmdPageUp },
       
   155         { 0,    'K', 0,     EFsEmailUiCmdPageDown },
       
   156         { 0,    'H', 0,     EFsEmailUiCmdHelp },
       
   157 
       
   158         { 0,    'I', 0,     EFsEmailUiCmdActionsCollapseExpandAllToggle },
       
   159         { 0,    'I', 0,     EFsEmailUiCmdActionsCollapseAll },
       
   160         { 0,    'I', 0,     EFsEmailUiCmdActionsExpandAll }
       
   161     };
       
   162 
       
   163 // Shortcuts for the main grid
       
   164 const CFSEmailUiShortcutBinding::TShortcutBinding KMainGridShortcuts[] = 
       
   165     {
       
   166         { 0,    'O', 0,     EFsEmailUiCmdOpen },
       
   167         { 0,  'Z', 0,     EFsEmailUiCmdSync },
       
   168         { 0,  'Z', 0,     EFsEmailUiCmdSyncAll },
       
   169         { 0,    'H', 0,     EFsEmailUiCmdHelp },
       
   170     };
       
   171 
       
   172 // Shortcuts for send attachments list view
       
   173 const CFSEmailUiShortcutBinding::TShortcutBinding KSendAttachmentListShortcuts[] =
       
   174     {
       
   175         { 0,    'O', 0,     ESendAttachmentMenuOpen },
       
   176         { 0,    'D', 0,     ESendAttachmentMenuRemoveAttachment },
       
   177         { 0, EStdKeyBackspace, 0, ESendAttachmentMenuRemoveAttachment },
       
   178         { 0,  'T', 0,     EFsEmailUiCmdGoToTop },
       
   179         { 0,  'B', 0,     EFsEmailUiCmdGoToBottom },
       
   180         { 0,    'J', 0,     EFsEmailUiCmdPageUp },
       
   181         { 0,    'K', 0,     EFsEmailUiCmdPageDown },
       
   182         { 0,    'H', 0,     ESendAttachmentMenuHelp },
       
   183         { 0,    'I', 0,     EFsEmailUiCmdActionsCollapseExpandAllToggle }
       
   184     };
       
   185     
       
   186 // Shortcuts for settings and global settings views
       
   187 const CFSEmailUiShortcutBinding::TShortcutBinding KSettingsShortcuts[] =
       
   188     {
       
   189         { 0,    'O', 0,     EFsEmailUiCmdOpen },
       
   190         { 0,  'T', 0,     EFsEmailUiCmdGoToTop },
       
   191         { 0,  'B', 0,     EFsEmailUiCmdGoToBottom },
       
   192         { 0,    'J', 0,     EFsEmailUiCmdPageUp },
       
   193         { 0,    'K', 0,     EFsEmailUiCmdPageDown },
       
   194         { 0,    'H', 0,     EFsEmailUiCmdHelp }
       
   195     };
       
   196 
       
   197 ///////////////////////
       
   198 // The class definition 
       
   199 CFSEmailUiShortcutBinding* CFSEmailUiShortcutBinding::NewL()
       
   200     {
       
   201     FUNC_LOG;
       
   202     CFSEmailUiShortcutBinding* self = new (ELeave) CFSEmailUiShortcutBinding();
       
   203     CleanupStack::PushL( self );
       
   204     self->ConstructL();
       
   205     CleanupStack::Pop( self );
       
   206     return self;
       
   207     }
       
   208     
       
   209 // ----------------------------------------------------------------------------    
       
   210 CFSEmailUiShortcutBinding::~CFSEmailUiShortcutBinding()
       
   211     {
       
   212     FUNC_LOG;
       
   213     delete iPtiEngine;
       
   214     iQwertyMappings = NULL; // owned by iPtiEngine
       
   215     iHalfQwertyMappings = NULL; // ownned by iPtiEngine
       
   216     iKbLayoutProperty.Close();
       
   217     }
       
   218         
       
   219         
       
   220 // ----------------------------------------------------------------------------    
       
   221 TInt CFSEmailUiShortcutBinding::CommandForShortcutKey( const TKeyEvent& aKey, 
       
   222                                                        TShortcutContext aContext ) const
       
   223     {
       
   224     FUNC_LOG;
       
   225     TText shortcut = aKey.iScanCode;
       
   226     TBuf<1> keyData; // we are only interested about the first char of the key
       
   227     
       
   228     TKeyBoardType kbType = KeyBoardType();
       
   229 
       
   230     if ( kbType == EQwerty4x12 || kbType == EQwerty4x10 || 
       
   231          kbType == EQwerty3x11 || kbType == ECustomQwerty )
       
   232         {
       
   233         // One of the QWERTY modes
       
   234         // Map the key to the corresponding character on the current keyboard
       
   235         // If Fn is held depressed, use the Fn mappings, otherwise use upper case mappings.
       
   236         TPtiTextCase caseMode = EPtiCaseUpper;
       
   237 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   238         if ( aKey.iModifiers&EModifierRightFunc )
       
   239             {
       
   240             caseMode = EPtiCaseFnLower;
       
   241             }
       
   242 #endif // RD_INTELLIGENT_TEXT_INPUT
       
   243         if ( iQwertyMappings )
       
   244             {
       
   245             iQwertyMappings->GetDataForKey( static_cast<TPtiKey>(aKey.iScanCode), 
       
   246                     keyData, caseMode );
       
   247             }
       
   248         }
       
   249     else if ( kbType == EHalfQwerty )
       
   250         {
       
   251         // Half-QWERTY mode
       
   252         // Map the key to the corresponding character in the Fn mode
       
   253         if ( iHalfQwertyMappings )
       
   254             {
       
   255 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   256             iHalfQwertyMappings->GetDataForKey( static_cast<TPtiKey>(aKey.iScanCode), 
       
   257                     keyData, EPtiCaseFnLower );
       
   258 #endif // RD_INTELLIGENT_TEXT_INPUT
       
   259             }
       
   260         }
       
   261     else
       
   262         {
       
   263         // ITU-T mode, use scancode directly without mapping
       
   264         }
       
   265     
       
   266     // Substitute the scan code with the mapped character if available
       
   267     if ( keyData.Length() )
       
   268         {
       
   269         shortcut = keyData[0];
       
   270         }
       
   271     // Map hash and asterisk keys separately if they have not been mapped in PtiEngine
       
   272     else if ( shortcut == EStdKeyHash )
       
   273         {
       
   274         shortcut = '#';
       
   275         }
       
   276     else if ( shortcut == EStdKeyNkpAsterisk )
       
   277         {
       
   278         shortcut = '*';
       
   279         }
       
   280 
       
   281     return CommandForShortcut( shortcut, aContext, aKey.iModifiers );
       
   282     }
       
   283         
       
   284         
       
   285 // ----------------------------------------------------------------------------    
       
   286 TInt CFSEmailUiShortcutBinding::CommandForShortcut( TText aShortcut, 
       
   287                                                     TShortcutContext aContext,
       
   288                                                     TUint32 aModifiers )
       
   289     {
       
   290     FUNC_LOG;
       
   291     TInt command = KErrNotFound;
       
   292     
       
   293     if ( aShortcut ) // value 0 is used as mark for no shortcut
       
   294         {
       
   295         TInt count = 0;
       
   296         const TShortcutBinding* bindings = NULL;
       
   297 
       
   298         // Select appropriate binding table    
       
   299         GetBindingsForContext( bindings, count, aContext );
       
   300             
       
   301         // Search command from the binding table
       
   302         for ( TInt i=0 ; i<count && command==KErrNotFound  ; ++i )
       
   303             {
       
   304             TBool isItutShortcut = ( aShortcut == bindings[i].iItutShortcut );
       
   305             
       
   306             TBool isQwertyShortcut = ( aShortcut == bindings[i].iQwertyShortcut );
       
   307             // Check the modifier keys for the QWERTY shortcut
       
   308             if ( isQwertyShortcut )
       
   309                 {
       
   310                 TUint32 matchingModifiers = ( aModifiers & bindings[i].iQwertyModifiers );
       
   311                 if ( matchingModifiers != bindings[i].iQwertyModifiers )
       
   312                     {
       
   313                     isQwertyShortcut = EFalse;
       
   314                     }
       
   315                 }
       
   316                                        
       
   317             if ( isItutShortcut || isQwertyShortcut )
       
   318                 {
       
   319                 command = bindings[i].iCommandId;
       
   320                 }
       
   321             }
       
   322         }
       
   323         
       
   324     return command;
       
   325     }
       
   326     
       
   327     
       
   328 // ----------------------------------------------------------------------------    
       
   329 TText CFSEmailUiShortcutBinding::ShortcutForCommand( TInt aCommandId, 
       
   330                                                      TShortcutContext aContext, 
       
   331                                                      TBool aQwertyMode )
       
   332     {
       
   333     FUNC_LOG;
       
   334     TText shortcut = 0;
       
   335     TInt count = 0;
       
   336     const TShortcutBinding* bindings = NULL;
       
   337     
       
   338     // Select appropriate binding table
       
   339     GetBindingsForContext( bindings, count, aContext );
       
   340         
       
   341     // Search shortcut from the binding table
       
   342     for ( TInt i=0 ; i<count && !shortcut  ; ++i )
       
   343         {
       
   344         if ( aCommandId == bindings[i].iCommandId )
       
   345             {
       
   346             if ( aQwertyMode )
       
   347                 {
       
   348                 // Only single-key shortcuts are supported here.
       
   349                 if ( !bindings[i].iQwertyModifiers )
       
   350                     {
       
   351                     shortcut = bindings[i].iQwertyShortcut;
       
   352                     }
       
   353                 }
       
   354             else
       
   355                 {
       
   356                 shortcut = bindings[i].iItutShortcut;
       
   357                 }
       
   358             }
       
   359         }
       
   360         
       
   361     return shortcut;
       
   362     }
       
   363     
       
   364     
       
   365 // ----------------------------------------------------------------------------    
       
   366 void CFSEmailUiShortcutBinding::AppendShortcutHintsL(
       
   367 	CEikMenuPane& aMenuPane,
       
   368 	TShortcutContext aContext ) const
       
   369     {
       
   370     FUNC_LOG;
       
   371     TKeyBoardType kbType = KeyBoardType();
       
   372     TBool isQwerty = 
       
   373         ( kbType != ENoKeyboard && kbType != EItutKeyPad && kbType != EHalfQwerty );
       
   374     
       
   375     // Browse through the commands in the menu pane and append shortcuts
       
   376     // where available.
       
   377     TInt count = aMenuPane.NumberOfItemsInPane();
       
   378     
       
   379     for ( TInt i = 0; i < count; ++i )
       
   380         {
       
   381         CEikMenuPaneItem::SData& itemData = aMenuPane.ItemDataByIndexL( i );
       
   382         TText hint = ShortcutForCommand(
       
   383         	itemData.iCommandId, aContext, isQwerty );        
       
   384         if ( hint )
       
   385             {
       
   386             AppendHintToCaption( itemData.iText, hint );
       
   387             }
       
   388         }
       
   389     }
       
   390     
       
   391     
       
   392 // ----------------------------------------------------------------------------    
       
   393 CFSEmailUiShortcutBinding::CFSEmailUiShortcutBinding()
       
   394     {
       
   395     FUNC_LOG;
       
   396     }
       
   397 	
       
   398 	
       
   399 // ----------------------------------------------------------------------------    
       
   400 void CFSEmailUiShortcutBinding::ConstructL()
       
   401     {
       
   402     FUNC_LOG;
       
   403     iPtiEngine = CPtiEngine::NewL();
       
   404     
       
   405     // Always use English mappings for QWERTY keyboards. This is because it is not 
       
   406     // certain that the mappings of the current language hold latin alphabet at all.
       
   407     // English should be available in all device variants as an optional input language.
       
   408     CPtiCoreLanguage* lang = 
       
   409         static_cast<CPtiCoreLanguage*>( iPtiEngine->GetLanguage( ELangEnglish ) );
       
   410     if (lang)
       
   411         {
       
   412         iQwertyMappings = static_cast<CPtiKeyMappings*>( lang->GetQwertyKeymappings() );
       
   413 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   414         iHalfQwertyMappings = static_cast<CPtiKeyMappings*>( lang->GetHalfQwertyKeymappings() );
       
   415 #endif // RD_INTELLIGENT_TEXT_INPUT        
       
   416         }
       
   417     lang = NULL; // owned by iPtiEngine
       
   418     
       
   419     
       
   420     if ( !iQwertyMappings && !iHalfQwertyMappings )
       
   421         {
       
   422         // In non-QWERTY devices we can free up PtiEngine right away, because
       
   423         // it is not needed anyway.
       
   424         delete iPtiEngine;
       
   425         iPtiEngine = NULL;
       
   426         }
       
   427 
       
   428     iKbLayoutProperty.Attach( KCRUidAvkon, KAknKeyBoardLayout );
       
   429     }
       
   430 	
       
   431 	
       
   432 // ----------------------------------------------------------------------------    
       
   433 CFSEmailUiShortcutBinding::TKeyBoardType CFSEmailUiShortcutBinding::KeyBoardType() const
       
   434     {
       
   435     FUNC_LOG;
       
   436     TInt keyboardType = ENoKeyboard;
       
   437 
       
   438     // RProperty does not define Get() as a constant function. This is
       
   439     // probably just a flaw in the interface. Cast away constness to
       
   440     // circumvent this.
       
   441     RProperty& kbProperty = const_cast<RProperty&>(iKbLayoutProperty);
       
   442     kbProperty.Get( keyboardType );
       
   443     return static_cast<TKeyBoardType>( keyboardType );
       
   444     }
       
   445 
       
   446 	
       
   447 // ----------------------------------------------------------------------------    
       
   448 void CFSEmailUiShortcutBinding::GetBindingsForContext( const TShortcutBinding*& aBindingArray, 
       
   449                                                        TInt& aBindingCount,
       
   450                                                        TShortcutContext aContext )
       
   451     {
       
   452     FUNC_LOG;
       
   453     switch (aContext)
       
   454         {
       
   455         case EContextMailList:
       
   456             {
       
   457             aBindingCount = sizeof(KMailListShortcuts) / sizeof(TShortcutBinding);
       
   458             aBindingArray = KMailListShortcuts;
       
   459             }
       
   460         break;
       
   461 
       
   462         case EContextSearchResults:
       
   463             {
       
   464             aBindingCount = sizeof(KSearchResultsShortcuts) / sizeof(TShortcutBinding);
       
   465             aBindingArray = KSearchResultsShortcuts;
       
   466             }
       
   467         break;
       
   468 
       
   469         case EContextMailViewer:
       
   470             {
       
   471             aBindingCount = sizeof(KMailViewerShortcuts) / sizeof(TShortcutBinding);
       
   472             aBindingArray = KMailViewerShortcuts;
       
   473             }
       
   474         break;
       
   475 
       
   476         case EContextHtmlViewer:
       
   477             {
       
   478             aBindingCount = sizeof(KHtmlViewerShortcuts) / sizeof(TShortcutBinding);
       
   479             aBindingArray = KHtmlViewerShortcuts;
       
   480             }
       
   481         break;
       
   482         
       
   483         case EContextMailDetails:
       
   484         case EContextFolderList:
       
   485         case EContextAttachmentList:
       
   486         case EContextDownloadManager:
       
   487             {
       
   488             aBindingCount = sizeof(KGenericListShortcuts) / sizeof(TShortcutBinding);
       
   489             aBindingArray = KGenericListShortcuts;
       
   490             }
       
   491         break;
       
   492 
       
   493         case EContextMainGrid:
       
   494             {
       
   495             aBindingCount = sizeof(KMainGridShortcuts) / sizeof(TShortcutBinding);
       
   496             aBindingArray = KMainGridShortcuts;
       
   497             }
       
   498         break;
       
   499 
       
   500         case EContextSendAttachmentList:
       
   501             {
       
   502             aBindingCount = sizeof(KSendAttachmentListShortcuts) / sizeof(TShortcutBinding);
       
   503             aBindingArray = KSendAttachmentListShortcuts;
       
   504             }
       
   505         break;
       
   506         
       
   507         case EContextSettings:
       
   508             {
       
   509             aBindingCount = sizeof(KSettingsShortcuts) / sizeof(TShortcutBinding);
       
   510             aBindingArray = KSettingsShortcuts;
       
   511             }
       
   512         break;
       
   513         
       
   514         default:
       
   515             {
       
   516             Panic( EFSEmailUiUnexpectedValue );
       
   517             }
       
   518         break;
       
   519         }
       
   520     }                                         
       
   521 
       
   522 
       
   523 // ----------------------------------------------------------------------------    
       
   524 void CFSEmailUiShortcutBinding::AppendHintToCaption( TDes& aCaption, 
       
   525                                                      TText aHint )
       
   526     {
       
   527     FUNC_LOG;
       
   528     static const TInt KHintLength = 4; // e.g. " [X]"
       
   529     _LIT( KLeadingSeparator, " [" );
       
   530     _LIT( KTailingSeparator, "]" );
       
   531     
       
   532     if ( aCaption.MaxLength() >= aCaption.Length() + KHintLength )
       
   533         {
       
   534         aCaption.Append( KLeadingSeparator );
       
   535         aCaption.Append( aHint );
       
   536         aCaption.Append( KTailingSeparator );
       
   537         }
       
   538     }
       
   539