mmsharing/mmshui/inc/musuigeneralview.h
branchRCL_3
changeset 33 bc78a40cd63c
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Mus Applications Event Observer Interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MUSUIGENERALVIEW_H
       
    21 #define MUSUIGENERALVIEW_H
       
    22 
       
    23 #include "musuisharingobserver.h"
       
    24 #include "musuiactivetimerobserver.h"
       
    25 
       
    26 #include <avkon.rsg>              // Avkon resource file
       
    27 #include <aknview.h>              // Avkon base view class
       
    28 #include <akntoolbarobserver.h>
       
    29 
       
    30 class CMusUiAppUi;
       
    31 class CMusUiEventController;
       
    32 class CMusUiActivityManager;
       
    33 class CMusUiViewContainer;
       
    34 class CAknIncallBubble;
       
    35 class CMusUiActiveTimer;
       
    36 class CMusUiBackgroundViewContainer;
       
    37 
       
    38 /**
       
    39  * The base class for the MUS application's view classes.
       
    40  * Encapsulates common methods for views.
       
    41  *
       
    42  * @lib musui.exe
       
    43  */
       
    44 class CMusUiGeneralView : public CAknView,
       
    45                           public MAknToolbarObserver,
       
    46                           public MMusUiSharingObserver,
       
    47                           public MMusUiActiveTimerObserver
       
    48     {
       
    49     
       
    50 public: // constructors and destructor
       
    51 
       
    52     enum TMusFgBgEventType
       
    53         {
       
    54         EMusFgBgEventNone,
       
    55         EMusFgEvent,
       
    56         EMusBgEvent
       
    57         };
       
    58 
       
    59     /**
       
    60     * EPOC default constructor.
       
    61     */
       
    62 	void ConstructL();
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     virtual ~CMusUiGeneralView();
       
    68 
       
    69 public: // new functions
       
    70 
       
    71     /**
       
    72      * @return the pointer to the application's AppUi (CMusUiAppUi).
       
    73      */
       
    74     CMusUiAppUi* MusAppUi() const;
       
    75     
       
    76     /**
       
    77      * Refreshes the view.  Called after the mode has been changed from portrait
       
    78      * to landscape or vice versa.  This is a virtual function that must be 
       
    79      * implemented by all concrete MUS UI views.
       
    80      */
       
    81     virtual void RefreshView() = 0;
       
    82     
       
    83     virtual void HandleToolbarCommandL( TInt aCommand ) = 0;
       
    84     
       
    85     virtual void HandleKeyUpEvent( TInt aKeyCode );
       
    86     
       
    87     virtual void SetToolbarVisibility( TBool aVisible );
       
    88 
       
    89     void AsyncQueryDialogAcceptedL( TBool aAccepted );
       
    90 
       
    91     TInt FocusedToolbarItem() const;
       
    92     
       
    93     virtual void LevelIndicatorDismissed() {};
       
    94     virtual void SetInitialFocusedItemL() = 0;
       
    95     
       
    96     TBool OperatorSpecificFunctionality() const;
       
    97     /**
       
    98     * Called when UI comes to foregound / goes to background.
       
    99     * CAknView version of HandleForegroundEventL is not used
       
   100     * at it generates lots of events. Instead, appui implements
       
   101     * foreground event callback funtion and forwards events to views
       
   102     * via this method.
       
   103     */
       
   104     virtual void DoHandleForegroundEventL( TBool aForeground ) = 0;  
       
   105 
       
   106 
       
   107 public: // from base class MAknToolbarObserver
       
   108     
       
   109     virtual void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
       
   110     
       
   111     virtual void OfferToolbarEventL( TInt aCommand );
       
   112     
       
   113 
       
   114 public: // from MMusUiSharingObserver
       
   115 
       
   116     /*
       
   117     * Shows sychronous wait dialog with softkey R_AVKON_SOFTKEYS_CANCEL.
       
   118     * @param aPrompt Prompt text shown in dialog
       
   119     * @param aTimerInSeconds Timer in seconds when dialog is dismissed
       
   120     *        automatically. Timer value 0 means that no timer is used.
       
   121     * @param aExpirationMessageResourceId is ID of resource indicating
       
   122     *        the message to be shown if timer expires. Value 0 means that
       
   123     *        no message is shown.
       
   124     * @return EFalse if dialog is dismissed by user pressing cancel
       
   125     *         or by expiration of timer. ETrue if DismissWaitDialogL
       
   126     *         is called with parameter ETrue;
       
   127     */
       
   128     virtual TBool ShowWaitDialogL( const TDesC& aPrompt, 
       
   129                                    TInt aTimerInSeconds = 0,
       
   130                                    TInt aExpirationMessageResourceId = 0 );
       
   131     
       
   132     /*
       
   133     * Dismisses sychronous wait dialog shown by calling ShowWaitDialogL.
       
   134     * @param aReturnValue determines return value of function 
       
   135     *        ShowWaitDialogL.
       
   136     */
       
   137     virtual void DismissWaitDialogL( TBool aReturnValue = ETrue );
       
   138     
       
   139     /*
       
   140     * Set call back service of wait dialog
       
   141     * @param aCallback A pointer of class MProgressDialogCallback
       
   142     *        which implemented DialogDismissedL 
       
   143     */
       
   144     virtual void SetWaitDialogCallbackL( MProgressDialogCallback* aCallback );
       
   145     
       
   146     virtual void ShowStatusPaneTitleL();
       
   147 
       
   148     virtual void EnableMiddleSoftkeyL( TInt aResourceId );
       
   149 
       
   150     virtual void ActivateVolumeControlL( TInt aValue, TBool aOnlyIfVisible = EFalse );  
       
   151     
       
   152     virtual void HighlightSelectedToolbarItem( TInt aCommand );
       
   153     
       
   154     /**
       
   155     * General functionality for replacing a toolbar command
       
   156     * Function should be overridden for specific functionality
       
   157     */
       
   158     virtual void ReplaceToolbarCommand( TInt aOldCommand, 
       
   159                                         TInt aNewCommand,
       
   160                                         TBool aSetNewCommandFocused );
       
   161     
       
   162     /**
       
   163     * If toolbar is shown, audio routing button will be refreshed according to
       
   164     * current state of audio routing. 
       
   165     * In case there is no toolbar, middle softkey will be updated
       
   166     */
       
   167     virtual void RefreshAudioRoutingToolbarButton();
       
   168     
       
   169     virtual void UpdateSessionTime( const TDesC& aSessionTime );  
       
   170         
       
   171     virtual void DismissMenuBar();
       
   172                                         
       
   173                                         
       
   174 public: // from base class CAknView
       
   175 
       
   176     /**
       
   177      * Takes care of command handling.
       
   178      *
       
   179      * @param aCommand  The command that was received.
       
   180      */
       
   181     virtual void HandleCommandL( TInt aCommand );
       
   182 
       
   183     /**
       
   184      * From MEikMenuObserver, called by framework before constructing menupane.
       
   185      * Initializes menu items common to all sharing types.
       
   186      */
       
   187     virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   188     
       
   189 public: // from MMusUiActiveTimerObserver    
       
   190     
       
   191     /**
       
   192      * Indicates that a certain amount of time elapsed
       
   193      */    
       
   194     virtual void TimerComplete( CMusUiActiveTimer* aTimer );
       
   195 
       
   196 
       
   197 protected: // New functions
       
   198 
       
   199     virtual CMusUiEventController* EventController() const = 0;
       
   200     
       
   201     virtual CMusUiViewContainer& SharingContainer() const = 0;
       
   202     
       
   203     /**
       
   204     * Leaves with KErrNotFound if eventcontroller is not available
       
   205     */
       
   206     CMusUiEventController& EventControllerL() const;
       
   207     
       
   208     /**
       
   209      * Called when event occurs of type EEventFocusLost or
       
   210      * EEventFocusGained.
       
   211      *
       
   212      * @param aForeground ETrue if the application is in the foreground,
       
   213      *                    otherwise EFalse.
       
   214      * @param aExit indicates if the application should exit 
       
   215      */
       
   216     void HandleForegroundEventL( TBool aForeground, TBool aExit );    
       
   217     
       
   218 
       
   219 protected:
       
   220 
       
   221     /**
       
   222      * Gets called by the framework when it's activating this view.
       
   223      *
       
   224      * @param aPrevViewId Previous view id
       
   225      * @param aCustomMessageId Custom message's id
       
   226      * @param aCustomMessage Custom message
       
   227      */
       
   228     void DoActivateL( const TVwsViewId& aPrevViewId,
       
   229                       TUid aCustomMessageId,
       
   230                       const TDesC8& aCustomMessage );
       
   231 
       
   232     /**
       
   233      * Gets called by the framework when it's deactivating this view.
       
   234      */
       
   235     void DoDeactivate();
       
   236 
       
   237 protected:
       
   238 
       
   239    
       
   240     void CompleteForegroundEventL();
       
   241     void DoForegroundEventL();
       
   242     void DoBackgroundEventL( TBool aExit );
       
   243     void SetCurrentFgBgEvent( TMusFgBgEventType aEventType );
       
   244     TInt ToolbarPlaceHolderHeight() const;
       
   245     TInt ToolbarPlaceHolderWidth() const;
       
   246     void UpdateBackgroundOrdinalPosition( TBool aUp );  
       
   247     void RefreshBackgroundContainer();
       
   248 
       
   249 protected: // data
       
   250 
       
   251     /**
       
   252     * ETrue if operator specific functionality is needed 
       
   253     */
       
   254     TBool iOperatorSpecificFunctionality;
       
   255         
       
   256     TBool iToolbarItemSelected;
       
   257     
       
   258     CMusUiBackgroundViewContainer* iBackgroundContainer; // skin background drawer
       
   259     
       
   260 private: // data
       
   261     
       
   262     CAknIncallBubble* iIncallBubble;
       
   263     
       
   264     CMusUiActiveTimer* iSessionEndTimer;
       
   265     
       
   266     CMusUiActiveTimer* iFgBgTimer;
       
   267     
       
   268     TMusFgBgEventType iCurrentFgBgEvent;
       
   269     
       
   270     TBool iCurrentExitSetting;
       
   271     
       
   272     };
       
   273 
       
   274 // macro for NO_TOOLBAR case
       
   275 #define MUS_NO_TOOLBAR ( iOperatorSpecificFunctionality && !(AknLayoutUtils::PenEnabled()))
       
   276 
       
   277 #endif // MUSUIGENERALVIEW_H
       
   278 
       
   279 // end of file