messagingappbase/mce/inc/MceMessageListContainer.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
child 71 17302fa075e1
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 *     List container user by message view.
       
    16 *     Derived from CMceListContainer.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MCEMESSAGELISTCONTAINER_H
       
    23 #define MCEMESSAGELISTCONTAINER_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <coecntrl.h> // CCoeControl
       
    27 #include <msvapi.h>
       
    28 //#include "MceListContainer.h"
       
    29 #include "MceMessageListContainerBase.h"
       
    30 #include "MceMessageListContTimer.h"
       
    31 
       
    32 #include "mcetemplate.h"
       
    33 #include "MceUtils.h"
       
    34 #include "MceListItem.h"
       
    35 #include <centralrepository.h> //CRepository
       
    36 #include <bldvariant.hrh>
       
    37 #include <eikcmobs.h>
       
    38 #include <e32property.h>
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CMceMessageListView;
       
    42 class CPtiEngine;
       
    43 class CMcePropertySubscriber;
       
    44 class CMsvSession;
       
    45 class CMceBitmapResolver;
       
    46 class CMceMessageListItemArray;
       
    47 class CMceMessageListBox;
       
    48 class MEikListBoxObserver;
       
    49 
       
    50 //CONSTS
       
    51 const TInt KMceSelectionReplacementSize = 5;
       
    52 
       
    53 
       
    54 // CLASS DECLARATION
       
    55 
       
    56 /**
       
    57 *  List container user by message view.
       
    58 *  Derived from CMceListContainer.
       
    59 */
       
    60 class  CMceMessageListContainer :
       
    61     public CMceMessageListContainerBase
       
    62 //    public CCoeControl,
       
    63 //    public MEikCommandObserver
       
    64     {
       
    65     public:  // Constructors and destructor
       
    66 
       
    67         /**
       
    68         * Two-phased constructor.
       
    69         */
       
    70         static CMceMessageListContainer* NewL(
       
    71             const TRect& aRect,
       
    72             CMsvSessionPtr aSession,
       
    73             TMsvId aFolderId,
       
    74             CMceBitmapResolver& aBitmapResolver,
       
    75             CMceMessageListView& aParentView );
       
    76 
       
    77         /**
       
    78         * Destructor.
       
    79         */
       
    80         virtual ~CMceMessageListContainer();
       
    81 
       
    82     public:
       
    83     
       
    84         /**
       
    85         * Returns list index of the current item
       
    86         * @return Index of the current item
       
    87         */
       
    88         TInt    CurrentItemIndex() const;
       
    89 
       
    90         /**
       
    91         * Returns mce's info of the current message
       
    92         * @return info
       
    93         */
       
    94         TMceListItem CurrentItemListItem() const;
       
    95 
       
    96         /**
       
    97         * Tries to find item from the currently opened list and retuns
       
    98         * list index if found. KErrNotFound if not found.
       
    99         * @param aId: item id to be searched
       
   100         * @return List index of the item.
       
   101         */
       
   102         TInt ItemIndex( TMsvId aId ) const;
       
   103 
       
   104         /**
       
   105         * Sets MSK label according to a focused item
       
   106         * Since 3.2
       
   107         */
       
   108         void SetMskL();
       
   109 
       
   110         /**
       
   111         * Is Outbox open?
       
   112         */
       
   113         TBool IsOutboxOpened() const;
       
   114 
       
   115         /**
       
   116         * Returns ETrue if Syncml outbox opened
       
   117         */
       
   118         TBool SyncMlOutboxOpened() const;
       
   119 
       
   120 
       
   121     public:     // Functions from base classes
       
   122     
       
   123         /**
       
   124         * From CMceMessageListContainerBase 
       
   125         */
       
   126         virtual TInt MceListId() const;
       
   127     
       
   128         /**
       
   129         * From CMceMessageListContainerBase 
       
   130         */
       
   131         virtual TInt Count() const;
       
   132 
       
   133         /**
       
   134         * From CMceMessageListContainerBase 
       
   135         */
       
   136         virtual TInt MessageCount() const;
       
   137 
       
   138         /**
       
   139         * From CMceMessageListContainerBase 
       
   140         */
       
   141         virtual TInt FolderCount() const;
       
   142         
       
   143         /**
       
   144         * From CMceMessageListContainerBase 
       
   145         */
       
   146         virtual TBool SetCurrentItemIdL( TMsvId aEntryId );
       
   147 
       
   148         /**
       
   149         * From CMceMessageListContainerBase 
       
   150         */
       
   151         virtual void ResetCurrentItemL();
       
   152 
       
   153         /**
       
   154         * From CMceMessageListContainerBase 
       
   155         */
       
   156         TMsvId FindEntry( const TDesC& aMatchString ) const;
       
   157         
       
   158         /**
       
   159         * From CMceMessageListContainerBase 
       
   160         */
       
   161         virtual void ItemCountChangedL( TBool aItemsAdded );
       
   162 
       
   163         /**
       
   164         * From CMceMessageListContainerBase 
       
   165         */
       
   166         virtual void RefreshListbox();
       
   167 
       
   168         /**
       
   169         * From CMceMessageListContainerBase 
       
   170         */
       
   171         virtual void SetSortTypeL( TInt aSortType, TBool aOrdering );
       
   172 
       
   173         /**
       
   174         * From CMceMessageListContainerBase 
       
   175         */
       
   176         virtual void SetMtmUiDataRegistry( MMtmUiDataRegistryObserver* aRegistryObserver );
       
   177 
       
   178         /**
       
   179         * From CMceMessageListContainerBase 
       
   180         */
       
   181         virtual TBool FindFirstUnreadMessageL( TMsvId& aEntryId ) const;
       
   182 
       
   183         /**
       
   184         * From CMceMessageListContainerBase 
       
   185         */
       
   186         virtual TMessageListItemType CurrentItemType() const;
       
   187         
       
   188         /**
       
   189         * From CMceMessageListContainerBase 
       
   190         */
       
   191         void SetFolderL( TMsvId aFolderId );
       
   192         
       
   193         /**
       
   194         * From CMceMessageListContainerBase 
       
   195         */
       
   196         TMsvId CurrentFolderId() const;
       
   197         
       
   198         /**
       
   199         * From CMceMessageListContainerBase 
       
   200         */
       
   201         const TMsvEntry& FolderEntry() const;
       
   202 
       
   203         /**
       
   204         * From CMceMessageListContainerBase 
       
   205         */
       
   206         TMsvId  CurrentItemId() const;
       
   207         
       
   208         /**
       
   209         * From CMceMessageListContainerBase 
       
   210         */
       
   211         CMsvEntrySelection* CurrentItemSelectionL();
       
   212 
       
   213         /**
       
   214         * From CMceMessageListContainerBase 
       
   215         */
       
   216         CMsvEntrySelection* CurrentItemSelectionRefreshL();
       
   217 
       
   218         /**
       
   219         * From CMceMessageListContainerBase 
       
   220         */
       
   221         TInt CurrentItemSelectionCount() const;
       
   222 
       
   223         /**
       
   224         * From CMceMessageListContainerBase 
       
   225         */
       
   226         TInt SelectionCount() const;
       
   227 
       
   228         /**
       
   229         * From CMceMessageListContainerBase 
       
   230         */
       
   231         virtual TBool IsItemSelected( TMsvId aItemId );
       
   232 
       
   233         /**
       
   234         * From CMceMessageListContainerBase 
       
   235         */
       
   236         void ClearSelection();
       
   237 
       
   238         /**
       
   239         * From CMceMessageListContainerBase 
       
   240         */
       
   241         void MarkItemSelectionL();
       
   242 
       
   243         /**
       
   244         * From CMceMessageListContainerBase 
       
   245         */
       
   246         void AddCurrentItemToSelectionL();
       
   247 
       
   248         /**
       
   249         * From CMceMessageListContainerBase 
       
   250         */
       
   251         void RemoveCurrentItemFromSelection();
       
   252 
       
   253         /**
       
   254         * From CMceMessageListContainerBase 
       
   255         * Updates selection indexes by reading selected message's TMsvIds from iSelectedEntries
       
   256         * and creates new CSelectionIndexArray.
       
   257         * @param aForceUpdate: set ETrue if index update is wanted to be done even when
       
   258         *   listbox's selection does not include any items.
       
   259         *   Usually this is set true only when calling from CMceBaseListView::HandleEntriesDeletedL
       
   260         */
       
   261         void RefreshSelectionIndexesL( TBool aForceUpdate = EFalse );
       
   262 
       
   263         /**
       
   264         * From CMceMessageListContainerBase 
       
   265         */
       
   266         void AddAllToSelectionL();
       
   267         
       
   268         /**
       
   269         * From CMceMessageListContainerBase 
       
   270         */
       
   271         void MarkAllReadMessagesL();
       
   272         
       
   273         /**
       
   274         * From CMceMessageListContainerBase 
       
   275         */
       
   276         TInt MarkedItemsCount();
       
   277 
       
   278         /**
       
   279         * From CMceMessageListContainerBase 
       
   280         */
       
   281         TBool IsCurrentItemFolder() const;
       
   282 
       
   283         /**
       
   284         * From CMceMessageListContainerBase 
       
   285         */
       
   286         TBool IsItemFolder( TMsvId aItemId ) const;
       
   287 
       
   288         /**
       
   289         * From CMceMessageListContainerBase 
       
   290         */
       
   291         TBool IsItemRemote( TMsvId aItemId ) const;
       
   292 
       
   293         /**
       
   294         * Checks is item folder.
       
   295         * @param aIndex index of the item to be checked.
       
   296         * @return ETrue if item is folder.
       
   297         */
       
   298         TBool IsItemFolder(TInt aIndex) const;
       
   299 
       
   300         /**
       
   301         * From CMceMessageListContainerBase 
       
   302         */
       
   303         TBool IsOpenedFolder( TMsvId aFolderId ) const;
       
   304         
       
   305         /**
       
   306         * From CMceMessageListContainerBase 
       
   307         */
       
   308         void SetListEmptyTextL(const TDesC& aText);
       
   309         
       
   310         /**
       
   311         * From CMceMessageListContainerBase 
       
   312         */
       
   313         void SetAnchorItemIdL( 
       
   314             TMessageListOperationType aOperationType );
       
   315             
       
   316         /**
       
   317         * From CMceMessageListContainerBase 
       
   318         */
       
   319         void HandleMsvSessionEventL( 
       
   320             MMsvSessionObserver::TMsvSessionEvent aEvent,
       
   321             CMsvEntrySelection& aSelection,
       
   322             TBool aDraw );
       
   323             
       
   324         /**
       
   325         * From CMceMessageListContainerBase 
       
   326         */
       
   327         TBool DisplayOptionsMenuFromSelectionKey() const;
       
   328         
       
   329         /**
       
   330         * From CMceMessageListContainerBase 
       
   331         */
       
   332         TUint OptionsCommandSupported() const;
       
   333 
       
   334         /**
       
   335         * From CMceMessageListContainerBase 
       
   336         */
       
   337         void HandleOptionsCommandL( TInt aCommand );
       
   338             
       
   339         /**
       
   340         * From CMceMessageListContainerBase 
       
   341         */
       
   342         void DateTimeFormatChangedL( TInt aChangeFlag );
       
   343 
       
   344         /**
       
   345         * From CMceMessageListContainerBase 
       
   346         */
       
   347         TInt SetSpecialMskL();
       
   348         
       
   349         /**
       
   350         * From CMceMessageListContainerBase 
       
   351         */
       
   352         void UpdateIconArrayL();
       
   353 
       
   354         /**
       
   355         * From CCoeControl
       
   356         */
       
   357         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   358 
       
   359         /**
       
   360         * From CMceMessageListContainerBase 
       
   361         */
       
   362         void SetContainerFlag( TMceContainerFlags aFlag, TBool aState );
       
   363 
       
   364     public:     // Functions from base classes
       
   365 
       
   366         /**
       
   367         * From CCoeControl
       
   368         */
       
   369         virtual TKeyResponse OfferKeyEventL(
       
   370             const TKeyEvent& aKeyEvent,
       
   371             TEventCode aType);        
       
   372 
       
   373             
       
   374         /**
       
   375         * From CCoeControl
       
   376         */
       
   377         void SizeChanged();
       
   378             
       
   379         /**
       
   380         * From 
       
   381         */
       
   382         void HandleResourceChange( TInt aType );
       
   383             
       
   384          /**
       
   385          * From MEikCommandObserver
       
   386          */
       
   387         virtual void ProcessCommandL(TInt aCommand);
       
   388          
       
   389         /**
       
   390         * From CCoeControl.
       
   391         * Handles pointer events.
       
   392         * @param aPointerEvent The pointer event. 
       
   393         */
       
   394         virtual void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   395         
       
   396         /**
       
   397         * From CCoeControl
       
   398         */
       
   399         TInt CountComponentControls() const;
       
   400 
       
   401         /**
       
   402         * From CCoeControl
       
   403         */
       
   404         CCoeControl* ComponentControl(TInt aIndex) const;
       
   405 
       
   406         
       
   407     protected:  // Functions from base classes
       
   408 
       
   409         /**
       
   410         * From CMceListContainer
       
   411         */
       
   412 //        virtual CEikTextListBox* CreateListBoxL( );        
       
   413 
       
   414         // From CCoeControl
       
   415         void FocusChanged(TDrawNow aDrawNow);
       
   416         
       
   417     private:
       
   418 
       
   419         /**
       
   420         * Symbian OS constructor.
       
   421         */
       
   422         void ConstructL(
       
   423             const TRect& aRect,
       
   424             CMsvSessionPtr aSession,
       
   425             CMceBitmapResolver& aBitmapResolver,
       
   426             TMsvId aFolderId );
       
   427 
       
   428         /**
       
   429         * Constructor is private.
       
   430         */
       
   431         CMceMessageListContainer(
       
   432             CMceMessageListView& aParentView );
       
   433 
       
   434             
       
   435         /**
       
   436          * Function that check if a key can be search
       
   437          * @param aPointerEvent The pointer event
       
   438          * @return ETrue if it can
       
   439          * since 3.2
       
   440          */
       
   441         TBool IsValidSearchKey(const TKeyEvent& aKeyEvent);
       
   442 
       
   443         /**
       
   444          * Handles a change in qwerty input mode setting.
       
   445          * @return KErrNone if ok.
       
   446          */
       
   447         TInt HandleQwertyModeChangeNotification();
       
   448 
       
   449         /**
       
   450          * Handles a change in qwerty input mode setting.
       
   451          * @return KErrNone if ok.
       
   452          */
       
   453         static TInt QwertyModeChangeNotification( TAny* aObj );
       
   454 
       
   455 
       
   456         /**
       
   457         * Adds item to iSelectedEntries
       
   458         * @param aEntryId: id of the entry to be added.
       
   459         */
       
   460         void AddItemToSelectionL( TMsvId aEntryId );
       
   461 
       
   462         /**
       
   463         * Removes item from iSelectedEntries
       
   464         * @param aEntryId: id of the entry to be removed.
       
   465         */
       
   466         void RemoveItemFromSelection( TMsvId aEntryId );
       
   467 
       
   468         /**
       
   469         * Handles focus when operation is completed. 
       
   470         * This is called by SetAnchorItemIdL when it gets
       
   471         * EMessageListOperationCompleted.
       
   472         */
       
   473         void HandleOperationCompletedL();
       
   474         
       
   475         /**
       
   476          * Handles shortcut for search
       
   477          * Since 5.0
       
   478          */
       
   479         void HandleShortcutForSearchL( const TKeyEvent& aKeyEvent );
       
   480 
       
   481         /*
       
   482         * Function that check if * key can change msglist state
       
   483         * @return ETrue if it can
       
   484         * Since 5.0
       
   485         */
       
   486         TBool StateCanBeChangedByStarKeyL() const;
       
   487         
       
   488         /*
       
   489         *  Check if * key has been handled
       
   490         *  @return ETrue if it's handled
       
   491         *  Since 5.0
       
   492         */
       
   493         TBool HasHandleStarKeyDoneL();
       
   494         
       
   495         /*
       
   496         *  mark item read/unread
       
   497         * Since 5.0
       
   498         */
       
   499         void MarkReadUnreadWithStarKeyL();
       
   500         /*
       
   501         * Check if message list is sort by date
       
   502         *  @return ETrue if it is
       
   503         *  Since 5.0
       
   504         */
       
   505         TBool IsSortByDate();
       
   506 
       
   507 
       
   508 
       
   509     private:
       
   510         CMceMessageListBox*            iListBox;
       
   511         CMceMessageListItemArray*          iListItems;
       
   512 //        TMceListType                iListType;
       
   513         CMsvEntrySelection*         iSelectedEntries;
       
   514         TMsvId                      iAnchorItemId;
       
   515         TInt                        iAnchorItemIndex;
       
   516         
       
   517         TInt                        iCurrMskResource;
       
   518 
       
   519 //        CMceMessageListView&            iOwningView;        
       
   520         CPtiEngine*                     iT9Interface;
       
   521         CMceMessageListContainerKeyTimer* iT9Timer;        
       
   522 
       
   523         CMcePropertySubscriber*     iQwertyModeStatusSubscriber;
       
   524         RProperty                   iQwertyModeStatusProperty;        
       
   525         TBool                       iPreviousInputMethod;
       
   526         TBool                       iInputMethodQwerty;
       
   527         
       
   528         TMessageListOperationType   iLastOperationType;
       
   529         TBool 			            iDialerEvent ;
       
   530         
       
   531     };
       
   532     
       
   533 #endif
       
   534 
       
   535 // End of file