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