diff -r 8466d47a6819 -r 12c456ceeff2 emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h --- a/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h Thu Dec 17 08:39:21 2009 +0200 +++ b/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h Thu Jan 07 12:38:38 2010 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Symbian Foundation License v1.0" @@ -11,12 +11,12 @@ * * Contributors: * -* Description: FreestyleEmailUi double line list visualiser definition +* Description: FreestyleEmailUi double line list visualiser definition * */ - - + + #ifndef __FREESTYLEEMAILUI_MAILLISTVISUALISER_H__ #define __FREESTYLEEMAILUI_MAILLISTVISUALISER_H__ @@ -89,13 +89,13 @@ struct STimeDateFormats { - TDateFormat iDateFormat; + TDateFormat iDateFormat; TChar iDateSeparator; TTimeFormat iTimeFormat; TChar iTimeSeparator; TLocalePos iAmPmPosition; }; - + enum TMailListUiControls { EControlBarComponent=0, @@ -117,9 +117,9 @@ }; // -class CFSEmailUiMailListVisualiser : public CFsEmailUiViewBase, - public MFsControlBarObserver, - public MFSEmailUiFolderListCallback, +class CFSEmailUiMailListVisualiser : public CFsEmailUiViewBase, + public MFsControlBarObserver, + public MFSEmailUiFolderListCallback, public MFSEmailUiSortListCallback, public MFsTreeListObserver, public MFSEmailUiContactHandlerObserver, @@ -136,16 +136,16 @@ void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); // Refresh the whole list void RefreshL( TFSMailMsgId* aFocusToMessage = NULL ); - // From view - TUid Id() const; + // From view + TUid Id() const; // Toolbar /*void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);*/ // Toolbar TInt NewEmailsInModelL() const; - TInt EmailsInModelL() const; - CFSEmailUiMailListModel* Model(); + TInt EmailsInModelL() const; + CFSEmailUiMailListModel* Model(); // Current active folder TFSMailMsgId FolderId(); // Dynamic variant switch, called by appui @@ -154,100 +154,104 @@ // Handle foregroundevent void HandleForegroundEventL(); // Sets softkeys - void SetViewSoftkeysL( TInt aResourceId ); + void SetViewSoftkeysL( TInt aResourceId ); void SetMskL(); // Highlighted index TInt HighlightedIndex() const; void SetHighlightedIndexL( TInt aWantedIndex ); // Event handling forwarded from control - TBool OfferEventL( const TAlfEvent& aEvent ); + TBool OfferEventL( const TAlfEvent& aEvent ); // /** - * Open highlighted mail or node. + * Open highlighted mail or node. * (Touchwork: Called from touch manager) */ void DoHandleListItemOpenL(); /** - * Open folderlist or shortlist. + * Open folderlist or shortlist. * (Touchwork: Called from touch manager) - * - * @param TInt button id. (shortlist or folderlist) + * + * @param TInt button id. (shortlist or folderlist) */ void DoHandleControlBarOpenL( TInt aControlBarButtonId ); /** - * Open action menu. + * Open action menu. * (Touchwork: Called from touch manager) */ void DoHandleListItemLongTapL(); /** - * Get control which is currently focused. + * Get control which is currently focused. * (Touchwork: Called from touch manager) - * + * * @return TInt id of control */ - TInt GetFocusedControl() const; + TInt GetFocusedControl() const; /** - * Set control bar as focused control. + * Set control bar as focused control. * (Touchwork: Called from touch manager) */ void SetControlBarFocusedL(); /** - * Set tree list as focused control. + * Set tree list as focused control. * (Touchwork: Called from touch manager) */ - void SetTreeListFocusedL(); + void SetTreeListFocusedL(); /** - * Helper function for disable controls to send - * any events. + * Helper function for disable controls to send + * any events. * (Touchwork) - * - * @param TBool state of controls. + * + * @param TBool state of controls. */ void DisableMailList( TBool aValue ); // - + // Command handling void HandleCommandL(TInt aCommand); - // Read status + // Read status void ChangeReadStatusOfHighlightedL( TBool aRead ); void ChangeReadStatusOfMarkedL( TBool aRead ); void ChangeReadStatusOfIndexL( TBool aRead, TInt aIndex ); - // Delete messages - void DeleteMessagesL(); + // Delete messages + void DeleteMessagesL(); // Move to drafts void MoveMessagesToDraftsL(); - + // From base class MFSEmailUiFolderListCallback // Handle folder list selection void FolderSelectedL( TFSMailMsgId aSelectedFolderId, TFSEmailUiCtrlBarResponse aResponse ); void MailboxSelectedL( TFSMailMsgId aSelectedFolderId ); TRect FolderButtonRect(); - + // From base class MFSEmailUiSortListCallback void SortOrderChangedL( TFSMailSortField aSortField, TFSEmailUiCtrlBarResponse aResponse ); TRect SortButtonRect(); - + + // Update theme colors + void UpdateTheme(); + // Navigation functions, used mainly from viewer TBool IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId, TFSMailMsgId& aFoundNextMsgFolder ) const; TBool IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId, TFSMailMsgId& aFoundPrevMsgFolder ) const; TInt MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId ); TInt MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId ); - + TInt MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId ); + /** - * Sets the manual mailbox syncronisation flag if the user chose + * Sets the manual mailbox syncronisation flag if the user chose * to synchorise mail box from the menu */ void ManualMailBoxSync( TBool aManualMailBoxSync ); - + // Returns ETrue if mailbox is syncronizing and EFalse if not TBool GetLatestSyncState(); @@ -277,14 +281,14 @@ * Called when CDateChangeTimer completes. This happens when either when date * changes or when user alters the system time. Redraws the list to ensure that * time stamp texts in emails and nodes are up-to-date. - */ + */ void NotifyDateChangedL(); // TPoint ActionMenuPosition(); // - + private: // from - + /** * @see CFsEmailUiViewBase::ChildDoActivateL */ @@ -295,9 +299,9 @@ void GetParentLayoutsL( RPointerArray& aLayoutArray ) const; /** * @see CFsEmailUiViewBase::SetStatusBarLayout - */ + */ void SetStatusBarLayout(); - + private: // Private functions CFSEmailUiMailListVisualiser( CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aMailListControlGroup ); @@ -306,48 +310,49 @@ // Refresh funcions void InsertNewMessagesL( const RArray& aMessages ); void InsertNewMessageL( CFSMailMessage* aNewMessage, const TBool aAllowRefresh ); // ownership is transferred - + void RefreshListItemsL(); // Refresh the list order only void RefreshOrderL(); - + // To start refreshing asynchronously void RefreshDeferred( TFSMailMsgId* aFocusToMessage = NULL ); static TInt DoRefresh( TAny* aSelfPtr ); void CompletePendingRefresh(); - + // Create and insert one list node item according to given model item. // Omitting the argument aChildIdx causes the new node to be appended at the end of the list. TFsTreeItemId InsertNodeItemL( TInt aModelIndex, TInt aChildIndex = KErrNotFound, const TBool aAllowRefresh = EFalse ); // Create and insert one list item according the given model item. The item is added under the given node. // Omitting the argument aChildIdx causes the new item to be appended as last child of the node. TFsTreeItemId InsertListItemL( TInt aModelIndex, TFsTreeItemId aParentNodeId, TInt aChildIdx = KErrNotFound, TBool aAllowRefresh = ETrue ); - + // Mail model update void UpdateMailListModelL(); void CreateModelItemsL( RPointerArray& aMessages ); - + // Create title divider model item for the given message. Separator text depends on active sorting mode. CFSEmailUiMailListModelItem* CreateSeparatorModelItemLC( CFSMailMessage& aMessage ) const; - + // Checks if the given messages belong under the same title divider. This depends on the currect sorting mode. TBool MessagesBelongUnderSameSeparatorL( const CFSMailMessage& aMessage1, const CFSMailMessage& aMessage2 ) const; - - // Rescale UI + + // Rescale UI void SetMailListLayoutAnchors(); // Control bar functions void CreateControlBarLayoutL(); void ScaleControlBarL(); void SetSortButtonTextAndIconL(); + HBufC* GetSortButtonTextLC(); void HandleControlBarEvent( TFsControlBarEvent aEvent, TInt aData ); // Followup flag void SetMessageFollowupFlagL(); void CreatePlainNodeL( const TDesC* aItemDataBuff, - CFsTreePlainOneLineNodeData* &aItemData, - CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const; + CFsTreePlainOneLineNodeData* &aItemData, + CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const; // Move messages to folder TInt MoveMsgsToFolderL( const TFSMailMsgId& aDestinationFolderId ); @@ -361,7 +366,7 @@ void MarkAllItemsL(); void UnmarkAllItemsL(); TInt CountMarkedItemsL(); - + void MarkMessagesIfFoundL( const RArray& aMessageIDs ); // Message deletion internal functions @@ -371,19 +376,19 @@ // Helper functions to access model data TFSMailMsgId MsgIdFromIndex( TInt aItemIdx ) const; - CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId ); - const CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId ) const; + CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId ); + const CFSMailMessage& MsgPtrFromListIdL( TFsTreeItemId aListId ) const; - // Item data and visualiser helper functions - MFsTreeItemData* ItemDataFromItemId( TFsTreeItemId aItemId ); + // Item data and visualiser helper functions + MFsTreeItemData* ItemDataFromItemId( TFsTreeItemId aItemId ); MFsTreeItemVisualizer* ItemVisualiserFromItemId( TFsTreeItemId aItemId ); - + // Helpers to get the ordinal of a message in the iModel TInt ItemIndexFromMessageId( const TFSMailMsgId& aMessageId ) const; TInt NextMessageIndex( TInt aCurMsgIdx ) const; TInt PreviousMessageIndex( TInt aCurMsgIdx ) const; TInt ModelIndexFromListId( TFsTreeItemId aItemId ) const; - + // Open highlighted mail void OpenHighlightedMailL(); void OpenMailItemL( TFsTreeItemId aMailItem ); @@ -394,52 +399,52 @@ // Shortcut specific toggles void ShortcutReadUnreadToggleL(); void ShortcutCollapseExpandAllToggleL(); - + // Utility functions to check if all nodes are expanded or collapsed TBool AllNodesCollapsed() const; TBool AllNodesExpanded() const; - + // Utility functions to check if mark as read/unread options should be available in menus TBool IsMarkAsReadAvailableL() const; TBool IsMarkAsUnreadAvailableL() const; - + // Utility function to get list of entries which will be targeted by the Actions menu commands. // The list contains either marked entries or the focused message entry or is empty. void GetActionsTargetEntriesL( RFsTreeItemIdList& aListItems ) const; - + // Action menu specific functions void LaunchActionMenuL(); void HandleActionMenuCommandL( TActionMenuCustomItemId itemId ); void LaunchStylusPopupMenuL(); - + // Compose, reply, reply all and forward void CreateNewMsgL(); void ReplyL( CFSMailMessage* aMsgPtr ); void ReplyAllL( CFSMailMessage* aMsgPtr ); void ForwardL( CFSMailMessage* aMsgPtr ); void DoReplyForwardL( TEditorLaunchMode aMode, CFSMailMessage* aMsgPtr = NULL ); - + // Some misc housekeeping functions void RemoveUnnecessaryNodesL(); - void UpdateMailListSettingsL(); + void UpdateMailListSettingsL(); void UpdateMailListTimeDateSettings(); STimeDateFormats MailListTimeDateSettings(); // Request to update list item data from given message pointer void UpdateItemDataL( CFsTreePlainTwoLineItemData* aData, const CFSMailMessage* aMsgPtr ); - + // Request to update preview pane data for list id with msg ptr void UpdatePreviewPaneTextForItemL( TFsTreeItemId aListItemId, CFSMailMessage* aMsgPtr ); void UpdatePreviewPaneTextForItemL( CFsTreePlainTwoLineItemData* aTwoLineItemData, CFSMailMessage* aMsgPtr ); void UpdatePreviewPaneTextIfNecessaryL( TFsTreeItemId aListItemId, TBool aUpdateItem = ETrue ); - + // Sender/Recipient text depending on the mail folder HBufC* GetListFirstTextLineL( const CFSMailMessage* aMsgPtr ); // Reload message pointer from mail client and update list item contents to match it. Item is // removed if it isn't valid anymore. void UpdateItemAtIndexL( TInt aIndex ); - + // Check validity of highlighted msg and remove from list if needed // EFalse indicates that mail was not valid anymore. TBool CheckValidityOfHighlightedMsgL(); @@ -461,27 +466,27 @@ // Gives the parent node if the item has one. Returns KErrNotFound if no parent node available. TFsTreeItemId ParentNode( TFsTreeItemId aItemId ) const; - + // Either marks or unmarks the current item depending on the current marking state // as stored in iListMarkItemsState. Used for marking when shift is depressed while // scrolling. Returns ETrue if the highlighted item is markable. TBool DoScrollMarkUnmarkL(); - + /** * Mark/unmark items under current separator. - * + * * @param aMarked If ETrue mark all items else unmark. * @param aSeparatorId Id of the separator. */ void MarkItemsUnderSeparatorL( TBool aMarked, TInt aSeparatorId ); - + //When maillist is activated this method handles the connection icon change void ConnectionIconHandling(); - + void SetListAndCtrlBarFocusL(); - + void SetMailListItemsExtendedL(); - + void DoFirstStartL(); // Called when flip state is changed @@ -489,44 +494,58 @@ /** * Handles the focus state changes - * @param aShow Indicates if focus should become visible or removed + * @param aVisible Indicates if focus should become visible or removed + */ + void FocusVisibilityChange( TBool aVisible ); + + /** + * Update texts in command area buttons */ - void HandleTimerFocusStateChange( TBool aShow ); + void UpdateButtonTextsL(); + + /** + * Tests whether a point is inside the control. + * + * @param aControl Control that is tested. + * @param aPoint Point in display coordinates. + * + * @return ETrue, if the point is inside one of the + * control's visuals. Otherwise EFalse. + */ + TBool HitTest( const CAlfControl& aControl, const TPoint& aPoint ) const; private: // data types - + private: // Private objects // Reference to Alf environment CAlfEnv& iEnv; // Mail list updater timer // Timer delays mail update to prevent unnesessary redraw events - CMailListUpdater* iMailListUpdater; + CMailListUpdater* iMailListUpdater; // Msg moved note timer - CMsgMovedNoteTimer* iMsgNoteTimer; + CMsgMovedNoteTimer* iMsgNoteTimer; // Screen layout uses iMailListControl CAlfAnchorLayout* iScreenAnchorLayout; // Control bar control and layout and store visual pointer CFsControlBar* iControlBarControl; CAlfVisual* iControlBarVisual; - CAlfDeckLayout* iControlBarLayout; + CAlfDeckLayout* iControlBarLayout; // Mail List control and layout CFreestyleEmailUiMailListControl* iMailListControl; CAlfDeckLayout* iListLayout; -// this feature is waiting for title divider bg graphics CAlfImageVisual* iTitleDividerBgVisual; -// - CFSEmailUiMailListModel* iModel; + CFSEmailUiMailListModel* iModel; CFsTreeList* iMailList; CFsTreeVisualizerBase* iMailTreeListVisualizer; - TInt iNumSlots; + TInt iNumSlots; CFSMailFolder* iMailFolder; - TInt iNewEmailsInModel; - RArray iTreeItemArray; + TInt iNewEmailsInModel; + RArray iTreeItemArray; RArray iButtonsIds; TInt iFocusedControl; TBool iToolbarInUse; - TInt iListMode; + TInt iListMode; TInt iNodesInUse; TInt iNewEmailButtonId; TInt iFolderListButtonId; @@ -535,9 +554,9 @@ MFsControlButtonInterface* iIconButton; MFsControlButtonInterface* iNewEmailButton; MFsControlButtonInterface* iFolderListButton; - MFsControlButtonInterface* iSortButton; - TBool iThisViewActive; - CPbkxContactActionMenu* iActionMenu; + MFsControlButtonInterface* iSortButton; + TBool iThisViewActive; + CPbkxContactActionMenu* iActionMenu; TFSMailSortCriteria iCurrentSortCriteria; // Set to indicate whether items should be marked or unmarked TBool iListMarkItemsState; @@ -564,16 +583,16 @@ CDateChangeTimer* iDateChangeTimer; TBool iFirstStartCompleted; // generic use async callback object - CAsyncCallBack* iAsyncCallback; + CAsyncCallBack* iAsyncCallback; // async callback for deferred redrawing CAsyncCallBack* iAsyncRedrawer; TFSMailMsgId iMsgToFocusAfterRedraw; + HBufC* iNewEmailText; - // - CEUiEmailListTouchManager* iTouchManager; - // - CAknStylusPopUpMenu* iStylusPopUpMenu; - + CEUiEmailListTouchManager* iTouchManager; + CAknStylusPopUpMenu* iStylusPopUpMenu; + TBool iStylusPopUpMenuLaunched; + TBool iShowReplyAll; }; @@ -598,7 +617,7 @@ CAknWaitDialog* iWaitNote; }; -// Delayd note timer +// Delayd note timer class CMsgMovedNoteTimer : public CTimer { public: @@ -626,12 +645,12 @@ ~CDateChangeTimer(); void Start(); void RunL(); - + protected: CDateChangeTimer( CFSEmailUiMailListVisualiser& aMailListVisualiser ); - + private: CFSEmailUiMailListVisualiser& iMailListVisualiser; }; -#endif +#endif