messagingappbase/mce/inc/MceOneRowMessageListContainer.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 *     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 
       
    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 
       
   138         /**
       
   139         * From CMceMessageListContainerBase
       
   140         */
       
   141         virtual void RefreshListbox();
       
   142 
       
   143         /**
       
   144         * From CMceMessageListContainerBase
       
   145         */
       
   146         virtual TBool FindFirstUnreadMessageL( TMsvId& aEntryId ) const;
       
   147 
       
   148         /**
       
   149         * From CMceMessageListContainerBase
       
   150         */
       
   151         virtual TMessageListItemType CurrentItemType() const;
       
   152 
       
   153         /**
       
   154         * From CMceMessageListContainerBase
       
   155         */
       
   156         void SetFolderL( TMsvId aFolderId );
       
   157 
       
   158         /**
       
   159         * From CMceMessageListContainerBase
       
   160         */
       
   161         TMsvId CurrentFolderId() const;
       
   162 
       
   163         /**
       
   164         * From CMceMessageListContainerBase
       
   165         */
       
   166         const TMsvEntry& FolderEntry() const;
       
   167 
       
   168         /**
       
   169         * From CMceMessageListContainerBase
       
   170         */
       
   171         TInt CurrentItemIndex() const;
       
   172 
       
   173         /**
       
   174         * From CMceMessageListContainerBase
       
   175         */
       
   176         TMsvId  CurrentItemId() const;
       
   177 
       
   178         /**
       
   179         * From CMceMessageListContainerBase
       
   180         */
       
   181         CMsvEntrySelection* CurrentItemSelectionL();
       
   182 
       
   183         /**
       
   184         * From CMceMessageListContainerBase
       
   185         */
       
   186         CMsvEntrySelection* CurrentItemSelectionRefreshL();
       
   187 
       
   188         /**
       
   189         * From CMceMessageListContainerBase
       
   190         */
       
   191         TInt CurrentItemSelectionCount() const;
       
   192 
       
   193         /**
       
   194         * From CMceMessageListContainerBase
       
   195         */
       
   196         TInt SelectionCount() const;
       
   197 
       
   198         /**
       
   199         * From CMceMessageListContainerBase
       
   200         */
       
   201         virtual TBool IsItemSelected( TMsvId aItemId );
       
   202 
       
   203         /**
       
   204         * From CMceMessageListContainerBase
       
   205         */
       
   206         void ClearSelection();
       
   207 
       
   208         /**
       
   209         * From CMceMessageListContainerBase
       
   210         */
       
   211         void MarkItemSelectionL();
       
   212 
       
   213         /**
       
   214         * From CMceMessageListContainerBase
       
   215         */
       
   216         void AddCurrentItemToSelectionL();
       
   217 
       
   218         /**
       
   219         * From CMceMessageListContainerBase
       
   220         */
       
   221         void RemoveCurrentItemFromSelection();
       
   222 
       
   223         /**
       
   224         * From CMceMessageListContainerBase
       
   225         */
       
   226         void RefreshSelectionIndexesL( TBool aForceUpdate = EFalse );
       
   227 
       
   228         /**
       
   229         * From CMceMessageListContainerBase
       
   230         */
       
   231         void AddAllToSelectionL();
       
   232         
       
   233         /**
       
   234         * From CMceMessageListContainerBase
       
   235         */
       
   236         void MarkAllReadMessagesL();
       
   237 
       
   238         /**
       
   239         * From CMceMessageListContainerBase
       
   240         */
       
   241         TInt MarkedItemsCount();
       
   242 
       
   243         /**
       
   244         * From CMceMessageListContainerBase 
       
   245         */
       
   246         TBool IsCurrentItemFolder() const;
       
   247 
       
   248         /**
       
   249         * From CMceMessageListContainerBase
       
   250         */
       
   251         TBool IsItemFolder( TMsvId aItemId ) const;
       
   252 
       
   253         /**
       
   254         * From CMceMessageListContainerBase
       
   255         */
       
   256         TBool IsItemFolder( TInt aIndex ) const;
       
   257 
       
   258         /**
       
   259         * From CMceMessageListContainerBase
       
   260         */
       
   261         TBool IsItemRemote( TMsvId aItemId ) const;
       
   262 
       
   263         /**
       
   264         * From CMceMessageListContainerBase
       
   265         */
       
   266         TBool IsOpenedFolder( TMsvId aFolderId ) const;
       
   267 
       
   268         /**
       
   269         * From CMceMessageListContainerBase
       
   270         */
       
   271         virtual void SetSortTypeL( TInt aSortType, TBool aOrdering );
       
   272 
       
   273         /**
       
   274         * From CMceMessageListContainerBase
       
   275         */
       
   276         virtual void SetMtmUiDataRegistry( MMtmUiDataRegistryObserver* aRegistryObserver );
       
   277 
       
   278         /**
       
   279         * From CMceMessageListContainerBase
       
   280         */
       
   281         void SetListEmptyTextL(const TDesC& aText);
       
   282 
       
   283         /**
       
   284         * From CCoeControl
       
   285         */
       
   286         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   287 
       
   288         /**
       
   289         * From CMceMessageListContainerBase
       
   290         */
       
   291         void SetAnchorItemIdL(
       
   292             TMessageListOperationType aOperationType );
       
   293 
       
   294         /**
       
   295         * From CMceMessageListContainerBase
       
   296         */
       
   297         void HandleMsvSessionEventL(
       
   298             MMsvSessionObserver::TMsvSessionEvent aEvent,
       
   299             CMsvEntrySelection& aSelection,
       
   300             TBool aDraw );
       
   301         
       
   302         /**
       
   303         * From CMceMessageListContainerBase 
       
   304         */
       
   305         TUint OptionsCommandSupported() const;
       
   306 
       
   307         /**
       
   308         * From CMceMessageListContainerBase 
       
   309         */
       
   310         void HandleOptionsCommandL( TInt aCommand );
       
   311         
       
   312         /**
       
   313         * From CMceMessageListContainerBase 
       
   314         */
       
   315         void DateTimeFormatChangedL( TInt aChangeFlag );
       
   316 
       
   317         /**
       
   318         * From CMceMessageListContainerBase 
       
   319         */
       
   320         TInt SetSpecialMskL();
       
   321             
       
   322         /**
       
   323         * Expands focused node
       
   324         */
       
   325         void ExpandFocusedNode();
       
   326 
       
   327         /**
       
   328         * Collapses focused node
       
   329         */
       
   330         void CollapseFocusedNode();
       
   331         
       
   332         /**
       
   333         * From CMceMessageListContainerBase 
       
   334         */
       
   335         void UpdateIconArrayL( );
       
   336 
       
   337     public:     // Functions from base classes
       
   338 
       
   339         /**
       
   340         * From CCoeControl
       
   341         */
       
   342         TInt CountComponentControls() const;
       
   343 
       
   344         /**
       
   345         * From CCoeControl
       
   346         */
       
   347         CCoeControl* ComponentControl(TInt aIndex) const;
       
   348 
       
   349         /**
       
   350         * From CCoeControl
       
   351         */
       
   352         virtual TKeyResponse OfferKeyEventL(
       
   353             const TKeyEvent& aKeyEvent,
       
   354             TEventCode aType );
       
   355 
       
   356         /**
       
   357         * From CCoeControl
       
   358         */
       
   359         void SizeChanged();
       
   360 
       
   361         /**
       
   362         * From CAknAppUi
       
   363         */
       
   364         void HandleResourceChange( TInt aType );
       
   365 
       
   366         /**
       
   367         * From MEikCommandObserver
       
   368         */
       
   369         virtual void ProcessCommandL(TInt aCommand);
       
   370 
       
   371         /**
       
   372         * Retrieves an object of the same type as that encapsulated in aId.
       
   373         *
       
   374         * @param aId An encapsulated object type ID.
       
   375         */
       
   376         TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   377 
       
   378         /**
       
   379         * Tries to find item from the currently opened list and retuns
       
   380         * list index if found. KErrNotFound if not found.
       
   381         * @param aId: item id to be searched
       
   382         * @return List index of the item.
       
   383         */
       
   384         TInt ItemIndex( TMsvId aId ) const;
       
   385 
       
   386         /**
       
   387         * From CCoeControl.
       
   388         * Draws this CHierarchicalColumnListAppView to the screen.
       
   389         *
       
   390         * @param aRect the rectangle of this view that needs updating.
       
   391         */
       
   392         void Draw( const TRect& aRect ) const;
       
   393 
       
   394         /**
       
   395         * Sets MSK command
       
   396         * @param aLabelResourceId Resource Id for MSK
       
   397         */
       
   398         void ChangeMskCommand( TInt aLabelResourceId );
       
   399 
       
   400         /**
       
   401         * From CMceMessageListContainerBase 
       
   402         */
       
   403         void SetContainerFlag( TMceContainerFlags aFlag, TBool aState );
       
   404 
       
   405     protected:  // Functions from base classes
       
   406         // From CCoeControl
       
   407         void FocusChanged(TDrawNow aDrawNow);
       
   408 
       
   409     private:
       
   410 
       
   411         /**
       
   412         * Symbian OS constructor.
       
   413         */
       
   414         void ConstructL(
       
   415             const TRect& aRect,
       
   416             CMsvSessionPtr aSession,
       
   417             MMtmUiDataRegistryObserver& aRegObserver );
       
   418 
       
   419         /**
       
   420         * Constructor is private.
       
   421         */
       
   422         CMceOneRowMessageListContainer( CMceMessageListView& aParentView );
       
   423 
       
   424         /**
       
   425          * Function that check if a key can be search
       
   426          * @param aPointerEvent The pointer event
       
   427          * @return ETrue if it can
       
   428          * since 3.2
       
   429          */
       
   430         TBool IsValidSearchKey(const TKeyEvent& aKeyEvent);
       
   431 
       
   432         /**
       
   433         * Add children items to specified node
       
   434         * @param aParentId Parent node Id
       
   435         */
       
   436         void AddChildrenL( TAknTreeItemID aParentId );
       
   437 
       
   438         /**
       
   439         * Removes children from specified node
       
   440         * @param aParentId Parent node Id
       
   441         */
       
   442         void RemoveChildren( TAknTreeItemID aParentId );
       
   443 
       
   444         /**
       
   445         * Gets number of marked items
       
   446         * @return number of marked items
       
   447         */
       
   448         TInt GetMarkedItemsCountL() const;
       
   449         
       
   450         /**
       
   451         * Adds default icons
       
   452         */
       
   453         void AddDefaultIconsL();
       
   454         
       
   455         /**
       
   456         * Adds an entry to tree list
       
   457         * @param aEntryIndex index of new entry
       
   458         */
       
   459         void AddEntryL( TInt aEntryIndex );
       
   460         
       
   461         /**
       
   462         * Updates an entry
       
   463         * @param aEntryId TMsvId of the entry to be changed
       
   464         */
       
   465         void UpdateEntryL( TMsvId aEntryId );
       
   466         
       
   467         /**
       
   468         * Updates tree list when new entry created
       
   469         * @param aSelection Items created
       
   470         * @param aDraw Will list be drawed immediality
       
   471         */
       
   472         void EntryCreatedL( 
       
   473             CMsvEntrySelection& aSelection,
       
   474             TBool aDraw );
       
   475         
       
   476         /**
       
   477         * Updates tree list when entry deleted
       
   478         * @param aSelection Items deleted
       
   479         * @param aDraw Will list be drawed immediality
       
   480         */
       
   481         void EntryDeletedL( 
       
   482             CMsvEntrySelection& aSelection,
       
   483             TBool aDraw );
       
   484         
       
   485         /**
       
   486          * Handles shortcut for search
       
   487          * Since 5.0
       
   488          */
       
   489         void HandleShortcutForSearchL( const TKeyEvent& aKeyEvent );
       
   490 
       
   491         /*
       
   492         * Function that check if * key can change msglist state
       
   493         * @return ETrue if it can
       
   494         * Since 5.0
       
   495         */
       
   496         TBool StateCanBeChangedByStarKeyL() const;
       
   497         
       
   498         /*
       
   499         *  Check if * key has been handled
       
   500         *  @return ETrue if it's handled
       
   501         *  Since 5.0
       
   502         */
       
   503         TBool HasHandleStarKeyDoneL();
       
   504         
       
   505         /*
       
   506         *  mark item read/unread
       
   507         * Since 5.0
       
   508         */
       
   509         void MarkReadUnreadWithStarKeyL();
       
   510 
       
   511         /*
       
   512         * Check if message list is sort by date
       
   513         *  @return ETrue if it is
       
   514         *  Since 5.0
       
   515         */
       
   516         TBool IsSortByDate();
       
   517 
       
   518         /*
       
   519         * Get icon id for subtitle icon
       
   520         * @param aSortType used sorting 
       
   521         * @param aSetUnread ETrue if unread type of icon
       
   522         * @return Icon id 
       
   523         */
       
   524         TInt GetSubtitleIcon ( TBool aSetUnread );
       
   525 
       
   526         /*
       
   527         * Updates subtitle icon
       
   528         * @param aSubtitleID: subtitle ID
       
   529         * @param aReadStatusKnown: ETrue if there is known unread item under subtitle
       
   530         */
       
   531         void UpdateSubtitleIconL( TAknTreeItemID aSubtitleID, TBool aReadStatusKnown );
       
   532 
       
   533         /**
       
   534         * From CCoeControl.
       
   535         * Handles pointer events.
       
   536         * @param aPointerEvent The pointer event. 
       
   537         */
       
   538         virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   539 
       
   540         /**
       
   541         * Saves marked items
       
   542         */
       
   543         void SaveMarkingL();
       
   544         /**
       
   545         * Handles focus when operation is completed. 
       
   546         * This is called by SetAnchorItemIdL when it gets
       
   547         * EMessageListOperationCompleted.
       
   548         */
       
   549         void HandleOperationCompletedL();
       
   550 
       
   551     private:
       
   552 
       
   553         CAknSingleColumnStyleTreeList*      iTreeListBox;
       
   554         CMceOneRowListItemArray*            iListItems;
       
   555         CMceOneRowBitmapResolver*           iBitmapResolver;
       
   556         CMsvEntrySelection*                 iSelectedEntries;
       
   557         TMsvId                              iAnchorItemId;
       
   558         TAknTreeItemID                      iAnchorItemIndex;
       
   559         TMessageListOperationType           iLastOperationType;
       
   560         TMsvId                              iSelectedItemWaitingIndex;
       
   561 
       
   562         /**
       
   563         * Background control context.
       
   564         * Own.
       
   565         */
       
   566         CAknsBasicBackgroundControlContext* iBgContext;
       
   567 
       
   568         TAknTreeItemID              iNodeId;
       
   569         TBool                       iMarkingModeEnabled;
       
   570         CPtiEngine*                 iT9Interface;
       
   571         CMceMessageListContainerKeyTimer* iT9Timer;        
       
   572         TBool                       iPreviousInputMethod;
       
   573         TBool                       iInputMethodQwerty;
       
   574         TMceFlags                   iContainerFlags;
       
   575         TDay                        iStartOfWeek;
       
   576         TBool 			            iDialerEvent;
       
   577         /**
       
   578          * CMail Changes, it will be ETrue if 
       
   579          * KFeatureIdFfEmailFramework is enabled
       
   580          */
       
   581         TBool                       iEmailFramework;
       
   582     };
       
   583 
       
   584 #endif
       
   585 
       
   586 // End of file