messagingappbase/mce/inc/MceMessageListItemArray.h
changeset 0 72b543305e3a
child 14 c6838af47512
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 *     Item array for the message items to be displayed by mce.
       
    16 *     Main view items are kept in memory (CArrayFixFlat<TMceListItem>) when created but
       
    17 *     Message view list items are fetched from the msgs when needed in MdcaPoint function
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef MCEMESSAGELISTITEMARRAY_H
       
    24 #define MCEMESSAGELISTITEMARRAY_H
       
    25 
       
    26 //  INCLUDES
       
    27 
       
    28 #include <msvapi.h>     // MMsvSessionObserver
       
    29 #include <bldvariant.hrh>
       
    30 #include "MceListItem.h"
       
    31 #include "MceUtils.h"
       
    32 #include "MceUtilsIdleClass.h"
       
    33 
       
    34 #include "mcetemplate.h"
       
    35 #include <PhCltTypes.h>
       
    36 
       
    37 // CONSTANTS
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CMsvSession;
       
    41 class CMceBitmapResolver;
       
    42 class MMtmUiDataRegistryObserver;
       
    43 class CMtmUiDataRegistry;
       
    44 class CImumInternalApi;
       
    45 class CImumInSettingsData;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50 *  Item array for the message items to be displayed by mce.
       
    51 *  Main view items are kept in memory (CArrayFixFlat<TMceListItem>) when created but
       
    52 *  Message view list items are fetched from the msgs when needed in MdcaPoint function
       
    53 */
       
    54 class CMceMessageListItemArray :
       
    55     public CBase, //CArrayFixFlat<TMceListItem>,
       
    56     public MMsvSessionObserver,
       
    57     public MDesCArray
       
    58 //    public MMceUtilsIdleClassObserver
       
    59     {
       
    60     public:
       
    61         /**
       
    62         * Two-phased constructor.
       
    63         */
       
    64         static CMceMessageListItemArray* NewL(
       
    65             CMsvSessionPtr aSession,
       
    66             TMsvId aFolderId,
       
    67             TMceListType aListType,
       
    68             CMceBitmapResolver& aBitmapResolver );
       
    69 
       
    70         /**
       
    71         * Destructor.
       
    72         */
       
    73         virtual ~CMceMessageListItemArray();
       
    74 
       
    75     public:
       
    76 
       
    77         /**
       
    78         * Returns list index of the message
       
    79         * @param aItemId: item to be searched.
       
    80         * @return Index of the item.
       
    81         */
       
    82         TInt ItemIndex( TMsvId aItemId ) const;
       
    83 
       
    84         /**
       
    85         * Returns message id of the list item.
       
    86         * @param aIndex: index of the item to be returned
       
    87         * @return message id (TMsvId)
       
    88         */
       
    89         TMsvId ItemId( TInt aIndex ) const;
       
    90 
       
    91         /**
       
    92         * @param aIndex
       
    93         * @return TMceListItem
       
    94         */
       
    95         const TMceListItem Item( TInt aIndex ) const;
       
    96 
       
    97         /**
       
    98         * Changes folder of the list.
       
    99         * @param aFolderId: folder id to be changed.
       
   100         */
       
   101         void SetFolderL( TMsvId aFolderId );
       
   102         
       
   103         
       
   104         TInt MessageCount();
       
   105         TInt FolderCount();
       
   106         
       
   107         /**
       
   108         *
       
   109         */
       
   110         TInt GetEntry( TMsvId aEntryId, TMsvEntry& aEntry );
       
   111 
       
   112         /**
       
   113         * Add item not in msgs (CBS, ...).
       
   114         * @param aNewItem: TMceListItem to be added to the list
       
   115         * @param aIndex: index in the list to be added (0 = first)
       
   116         */
       
   117 //        void AddExtraItemL( TMceListItem& aNewItem, TInt aIndex );
       
   118 
       
   119         /**
       
   120         * Add item not in msgs (CBS, ...).
       
   121         * @param aNewItem: TMceListItem to be added to the list
       
   122         * @param aIndex: index in the list to be added (0 = first)
       
   123         * @param aIconIndex: index of the icon in file MceExtraIcons
       
   124         * @param aApplicationUid: Related Application uid. This is used 
       
   125         *        when loading correct application icon. If this is not set, 
       
   126         *        then icon is loaded from MceExtraIcons.
       
   127         */
       
   128 /*        void AddExtraItemWithIconL( 
       
   129             TMceListItem& aNewItem, 
       
   130             TInt aIndex, 
       
   131             TInt aIconIndex,
       
   132             TUid aApplicationUid );
       
   133 */
       
   134       /**
       
   135         * Check if item is folder
       
   136         * @param aItemId: id of the item to be checked
       
   137         * @return ETrue if item is folder
       
   138         */
       
   139         TBool IsItemFolder( TMsvId aItemId ) const;
       
   140 
       
   141       /**
       
   142         * Sets MtmUiDataRegistryObserver
       
   143         * Needed only by Outbox list to get status of the message
       
   144         * @param aRegistryObserver: registry observer (usually object of CMceUi)
       
   145         * @return none
       
   146         */
       
   147         void SetRegistryObserver( MMtmUiDataRegistryObserver* aRegistryObserver );
       
   148 
       
   149         /**
       
   150         * Finds entry index in message list
       
   151         * @param aMatchString: the string which is searched
       
   152         */
       
   153         TInt FindEntryIndex( const TDesC& aMatchString ) const;
       
   154 
       
   155         /**
       
   156         * Sets sort order in folder entry
       
   157         * @param aOrdering: the sort order
       
   158         */
       
   159         void SetOrderingL( TInt aOrdering );
       
   160 
       
   161         /**
       
   162         * Help needs info, if remote folder or own folder
       
   163         */
       
   164         TBool IsFolderRemote() const;        
       
   165         TBool IsItemRemote( TMsvId aItemId ) const;
       
   166 
       
   167         /**
       
   168         * Checks, if Delete should be discarded in outbox
       
   169         * @param aItemId: id of the item to be checked
       
   170         * @return ETrue, if Delete should be discarded
       
   171         */
       
   172         TBool DeleteDiscard( TMsvId aItemId ) const;
       
   173 
       
   174         /**
       
   175         * Sets roaming flag
       
   176         * @param aRoaming: roaming flag         
       
   177         */
       
   178 //        void SetRoaming( TBool aRoaming );
       
   179        
       
   180         /**
       
   181         * Gets roaming flag            
       
   182         */
       
   183 //        TBool Roaming() const;
       
   184 
       
   185         /**
       
   186         * Sets always online flag
       
   187         * @param aAlwaysOnline: always online flag         
       
   188         */
       
   189 //        void SetAlwaysOnline( TBool aAlwaysOnline );
       
   190 
       
   191         /**
       
   192         * Sets sort order
       
   193         * @param aSortType: sort type
       
   194         * @param aOrdering: sort ordering(ascending/descending)  
       
   195         */
       
   196         void SetOrderingL( TInt aSortType, TBool aOrdering );
       
   197 
       
   198         /**
       
   199         * returns sort type
       
   200         */
       
   201         TMsvSelectionOrdering SortType();
       
   202 
       
   203 #ifdef RD_READ_MESSAGE_DELETION 
       
   204         /**
       
   205         * returns folder's parent folder Id
       
   206         */
       
   207         TMsvId GetParentFolderId() const; 
       
   208 #endif //RD_READ_MESSAGE_DELETION 
       
   209 
       
   210     public:     // Functions from base classes
       
   211 
       
   212         /**
       
   213         * From MDesCArray
       
   214         */
       
   215         virtual TInt MdcaCount() const;
       
   216 
       
   217         /**
       
   218         * From MDesCArray
       
   219         */
       
   220         virtual TPtrC MdcaPoint(TInt aIndex) const;
       
   221 
       
   222     public:    // Functions from base classes
       
   223         /**
       
   224         * From MMsvSessionObserver
       
   225         */
       
   226         virtual void HandleSessionEventL(
       
   227             TMsvSessionEvent aEvent,
       
   228             TAny* aArg1,
       
   229             TAny* aArg2,
       
   230             TAny* aArg3);
       
   231 
       
   232         /**
       
   233         * Reconstructs main view folder list
       
   234         */
       
   235 //        void ConstructMainViewL();
       
   236 
       
   237         /**
       
   238         * Currently opened folder id
       
   239         */
       
   240         TMsvId FolderId() const;        
       
   241         
       
   242         
       
   243         /**
       
   244         *
       
   245         */
       
   246         const TMsvEntry& FolderEntry() const;
       
   247 
       
   248         /**
       
   249         * Help needs info, if remote account is connected
       
   250         */
       
   251         TBool IsConnected() const;
       
   252         
       
   253         /**
       
   254         *
       
   255         */
       
   256 //        void ResetIconIndexL( TInt aIndex );
       
   257         
       
   258         /**
       
   259         *
       
   260         */
       
   261 //        void StartListUpdateL();
       
   262         
       
   263 //        TBool MMceUtilsIdleClassStepL();
       
   264 //        void SetListItemArrayObserver( MMceListItemArrayObserver* aObserver );
       
   265 
       
   266 
       
   267         /*
       
   268         *
       
   269         */
       
   270         TBool FindFirstUnreadMessageL( TMsvId& aEntryId ) const;
       
   271     
       
   272     
       
   273     private:
       
   274 
       
   275         /**
       
   276         * By default Symbian OS constructor is private.
       
   277         */
       
   278         void ConstructL();
       
   279 
       
   280         /**
       
   281         *
       
   282         */
       
   283         CMceMessageListItemArray(
       
   284             CMsvSessionPtr aSession,
       
   285             TMsvId aFolderId,
       
   286             TMceListType aListType,
       
   287             CMceBitmapResolver& aBitmapResolver );
       
   288 
       
   289         /**
       
   290         * Adds TMsvEntry to the array (used only in Main view).
       
   291         * @param aEntry TMsvEntry of the item to be added.
       
   292         * @return nothing
       
   293         */
       
   294 //        void AddItemL( const TMsvEntry& aEntry );
       
   295 
       
   296         /**
       
   297         * Adds folders to the array (used only in Main view)
       
   298         * @param aId id of the folder
       
   299         */
       
   300 //        void AddFoldersL( TMsvId aId );
       
   301 
       
   302         /**
       
   303         * Adds folders Inbox and Documents to the array
       
   304         * (used only in Main view).
       
   305         */
       
   306 //        void AddInboxDocumentsL();
       
   307 
       
   308         /**
       
   309         * Adds folders Draft, Sent, Outbox to the array
       
   310         * (used only in Main view).
       
   311         */
       
   312 //        void AddDraftSentOutboxL();
       
   313 
       
   314         /**
       
   315         * Creates send status string.
       
   316         * @param aText buffer status string is put.
       
   317         * @param aEntry TMsvEntry of the item.
       
   318         */
       
   319         void MakeSendStatusStringL(TDes& aText, const TMsvEntry& aEntry) const;
       
   320 
       
   321         /**
       
   322         * Appends aSourceString to aTargetString and changes KColumnListSeparator
       
   323         * characters to space characters.
       
   324         * @param aTargetString buffer to append aSource string.
       
   325         * @param aSourceString source buffer.
       
   326         */
       
   327         void StripAndAppendString(TDes& aTargetString, const TDesC& aSourceString) const;
       
   328 
       
   329         /**
       
   330         * Creates string for message list view listbox. Called by MdcaPoint.
       
   331         * @param aIndex: index of the message to be drawn
       
   332         */
       
   333         TPtrC MakeStringForMessageView( TInt aIndex ) const;
       
   334 
       
   335         /**
       
   336         * Creates string for main view listbox. Called by MdcaPoint.
       
   337         * @param aIndex: index of the message to be drawn
       
   338         */
       
   339 //        TPtrC MakeStringForMainView( TInt aIndex ) const;
       
   340 
       
   341         /**
       
   342         * Appends folder entry string to the buffer.
       
   343         * @param aBuffer: buffer to be append
       
   344         * @param aEntry: entry to be append. Must be folder.
       
   345         */
       
   346         void AppendFolderString( TDes& aBuffer, const TMsvEntry& aEntry ) const;
       
   347 
       
   348         /**
       
   349         * Appends message entry string to the buffer.
       
   350         * @param aBuffer: buffer to be append
       
   351         * @param aEntry: entry to be append. Must be message.
       
   352         */
       
   353         void AppendMessageString( TDes& aBuffer, const TMsvEntry& aEntry ) const;
       
   354 
       
   355 
       
   356         /**
       
   357         * Appends recipient string to the buffer.
       
   358         * @param aBuffer: buffer to be append
       
   359         * @param aEntry: entry to be append. Must be message.
       
   360         */
       
   361         void AppendRecipientStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const;
       
   362         
       
   363         /**
       
   364         * Checks if always online account and always online date/time valid
       
   365         * @param aAccount: service id
       
   366         * @return ETrue,if always online account and always online date/time valid
       
   367         */
       
   368 //        TBool AlwaysOnlineDateTimeValidL( const TMsvId aAccount, TBool &aoDefined ) const;
       
   369 
       
   370 
       
   371         /**
       
   372         * This performs number grouping to the given phone number if required.
       
   373         *
       
   374         * @param aPhoneNumber (in/out): A valid phone number to be reformated
       
   375         * with number grouping. If number grouping feature is turned on and
       
   376         * the give phone number does not already exceed the maximum displayable
       
   377         * length for number grouping, the reformated phone number with number
       
   378         * grouping is returned. Otherwise, the phone number remains unchanged.
       
   379         *
       
   380         * NOTE: Caller must validate the phone number and pass the phone
       
   381         *       number if it's valid.
       
   382         * @return none
       
   383         * @since 2.7
       
   384         */
       
   385         void DoNumberGroupingL( TDes& aPhoneNumber ) const;
       
   386 
       
   387         /**
       
   388         * Creates inbox status string for MMS notification
       
   389         * @param aText buffer status string is put.
       
   390         * @param aEntry TMsvEntry of the item.
       
   391         */
       
   392         void MakeInboxStatusStringL( TDes& aText, const TMsvEntry& aEntry ) const;
       
   393 
       
   394         /**
       
   395         * Handles folders, messages string
       
   396         * @param aBuffer: buffer to be append
       
   397         * @param aEntry TMsvEntry of the item.
       
   398         */
       
   399         void HandleFolderMessagesStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const; 
       
   400     
       
   401         /**
       
   402         * Removes the prefixes from the given text string
       
   403         * @param aTextString: Text string
       
   404         */
       
   405         TInt SkipPrefix( TPtrC aTextString ) const;
       
   406         
       
   407         /**
       
   408         * Saves new orderding to root entry
       
   409         * @param aNewOrdering
       
   410         * @since 3.0
       
   411         */
       
   412         void SaveOrderingL( const TMsvSelectionOrdering& aNewOrdering ) const;
       
   413 
       
   414         /**
       
   415         * Appends Bt/IrDa message entry string to the buffer.
       
   416         * @param aBuffer: buffer to be append
       
   417         * @param aEntry: entry to be append. Must be message.
       
   418         */
       
   419         void AppendBtIrMessageStringL( TDes& aBuffer, const TMsvEntry& aEntry ) const;
       
   420 
       
   421         /**
       
   422          * 
       
   423          *
       
   424          * @since S60 v3.2
       
   425          * @param 
       
   426          * @return 
       
   427          * @leave &(leavedesc)s
       
   428          */
       
   429         void StoreIndex( const TInt aIndex );
       
   430     
       
   431         /**
       
   432          * 
       
   433          *
       
   434          * @since S60 v3.1
       
   435          * @param 
       
   436          * @return 
       
   437          * @leave 
       
   438          */
       
   439 /*        void MakeItemL( 
       
   440             TMceListItem& aListItem, 
       
   441             const TMsvEntry& aEntry ) const;
       
   442 */
       
   443         /**
       
   444          * 
       
   445          *
       
   446          * @since S60 v3.1
       
   447          * @param 
       
   448          * @return 
       
   449          * @leave 
       
   450          */
       
   451 /*        void InsertItemL( 
       
   452             const TMsvEntry& aEntry, 
       
   453             const TInt aIndex );
       
   454 */
       
   455         /**
       
   456          * Checks if the entry can be added to list
       
   457          *
       
   458          * @since S60 v3.1
       
   459          * @param aEntry Entry to be checked
       
   460          * @param aId Id to be checked
       
   461          * @return ETrue when the entry can be added to list
       
   462          * @return EFalse when the entry can NOT be added to list
       
   463          */
       
   464 /*        TBool ShouldAddToList( 
       
   465             const TMsvEntry& aEntry,
       
   466             const TMsvId aId );
       
   467 */
       
   468 
       
   469         /**
       
   470          * Gathers all the services that needs to be shown to the list
       
   471          *
       
   472          * @since S60 v3.1
       
   473          * @leave KErrNoMemory when failed to add item to list
       
   474          * @return Index of the draft folder
       
   475          */
       
   476 //        TInt CollectServicesL( const TMsvId aId );
       
   477 
       
   478         /**
       
   479          * 
       
   480          *
       
   481          * @since S60 v3.1
       
   482          * @param 
       
   483          * @return 
       
   484          * @leave 
       
   485          */
       
   486 //        void AddMailboxesL( const TInt aMailboxIndex );
       
   487         
       
   488         /**
       
   489         *
       
   490         */
       
   491         void AppendMessageCountString( TDes& aBuffer, TInt aMessageCount) const;
       
   492         
       
   493         /**
       
   494         *
       
   495         */
       
   496         void AppendTimeStringL( TDes& aText, const TMsvEntry& aEntry ) const;
       
   497 
       
   498         //FS Email stuff
       
   499         TInt CreateEntryIndexL() const;
       
   500         TInt GetEntryIndex( TInt aIndex ) const;
       
   501     
       
   502     private:    // Data
       
   503         CMsvSessionPtr                  iSession;
       
   504         CMsvEntry*                      iFolderEntry;
       
   505         TMsvId                          iFolderId;
       
   506         TMceListType                    iListType;
       
   507         CMceBitmapResolver&             iBitmapResolver;
       
   508         MMtmUiDataRegistryObserver*     iRegistryObserver;
       
   509         HBufC*                          iListBoxText;
       
   510         CDesCArrayFlat*                 iNumberOfMessagesStrings;
       
   511         TBool                           iAlwaysOnline;
       
   512         TBool                           iRoaming;
       
   513         TBool                           iNumberGroupingEnabledFlag;
       
   514         CMtmUiDataRegistry*             iUiRegistry;
       
   515         TMsvSelectionOrdering           iPreviousSelectionOrdering;
       
   516         TInt                            iDescriptionLength;
       
   517         // ETrue if MCE integration feature is ON. In practice, this means
       
   518         // that S60 mailboxes are hided from MCE main view
       
   519         TBool iEmailClientIntegration;
       
   520         
       
   521         // ETrue if there is other than platform email application registered
       
   522         // to handle S60 mailboxes
       
   523         TBool iIntegratedEmailAppExcist;
       
   524         CArrayFixFlat<TInt>*            iMsgIndex;
       
   525         
       
   526         /**
       
   527          * CMail Changes, it will be ETrue if 
       
   528          * KFeatureIdFfEmailFramework is enabled
       
   529          */
       
   530         TBool  iEmailFramework;          
       
   531     };
       
   532 
       
   533 #endif      // MCEMESSAGELISTITEMARRAY_H
       
   534 
       
   535 // End of File