messagingappbase/mce/inc/MceOneRowMessageListContainer.h
changeset 79 2981cb3aa489
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     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 *     Container for main view.
       
    16 *     Derived from CMceListContainer.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MCEONEROWMESSAGELISTCONTAINER_H
       
    23 #define MCEONEROWMESSAGELISTCONTAINER_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <coecntrl.h> // CCoeControl
       
    27 #include <bldvariant.hrh>
       
    28 #include <akntreelistobserver.h>
       
    29 #include <msvstd.h>
       
    30 
       
    31 #include "MceMessageListContainerBase.h"
       
    32 #include "MceMessageListContTimer.h"
       
    33 #include "MceOneRowMessageListArray.h"
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CMceOneRowListItemArray;
       
    37 class CAknSingleColumnStyleTreeList;
       
    38 class CAknsBasicBackgroundControlContext;
       
    39 class CPtiEngine;
       
    40 class CAknTreeList;
       
    41 class CMtmUiDataRegistry;
       
    42 // CLASS DECLARATION
       
    43 
       
    44 
       
    45 /**
       
    46 *  Container for main view.
       
    47 *  Derived from CMceListContainer.
       
    48 */
       
    49 class  CMceOneRowMessageListContainer :
       
    50     public CMceMessageListContainerBase,
       
    51     public MAknTreeListObserver,
       
    52     public MMceOneRowListItemArrayObserver
       
    53     {
       
    54     public:  // Constructors and destructor
       
    55 
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         */
       
    59         static CMceOneRowMessageListContainer* NewL(
       
    60             CMceMessageListView& aParentView,
       
    61             const TRect& aRect,
       
    62             CMsvSessionPtr aSession,
       
    63             MMtmUiDataRegistryObserver& aRegObserver );
       
    64 
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CMceOneRowMessageListContainer();
       
    69 
       
    70         /**
       
    71         * From MAknTreeListObserver.
       
    72         * Handles tree list events.
       
    73         */
       
    74         TBool HandleTreeListEvent( CAknTreeList& aList, TAknTreeItemID aItem,
       
    75             TEvent aEvent );
       
    76 
       
    77         /**
       
    78         * Resets tree list
       
    79         */
       
    80         void ResetListbox();
       
    81 
       
    82         /**
       
    83         * Returns ETrue if empty list or there are items selected.
       
    84         */
       
    85         TBool DisplayOptionsMenuFromSelectionKey() const;
       
    86 
       
    87         /**
       
    88         * From MMceOneRowListItemArrayObserver
       
    89         */
       
    90         void MceListItemArrayChangedL(
       
    91             CArrayFixFlat<TInt>& aChangedItems );
       
    92 
       
    93         /**
       
    94         * From MMceOneRowListItemArrayObserver
       
    95         */
       
    96         void HandleMarkCommandL( TInt aCommand );
       
    97 
       
    98         /**
       
    99         * From CMceMessageListContainerBase
       
   100         */
       
   101         TInt MceListId() const;
       
   102 
       
   103         /**
       
   104         * From CMceMessageListContainerBase
       
   105         */
       
   106         virtual TInt Count() const;
       
   107 
       
   108         /**
       
   109         * From CMceMessageListContainerBase
       
   110         */
       
   111         virtual TInt MessageCount() const;
       
   112 
       
   113         /**
       
   114         * From CMceMessageListContainerBase
       
   115         */
       
   116         virtual TInt FolderCount() const;
       
   117 
       
   118         /**
       
   119         * From CMceMessageListContainerBase
       
   120         */
       
   121         virtual TBool SetCurrentItemIdL( TMsvId aEntryId );
       
   122 
       
   123         /**
       
   124         * From CMceMessageListContainerBase
       
   125         */
       
   126         virtual void ResetCurrentItemL();
       
   127 
       
   128         /**
       
   129         * From CMceMessageListContainerBase
       
   130         */
       
   131         TMsvId FindEntry( const TDesC& aMatchString ) const;
       
   132 
       
   133         /**
       
   134         * From CMceMessageListContainerBase
       
   135         */
       
   136         virtual void ItemCountChangedL( TBool aItemsAdded,
       
   137                 CArrayFix<TInt>* aAddedIndexes = 0 );
       
   138 
       
   139         /**
       
   140         * From CMceMessageListContainerBase
       
   141         */
       
   142         virtual void RefreshListbox();
       
   143 
       
   144         /**
       
   145         * From CMceMessageListContainerBase
       
   146         */
       
   147         virtual TBool FindFirstUnreadMessageL( TMsvId& aEntryId ) const;
       
   148 
       
   149         /**
       
   150         * From CMceMessageListContainerBase
       
   151         */
       
   152         virtual TMessageListItemType CurrentItemType() const;
       
   153 
       
   154         /**
       
   155         * From CMceMessageListContainerBase
       
   156         */
       
   157         void SetFolderL( TMsvId aFolderId );
       
   158 
       
   159         /**
       
   160         * From CMceMessageListContainerBase
       
   161         */
       
   162         TMsvId CurrentFolderId() const;
       
   163 
       
   164         /**
       
   165         * From CMceMessageListContainerBase
       
   166         */
       
   167         const TMsvEntry& FolderEntry() const;
       
   168 
       
   169         /**
       
   170         * From CMceMessageListContainerBase
       
   171         */
       
   172         TInt CurrentItemIndex() const;
       
   173 
       
   174         /**
       
   175         * From CMceMessageListContainerBase
       
   176         */
       
   177         TMsvId  CurrentItemId() const;
       
   178 
       
   179         /**
       
   180         * From CMceMessageListContainerBase
       
   181         */
       
   182         CMsvEntrySelection* CurrentItemSelectionL();
       
   183 
       
   184         /**
       
   185         * From CMceMessageListContainerBase
       
   186         */
       
   187         CMsvEntrySelection* CurrentItemSelectionRefreshL();
       
   188 
       
   189         /**
       
   190         * From CMceMessageListContainerBase
       
   191         */
       
   192         TInt CurrentItemSelectionCount() const;
       
   193 
       
   194         /**
       
   195         * From CMceMessageListContainerBase
       
   196         */
       
   197         TInt SelectionCount() const;
       
   198 
       
   199         /**
       
   200         * From CMceMessageListContainerBase
       
   201         */
       
   202         virtual TBool IsItemSelected( TMsvId aItemId );
       
   203 
       
   204         /**
       
   205         * From CMceMessageListContainerBase
       
   206         */
       
   207         void ClearSelection();
       
   208 
       
   209         /**
       
   210         * From CMceMessageListContainerBase
       
   211         */
       
   212         void MarkItemSelectionL();
       
   213 
       
   214         /**
       
   215         * From CMceMessageListContainerBase
       
   216         */
       
   217         void AddCurrentItemToSelectionL();
       
   218 
       
   219         /**
       
   220         * From CMceMessageListContainerBase
       
   221         */
       
   222         void RemoveCurrentItemFromSelection();
       
   223 
       
   224         /**
       
   225         * From CMceMessageListContainerBase
       
   226         */
       
   227         void RefreshSelectionIndexesL( TBool aForceUpdate = EFalse );
       
   228 
       
   229         /**
       
   230         * From CMceMessageListContainerBase
       
   231         */
       
   232         void AddAllToSelectionL();
       
   233         
       
   234         /**
       
   235         * From CMceMessageListContainerBase
       
   236         */
       
   237         void MarkAllReadMessagesL();
       
   238 
       
   239         /**
       
   240         * From CMceMessageListContainerBase
       
   241         */
       
   242         TInt MarkedItemsCount();
       
   243 
       
   244         /**
       
   245         * From CMceMessageListContainerBase 
       
   246         */
       
   247         TBool IsCurrentItemFolder() const;
       
   248 
       
   249         /**
       
   250         * From CMceMessageListContainerBase
       
   251         */
       
   252         TBool IsItemFolder( TMsvId aItemId ) const;
       
   253 
       
   254         /**
       
   255         * From CMceMessageListContainerBase
       
   256         */
       
   257         TBool IsItemFolder( TInt aIndex ) const;
       
   258 
       
   259         /**
       
   260         * From CMceMessageListContainerBase
       
   261         */
       
   262         TBool IsItemRemote( TMsvId aItemId ) const;
       
   263 
       
   264         /**
       
   265         * From CMceMessageListContainerBase
       
   266         */
       
   267         TBool IsOpenedFolder( TMsvId aFolderId ) const;
       
   268 
       
   269         /**
       
   270         * From CMceMessageListContainerBase
       
   271         */
       
   272         virtual void SetSortTypeL( TInt aSortType, TBool aOrdering );
       
   273 
       
   274         /**
       
   275         * From CMceMessageListContainerBase
       
   276         */
       
   277         virtual void SetMtmUiDataRegistry( MMtmUiDataRegistryObserver* aRegistryObserver );
       
   278 
       
   279         /**
       
   280         * From CMceMessageListContainerBase
       
   281         */
       
   282         void SetListEmptyTextL(const TDesC& aText);
       
   283 
       
   284         /**
       
   285         * From CCoeControl
       
   286         */
       
   287         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   288 
       
   289         /**
       
   290         * From CMceMessageListContainerBase
       
   291         */
       
   292         void SetAnchorItemIdL(
       
   293             TMessageListOperationType aOperationType );
       
   294 
       
   295         /**
       
   296         * From CMceMessageListContainerBase
       
   297         */
       
   298         void HandleMsvSessionEventL(
       
   299             MMsvSessionObserver::TMsvSessionEvent aEvent,
       
   300             CMsvEntrySelection& aSelection,
       
   301             TBool aDraw );
       
   302         
       
   303         /**
       
   304         * From CMceMessageListContainerBase 
       
   305         */
       
   306         TUint OptionsCommandSupported() const;
       
   307 
       
   308         /**
       
   309         * From CMceMessageListContainerBase 
       
   310         */
       
   311         void HandleOptionsCommandL( TInt aCommand );
       
   312         
       
   313         /**
       
   314         * From CMceMessageListContainerBase 
       
   315         */
       
   316         void DateTimeFormatChangedL( TInt aChangeFlag );
       
   317 
       
   318         /**
       
   319         * From CMceMessageListContainerBase 
       
   320         */
       
   321         TInt SetSpecialMskL();
       
   322             
       
   323         /**
       
   324         * Expands focused node
       
   325         */
       
   326         void ExpandFocusedNode();
       
   327 
       
   328         /**
       
   329         * Collapses focused node
       
   330         */
       
   331         void CollapseFocusedNode();
       
   332         
       
   333         /**
       
   334         * From CMceMessageListContainerBase 
       
   335         */
       
   336         void UpdateIconArrayL( );
       
   337 		
       
   338         /**
       
   339         * From CMceMessageListContainerBase 
       
   340         */
       
   341         void SetMarkingModeOff();
       
   342 
       
   343     public:     // Functions from base classes
       
   344 
       
   345         /**
       
   346         * From CCoeControl
       
   347         */
       
   348         TInt CountComponentControls() const;
       
   349 
       
   350         /**
       
   351         * From CCoeControl
       
   352         */
       
   353         CCoeControl* ComponentControl(TInt aIndex) const;
       
   354 
       
   355         /**
       
   356         * From CCoeControl
       
   357         */
       
   358         virtual TKeyResponse OfferKeyEventL(
       
   359             const TKeyEvent& aKeyEvent,
       
   360             TEventCode aType );
       
   361 
       
   362         /**
       
   363         * From CCoeControl
       
   364         */
       
   365         void SizeChanged();
       
   366 
       
   367         /**
       
   368         * From CAknAppUi
       
   369         */
       
   370         void HandleResourceChange( TInt aType );
       
   371 
       
   372         /**
       
   373         * From MEikCommandObserver
       
   374         */
       
   375         virtual void ProcessCommandL(TInt aCommand);
       
   376 
       
   377         /**
       
   378         * Retrieves an object of the same type as that encapsulated in aId.
       
   379         *
       
   380         * @param aId An encapsulated object type ID.
       
   381         */
       
   382         TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   383 
       
   384         /**
       
   385         * Tries to find item from the currently opened list and retuns
       
   386         * list index if found. KErrNotFound if not found.
       
   387         * @param aId: item id to be searched
       
   388         * @return List index of the item.
       
   389         */
       
   390         TInt ItemIndex( TMsvId aId ) const;
       
   391 
       
   392         /**
       
   393         * From CCoeControl.
       
   394         * Draws this CHierarchicalColumnListAppView to the screen.
       
   395         *
       
   396         * @param aRect the rectangle of this view that needs updating.
       
   397         */
       
   398         void Draw( const TRect& aRect ) const;
       
   399 
       
   400         /**
       
   401         * Sets MSK command
       
   402         * @param aLabelResourceId Resource Id for MSK
       
   403         */
       
   404         void ChangeMskCommand( TInt aLabelResourceId );
       
   405 
       
   406         /**
       
   407         * From CMceMessageListContainerBase 
       
   408         */
       
   409         void SetContainerFlag( TMceContainerFlags aFlag, TBool aState );
       
   410 
       
   411     protected:  // Functions from base classes
       
   412         // From CCoeControl
       
   413         void FocusChanged(TDrawNow aDrawNow);
       
   414 
       
   415     private:
       
   416 
       
   417         /**
       
   418         * Symbian OS constructor.
       
   419         */
       
   420         void ConstructL(
       
   421             const TRect& aRect,
       
   422             CMsvSessionPtr aSession,
       
   423             MMtmUiDataRegistryObserver& aRegObserver );
       
   424 
       
   425         /**
       
   426         * Constructor is private.
       
   427         */
       
   428         CMceOneRowMessageListContainer( CMceMessageListView& aParentView );
       
   429 
       
   430         /**
       
   431          * Function that check if a key can be search
       
   432          * @param aPointerEvent The pointer event
       
   433          * @return ETrue if it can
       
   434          * since 3.2
       
   435          */
       
   436         TBool IsValidSearchKey(const TKeyEvent& aKeyEvent);
       
   437 
       
   438         /**
       
   439         * Add children items to specified node
       
   440         * @param aParentId Parent node Id
       
   441         */
       
   442         void AddChildrenL( TAknTreeItemID aParentId );
       
   443 
       
   444         /**
       
   445         * Removes children from specified node
       
   446         * @param aParentId Parent node Id
       
   447         */
       
   448         void RemoveChildren( TAknTreeItemID aParentId );
       
   449 
       
   450         /**
       
   451         * Gets number of marked items
       
   452         * @return number of marked items
       
   453         */
       
   454         TInt GetMarkedItemsCountL() const;
       
   455         
       
   456         /**
       
   457         * Adds default icons
       
   458         */
       
   459         void AddDefaultIconsL();
       
   460         
       
   461         /**
       
   462         * Adds an entry to tree list
       
   463         * @param aEntryIndex index of new entry
       
   464         */
       
   465         void AddEntryL( TInt aEntryIndex );
       
   466         
       
   467         /**
       
   468         * Updates an entry
       
   469         * @param aEntryId TMsvId of the entry to be changed
       
   470         */
       
   471         void UpdateEntryL( TMsvId aEntryId );
       
   472         
       
   473         /**
       
   474         * Updates tree list when new entry created
       
   475         * @param aSelection Items created
       
   476         * @param aDraw Will list be drawed immediality
       
   477         */
       
   478         void EntryCreatedL( 
       
   479             CMsvEntrySelection& aSelection,
       
   480             TBool aDraw );
       
   481         
       
   482         /**
       
   483         * Updates tree list when entry deleted
       
   484         * @param aSelection Items deleted
       
   485         * @param aDraw Will list be drawed immediality
       
   486         */
       
   487         void EntryDeletedL( 
       
   488             CMsvEntrySelection& aSelection,
       
   489             TBool aDraw );
       
   490         
       
   491         /**
       
   492          * Handles shortcut for search
       
   493          * Since 5.0
       
   494          */
       
   495         void HandleShortcutForSearchL( const TKeyEvent& aKeyEvent );
       
   496 
       
   497         /*
       
   498         * Function that check if * key can change msglist state
       
   499         * @return ETrue if it can
       
   500         * Since 5.0
       
   501         */
       
   502         TBool StateCanBeChangedByStarKeyL() const;
       
   503         
       
   504         /*
       
   505         *  Check if * key has been handled
       
   506         *  @return ETrue if it's handled
       
   507         *  Since 5.0
       
   508         */
       
   509         TBool HasHandleStarKeyDoneL();
       
   510         
       
   511         /*
       
   512         *  mark item read/unread
       
   513         * Since 5.0
       
   514         */
       
   515         void MarkReadUnreadWithStarKeyL();
       
   516 
       
   517         /*
       
   518         * Check if message list is sort by date
       
   519         *  @return ETrue if it is
       
   520         *  Since 5.0
       
   521         */
       
   522         TBool IsSortByDate();
       
   523 
       
   524         /*
       
   525         * Get icon id for subtitle icon
       
   526         * @param aSortType used sorting 
       
   527         * @param aSetUnread ETrue if unread type of icon
       
   528         * @return Icon id 
       
   529         */
       
   530         TInt GetSubtitleIcon ( TBool aSetUnread );
       
   531 
       
   532         /*
       
   533         * Updates subtitle icon
       
   534         * @param aSubtitleID: subtitle ID
       
   535         * @param aReadStatusKnown: ETrue if there is known unread item under subtitle
       
   536         */
       
   537         void UpdateSubtitleIconL( TAknTreeItemID aSubtitleID, TBool aReadStatusKnown );
       
   538 
       
   539         /**
       
   540         * From CCoeControl.
       
   541         * Handles pointer events.
       
   542         * @param aPointerEvent The pointer event. 
       
   543         */
       
   544         virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   545 
       
   546         /**
       
   547         * Saves marked items
       
   548         */
       
   549         void SaveMarkingL();
       
   550         /**
       
   551         * Handles focus when operation is completed. 
       
   552         * This is called by SetAnchorItemIdL when it gets
       
   553         * EMessageListOperationCompleted.
       
   554         */
       
   555         void HandleOperationCompletedL();
       
   556 
       
   557         /**
       
   558          * Check the MTM technology type for Mail Technology 
       
   559          * @param aMtm: Mtm Uid
       
   560          * @return : ETrue if Mtm Technology is Mail
       
   561          *           otherwsie EFalse
       
   562          */
       
   563         TBool IsMailMtmTechnology( TUid aMtm )const;
       
   564         
       
   565     private:
       
   566 
       
   567         CAknSingleColumnStyleTreeList*      iTreeListBox;
       
   568         CMceOneRowListItemArray*            iListItems;
       
   569         CMceOneRowBitmapResolver*           iBitmapResolver;
       
   570         CMsvEntrySelection*                 iSelectedEntries;
       
   571         TMsvId                              iAnchorItemId;
       
   572         TAknTreeItemID                      iAnchorItemIndex;
       
   573         TMessageListOperationType           iLastOperationType;
       
   574         TMsvId                              iSelectedItemWaitingIndex;
       
   575 
       
   576         /**
       
   577         * Background control context.
       
   578         * Own.
       
   579         */
       
   580         CAknsBasicBackgroundControlContext* iBgContext;
       
   581 
       
   582         TAknTreeItemID              iNodeId;
       
   583         TBool                       iMarkingModeEnabled;
       
   584         CPtiEngine*                 iT9Interface;
       
   585         CMceMessageListContainerKeyTimer* iT9Timer;        
       
   586         TBool                       iPreviousInputMethod;
       
   587         TBool                       iInputMethodQwerty;
       
   588         TMceFlags                   iContainerFlags;
       
   589         TDay                        iStartOfWeek;
       
   590         TBool 			            iDialerEvent;
       
   591         /**
       
   592          * CMail Changes, it will be ETrue if 
       
   593          * KFeatureIdFfEmailFramework is enabled
       
   594          */
       
   595         TBool                       iEmailFramework;
       
   596         CMtmUiDataRegistry*         iUiRegistry;
       
   597         /**
       
   598          * For mass deletion of messages in onerowlist 
       
   599          * iDeletedMessges will keeptrack of no of messages got actually 
       
   600          *                 deleted and we got the call back from m/w
       
   601          * iSelectedSubTitles will keep list of all the subtitles from where
       
   602          *                 messages got deleted but not the subtitle.  
       
   603          */
       
   604         TInt                        iDeletedMessges;
       
   605         RArray<TAknTreeItemID>      iSelectedSubTitles;
       
   606 
       
   607     };
       
   608 
       
   609 #endif
       
   610 
       
   611 // End of file