email/mail/ViewerSrc/Msgmailcharactersethandler.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Character set menu handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMSGMAILCHARACTERSETHANDLER_H
       
    21 #define CMSGMAILCHARACTERSETHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CEikMenuPane;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32 *  Character set handler
       
    33 * Handle dynamic options in characterset menu.
       
    34 *
       
    35 *  @since Series60_25
       
    36 */
       
    37 class CMsgMailCharacterSetHandler : public CBase
       
    38     {
       
    39     public:  // Constructors and destructor
       
    40         /**
       
    41         * Two-phased constructor.
       
    42         * @param aFirstFreeCommandId First dynamic option menu 
       
    43         * item will use this id.
       
    44         */
       
    45         static CMsgMailCharacterSetHandler* NewL( TInt aFirstFreeCommandId );
       
    46         
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         ~CMsgMailCharacterSetHandler();
       
    51 
       
    52     public: // New functions
       
    53         
       
    54         /**
       
    55         * SetCharacterSetSubMenuItemsL
       
    56         * @since Series60_2.6
       
    57         * @param aMenuPane MenuPane where items are added
       
    58         * @param aActiveCharacterSet Currently active characterset. Character
       
    59         *           set with this ID is hide from the options menu.
       
    60         */
       
    61         void SetCharacterSetSubMenuItemsL(
       
    62             CEikMenuPane& aMenuPane, 
       
    63             TUint aActiveCharacterSet);
       
    64         /**
       
    65         * GetCharacterSetId
       
    66         * @since Series60_2.5
       
    67         * @param aCommandId Options menu command id.
       
    68         * @param aCharacterSetId Corresponding CharacterSet Id
       
    69         * @return ETrue if aCommandId was consumed
       
    70         */
       
    71         TBool GetCharacterSetId(TInt aCommandId, TUint& aCharacterSetId);
       
    72 
       
    73         /**
       
    74         * CharacterSetCount
       
    75         * @since Series60_2.6
       
    76         * @param aMenuPane MenuPane where item is added
       
    77         * Menu item is not added if characterset count is zero.
       
    78         */
       
    79         void SetCharacterSetMenuItemL(CEikMenuPane& aMenuPane);
       
    80        
       
    81     private:  // Implementation
       
    82         TBool IsAcceptedCharacterSet(TUint aCharacterSetId);
       
    83         void AppendItemsToItemArrayL();    
       
    84         
       
    85         // Item array data structure
       
    86         struct TData
       
    87             {
       
    88             enum { ENominalTextLength=40 }; // see CEikMenuPaneItem::SData
       
    89             TInt iCommandId;
       
    90             TUint iCharacterSetId;
       
    91             TBuf<ENominalTextLength> iText; // Options menu text           
       
    92             };
       
    93 
       
    94     private:
       
    95 
       
    96         /**
       
    97         * C++ default constructor.
       
    98         */
       
    99         CMsgMailCharacterSetHandler();
       
   100 
       
   101         /**
       
   102         * By default Symbian 2nd phase constructor is private.
       
   103         */
       
   104         void ConstructL();
       
   105 
       
   106     private:    // Data
       
   107         /// Variant flag
       
   108         TInt iVariationFlag;
       
   109         /// Item array
       
   110         RArray<TData> iItems;
       
   111         /// FirstFreeCommandId
       
   112         TInt iFirstFreeCommandId;
       
   113 
       
   114     };
       
   115 
       
   116 #endif      // CMSGMAILCHARACTERSETHANDLER_H   
       
   117             
       
   118 // End of File