messagingappbase/mce/inc/MceOneRowMessageListBitmapResolver.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:  
       
    15 *     Handles different mce bitmaps.
       
    16 *     First collects all the bitmaps from different mtm's and also local
       
    17 *     folder's bitmaps to icon array.
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef MCEONEROWBITMAPRESOLVER_H
       
    24 #define MCEONEROWBITMAPRESOLVER_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include "mcetemplate.h"
       
    28 #include <msvapi.h>
       
    29 #include <AknsUtils.h>
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // DATA TYPES
       
    34 // these should correspond to the icon array created in CMceOneRowBitmapResolver::ConstructL
       
    35 enum TMceBitmapArrayIndexes
       
    36     {
       
    37     EMceBitmapIndexUnknown = 0,
       
    38     EMceBitmapIndexFolderTemp,
       
    39     EMceBitmapIndexFolderSmall,
       
    40     EMceBitmapIndexFolderSmallNew,
       
    41     EMceBitmapIndexAttachment,
       
    42     EMceBitmapIndexAttachmentFocus,
       
    43     EMceBitmapIndexPriorityHigh,
       
    44     EMceBitmapIndexPriorityHighFocus,
       
    45     EMceBitmapIndexPriorityLow,
       
    46     EMceBitmapIndexPriorityLowFocus,
       
    47     EMceBitmapIndexSubSender,
       
    48     EMceBitmapIndexSubSenderUnread,
       
    49     EMceBitmapIndexSubSubject,
       
    50     EMceBitmapIndexSubSubjectUnread,
       
    51     EMceBitmapIndexSubTime,
       
    52     EMceBitmapIndexSubTimeUnread,
       
    53     EMceBitmapIndexLastIconIndex
       
    54     };
       
    55     
       
    56 
       
    57 /**
       
    58 * this class stores icon id in the tree list and bitmap pointer returned by the mtm ui data.
       
    59 * more detailed explanation here...
       
    60 */    
       
    61 class TMceHierListIconEntry
       
    62     {
       
    63     public:
       
    64     TInt        iIconId;
       
    65     TUid        iMtmUid;
       
    66     CFbsBitmap* iBitmapPointer;
       
    67     };
       
    68 
       
    69 typedef RArray<TMceHierListIconEntry> RMceListIconArray;
       
    70 
       
    71     
       
    72 
       
    73 // FORWARD DECLARATIONS
       
    74 class CMsvSession;
       
    75 class MMtmUiDataRegistryObserver;
       
    76 class CAknSingleColumnStyleTreeList;
       
    77 
       
    78 // CLASS DECLARATION
       
    79 
       
    80 
       
    81 
       
    82 /**
       
    83 *  Handles different mce bitmaps.
       
    84 *  First collects all the bitmaps from different mtm's and also local
       
    85 *  folder's bitmaps to icon array.
       
    86 */
       
    87 class CMceOneRowBitmapResolver : public CBase
       
    88     {
       
    89     public:  // Constructors and destructor
       
    90 
       
    91         /**
       
    92         * Two-phased constructor.
       
    93         */
       
    94         static CMceOneRowBitmapResolver* NewL(
       
    95             CMsvSessionPtr aSession,
       
    96             MMtmUiDataRegistryObserver& aRegObserver );
       
    97 
       
    98         /**
       
    99         * Destructor.
       
   100         */
       
   101         virtual ~CMceOneRowBitmapResolver();
       
   102 
       
   103         /**
       
   104         * Returns pointer to icon array.
       
   105         * @return Pointer to icon array.
       
   106         */
       
   107         CArrayPtrFlat<CGulIcon>* IconArray();
       
   108 
       
   109         /**
       
   110         * Can be used to get index of the bitmap of the message.
       
   111         * Loads bitmap from the mtm ui data and changes it to be last icon in icon array
       
   112         * @param aEntry: Fill TMsvEntry fields before calling this.
       
   113         * @return Index of the bitmap requested.
       
   114         */
       
   115         TInt BitmapIndex( const TMsvEntry& aEntry );
       
   116 
       
   117         /**
       
   118         * Checks if entry aId has unread children.
       
   119         * @param aId: folder or service to be checked.
       
   120         * @return ETrue if unread children found.
       
   121         */
       
   122         TBool HasUnreadMessagesL( const TMsvId aId );
       
   123 
       
   124         /**
       
   125         * Changes the bitmaps in icon array, if skin is changed
       
   126         */
       
   127         void ChangeBitmapInIconArrayL(  );
       
   128 
       
   129         /**
       
   130         * Loads correct bitmap of the message from the mtm ui data and changes
       
   131         * it to the last of the iIcons array. In ConstructL dummy icon is added to the
       
   132         * last so that it can be changed.
       
   133         * @param aEntry: entry to be loaded.
       
   134         *        aPriority ETrue if the method is called to retrieve the icon of
       
   135         *                  high or low priority of a MMS
       
   136         * @return Index of the bitmap requested.
       
   137         */
       
   138         TInt LoadBitmapL( const TMsvEntry& aEntry );
       
   139 
       
   140         /**
       
   141         * Returns bitmap index which is used as placeholder for
       
   142         * mtm icons
       
   143         * @since 3.0
       
   144         * @return index in the icon array
       
   145         */
       
   146         //TInt MtmIconIndex();
       
   147         
       
   148         
       
   149         /**
       
   150         * @return: Icon id in the tree list. KErrNotFound if icon is not added to tree list...
       
   151         */        
       
   152         TInt GetBitmapL( TMsvEntry& aEntry, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
       
   153         
       
   154         /**
       
   155         *
       
   156         */        
       
   157         TInt GetBitmapL( TMceBitmapArrayIndexes aBitmapIndex, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
       
   158         
       
   159         /**
       
   160         *
       
   161         */
       
   162         TInt AddTreeIconIdL( 
       
   163             CFbsBitmap* aBitmap, 
       
   164             TInt aTreeIconIndex,
       
   165             TUid aMtmUid );
       
   166         
       
   167         /**
       
   168         *
       
   169         */
       
   170         void SetTreeIconId( TMceBitmapArrayIndexes aBitmapIndex, TInt aTreeIconIndex );
       
   171         
       
   172         /**
       
   173         *
       
   174         */
       
   175         TInt TreeIconId( TMceBitmapArrayIndexes aBitmapIndex );
       
   176         
       
   177         /**
       
   178         *
       
   179         */
       
   180         void SkinChangedL( CAknSingleColumnStyleTreeList* aListbox );
       
   181         
       
   182         /**
       
   183         * Updates icon array
       
   184         * @param aListbox
       
   185         */
       
   186         void UpdateIconArrayL( CAknSingleColumnStyleTreeList* aListbox );
       
   187         
       
   188     private:
       
   189 
       
   190         /**
       
   191         * Constructor.
       
   192         */
       
   193         CMceOneRowBitmapResolver(
       
   194             CMsvSessionPtr aSession,
       
   195             MMtmUiDataRegistryObserver& aRegObserver );
       
   196 
       
   197         /**
       
   198         * By default Symbian OS constructor is private.
       
   199         */
       
   200         void ConstructL();
       
   201 
       
   202         /**
       
   203         * Returns bitmap index of the entry
       
   204         * @param aEntryId: id of the entry to be returned
       
   205         * @return index of the bitmap
       
   206         */
       
   207         TInt LocalEntryBitmapIndex( TMsvId aEntryId ) const;
       
   208         
       
   209         enum TMceOneRowBitmapLoadType
       
   210             {
       
   211             EMceOneRowBitmapLoadNormal = 0,
       
   212             EMceOneRowBitmapLoadSkinned,
       
   213             EMceOneRowBitmapLoadSkinnedHighlight
       
   214             };
       
   215 
       
   216 
       
   217         /**
       
   218         * Loads and adds local bitmap to icon array.
       
   219         * @param aId
       
   220         * @param aFileName
       
   221         * @param aBitmapIndex
       
   222         * @param aBitmapType: 0 = 'normal', 1 = skinned, 2 = skinned highlighted
       
   223         */
       
   224         void CreateAndAppendIconL( 
       
   225             MAknsSkinInstance* aSkin,
       
   226             TAknsItemID aId,
       
   227             const TDesC& aFileName,
       
   228             TInt aBitmapIndex, 
       
   229             TMceOneRowBitmapLoadType aBitmapType );
       
   230 
       
   231     private:    // Data
       
   232         MMtmUiDataRegistryObserver& iRegObserver;
       
   233         CMsvSessionPtr              iSession;
       
   234         CArrayPtrFlat<CGulIcon>*    iIcons;
       
   235 
       
   236         // security data caging
       
   237         TFileName                   iFilenameMuiu;
       
   238         TFileName                   iFilenameAvkon;
       
   239         TInt                        iBitmapsLoaded;
       
   240         RMceListIconArray           iIconArray;
       
   241 
       
   242 
       
   243     };
       
   244 
       
   245 
       
   246 #endif
       
   247 
       
   248 
       
   249 // End of file