messagingappbase/mce/inc/MceBitmapResolver.h
changeset 0 72b543305e3a
child 15 52d61119153d
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 MCEBITMAPRESOLVER_H
       
    24 #define MCEBITMAPRESOLVER_H
       
    25 
       
    26 //  INCLUDES
       
    27 
       
    28 #include "mcetemplate.h"
       
    29 #include <AknsUtils.h>
       
    30 
       
    31 // CONSTANTS
       
    32 const TInt KMceMmsPriority = 1;	// For loading the MMS priority icons
       
    33 
       
    34 // DATA TYPES
       
    35 // these should correspond to the icon array created in CMceBitmapResolver::ConstructL
       
    36 enum TMceBitmapArrayIndexes
       
    37     {
       
    38     EMceBitmapIndexMessageSelected = 0,
       
    39     EMceBitmapIndexWrite,
       
    40     EMceBitmapIndexRemote,
       
    41     EMceBitmapIndexRemoteNew,
       
    42     EMceBitmapIndexDr,
       
    43     EMceBitmapIndexInbox,
       
    44     EMceBitmapIndexInboxNew,
       
    45     EMceBitmapIndexDocuments,
       
    46     EMceBitmapIndexDocumentsNew,
       
    47     EMceBitmapIndexDrafts,
       
    48     EMceBitmapIndexSent,
       
    49     EMceBitmapIndexOutbox,
       
    50     EMceBitmapIndexUnknown,
       
    51     EMceBitmapIndexFolderTemp,
       
    52     EMceBitmapIndexFolderSmall,
       
    53     EMceBitmapIndexFolderSmallNew,
       
    54     EMceBitmapIndexAttachment,
       
    55     EMceBitmapIndexMailboxConnectionOn,
       
    56     EMceBitmapIndexAlwaysAdd,
       
    57     EMceBitmapIndexInactiveAdd,
       
    58     EMceBitmapIndexAlwaysRoaming,
       
    59     EMceBitmapIndexPriorityHigh,
       
    60     EMceBitmapIndexPriorityLow,
       
    61     EMceBitmapIndexReplaceMtmIcon // this MUST be last
       
    62     };
       
    63 
       
    64 // FORWARD DECLARATIONS
       
    65 class CMsvSession;
       
    66 class MMtmUiDataRegistryObserver;
       
    67 
       
    68 // CLASS DECLARATION
       
    69 
       
    70 /**
       
    71 *  Helper class for bitmap resolver.
       
    72 */
       
    73 class TMceBitmapListItem
       
    74     {
       
    75     public:                     // Data
       
    76         TBool       iExtraItem;
       
    77         TUid        iType;  // if extra item, includes application uid to load correct application icon...
       
    78         TUid        iMtm;
       
    79         TInt        iIndex; // probably not neccessary
       
    80         TMsvId      iId;    // needed with inbox, outbox, etc.
       
    81     };
       
    82 
       
    83 /**
       
    84 *  Handles different mce bitmaps.
       
    85 *  First collects all the bitmaps from different mtm's and also local
       
    86 *  folder's bitmaps to icon array.
       
    87 */
       
    88 class CMceBitmapResolver : public CBase
       
    89     {
       
    90     public:  // Constructors and destructor
       
    91 
       
    92         /**
       
    93         * Two-phased constructor.
       
    94         */
       
    95         static CMceBitmapResolver* NewL(
       
    96             CMsvSessionPtr aSession,
       
    97             MMtmUiDataRegistryObserver& aRegObserver,
       
    98             TBool aLargeIcons );
       
    99 
       
   100         /**
       
   101         * Destructor.
       
   102         */
       
   103         ~CMceBitmapResolver();
       
   104 
       
   105         /**
       
   106         * Returns pointer to icon array.
       
   107         * @return Pointer to icon array.
       
   108         */
       
   109         CArrayPtrFlat<CGulIcon>* IconArray();
       
   110 
       
   111         /**
       
   112         * Can be used to get index of the bitmap of the message.
       
   113         * @param aItem: Fill TMceBitmapListItem fields before calling this.
       
   114         * @return Index of the bitmap requested.
       
   115         */
       
   116         TInt BitmapIndex( const TMceBitmapListItem& aItem ) const;
       
   117 
       
   118         /**
       
   119         * Can be used to get index of the bitmap of the message.
       
   120         * Loads bitmap from the mtm ui data and changes it to be last icon in icon array
       
   121         * @param aEntry: Fill TMsvEntry fields before calling this.
       
   122         * @return Index of the bitmap requested.
       
   123         */
       
   124         TInt BitmapIndex( const TMsvEntry& aEntry );
       
   125 
       
   126 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT
       
   127         /**
       
   128         * Can be used to get index of the bitmap of the message.
       
   129         * Loads bitmap from the mtm ui data and changes it to be last icon in icon array
       
   130         * Since 5.0
       
   131         * @param aEntry: Fill TMsvEntry fields before calling this.
       
   132         * @param aMessageCount: number of messages under the entry (0 if entry is not folder)
       
   133         * @return Index of the bitmap requested.
       
   134         */
       
   135         TInt BitmapIndex( const TMsvEntry& aEntry, TInt& aMessageCount );
       
   136 
       
   137         /**
       
   138         * Checks if entry aId has unread children.
       
   139         * Since 5.0
       
   140         * @param aId: folder or service to be checked.
       
   141         * @param aMessages:number of messages under the folder or service.
       
   142         * @param aUnreadMessages: number of unread messages under the folder or service.
       
   143         * @return ETrue if unread children found.
       
   144         */
       
   145         TBool HasUnreadMessagesL( const TMsvId aId, TInt& aMessages, TInt& aUnreadMessages );
       
   146 #else
       
   147 
       
   148         /**
       
   149         * Checks if entry aId has unread children.
       
   150         * @param aId: folder or service to be checked.
       
   151         * @return ETrue if unread children found.
       
   152         */
       
   153         TBool HasUnreadMessagesL( const TMsvId aId );
       
   154 #endif // RD_MSG_NAVIPANE_IMPROVEMENT
       
   155 
       
   156         /**
       
   157         * Changes the bitmaps in icon array, if skin is changed
       
   158         */
       
   159         void ChangeBitmapInIconArrayL(  );
       
   160  
       
   161         /**
       
   162         * Loads correct bitmap of the message from the mtm ui data and changes
       
   163         * it to the last of the iIcons array. In ConstructL dummy icon is added to the
       
   164         * last so that it can be changed.
       
   165         * @param aEntry: entry to be loaded.
       
   166         *        aPriority ETrue if the method is called to retrieve the icon of
       
   167         *                  high or low priority of a MMS
       
   168         * @param aHasUnreadMessages ETrue if current service/folder has unread messages, othervise EFalse.
       
   169         *        this is needed because BitmapIndex is already doing this calculation so prevent duplicate calculation.
       
   170         * @return Index of the bitmap requested.
       
   171         */
       
   172 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT
       
   173         TInt LoadBitmapL( const TMsvEntry& aEntry, TBool aPriority = EFalse );
       
   174 #else
       
   175         TInt LoadBitmapL( const TMsvEntry& aEntry, TBool aHasUnreadMessages );
       
   176 #endif
       
   177         /**
       
   178         * Loads and adds local bitmap to icon array.
       
   179         * @param aId
       
   180         * @param aFileName
       
   181         * @param aBitmapIndex
       
   182         * @param aListItem
       
   183         */
       
   184         void CreateAndAppendIconL(
       
   185             TAknsItemID aId,
       
   186             const TDesC& aFileName,
       
   187             TInt aBitmapIndex,
       
   188             const TMceBitmapListItem* aListItem = NULL,
       
   189             TBool aColorSkinnedIcon = EFalse );
       
   190 
       
   191                     
       
   192         /**
       
   193         * Returns bitmap index which is used as placeholder for
       
   194         * mtm icons
       
   195         * @since 3.0
       
   196         * @return index in the icon array
       
   197         */
       
   198         TInt MtmIconIndex();
       
   199         
       
   200         /**
       
   201         * description length defined in muiu cenrep file.
       
   202         * KCRUidMuiuSettings / KMuiuDescriptionLength
       
   203         */
       
   204         TInt DescriptionLength();
       
   205         
       
   206         
       
   207     private:
       
   208 
       
   209         /**
       
   210         * Constructor.
       
   211         */
       
   212         CMceBitmapResolver(
       
   213             CMsvSessionPtr aSession,
       
   214             MMtmUiDataRegistryObserver& aRegObserver,
       
   215             TBool aLargeIcons );
       
   216 
       
   217         /**
       
   218         * By default Symbian OS constructor is private.
       
   219         */
       
   220         void ConstructL();
       
   221 
       
   222         /**
       
   223         * Loads and adds local bitmap to icon array. Uses \system\data\muiu.mbm
       
   224         * @param aId
       
   225         * @param aBitmapIndex
       
   226         * @param aListItem
       
   227         */
       
   228         void CreateAndAppendIconL(
       
   229             TAknsItemID aId,
       
   230             TInt aBitmapIndex,
       
   231             const TMceBitmapListItem* aListItem = NULL );
       
   232 
       
   233         /**
       
   234         * Returns bitmap index of the entry
       
   235         * @param aEntryId: id of the entry to be returned
       
   236         * @return index of the bitmap
       
   237         */
       
   238         TInt LocalEntryBitmapIndex( TMsvId aEntryId ) const;
       
   239 
       
   240     private:    // Data
       
   241         MMtmUiDataRegistryObserver& iRegObserver;
       
   242         CMsvSessionPtr              iSession;
       
   243         TBool                       iLargeIcons; // ETrue if large icons == main view
       
   244 
       
   245         CArrayPtrFlat<CGulIcon>*    iIcons;
       
   246         CArrayFixFlat<TMceBitmapListItem>* iIconIndexes;
       
   247 
       
   248         // security data caging
       
   249         TFileName                   iFilenameMuiu;
       
   250         TFileName                   iFilenameAvkon;
       
   251         TInt                        iBitmapsLoaded;
       
   252         
       
   253         TInt                        iDescriptionLength;
       
   254 
       
   255 
       
   256     };
       
   257 
       
   258 
       
   259 #endif
       
   260 
       
   261 
       
   262 // End of file