iaupdate/IAD/ui/inc/iaupdateengine.h
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
child 27 e8965914fac7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
     1 /*
       
     2 * Copyright (c) 2009-2010 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:   This file contains the header file of the IAUpdateEngine
       
    15 *                class 
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef IAUPDATEENGINE_H_
       
    20 #define IAUPDATEENGINE_H_
       
    21 
       
    22 #include <QObject>
       
    23 
       
    24 #include "iaupdateuidefines.h"
       
    25 #include "iaupdateuicontrollerobserver.h"
       
    26 #include "iaupdatenode.h"
       
    27 
       
    28 class IAUpdateServiceProvider;
       
    29 class CIAUpdateUiController;
       
    30 class CIAUpdateFWUpdateHandler;
       
    31 class CIAUpdateParameters;
       
    32 class CIAUpdateGlobalLockHandler;
       
    33 class CIAUpdateAutomaticCheck;
       
    34 class MIAUpdateNode;
       
    35 class MIAUpdateFwNode;
       
    36 class CEikonEnv;
       
    37 class RCmManager;
       
    38 class CIdle;
       
    39 class HbAction;
       
    40 class IAUpdateResultsDialog;
       
    41 
       
    42 class IAUpdateEngine : public QObject,
       
    43                        public MIAUpdateUiControllerObserver
       
    44     {
       
    45     Q_OBJECT
       
    46 
       
    47 public:
       
    48     IAUpdateEngine(QObject *parent = 0);
       
    49     ~IAUpdateEngine();
       
    50     
       
    51     void StartedByLauncherL( bool aRefreshFromNetworkDenied );
       
    52      
       
    53      /**
       
    54       * When the update check operation is started through
       
    55       * the API, the session directs the requests for the UI. UI will
       
    56       * handle the operation and inform the observer when the operation is
       
    57       * completed.
       
    58       * @param aFilterParams These parameters are used when update items
       
    59       * are filtered for the UI list.
       
    60       */
       
    61      void CheckUpdatesRequestL( int wgid, 
       
    62                                 CIAUpdateParameters* aFilterParams, 
       
    63                                 bool aForcedRefresh );
       
    64 
       
    65      /**
       
    66       * When the show update operation is started through
       
    67       * the API, the session directs the requests for the UI. UI will
       
    68       * hanle the operation and inform the observer when the operation is
       
    69       * completed.
       
    70       * @param aFilterParams These parameters are used when update items
       
    71       * are filtered for the UI list.
       
    72       */
       
    73      void ShowUpdatesRequestL( int wgid, CIAUpdateParameters* aFilterParams );
       
    74      
       
    75               
       
    76      
       
    77      /** 
       
    78       * When the update operation is started through
       
    79       * the API, the session directs the requests for the UI. UI will
       
    80       * hanle the operation and inform the observer when the operation is
       
    81       * completed.
       
    82       * @param aUid  Uid of the caller of the request
       
    83       */
       
    84      void ShowUpdateQueryRequestL( int wgid, uint aUid );
       
    85      
       
    86      
       
    87      void StartUpdate( bool aFirmwareUpdate );
       
    88      /**
       
    89       * Set this application visible/unvisible
       
    90       * @param aVisible If EFalse application is put background and is hidden in FSW 
       
    91       */
       
    92       void SetVisibleL( bool aVisible );
       
    93       
       
    94       /**
       
    95       * Set window group id of client application 
       
    96       *
       
    97       * @param aWgId Window group id
       
    98       */
       
    99       void SetClientWgId( int aWgId );
       
   100           
       
   101       /**
       
   102       * Is client application in background
       
   103       *
       
   104       * @param True value if client application is in background
       
   105       */
       
   106       bool ClientInBackgroundL() const;
       
   107     
       
   108 signals:
       
   109     void toMainView();
       
   110     
       
   111     /**
       
   112     * Refreshes main view 
       
   113     * @param aError  Error code
       
   114     */              
       
   115     void refresh(const RPointerArray<MIAUpdateNode>& nodes,
       
   116                  const RPointerArray<MIAUpdateFwNode>& fwNodes,
       
   117                  int error);
       
   118     
       
   119 
       
   120 public slots:    
       
   121     void handleAllClientsClosed();    
       
   122 
       
   123     void dialogFinished(HbAction* action);
       
   124   
       
   125 
       
   126 private: // From MIAUpdateUiControllerObserver   
       
   127     /**
       
   128     * Called when async engine start-up is completed
       
   129     *
       
   130     * @param aError Error code
       
   131     */
       
   132     void StartupComplete( TInt aError ); 
       
   133     
       
   134     /**
       
   135     * Leaving method, called as trapped in StartupComplete
       
   136     */
       
   137     void StartupCompleteL(); 
       
   138  
       
   139     
       
   140     /**
       
   141     * Handles leave error. 
       
   142     *
       
   143     * @param aError Error code
       
   144     */      
       
   145     void HandleLeaveErrorL( TInt aError );
       
   146     
       
   147     /**
       
   148     * Handles leave error withot leaving
       
   149     *
       
   150     * @param aError Error code
       
   151     */      
       
   152     void HandleLeaveErrorWithoutLeave( TInt aError );
       
   153     
       
   154     /**
       
   155     Called when UI to be redrawn during update process
       
   156     *
       
   157     * @param aError Error code
       
   158     */
       
   159     void RefreshUI();
       
   160             
       
   161     /**
       
   162     * Called when async update list refresh is completed
       
   163     *
       
   164     * @param aError Error code
       
   165     */
       
   166     void RefreshCompleteL( TBool aWithViewActivation, TInt aError );
       
   167     
       
   168     /**
       
   169     * Called when async updating is completed
       
   170     *
       
   171     * @param aError Error code
       
   172     */     
       
   173     void UpdateCompleteL( TInt aError );
       
   174     
       
   175 private:  //new methods
       
   176 
       
   177     /**
       
   178     * Show results dialog of update
       
   179     */ 
       
   180     void ShowResultsDialogL();
       
   181     
       
   182     
       
   183     void ShowRebootDialogL();
       
   184            
       
   185     /**
       
   186     * Informs an observer that its async request is completed 
       
   187     *
       
   188     * @param aError  Error code 
       
   189     */ 
       
   190     void InformRequestObserver( int aError );
       
   191     
       
   192     /**
       
   193      * Sets the default connection method used for network access.
       
   194      * Connection can be set as an accesspoint or as a snap for example.
       
   195      *
       
   196      * @param aTotalSilent Set to ETrue if want silent connection
       
   197      *
       
   198      * @note Not stored persistently. A client needs to set this 
       
   199      * again every time it creates the controller.
       
   200      *
       
   201      * @note Leaves with KErrNotFound if connection method was not
       
   202      * set in the repocitory.
       
   203      */
       
   204     void SetDefaultConnectionMethodL( bool aTotalSilent );   
       
   205     
       
   206      /**
       
   207      * Choose a usable IAP from all SNAPs
       
   208      *
       
   209      * @param aCmManager handle of connection manager
       
   210      */  
       
   211     uint GetBestIAPInAllSNAPsL( RCmManager& aCmManager );
       
   212         
       
   213      /**
       
   214      * Choose a usable IAP from Internet SNAP
       
   215      *
       
   216      * @param aCmManager handle of connection manager
       
   217      */
       
   218     uint GetBestIAPInInternetSNAPL( RCmManager& aCmManager );
       
   219 
       
   220      /**
       
   221      * Choose the best IAP under the given SNAP
       
   222      *
       
   223      * @param aCmManager handle of connection manager
       
   224      * @param aSNAP SNAP ID
       
   225      */  
       
   226      uint GetBestIAPInThisSNAPL( RCmManager& aCmManager, uint aSNAP = 0);
       
   227      
       
   228      /**
       
   229      * Shows update query dialog (now/later) 
       
   230      */ 
       
   231      void ShowUpdateQueryL();
       
   232 
       
   233      void HideApplicationInFSWL( bool aHide ) const;
       
   234                
       
   235      /**
       
   236      * CIdle callback function, that shows update query dialog
       
   237      * To be used because a client to be informed immediately that its 
       
   238      * async request is issued. Waiting dialog cannot be shown before responding to a client  
       
   239      *
       
   240      * @param aPtr  Pointer to this instance
       
   241      */
       
   242      static TInt UpdateQueryCallbackL( TAny* aPtr );
       
   243      
       
   244      /**
       
   245      * CIdle callback function, that performs automatic update check and query
       
   246      *
       
   247      * @param aPtr  Pointer to this instance
       
   248      */
       
   249      static TInt AutomaticCheckCallbackL( TAny* aPtr );
       
   250      
       
   251      bool DoPossibleApplicationClose();
       
   252  
       
   253    
       
   254 
       
   255 private:
       
   256      
       
   257     enum DialogState
       
   258         {
       
   259         NoDialog,
       
   260         Results,
       
   261         RebootQuery,
       
   262         ShowUpdateQuery
       
   263         };
       
   264      
       
   265     IAUpdateServiceProvider *mServiceProvider;
       
   266     IAUpdateResultsDialog* mResultsDialog;
       
   267     
       
   268     CIAUpdateUiController* iController;
       
   269     CIAUpdateFWUpdateHandler* iFwUpdateHandler;
       
   270     CIAUpdateGlobalLockHandler* iGlobalLockHandler;
       
   271     CIAUpdateAutomaticCheck* iAutomaticCheck;
       
   272     CEikonEnv* iEikEnv; //not owned
       
   273     CIdle* iIdle;
       
   274     CIdle* iIdleAutCheck;
       
   275     
       
   276     
       
   277     IAUpdateUiDefines::TIAUpdateUiRequestType mRequestType;
       
   278     bool mUpdateNow;
       
   279     RArray<TUint32> iDestIdArray;
       
   280     bool mRequestIssued;
       
   281     bool mStartedFromApplication;
       
   282     bool mUiRefreshAllowed;
       
   283     uint mUpdatequeryUid;
       
   284     int mWgId;
       
   285     DialogState mDialogState;
       
   286     HbAction *mPrimaryAction;
       
   287     HbAction *mSecondaryAction;
       
   288     };
       
   289 
       
   290 #endif /* IAUPDATEENGINE_H_ */