emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h
changeset 1 12c456ceeff2
parent 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
0:8466d47a6819 1:12c456ceeff2
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Symbian Foundation License v1.0"
     5 * under the terms of the License "Symbian Foundation License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  FreestyleEmailUi double line list visualiser definition 
    14 * Description:  FreestyleEmailUi double line list visualiser definition
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18  
    18 
    19     
    19 
    20 #ifndef __FREESTYLEEMAILUI_MAILLISTVISUALISER_H__
    20 #ifndef __FREESTYLEEMAILUI_MAILLISTVISUALISER_H__
    21 #define __FREESTYLEEMAILUI_MAILLISTVISUALISER_H__
    21 #define __FREESTYLEEMAILUI_MAILLISTVISUALISER_H__
    22 
    22 
    23 // SYSTEM INCLUDES
    23 // SYSTEM INCLUDES
    24 #include <EIKMOBS.H>
    24 #include <EIKMOBS.H>
    87 	MFsTreeItemVisualizer* iTreeItemVisualiser;
    87 	MFsTreeItemVisualizer* iTreeItemVisualiser;
    88 	};
    88 	};
    89 
    89 
    90 struct STimeDateFormats
    90 struct STimeDateFormats
    91 	{
    91 	{
    92 	TDateFormat iDateFormat;	
    92 	TDateFormat iDateFormat;
    93 	TChar iDateSeparator;
    93 	TChar iDateSeparator;
    94 	TTimeFormat iTimeFormat;
    94 	TTimeFormat iTimeFormat;
    95 	TChar iTimeSeparator;
    95 	TChar iTimeSeparator;
    96 	TLocalePos iAmPmPosition;
    96 	TLocalePos iAmPmPosition;
    97 	};
    97 	};
    98 	
    98 
    99 enum TMailListUiControls
    99 enum TMailListUiControls
   100 	{
   100 	{
   101 	EControlBarComponent=0,
   101 	EControlBarComponent=0,
   102 	EMailListComponent
   102 	EMailListComponent
   103 	};
   103 	};
   115 	EListControlSeparatorDisabled=0,
   115 	EListControlSeparatorDisabled=0,
   116 	EListControlSeparatorEnabled
   116 	EListControlSeparatorEnabled
   117 	};
   117 	};
   118 
   118 
   119 // <cmail>
   119 // <cmail>
   120 class CFSEmailUiMailListVisualiser : public CFsEmailUiViewBase, 
   120 class CFSEmailUiMailListVisualiser : public CFsEmailUiViewBase,
   121 									 public MFsControlBarObserver, 
   121 									 public MFsControlBarObserver,
   122 									 public MFSEmailUiFolderListCallback, 
   122 									 public MFSEmailUiFolderListCallback,
   123 									 public MFSEmailUiSortListCallback,
   123 									 public MFSEmailUiSortListCallback,
   124 									 public MFsTreeListObserver,
   124 									 public MFsTreeListObserver,
   125 									 public MFSEmailUiContactHandlerObserver,
   125 									 public MFSEmailUiContactHandlerObserver,
   126 									 public MFsActionMenuPositionGiver
   126 									 public MFsActionMenuPositionGiver
   127 // </cmail>
   127 // </cmail>
   134     void PrepareForExit();
   134     void PrepareForExit();
   135 
   135 
   136 	void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
   136 	void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
   137 	// Refresh the whole list
   137 	// Refresh the whole list
   138 	void RefreshL( TFSMailMsgId* aFocusToMessage = NULL );
   138 	void RefreshL( TFSMailMsgId* aFocusToMessage = NULL );
   139 	// From view 
   139 	// From view
   140 	TUid Id() const;	
   140 	TUid Id() const;
   141 	// <cmail> Toolbar
   141 	// <cmail> Toolbar
   142 	/*void DoActivateL(const TVwsViewId& aPrevViewId,
   142 	/*void DoActivateL(const TVwsViewId& aPrevViewId,
   143 	                 TUid aCustomMessageId,
   143 	                 TUid aCustomMessageId,
   144 	                 const TDesC8& aCustomMessage);*/
   144 	                 const TDesC8& aCustomMessage);*/
   145     // </cmail> Toolbar
   145     // </cmail> Toolbar
   146 	TInt NewEmailsInModelL() const;
   146 	TInt NewEmailsInModelL() const;
   147 	TInt EmailsInModelL() const;	              
   147 	TInt EmailsInModelL() const;
   148 	CFSEmailUiMailListModel* Model();	
   148 	CFSEmailUiMailListModel* Model();
   149 	// Current active folder
   149 	// Current active folder
   150 	TFSMailMsgId FolderId();
   150 	TFSMailMsgId FolderId();
   151 	// Dynamic variant switch, called by appui
   151 	// Dynamic variant switch, called by appui
   152 	void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType );
   152 	void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType );
   153 	void HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType );
   153 	void HandleDynamicVariantSwitchOnBackgroundL( CFsEmailUiViewBase::TDynamicSwitchType aType );
   154 	// Handle foregroundevent
   154 	// Handle foregroundevent
   155 	void HandleForegroundEventL();
   155 	void HandleForegroundEventL();
   156 	// Sets softkeys
   156 	// Sets softkeys
   157 	void SetViewSoftkeysL( TInt aResourceId );	
   157 	void SetViewSoftkeysL( TInt aResourceId );
   158 	void SetMskL();
   158 	void SetMskL();
   159 	// Highlighted index
   159 	// Highlighted index
   160 	TInt HighlightedIndex() const;
   160 	TInt HighlightedIndex() const;
   161 	void SetHighlightedIndexL( TInt aWantedIndex );
   161 	void SetHighlightedIndexL( TInt aWantedIndex );
   162 	// Event handling forwarded from control
   162 	// Event handling forwarded from control
   163 	TBool OfferEventL( const TAlfEvent& aEvent ); 
   163 	TBool OfferEventL( const TAlfEvent& aEvent );
   164 
   164 
   165     // <cmail>
   165     // <cmail>
   166 	/**
   166 	/**
   167 	 * Open highlighted mail or node. 
   167 	 * Open highlighted mail or node.
   168 	 * (Touchwork: Called from touch manager)
   168 	 * (Touchwork: Called from touch manager)
   169 	 */
   169 	 */
   170 	void DoHandleListItemOpenL();
   170 	void DoHandleListItemOpenL();
   171 
   171 
   172 	/**
   172 	/**
   173      * Open folderlist or shortlist.  
   173      * Open folderlist or shortlist.
   174      * (Touchwork: Called from touch manager)
   174      * (Touchwork: Called from touch manager)
   175      * 
   175      *
   176      * @param TInt button id. (shortlist or folderlist) 
   176      * @param TInt button id. (shortlist or folderlist)
   177      */
   177      */
   178 	void DoHandleControlBarOpenL( TInt aControlBarButtonId );
   178 	void DoHandleControlBarOpenL( TInt aControlBarButtonId );
   179 
   179 
   180     /**
   180     /**
   181      * Open action menu.   
   181      * Open action menu.
   182      * (Touchwork: Called from touch manager)
   182      * (Touchwork: Called from touch manager)
   183      */
   183      */
   184 	void DoHandleListItemLongTapL();
   184 	void DoHandleListItemLongTapL();
   185 
   185 
   186     /**
   186     /**
   187      * Get control which is currently focused.    
   187      * Get control which is currently focused.
   188      * (Touchwork: Called from touch manager)
   188      * (Touchwork: Called from touch manager)
   189      * 
   189      *
   190      * @return TInt id of control
   190      * @return TInt id of control
   191      */
   191      */
   192 	TInt GetFocusedControl() const; 
   192 	TInt GetFocusedControl() const;
   193 
   193 
   194     /**
   194     /**
   195      * Set control bar as focused control.   
   195      * Set control bar as focused control.
   196      * (Touchwork: Called from touch manager)
   196      * (Touchwork: Called from touch manager)
   197      */
   197      */
   198 	void SetControlBarFocusedL();
   198 	void SetControlBarFocusedL();
   199 
   199 
   200     /**
   200     /**
   201      * Set tree list as focused control.   
   201      * Set tree list as focused control.
   202      * (Touchwork: Called from touch manager)
   202      * (Touchwork: Called from touch manager)
   203      */
   203      */
   204 	void SetTreeListFocusedL(); 
   204 	void SetTreeListFocusedL();
   205 
   205 
   206     /**
   206     /**
   207      * Helper function for disable controls to send 
   207      * Helper function for disable controls to send
   208      * any events.    
   208      * any events.
   209      * (Touchwork)
   209      * (Touchwork)
   210      * 
   210      *
   211      * @param TBool state of controls. 
   211      * @param TBool state of controls.
   212      */
   212      */
   213 	void DisableMailList( TBool aValue );
   213 	void DisableMailList( TBool aValue );
   214 	// </cmail>
   214 	// </cmail>
   215 	
   215 
   216 	// Command handling
   216 	// Command handling
   217 	void HandleCommandL(TInt aCommand);
   217 	void HandleCommandL(TInt aCommand);
   218 	// Read status 
   218 	// Read status
   219 	void ChangeReadStatusOfHighlightedL( TBool aRead );
   219 	void ChangeReadStatusOfHighlightedL( TBool aRead );
   220 	void ChangeReadStatusOfMarkedL( TBool aRead );
   220 	void ChangeReadStatusOfMarkedL( TBool aRead );
   221 	void ChangeReadStatusOfIndexL( TBool aRead, TInt aIndex );
   221 	void ChangeReadStatusOfIndexL( TBool aRead, TInt aIndex );
   222 	// Delete messages 
   222 	// Delete messages
   223 	void DeleteMessagesL(); 	
   223 	void DeleteMessagesL();
   224 	// Move to drafts
   224 	// Move to drafts
   225 	void MoveMessagesToDraftsL();
   225 	void MoveMessagesToDraftsL();
   226 	
   226 
   227 	// From base class MFSEmailUiFolderListCallback
   227 	// From base class MFSEmailUiFolderListCallback
   228 	// Handle folder list selection
   228 	// Handle folder list selection
   229 	void FolderSelectedL( TFSMailMsgId aSelectedFolderId,
   229 	void FolderSelectedL( TFSMailMsgId aSelectedFolderId,
   230 	 					 TFSEmailUiCtrlBarResponse aResponse );
   230 	 					 TFSEmailUiCtrlBarResponse aResponse );
   231 	void MailboxSelectedL( TFSMailMsgId aSelectedFolderId );
   231 	void MailboxSelectedL( TFSMailMsgId aSelectedFolderId );
   232 	TRect FolderButtonRect();
   232 	TRect FolderButtonRect();
   233 	
   233 
   234 	// From base class MFSEmailUiSortListCallback
   234 	// From base class MFSEmailUiSortListCallback
   235 	void SortOrderChangedL( TFSMailSortField aSortField,
   235 	void SortOrderChangedL( TFSMailSortField aSortField,
   236 	 					   TFSEmailUiCtrlBarResponse aResponse );
   236 	 					   TFSEmailUiCtrlBarResponse aResponse );
   237 	TRect SortButtonRect();
   237 	TRect SortButtonRect();
   238 	
   238 
       
   239 	// Update theme colors
       
   240 	void UpdateTheme();
       
   241 
   239 	// Navigation functions, used mainly from viewer
   242 	// Navigation functions, used mainly from viewer
   240 	TBool IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId, TFSMailMsgId& aFoundNextMsgFolder ) const;
   243 	TBool IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId, TFSMailMsgId& aFoundNextMsgFolder ) const;
   241 	TBool IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId, TFSMailMsgId& aFoundPrevMsgFolder ) const;
   244 	TBool IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId, TFSMailMsgId& aFoundPrevMsgFolder ) const;
   242 	TInt MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId );
   245 	TInt MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId );
   243 	TInt MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId );
   246 	TInt MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId );
   244 
   247 	TInt MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId );
       
   248 	
   245 	/**
   249 	/**
   246      * Sets the manual mailbox syncronisation flag if the user chose   
   250      * Sets the manual mailbox syncronisation flag if the user chose
   247      * to synchorise mail box from the menu
   251      * to synchorise mail box from the menu
   248      */
   252      */
   249     void ManualMailBoxSync( TBool aManualMailBoxSync );
   253     void ManualMailBoxSync( TBool aManualMailBoxSync );
   250     
   254 
   251     // Returns ETrue if mailbox is syncronizing and EFalse if not
   255     // Returns ETrue if mailbox is syncronizing and EFalse if not
   252     TBool GetLatestSyncState();
   256     TBool GetLatestSyncState();
   253 
   257 
   254 	void GetMarkedMessagesL( RArray<TFSMailMsgId>& aMessageIDs ) const;
   258 	void GetMarkedMessagesL( RArray<TFSMailMsgId>& aMessageIDs ) const;
   255 	CFsTreeList& GetMailList();
   259 	CFsTreeList& GetMailList();
   275 
   279 
   276     /**
   280     /**
   277     * Called when CDateChangeTimer completes. This happens when either when date
   281     * Called when CDateChangeTimer completes. This happens when either when date
   278     * changes or when user alters the system time. Redraws the list to ensure that
   282     * changes or when user alters the system time. Redraws the list to ensure that
   279     * time stamp texts in emails and nodes are up-to-date.
   283     * time stamp texts in emails and nodes are up-to-date.
   280     */ 
   284     */
   281     void NotifyDateChangedL();
   285     void NotifyDateChangedL();
   282 // <cmail>
   286 // <cmail>
   283     TPoint ActionMenuPosition();
   287     TPoint ActionMenuPosition();
   284 // </cmail>
   288 // </cmail>
   285   
   289 
   286 private: // from
   290 private: // from
   287     
   291 
   288     /**
   292     /**
   289      * @see CFsEmailUiViewBase::ChildDoActivateL
   293      * @see CFsEmailUiViewBase::ChildDoActivateL
   290      */
   294      */
   291     void ChildDoActivateL( const TVwsViewId& aPrevViewId,
   295     void ChildDoActivateL( const TVwsViewId& aPrevViewId,
   292             TUid aCustomMessageId,
   296             TUid aCustomMessageId,
   293             const TDesC8& aCustomMessage );
   297             const TDesC8& aCustomMessage );
   294     void ChildDoDeactivate();
   298     void ChildDoDeactivate();
   295     void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const;
   299     void GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const;
   296     /**
   300     /**
   297 	 * @see CFsEmailUiViewBase::SetStatusBarLayout
   301 	 * @see CFsEmailUiViewBase::SetStatusBarLayout
   298 	 */ 
   302 	 */
   299     void SetStatusBarLayout();
   303     void SetStatusBarLayout();
   300     
   304 
   301 private: // Private functions
   305 private: // Private functions
   302     CFSEmailUiMailListVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi,
   306     CFSEmailUiMailListVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi,
   303         CAlfControlGroup& aMailListControlGroup );
   307         CAlfControlGroup& aMailListControlGroup );
   304     void ConstructL();
   308     void ConstructL();
   305 
   309 
   306 	// Refresh funcions
   310 	// Refresh funcions
   307     void InsertNewMessagesL( const RArray<TFSMailMsgId>& aMessages );
   311     void InsertNewMessagesL( const RArray<TFSMailMsgId>& aMessages );
   308     void InsertNewMessageL( CFSMailMessage* aNewMessage, const TBool aAllowRefresh ); // ownership is transferred
   312     void InsertNewMessageL( CFSMailMessage* aNewMessage, const TBool aAllowRefresh ); // ownership is transferred
   309     
   313 
   310     void RefreshListItemsL();
   314     void RefreshListItemsL();
   311     // Refresh the list order only
   315     // Refresh the list order only
   312     void RefreshOrderL();
   316     void RefreshOrderL();
   313     
   317 
   314     // To start refreshing asynchronously
   318     // To start refreshing asynchronously
   315     void RefreshDeferred( TFSMailMsgId* aFocusToMessage = NULL );
   319     void RefreshDeferred( TFSMailMsgId* aFocusToMessage = NULL );
   316     static TInt DoRefresh( TAny* aSelfPtr );
   320     static TInt DoRefresh( TAny* aSelfPtr );
   317     void CompletePendingRefresh();
   321     void CompletePendingRefresh();
   318     
   322 
   319     // Create and insert one list node item according to given model item.
   323     // Create and insert one list node item according to given model item.
   320     // Omitting the argument aChildIdx causes the new node to be appended at the end of the list.
   324     // Omitting the argument aChildIdx causes the new node to be appended at the end of the list.
   321     TFsTreeItemId InsertNodeItemL( TInt aModelIndex, TInt aChildIndex = KErrNotFound, const TBool aAllowRefresh = EFalse );
   325     TFsTreeItemId InsertNodeItemL( TInt aModelIndex, TInt aChildIndex = KErrNotFound, const TBool aAllowRefresh = EFalse );
   322     // Create and insert one list item according the given model item. The item is added under the given node.
   326     // Create and insert one list item according the given model item. The item is added under the given node.
   323     // Omitting the argument aChildIdx causes the new item to be appended as last child of the node.
   327     // Omitting the argument aChildIdx causes the new item to be appended as last child of the node.
   324     TFsTreeItemId InsertListItemL( TInt aModelIndex, TFsTreeItemId aParentNodeId, TInt aChildIdx = KErrNotFound, TBool aAllowRefresh = ETrue );
   328     TFsTreeItemId InsertListItemL( TInt aModelIndex, TFsTreeItemId aParentNodeId, TInt aChildIdx = KErrNotFound, TBool aAllowRefresh = ETrue );
   325 	
   329 
   326 	// Mail model update
   330 	// Mail model update
   327 	void UpdateMailListModelL();
   331 	void UpdateMailListModelL();
   328 	void CreateModelItemsL( RPointerArray<CFSMailMessage>& aMessages );
   332 	void CreateModelItemsL( RPointerArray<CFSMailMessage>& aMessages );
   329 	
   333 
   330 	// Create title divider model item for the given message. Separator text depends on active sorting mode.
   334 	// Create title divider model item for the given message. Separator text depends on active sorting mode.
   331 	CFSEmailUiMailListModelItem* CreateSeparatorModelItemLC( CFSMailMessage& aMessage ) const;
   335 	CFSEmailUiMailListModelItem* CreateSeparatorModelItemLC( CFSMailMessage& aMessage ) const;
   332 	
   336 
   333 	// Checks if the given messages belong under the same title divider. This depends on the currect sorting mode.
   337 	// Checks if the given messages belong under the same title divider. This depends on the currect sorting mode.
   334 	TBool MessagesBelongUnderSameSeparatorL( const CFSMailMessage& aMessage1, const CFSMailMessage& aMessage2 ) const;
   338 	TBool MessagesBelongUnderSameSeparatorL( const CFSMailMessage& aMessage1, const CFSMailMessage& aMessage2 ) const;
   335 	
   339 
   336 	// Rescale UI	
   340 	// Rescale UI
   337 	void SetMailListLayoutAnchors();
   341 	void SetMailListLayoutAnchors();
   338 
   342 
   339 	// Control bar functions
   343 	// Control bar functions
   340 	void CreateControlBarLayoutL();
   344 	void CreateControlBarLayoutL();
   341 	void ScaleControlBarL();
   345 	void ScaleControlBarL();
   342 	void SetSortButtonTextAndIconL();
   346 	void SetSortButtonTextAndIconL();
       
   347 	HBufC* GetSortButtonTextLC();
   343     void HandleControlBarEvent( TFsControlBarEvent aEvent, TInt aData );
   348     void HandleControlBarEvent( TFsControlBarEvent aEvent, TInt aData );
   344 
   349 
   345 	// Followup flag
   350 	// Followup flag
   346 	void SetMessageFollowupFlagL();
   351 	void SetMessageFollowupFlagL();
   347 
   352 
   348 	void CreatePlainNodeL( const TDesC* aItemDataBuff,
   353 	void CreatePlainNodeL( const TDesC* aItemDataBuff,
   349                            CFsTreePlainOneLineNodeData* &aItemData,   
   354                            CFsTreePlainOneLineNodeData* &aItemData,
   350                            CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const;                           	
   355                            CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const;
   351 
   356 
   352 	// Move messages to folder
   357 	// Move messages to folder
   353 	TInt MoveMsgsToFolderL( const TFSMailMsgId& aDestinationFolderId );
   358 	TInt MoveMsgsToFolderL( const TFSMailMsgId& aDestinationFolderId );
   354 
   359 
   355 	// Collapse/Expand nodes
   360 	// Collapse/Expand nodes
   359 
   364 
   360 	// Mark control functions
   365 	// Mark control functions
   361 	void MarkAllItemsL();
   366 	void MarkAllItemsL();
   362 	void UnmarkAllItemsL();
   367 	void UnmarkAllItemsL();
   363 	TInt CountMarkedItemsL();
   368 	TInt CountMarkedItemsL();
   364 	
   369 
   365 	void MarkMessagesIfFoundL( const RArray<TFSMailMsgId>& aMessageIDs );
   370 	void MarkMessagesIfFoundL( const RArray<TFSMailMsgId>& aMessageIDs );
   366 
   371 
   367 	// Message deletion internal functions
   372 	// Message deletion internal functions
   368 	void DeleteFocusedMessageL();
   373 	void DeleteFocusedMessageL();
   369 	void DeleteMarkedMessagesL();
   374 	void DeleteMarkedMessagesL();
   370 	static TInt DoDeleteMarkedMessages( TAny* aSelfPtr );
   375 	static TInt DoDeleteMarkedMessages( TAny* aSelfPtr );
   371 
   376 
   372 	// Helper functions to access model data
   377 	// Helper functions to access model data
   373 	TFSMailMsgId MsgIdFromIndex( TInt aItemIdx ) const;
   378 	TFSMailMsgId MsgIdFromIndex( TInt aItemIdx ) const;
   374 	CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId );	
   379 	CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId );
   375     const CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId ) const; 
   380     const CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId ) const;
   376 
   381 
   377 	// Item data and visualiser helper functions 
   382 	// Item data and visualiser helper functions
   378 	MFsTreeItemData* ItemDataFromItemId( TFsTreeItemId aItemId );										
   383 	MFsTreeItemData* ItemDataFromItemId( TFsTreeItemId aItemId );
   379 	MFsTreeItemVisualizer* ItemVisualiserFromItemId( TFsTreeItemId aItemId );
   384 	MFsTreeItemVisualizer* ItemVisualiserFromItemId( TFsTreeItemId aItemId );
   380 	
   385 
   381 	// Helpers to get the ordinal of a message in the iModel
   386 	// Helpers to get the ordinal of a message in the iModel
   382 	TInt ItemIndexFromMessageId( const TFSMailMsgId& aMessageId ) const;
   387 	TInt ItemIndexFromMessageId( const TFSMailMsgId& aMessageId ) const;
   383 	TInt NextMessageIndex( TInt aCurMsgIdx ) const;
   388 	TInt NextMessageIndex( TInt aCurMsgIdx ) const;
   384 	TInt PreviousMessageIndex( TInt aCurMsgIdx ) const;
   389 	TInt PreviousMessageIndex( TInt aCurMsgIdx ) const;
   385 	TInt ModelIndexFromListId( TFsTreeItemId aItemId ) const;
   390 	TInt ModelIndexFromListId( TFsTreeItemId aItemId ) const;
   386 	
   391 
   387 	// Open highlighted mail
   392 	// Open highlighted mail
   388 	void OpenHighlightedMailL();
   393 	void OpenHighlightedMailL();
   389 	void OpenMailItemL( TFsTreeItemId aMailItem );
   394 	void OpenMailItemL( TFsTreeItemId aMailItem );
   390 
   395 
   391 	// Create folder name buffer, either from database or from actual folder name
   396 	// Create folder name buffer, either from database or from actual folder name
   392 	HBufC* CreateFolderNameLC( const CFSMailFolder* aFolder ) const;
   397 	HBufC* CreateFolderNameLC( const CFSMailFolder* aFolder ) const;
   393 
   398 
   394 	// Shortcut specific toggles
   399 	// Shortcut specific toggles
   395 	void ShortcutReadUnreadToggleL();
   400 	void ShortcutReadUnreadToggleL();
   396 	void ShortcutCollapseExpandAllToggleL();
   401 	void ShortcutCollapseExpandAllToggleL();
   397 	
   402 
   398 	// Utility functions to check if all nodes are expanded or collapsed
   403 	// Utility functions to check if all nodes are expanded or collapsed
   399 	TBool AllNodesCollapsed() const;
   404 	TBool AllNodesCollapsed() const;
   400 	TBool AllNodesExpanded() const;
   405 	TBool AllNodesExpanded() const;
   401 	
   406 
   402 	// Utility functions to check if mark as read/unread options should be available in menus
   407 	// Utility functions to check if mark as read/unread options should be available in menus
   403 	TBool IsMarkAsReadAvailableL() const;
   408 	TBool IsMarkAsReadAvailableL() const;
   404 	TBool IsMarkAsUnreadAvailableL() const;
   409 	TBool IsMarkAsUnreadAvailableL() const;
   405 	
   410 
   406 	// Utility function to get list of entries which will be targeted by the Actions menu commands.
   411 	// Utility function to get list of entries which will be targeted by the Actions menu commands.
   407 	// The list contains either marked entries or the focused message entry or is empty.
   412 	// The list contains either marked entries or the focused message entry or is empty.
   408 	void GetActionsTargetEntriesL( RFsTreeItemIdList& aListItems ) const;
   413 	void GetActionsTargetEntriesL( RFsTreeItemIdList& aListItems ) const;
   409 	
   414 
   410 	// Action menu specific functions
   415 	// Action menu specific functions
   411 	void LaunchActionMenuL();
   416 	void LaunchActionMenuL();
   412 	void HandleActionMenuCommandL( TActionMenuCustomItemId itemId );
   417 	void HandleActionMenuCommandL( TActionMenuCustomItemId itemId );
   413 	void LaunchStylusPopupMenuL();
   418 	void LaunchStylusPopupMenuL();
   414 	
   419 
   415 	// Compose, reply, reply all and forward
   420 	// Compose, reply, reply all and forward
   416 	void CreateNewMsgL();
   421 	void CreateNewMsgL();
   417 	void ReplyL( CFSMailMessage* aMsgPtr );
   422 	void ReplyL( CFSMailMessage* aMsgPtr );
   418 	void ReplyAllL( CFSMailMessage* aMsgPtr );
   423 	void ReplyAllL( CFSMailMessage* aMsgPtr );
   419 	void ForwardL( CFSMailMessage* aMsgPtr );
   424 	void ForwardL( CFSMailMessage* aMsgPtr );
   420 	void DoReplyForwardL( TEditorLaunchMode aMode, CFSMailMessage* aMsgPtr = NULL );
   425 	void DoReplyForwardL( TEditorLaunchMode aMode, CFSMailMessage* aMsgPtr = NULL );
   421 	
   426 
   422 	// Some misc housekeeping functions
   427 	// Some misc housekeeping functions
   423 	void RemoveUnnecessaryNodesL();
   428 	void RemoveUnnecessaryNodesL();
   424 	void UpdateMailListSettingsL();	
   429 	void UpdateMailListSettingsL();
   425 	void UpdateMailListTimeDateSettings();
   430 	void UpdateMailListTimeDateSettings();
   426 	STimeDateFormats MailListTimeDateSettings();
   431 	STimeDateFormats MailListTimeDateSettings();
   427 
   432 
   428 	// Request to update list item data from given message pointer
   433 	// Request to update list item data from given message pointer
   429     void UpdateItemDataL( CFsTreePlainTwoLineItemData* aData, const CFSMailMessage* aMsgPtr );
   434     void UpdateItemDataL( CFsTreePlainTwoLineItemData* aData, const CFSMailMessage* aMsgPtr );
   430 	
   435 
   431 	// Request to update preview pane data for list id with msg ptr
   436 	// Request to update preview pane data for list id with msg ptr
   432 	void UpdatePreviewPaneTextForItemL( TFsTreeItemId aListItemId, CFSMailMessage* aMsgPtr );
   437 	void UpdatePreviewPaneTextForItemL( TFsTreeItemId aListItemId, CFSMailMessage* aMsgPtr );
   433 	void UpdatePreviewPaneTextForItemL( CFsTreePlainTwoLineItemData* aTwoLineItemData, CFSMailMessage* aMsgPtr );
   438 	void UpdatePreviewPaneTextForItemL( CFsTreePlainTwoLineItemData* aTwoLineItemData, CFSMailMessage* aMsgPtr );
   434     void UpdatePreviewPaneTextIfNecessaryL( TFsTreeItemId aListItemId, TBool aUpdateItem = ETrue );
   439     void UpdatePreviewPaneTextIfNecessaryL( TFsTreeItemId aListItemId, TBool aUpdateItem = ETrue );
   435 	
   440 
   436 	// Sender/Recipient text depending on the mail folder
   441 	// Sender/Recipient text depending on the mail folder
   437 	HBufC* GetListFirstTextLineL( const CFSMailMessage* aMsgPtr );
   442 	HBufC* GetListFirstTextLineL( const CFSMailMessage* aMsgPtr );
   438 
   443 
   439 	// Reload message pointer from mail client and update list item contents to match it. Item is
   444 	// Reload message pointer from mail client and update list item contents to match it. Item is
   440 	// removed if it isn't valid anymore.
   445 	// removed if it isn't valid anymore.
   441 	void UpdateItemAtIndexL( TInt aIndex );
   446 	void UpdateItemAtIndexL( TInt aIndex );
   442 	
   447 
   443 	// Check validity of highlighted msg and remove from list if needed
   448 	// Check validity of highlighted msg and remove from list if needed
   444 	// EFalse indicates that mail was not valid anymore.
   449 	// EFalse indicates that mail was not valid anymore.
   445 	TBool CheckValidityOfHighlightedMsgL();
   450 	TBool CheckValidityOfHighlightedMsgL();
   446 
   451 
   447 	// Icon update for msg item
   452 	// Icon update for msg item
   459 	void SetMailboxNameToStatusPaneL();
   464 	void SetMailboxNameToStatusPaneL();
   460 	void SetBrandedListWatermarkL();
   465 	void SetBrandedListWatermarkL();
   461 
   466 
   462     // Gives the parent node if the item has one. Returns KErrNotFound if no parent node available.
   467     // Gives the parent node if the item has one. Returns KErrNotFound if no parent node available.
   463     TFsTreeItemId ParentNode( TFsTreeItemId aItemId ) const;
   468     TFsTreeItemId ParentNode( TFsTreeItemId aItemId ) const;
   464     
   469 
   465     // Either marks or unmarks the current item depending on the current marking state
   470     // Either marks or unmarks the current item depending on the current marking state
   466     // as stored in iListMarkItemsState. Used for marking when shift is depressed while
   471     // as stored in iListMarkItemsState. Used for marking when shift is depressed while
   467     // scrolling. Returns ETrue if the highlighted item is markable.
   472     // scrolling. Returns ETrue if the highlighted item is markable.
   468     TBool DoScrollMarkUnmarkL();
   473     TBool DoScrollMarkUnmarkL();
   469     
   474 
   470     /**
   475     /**
   471      * Mark/unmark items under current separator.
   476      * Mark/unmark items under current separator.
   472      * 
   477      *
   473      * @param aMarked If ETrue mark all items else unmark.
   478      * @param aMarked If ETrue mark all items else unmark.
   474      * @param aSeparatorId Id of the separator.
   479      * @param aSeparatorId Id of the separator.
   475      */
   480      */
   476     void MarkItemsUnderSeparatorL( TBool aMarked, TInt aSeparatorId );
   481     void MarkItemsUnderSeparatorL( TBool aMarked, TInt aSeparatorId );
   477     
   482 
   478     //When maillist is activated this method handles the connection icon change
   483     //When maillist is activated this method handles the connection icon change
   479     void ConnectionIconHandling();
   484     void ConnectionIconHandling();
   480     
   485 
   481     void SetListAndCtrlBarFocusL();
   486     void SetListAndCtrlBarFocusL();
   482     
   487 
   483     void SetMailListItemsExtendedL();
   488     void SetMailListItemsExtendedL();
   484     
   489 
   485     void DoFirstStartL();
   490     void DoFirstStartL();
   486 
   491 
   487     // Called when flip state is changed
   492     // Called when flip state is changed
   488     void FlipStateChangedL( TBool aFlipOpen );
   493     void FlipStateChangedL( TBool aFlipOpen );
   489 
   494 
   490     /**
   495     /**
   491      * Handles the focus state changes
   496      * Handles the focus state changes
   492      * @param aShow Indicates if focus should become visible or removed
   497      * @param aVisible Indicates if focus should become visible or removed
   493      */
   498      */
   494     void HandleTimerFocusStateChange( TBool aShow );
   499     void FocusVisibilityChange( TBool aVisible );
       
   500 
       
   501     /**
       
   502      * Update texts in command area buttons
       
   503      */
       
   504     void UpdateButtonTextsL();
       
   505 
       
   506     /**
       
   507      * Tests whether a point is inside the control.
       
   508      *
       
   509      * @param aControl  Control that is tested.
       
   510      * @param aPoint    Point in display coordinates.
       
   511      *
       
   512      * @return  <code>ETrue</code>, if the point is inside one of the
       
   513      *          control's visuals. Otherwise <code>EFalse</code>.
       
   514      */
       
   515     TBool HitTest( const CAlfControl& aControl, const TPoint& aPoint ) const;
   495 
   516 
   496 private: // data types
   517 private: // data types
   497 
   518 
   498     
   519 
   499 private: // Private objects
   520 private: // Private objects
   500     // Reference to Alf environment
   521     // Reference to Alf environment
   501     CAlfEnv& iEnv;
   522     CAlfEnv& iEnv;
   502   	// Mail list updater timer
   523   	// Mail list updater timer
   503 	// Timer delays mail update to prevent unnesessary redraw events
   524 	// Timer delays mail update to prevent unnesessary redraw events
   504 	CMailListUpdater* iMailListUpdater; 
   525 	CMailListUpdater* iMailListUpdater;
   505 	// Msg moved note timer
   526 	// Msg moved note timer
   506 	CMsgMovedNoteTimer* iMsgNoteTimer; 
   527 	CMsgMovedNoteTimer* iMsgNoteTimer;
   507   	// Screen layout uses iMailListControl
   528   	// Screen layout uses iMailListControl
   508 	CAlfAnchorLayout* iScreenAnchorLayout;
   529 	CAlfAnchorLayout* iScreenAnchorLayout;
   509   	// Control bar control and layout and store visual pointer
   530   	// Control bar control and layout and store visual pointer
   510 	CFsControlBar* iControlBarControl;
   531 	CFsControlBar* iControlBarControl;
   511 	CAlfVisual* iControlBarVisual;
   532 	CAlfVisual* iControlBarVisual;
   512  	CAlfDeckLayout* iControlBarLayout;  
   533  	CAlfDeckLayout* iControlBarLayout;
   513   	// Mail List control and layout
   534   	// Mail List control and layout
   514     CFreestyleEmailUiMailListControl* iMailListControl;
   535     CFreestyleEmailUiMailListControl* iMailListControl;
   515  	CAlfDeckLayout* iListLayout;
   536  	CAlfDeckLayout* iListLayout;
   516 // <cmail> this feature is waiting for title divider bg graphics
       
   517     CAlfImageVisual* iTitleDividerBgVisual;
   537     CAlfImageVisual* iTitleDividerBgVisual;
   518 // </cmail>
   538     CFSEmailUiMailListModel* iModel;
   519     CFSEmailUiMailListModel* iModel; 
       
   520   	CFsTreeList* iMailList;
   539   	CFsTreeList* iMailList;
   521     CFsTreeVisualizerBase* iMailTreeListVisualizer;
   540     CFsTreeVisualizerBase* iMailTreeListVisualizer;
   522   	TInt iNumSlots;		
   541   	TInt iNumSlots;
   523    	CFSMailFolder* iMailFolder;
   542    	CFSMailFolder* iMailFolder;
   524     TInt iNewEmailsInModel; 	
   543     TInt iNewEmailsInModel;
   525 	RArray<SMailListItem> iTreeItemArray;   
   544 	RArray<SMailListItem> iTreeItemArray;
   526     RArray<TInt> iButtonsIds;
   545     RArray<TInt> iButtonsIds;
   527     TInt iFocusedControl;
   546     TInt iFocusedControl;
   528     TBool iToolbarInUse;
   547     TBool iToolbarInUse;
   529     TInt iListMode;    
   548     TInt iListMode;
   530     TInt iNodesInUse;
   549     TInt iNodesInUse;
   531     TInt iNewEmailButtonId;
   550     TInt iNewEmailButtonId;
   532 	TInt iFolderListButtonId;
   551 	TInt iFolderListButtonId;
   533 	TInt iSortButtonId;
   552 	TInt iSortButtonId;
   534 	TInt iImageButtonId;
   553 	TInt iImageButtonId;
   535 	MFsControlButtonInterface* iIconButton;
   554 	MFsControlButtonInterface* iIconButton;
   536 	MFsControlButtonInterface* iNewEmailButton;
   555 	MFsControlButtonInterface* iNewEmailButton;
   537 	MFsControlButtonInterface* iFolderListButton;
   556 	MFsControlButtonInterface* iFolderListButton;
   538 	MFsControlButtonInterface* iSortButton;	
   557 	MFsControlButtonInterface* iSortButton;
   539 	TBool iThisViewActive;	
   558 	TBool iThisViewActive;
   540 	CPbkxContactActionMenu* iActionMenu;	
   559 	CPbkxContactActionMenu* iActionMenu;
   541     TFSMailSortCriteria iCurrentSortCriteria;
   560     TFSMailSortCriteria iCurrentSortCriteria;
   542 	// Set to indicate whether items should be marked or unmarked
   561 	// Set to indicate whether items should be marked or unmarked
   543 	TBool iListMarkItemsState;
   562 	TBool iListMarkItemsState;
   544 	// Set to indicate if Shift key is being held down in which case selection key has mark/unmark functionality
   563 	// Set to indicate if Shift key is being held down in which case selection key has mark/unmark functionality
   545 	TBool iShiftDepressed;
   564 	TBool iShiftDepressed;
   562 	TBool iListOrderMayBeOutOfDate;
   581 	TBool iListOrderMayBeOutOfDate;
   563 	CAknWaitDialog* iDeletingWaitNote;
   582 	CAknWaitDialog* iDeletingWaitNote;
   564 	CDateChangeTimer* iDateChangeTimer;
   583 	CDateChangeTimer* iDateChangeTimer;
   565 	TBool iFirstStartCompleted;
   584 	TBool iFirstStartCompleted;
   566 	// generic use async callback object
   585 	// generic use async callback object
   567 	CAsyncCallBack* iAsyncCallback; 
   586 	CAsyncCallBack* iAsyncCallback;
   568 	// async callback for deferred redrawing
   587 	// async callback for deferred redrawing
   569 	CAsyncCallBack* iAsyncRedrawer;
   588 	CAsyncCallBack* iAsyncRedrawer;
   570 	TFSMailMsgId iMsgToFocusAfterRedraw;
   589 	TFSMailMsgId iMsgToFocusAfterRedraw;
   571 
   590 	HBufC* iNewEmailText;
   572     //<cmail>
   591 
   573     CEUiEmailListTouchManager* iTouchManager; 
   592     CEUiEmailListTouchManager* iTouchManager;
   574     //</cmail>
   593     CAknStylusPopUpMenu* iStylusPopUpMenu;
   575     CAknStylusPopUpMenu* iStylusPopUpMenu; 
   594     TBool iStylusPopUpMenuLaunched;
   576     
   595 
   577     TBool iShowReplyAll;
   596     TBool iShowReplyAll;
   578   	};
   597   	};
   579 
   598 
   580 
   599 
   581 // Definition of the mail updater timer. This timer is used for
   600 // Definition of the mail updater timer. This timer is used for
   596     CFSEmailUiMailListVisualiser* iMailListVisualiser;
   615     CFSEmailUiMailListVisualiser* iMailListVisualiser;
   597     TBool iIsSorting;
   616     TBool iIsSorting;
   598     CAknWaitDialog* iWaitNote;
   617     CAknWaitDialog* iWaitNote;
   599     };
   618     };
   600 
   619 
   601 // Delayd note timer 
   620 // Delayd note timer
   602 class CMsgMovedNoteTimer : public CTimer
   621 class CMsgMovedNoteTimer : public CTimer
   603     {
   622     {
   604 public:
   623 public:
   605     static CMsgMovedNoteTimer* NewL( CFreestyleEmailUiAppUi* aAppUi, CFSEmailUiMailListVisualiser* aMailListVisualiser );
   624     static CMsgMovedNoteTimer* NewL( CFreestyleEmailUiAppUi* aAppUi, CFSEmailUiMailListVisualiser* aMailListVisualiser );
   606     ~CMsgMovedNoteTimer();
   625     ~CMsgMovedNoteTimer();
   624 public:
   643 public:
   625     static CDateChangeTimer* NewL( CFSEmailUiMailListVisualiser& aMailListVisualiser );
   644     static CDateChangeTimer* NewL( CFSEmailUiMailListVisualiser& aMailListVisualiser );
   626     ~CDateChangeTimer();
   645     ~CDateChangeTimer();
   627     void Start();
   646     void Start();
   628     void RunL();
   647     void RunL();
   629     
   648 
   630 protected:
   649 protected:
   631     CDateChangeTimer( CFSEmailUiMailListVisualiser& aMailListVisualiser );
   650     CDateChangeTimer( CFSEmailUiMailListVisualiser& aMailListVisualiser );
   632     
   651 
   633 private:
   652 private:
   634     CFSEmailUiMailListVisualiser& iMailListVisualiser;
   653     CFSEmailUiMailListVisualiser& iMailListVisualiser;
   635     };
   654     };
   636 
   655 
   637 #endif 
   656 #endif