photosgallery/gallery/inc/glxappui.h
branchRCL_3
changeset 60 5b3385a43d68
child 64 34937ec34dac
equal deleted inserted replaced
59:8e5f6eea9c9f 60:5b3385a43d68
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:    AppUi class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef C_GLXWERAPPUI_H
       
    22 #define C_GLXWERAPPUI_H
       
    23 
       
    24 #include <aknViewAppUi.h>
       
    25 #include <mpxcollectionobserver.h>
       
    26 #include <mglxnavigationalstateobserver.h>
       
    27 #include <mpxcollectionpath.h>
       
    28 #include "glxiadupdate.h"
       
    29 
       
    30 class MMPXViewUtility;
       
    31 class MMPXCollectionUtility;
       
    32 class CGlxUiUtility;
       
    33 class CRepository;
       
    34 class CGlxNavigationalState;
       
    35 class CAknGlobalNote;
       
    36 
       
    37 /**
       
    38  *  CGlxAppUi
       
    39  *
       
    40  *  @lib ViewerApplication
       
    41  */
       
    42 
       
    43 class CGlxAppUi : public CAknViewAppUi, public MGlxNavigationalStateObserver
       
    44 	{
       
    45 public:
       
    46 	CGlxAppUi();
       
    47 	void ConstructL();
       
    48 	~CGlxAppUi();
       
    49 
       
    50 public: // from CAknAppUi
       
    51 	/**
       
    52 	 * From CAknAppUi
       
    53      * Handle user menu selections
       
    54   	 * @param aCommand Id of the command
       
    55      */
       
    56 	void HandleCommandL(TInt aCommand);
       
    57 
       
    58     // From MGlxNavigationalStateObserver
       
    59     void HandleNavigationalStateChangedL();
       
    60     //OOM Method
       
    61     void HandleApplicationSpecificEventL(TInt aEventType, const TWsEvent& aWsEvent);
       
    62 
       
    63     // Callback for periodic timer, static, 
       
    64     static TInt PeriodicCallback( TAny* aPtr );
       
    65     //nonstatic func called from periodic timer
       
    66     void PeriodicCallback();
       
    67 
       
    68 private:    // From CEikAppUi
       
    69     MCoeMessageObserver::TMessageResponse HandleMessageL(
       
    70                             TUint32 aClientHandleOfTargetWindowGroup,
       
    71                             TUid aMessageUid, const TDesC8& aMessageParameters);
       
    72     TBool ProcessCommandParametersL(TApaCommand aCommand,
       
    73                             TFileName& aDocumentName, const TDesC8& aTail);
       
    74 
       
    75 private: // From CCoeAppUi
       
    76 
       
    77     void HandleForegroundEventL( TBool aForeground );
       
    78  
       
    79 private:
       
    80     enum TEntryType
       
    81         {
       
    82         EEntryTypeStartUp = 0,
       
    83         EEntryTypeFocusGained
       
    84         };
       
    85     
       
    86 
       
    87     /**
       
    88      * Handle an activation message.
       
    89      * @param aCommand command data sent from the activating application.
       
    90      * @param aDocumentName image file name data sent from the activating application.
       
    91      * @param aData Message data from activating application.
       
    92      */
       
    93     void HandleActivationMessageL(const TApaCommand& aCommand, const TFileName& aDocumentName, const TDesC8& aData);
       
    94 	 /**
       
    95      * Handle an activation message.    
       
    96      * @param aData Message data from activating application.
       
    97      */
       
    98     void HandleActivationMessageL(const TDesC8& aData);
       
    99     /**
       
   100      * Set activation parameter for startup view, converting to 16-bit
       
   101      * descriptor used by MPX.
       
   102      * @param aParam Activation parameter.
       
   103      */
       
   104     void SetActivationParamL(const TDesC8& aParam);
       
   105 
       
   106     /**
       
   107      * Get view scoring ids based on current navigational state
       
   108      * (using Get in the name since the function does not return anything)
       
   109      * @param aIns list that will be populated with scoring ids
       
   110      */
       
   111     void GetViewScoringIdsL( RArray<TUid>& aIds ) const;
       
   112 
       
   113     /**
       
   114      * Get view scoring id for collection plugin
       
   115      * @param naviState Path to represent navigational state
       
   116      * @return scoding id
       
   117      */
       
   118     TUid GetViewScoringIdForCollectionPlugin( const CMPXCollectionPath& aNaviState ) const;
       
   119 
       
   120     /**
       
   121      * Get view scoring id for depth in ui hierarchy
       
   122      * @param naviState Path to represent navigational state
       
   123      * @return scoding id
       
   124      */
       
   125     TUid ViewScoringIdForNaviStateDepth( const CMPXCollectionPath& aNaviState ) const;
       
   126 
       
   127     /**
       
   128      * Requesting OOM to Free Some Memory, so that photos can Start
       
   129      * @return Error if Memory Cannot be freed else Error None
       
   130      */
       
   131     TInt OOMRequestFreeMemoryL( TInt aBytesRequested) ;
       
   132 
       
   133     /**
       
   134      * Finds Current Memory Availability And Decides to Send a Request for freeing the memory 
       
   135      * @param aCriticalMemoryRequired Bare Minimum to start photos 
       
   136      * @return Error Code from OOM
       
   137      */
       
   138     TInt ReserveMemoryL(TInt aCriticalMemoryRequired);
       
   139     
       
   140     /**
       
   141      * Finds Current Minimum Required memory to start photos 
       
   142      * @param Type of application invokation 
       
   143      * @return Required Critical Memory
       
   144      */
       
   145     TInt RamRequiredInBytesL(TEntryType aType);
       
   146     
       
   147     /**
       
   148      * @todo:
       
   149      * Get view scoring id for depth in ui hierarchy
       
   150      * @param naviState Path to represent navigational state
       
   151      * @return scoding id
       
   152      */
       
   153     void ReserveMemoryL(TEntryType aType);
       
   154 
       
   155     //OOM
       
   156     /*
       
   157     *Invoked by the OOM framwork when photos app needs to free memory for other applications.
       
   158     */
       
   159     void StartCleanupL();
       
   160 
       
   161     //OOM
       
   162     /*
       
   163     *Invoked by the OOM framwork when photos app needs to free memory for other applications.
       
   164     */
       
   165     void StopCleanupL();
       
   166 	
       
   167 	/**
       
   168      * Check for updates via IAD.
       
   169      */
       
   170     void DoCheckForIADUpdatesL();
       
   171     /**
       
   172      * close photos app.
       
   173      */
       
   174      void ClosePhotosL();
       
   175 
       
   176 private:
       
   177     MMPXViewUtility* iViewUtility;
       
   178     
       
   179     CAknGlobalNote* iGlobalWaitNote;
       
   180     TInt iNoteId;
       
   181     HBufC* iFreeMemText;
       
   182 
       
   183     /// Singleton that stores gallery's navigational state
       
   184     CGlxNavigationalState* iNavigationalState;
       
   185     
       
   186     /** Optional view plugin UID to activate when the collection is opened */
       
   187     TUid iStartupViewUid;
       
   188 
       
   189     /** Optional activation parameter for the next view */
       
   190     HBufC* iActivationParam;
       
   191     
       
   192     TBool iFocusLostLowMemory;
       
   193     TBool iStartUpSequence;
       
   194 
       
   195     ///Ui utility
       
   196     CGlxUiUtility* iUiUtility;
       
   197 
       
   198     /// Central repository entry for app (owned)
       
   199     CRepository* iRepository;
       
   200     
       
   201     /**
       
   202      * IAD updater class
       
   203      */
       
   204     CGlxIadUpdate* iIadUpdate;
       
   205 	
       
   206     /**
       
   207     *This flag to chk whether red key has been pressed
       
   208     */
       
   209     TBool iEndKeyPressed;
       
   210 
       
   211     /**
       
   212      *Timer to check for IAD updates 30 seconds after application startup.
       
   213      */
       
   214      CPeriodic* iPeriodic ;
       
   215      
       
   216      /**
       
   217       * Flag to filter any spurious EPathChanged event from MPX Collection f/w.
       
   218       */     
       
   219      TBool iStateChangeRequested;
       
   220 } ;
       
   221 
       
   222 
       
   223 #endif // C_GLXWERAPPUI_H
       
   224