emailuis/emailui/inc/FreestyleEmailUiViewBase.h
changeset 1 12c456ceeff2
parent 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
0:8466d47a6819 1:12c456ceeff2
     1 /*
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2008 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 "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public 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.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 *
    13 *
    14 * Description:  Declaration for the common base class for all FsEmailUi views.
    14 * Description:  Declaration for the common base class for all FsEmailUi views.
    15 *                The class is not intended for instantation.
    15 *                The class is not intended for instantation.
    16 *
    16 *
    17 */
    17 */
    18  
    18 
    19 
    19 
    20 #ifndef __FREESTYLEEMAILUI_VIEWBASE_H__
    20 #ifndef __FREESTYLEEMAILUI_VIEWBASE_H__
    21 #define __FREESTYLEEMAILUI_VIEWBASE_H__
    21 #define __FREESTYLEEMAILUI_VIEWBASE_H__
    22 
    22 
    23 #include <aknview.h>
    23 #include <aknview.h>
    40         {
    40         {
    41         ESkinChanged,
    41         ESkinChanged,
    42         EScreenLayoutChanged,
    42         EScreenLayoutChanged,
    43         EOther
    43         EOther
    44         };
    44         };
    45     
    45 
    46 public: // from CAknView
    46 public: // from CAknView
    47     // dummy implementation for the base class abstact functions are needed to be able to define a constructor
    47     // dummy implementation for the base class abstact functions are needed to be able to define a constructor
    48     TUid Id() const;
    48     TUid Id() const;
    49 
    49 
    50 
    50 
    51 // <cmail> Toolbar
    51 // <cmail> Toolbar
    52 private:
    52 private:
    53     
    53 
    54     virtual void DoActivateL( const TVwsViewId& aPrevViewId,
    54     virtual void DoActivateL( const TVwsViewId& aPrevViewId,
    55         TUid aCustomMessageId,
    55         TUid aCustomMessageId,
    56         const TDesC8& aCustomMessage );
    56         const TDesC8& aCustomMessage );
    57 // </cmail> Toolbar
    57 // </cmail> Toolbar
    58 	
    58 
    59     /**
    59     /**
    60     * Inherited classes should NOT override this. The should override ChildDoDeactivate() instead.
    60     * Inherited classes should NOT override this. The should override ChildDoDeactivate() instead.
    61     */
    61     */
    62     void DoDeactivate();
    62     void DoDeactivate();
    63     
    63 
    64 public: // new functions
    64 public: // new functions
    65     /**
    65     /**
    66     * Returns a handle to the control group assosiated to this view, as given in the class constructor.
    66     * Returns a handle to the control group assosiated to this view, as given in the class constructor.
    67     */
    67     */
    68     CAlfControlGroup& ControlGroup();
    68     CAlfControlGroup& ControlGroup();
    92     */
    92     */
    93     virtual TBool IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId, TFSMailMsgId& aFoundNextMsgFolder ) const;
    93     virtual TBool IsNextMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId, TFSMailMsgId& aFoundNextMsgFolder ) const;
    94     virtual TBool IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId, TFSMailMsgId& aFoundPrevMsgFolder ) const;
    94     virtual TBool IsPreviousMsgAvailable( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId, TFSMailMsgId& aFoundPrevMsgFolder ) const;
    95     virtual TInt MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId );
    95     virtual TInt MoveToNextMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundNextMsgId );
    96     virtual TInt MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId );
    96     virtual TInt MoveToPreviousMsgL( TFSMailMsgId aCurrentMsgId, TFSMailMsgId& aFoundPreviousMsgId );
    97 
    97     virtual TInt MoveToPreviousMsgAfterDeleteL( TFSMailMsgId aFoundPreviousMsgId );
    98     /**
    98     /**
    99      * Do the transition effect for the view if effects are enabled.
    99      * Do the transition effect for the view if effects are enabled.
   100      */
   100      */
   101     void DoTransition( TBool aDirectionOut );
   101     void DoTransition( TBool aDirectionOut );
   102 
   102 
   103     /**
   103     /**
   104      * Prepares application exit. This is called by AppUi during cleanup before AppUi's destructor
   104      * Prepares application exit. This is called by AppUi during cleanup before AppUi's destructor
   105      */
   105      */
   106 	virtual void PrepareExitL();
   106 	virtual void PrepareExitL();
   107 	
   107 
   108 	/**
   108 	/**
   109 	 * Called when flip state changes.
   109 	 * Called when flip state changes.
   110 	 */
   110 	 */
   111 	virtual void FlipStateChangedL( TBool aKeyboardFlipOpen );
   111 	virtual void FlipStateChangedL( TBool aKeyboardFlipOpen );
   112 
   112 
   113 	/**
   113 	/**
   114 	* This method is called from the appui when the focus removal timer expires.
   114 	* This method is called from the appui when the focus state is changed.
   115 	* Each inherited view should implement own method for focus removal
   115 	* Each inherited view should implement own method for focus handling
   116 	* @param aShow Indicates if focus should become visible or removed
   116 	* @param aVisible Indicates if focus should become visible or removed
   117 	*/
   117 	*/
   118 	virtual void HandleTimerFocusStateChange( TBool aShow);
   118 	virtual void FocusVisibilityChange( TBool aVisible );
   119 	
   119 
   120 protected: // methods
   120 protected: // methods
   121 
   121 
   122     /**
   122     /**
   123      * Inherited classes may override this to react to FsEmail application
   123      * Inherited classes may override this to react to FsEmail application
   124      * being brougt to foreground while that particular view is active.
   124      * being brougt to foreground while that particular view is active.
   125      */
   125      */
   126     virtual void HandleForegroundEventL();
   126     virtual void HandleForegroundEventL();
   127 
   127 
   128     /**
   128     /**
   129     * Inherited classes should override this instead of DoDeactivate() 
   129     * Inherited classes should override this instead of DoDeactivate()
   130     * to do the view deactivation
   130     * to do the view deactivation
   131     */
   131     */
   132     virtual void ChildDoDeactivate() = 0;
   132     virtual void ChildDoDeactivate() = 0;
   133 
   133 
   134     /**
   134     /**
   135      * Make control group of the view visible and set to accept input.
   135      * Make control group of the view visible and set to accept input.
   136      */
   136      */
   137     virtual void ActivateControlGroup( TInt aDelay = 0 );
   137     virtual void ActivateControlGroup( TInt aDelay = 0 );
   138     
   138 
   139     /**
   139     /**
   140      * Make control group of the view invisible and set to ignore input.
   140      * Make control group of the view invisible and set to ignore input.
   141      */
   141      */
   142     virtual void DeactivateControlGroup( TInt aDelay = 0 );
   142     virtual void DeactivateControlGroup( TInt aDelay = 0 );
   143 
   143 
   144     /**
   144     /**
   145     * Inheriting Alfred views can override these functions, if they need to do
   145     * Inheriting Alfred views can override these functions, if they need to do
   146     * some special tricks for transition effects
   146     * some special tricks for transition effects
   147     */
   147     */
   148     virtual void DoTransitionEffect( TBool aDirectionOut );
   148     virtual void DoTransitionEffect( TBool aDirectionOut );
   149     
   149 
   150     /**
   150     /**
   151     * Inheriting Alfred views should override this and return their parent
   151     * Inheriting Alfred views should override this and return their parent
   152     * layout(s) in array given as parameter. Default implementation
   152     * layout(s) in array given as parameter. Default implementation
   153     * does nothing, so then the array is empty.
   153     * does nothing, so then the array is empty.
   154     */
   154     */
   164     /**
   164     /**
   165     * Used to indicate that the next out transition effect should be long
   165     * Used to indicate that the next out transition effect should be long
   166     * (some long opening view is to be opened next)
   166     * (some long opening view is to be opened next)
   167     */
   167     */
   168     void SetNextTransitionOutLong( TBool aLongTransitionOut );
   168     void SetNextTransitionOutLong( TBool aLongTransitionOut );
   169     
   169 
   170     TBool IsNextTransitionOutLong();
   170     TBool IsNextTransitionOutLong();
   171 
   171 
   172     /**
   172     /**
   173      * Derived classes should call this always when the view is entered with forward navigation.
   173      * Derived classes should call this always when the view is entered with forward navigation.
   174      * This is required to make returning from the view work correctly in case of external activation.
   174      * This is required to make returning from the view work correctly in case of external activation.
   175      * It doesn't hurt to call this also from views which cannot be externally activated.
   175      * It doesn't hurt to call this also from views which cannot be externally activated.
   176      */
   176      */
   177     void ViewEntered( const TVwsViewId& aPrevViewId );
   177     void ViewEntered( const TVwsViewId& aPrevViewId );
   178     
   178 
   179     /**
   179     /**
   180      * Derived classes should call this to do backwards navigation e.g. when user
   180      * Derived classes should call this to do backwards navigation e.g. when user
   181      * presses "Back" button. This returns to the previous view, and in case the view
   181      * presses "Back" button. This returns to the previous view, and in case the view
   182      * was activated externally, takes FsEmail to background and brings the previous
   182      * was activated externally, takes FsEmail to background and brings the previous
   183      * application to foreground.
   183      * application to foreground.
   184      */
   184      */
   185     virtual void NavigateBackL();    
   185     virtual void NavigateBackL();
   186 
   186 
   187     /**
   187     /**
   188      * Derived classes can call this utility function to set the middle soft key
   188      * Derived classes can call this utility function to set the middle soft key
   189      * label and ID from the given resource.
   189      * label and ID from the given resource.
   190      */
   190      */
   191     void ChangeMskCommandL( TInt aLabelResourceId );
   191     void ChangeMskCommandL( TInt aLabelResourceId );
   192 
   192 
   193 // <cmail> Toolbar
   193 // <cmail> Toolbar
   194 protected: // toobar changes    
   194 protected: // toobar changes
   195     
   195 
   196     /**
   196     /**
   197      * @see CAknView::DoActivateL
   197      * @see CAknView::DoActivateL
   198      */
   198      */
   199     virtual void ChildDoActivateL( 
   199     virtual void ChildDoActivateL(
   200             const TVwsViewId& aPrevViewId,
   200             const TVwsViewId& aPrevViewId,
   201             TUid aCustomMessageId,
   201             TUid aCustomMessageId,
   202             const TDesC8& aCustomMessage ) = 0;
   202             const TDesC8& aCustomMessage ) = 0;
   203     
   203 
   204     /**
   204     /**
   205      * Return view's toolbar resource id.
   205      * Return view's toolbar resource id.
   206      */
   206      */
   207     virtual TInt ToolbarResourceId() const;
   207     virtual TInt ToolbarResourceId() const;
   208    
   208 
   209     /**
   209     /**
   210      * Called when whole toolbar needs to be updated. Creates and sets new 
   210      * Called when whole toolbar needs to be updated. Creates and sets new
   211      * toolbar by calling ToolbarResourceId() method.
   211      * toolbar by calling ToolbarResourceId() method.
   212      */
   212      */
   213     void UpdateToolbarL();
   213     void UpdateToolbarL();
   214 
   214 
   215     /**
   215     /**
   216      * Get array of item IDs that need to be dimmed before toolbar is set for
   216      * Get array of item IDs that need to be dimmed before toolbar is set for
   217      * view.
   217      * view.
   218      * @param aResourceId Resource ID of the toolbar.
   218      * @param aResourceId Resource ID of the toolbar.
   219      * @param aDimmedItems Array of items that will be dimmed.
   219      * @param aDimmedItems Array of items that will be dimmed.
   220      */   
   220      */
   221     virtual void GetInitiallyDimmedItemsL( const TInt aResourceId,
   221     virtual void GetInitiallyDimmedItemsL( const TInt aResourceId,
   222             RArray<TInt>& aDimmedItems ) const;
   222             RArray<TInt>& aDimmedItems ) const;
   223     
   223 
   224     /**
   224     /**
   225      * Replaces single toolbar item with item from resource file. Control
   225      * Replaces single toolbar item with item from resource file. Control
   226      * must be of AVKON_BUTTON type.
   226      * must be of AVKON_BUTTON type.
   227      * @param aReaplceId Id of command to be replaced.
   227      * @param aReaplceId Id of command to be replaced.
   228      * @param aResourceId Resource Id of the control that will replace existing
   228      * @param aResourceId Resource Id of the control that will replace existing
   234 
   234 
   235     /**
   235     /**
   236      * Removes single toolbar item from toolbar.
   236      * Removes single toolbar item from toolbar.
   237      */
   237      */
   238     void RemoveToolbarItem( const TInt aRemoveId );
   238     void RemoveToolbarItem( const TInt aRemoveId );
   239     
   239 
   240     /**
   240     /**
   241      * Hides toolbar.
   241      * Hides toolbar.
   242      */
   242      */
   243     void HideToolbar();
   243     void HideToolbar();
   244 
   244 
   249 
   249 
   250     /**
   250     /**
   251      * Dim/undim toolbar item.
   251      * Dim/undim toolbar item.
   252      */
   252      */
   253     void SetToolbarItemDimmed( const TInt aCommandId, const TBool aDimmed );
   253     void SetToolbarItemDimmed( const TInt aCommandId, const TBool aDimmed );
   254     
   254 
   255     /**
   255     /**
   256      * Returns ETrue if view has toolbar.
   256      * Returns ETrue if view has toolbar.
   257      */
   257      */
   258     virtual TBool HasToolbar() const;
   258     virtual TBool HasToolbar() const;
   259     
   259 
   260 protected: // Single click changes   
   260 protected: // Single click changes
   261     /**
   261     /**
   262      * Return current state of the focus visibility
   262      * Return current state of the focus visibility
   263      * @return ETrue if the focus should be shown
   263      * @return ETrue if the focus should be shown
   264      */
   264      */
   265     virtual TBool IsFocusShown();
   265     virtual TBool IsFocusShown();
   267 	/**
   267 	/**
   268 	 * Set status bar layout. By default layout is R_AVKON_STATUS_PANE_LAYOUT_USUAL.
   268 	 * Set status bar layout. By default layout is R_AVKON_STATUS_PANE_LAYOUT_USUAL.
   269 	 * Inherited classes can override this and set desired status bar layout.
   269 	 * Inherited classes can override this and set desired status bar layout.
   270 	 */
   270 	 */
   271 	virtual void SetStatusBarLayout();
   271 	virtual void SetStatusBarLayout();
   272 	            
   272 
   273 protected: // from MAknToolbarObserver
   273 protected: // from MAknToolbarObserver
   274     
   274 
   275     /**
   275     /**
   276      * @see MAknToolbarObserver::OfferToolbarEventL
   276      * @see MAknToolbarObserver::OfferToolbarEventL
   277      */
   277      */
   278     void OfferToolbarEventL( TInt aCommand );
   278     void OfferToolbarEventL( TInt aCommand );
   279 
   279 
   280 // </cmail> Toolbar
   280 // </cmail> Toolbar
   281     
   281 
   282 protected: // construction
   282 protected: // construction
   283     
   283 
   284     CFsEmailUiViewBase( CAlfControlGroup& aControlGroup, CFreestyleEmailUiAppUi& aAppUi );
   284     CFsEmailUiViewBase( CAlfControlGroup& aControlGroup, CFreestyleEmailUiAppUi& aAppUi );
   285    
   285 
   286     /**
   286     /**
   287      * Return view active status. ETrue if the view is currently activated, EFalse otherwise.
   287      * Return view active status. ETrue if the view is currently activated, EFalse otherwise.
   288      */
   288      */
   289     TBool IsViewActive() const;
   289     TBool IsViewActive() const;
   290    
   290 
   291 private:
   291 private:
   292 
   292 
   293     /**
   293     /**
   294      * Sets view's active status. Private to protect calling from inherited classes.
   294      * Sets view's active status. Private to protect calling from inherited classes.
   295      */
   295      */
   296     void SetViewActive( const TBool aActive );
   296     void SetViewActive( const TBool aActive );
   297            
   297 
   298 protected: // data
   298 protected: // data
   299     
   299 
   300     CAlfControlGroup& iControlGroup;
   300     CAlfControlGroup& iControlGroup;
   301     CFreestyleEmailUiAppUi& iAppUi;
   301     CFreestyleEmailUiAppUi& iAppUi;
   302 
   302 
   303     // Status of the keyboard flip
   303     // Status of the keyboard flip
   304     TBool iKeyboardFlipOpen;
   304     TBool iKeyboardFlipOpen;
   305 
   305 
   306     // Is focus visible
   306     // Is focus visible
   307     TBool iFocusVisible;
   307     TBool iFocusVisible;
   308     
   308 
   309 private: // data
   309 private: // data
   310     
   310 
   311     TUid iPreviousAppUid;
   311     TUid iPreviousAppUid;
   312     // ID of the mailbox which was active before this view was activated from an external application
   312     // ID of the mailbox which was active before this view was activated from an external application
   313     TFSMailMsgId iActiveMailboxBeforeExternalActivation;
   313     TFSMailMsgId iActiveMailboxBeforeExternalActivation;
   314     // Flag to indicate if next fade out effect should be longer than normally
   314     // Flag to indicate if next fade out effect should be longer than normally
   315     TBool iIsNextTransitionEffectOutLong;
   315     TBool iIsNextTransitionEffectOutLong;