iaupdate/IAD/ui/inc/iaupdateengine.h
changeset 29 26b6f0522fd8
child 33 8110bf1194d1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
       
     1 /*
       
     2 * Copyright (c) 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:   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 CIAUpdateParameters;
       
    31 class CIAUpdateGlobalLockHandler;
       
    32 class MIAUpdateNode;
       
    33 class MIAUpdateFwNode;
       
    34 class CEikonEnv;
       
    35 class RCmManagerExt;
       
    36 class CIdle;
       
    37 
       
    38 class IAUpdateEngine : public QObject,
       
    39                        public MIAUpdateUiControllerObserver
       
    40     {
       
    41     Q_OBJECT
       
    42 
       
    43 public:
       
    44     IAUpdateEngine(QObject *parent = 0);
       
    45     virtual ~IAUpdateEngine();
       
    46     
       
    47     void StartedByLauncherL( TBool aRefreshFromNetworkDenied );
       
    48      
       
    49      /**
       
    50       * When the update check operation is started through
       
    51       * the API, the session directs the requests for the UI. UI will
       
    52       * handle the operation and inform the observer when the operation is
       
    53       * completed.
       
    54       * @param aFilterParams These parameters are used when update items
       
    55       * are filtered for the UI list.
       
    56       */
       
    57      void CheckUpdatesRequestL( int wgid, CIAUpdateParameters* aFilterParams );
       
    58 
       
    59      /**
       
    60       * When the show update operation is started through
       
    61       * the API, the session directs the requests for the UI. UI will
       
    62       * hanle the operation and inform the observer when the operation is
       
    63       * completed.
       
    64       * @param aFilterParams These parameters are used when update items
       
    65       * are filtered for the UI list.
       
    66       */
       
    67      void ShowUpdatesRequestL( int wgid, CIAUpdateParameters* aFilterParams );
       
    68      
       
    69               
       
    70      
       
    71      /** 
       
    72       * When the update operation is started through
       
    73       * the API, the session directs the requests for the UI. UI will
       
    74       * hanle the operation and inform the observer when the operation is
       
    75       * completed.
       
    76       * @param aUid  Uid of the caller of the request
       
    77       */
       
    78      void ShowUpdateQueryRequestL( int wgid, TUint aUid );
       
    79           
       
    80      /**
       
    81       * Set this application visible/unvisible
       
    82       * @param aVisible If EFalse application is put background and is hidden in FSW 
       
    83       */
       
    84       void SetVisibleL( TBool aVisible );
       
    85       
       
    86       /**
       
    87       * Set window group id of client application 
       
    88       *
       
    89       * @param aWgId Window group id
       
    90       */
       
    91       void SetClientWgId( TInt aWgId );
       
    92           
       
    93       /**
       
    94       * Is client application in backround
       
    95       *
       
    96       * @param True value if client application is in background
       
    97       */
       
    98       TInt ClientInBackgroundL() const;
       
    99     
       
   100       //void refresh(int error);
       
   101 signals:
       
   102     void toMainView();
       
   103     
       
   104     /**
       
   105     * Refreshes main view 
       
   106     * @param aError  Error code
       
   107     */              
       
   108     void refresh(const RPointerArray<MIAUpdateNode>& nodes,
       
   109                  const RPointerArray<MIAUpdateFwNode>& fwNodes,
       
   110                  int error);
       
   111     
       
   112     void toHistoryView();
       
   113 
       
   114 public slots:    
       
   115     void handleAllClientsClosed();    
       
   116   
       
   117 
       
   118 private: // From MIAUpdateUiControllerObserver   
       
   119     /**
       
   120     * Called when async engine start-up is completed
       
   121     *
       
   122     * @param aError Error code
       
   123     */
       
   124     void StartupComplete( TInt aError ); 
       
   125     
       
   126     /**
       
   127     * Leaving method, called as trapped in StartupComplete
       
   128     */
       
   129     void StartupCompleteL(); 
       
   130  
       
   131     
       
   132     /**
       
   133     * Handles leave error. 
       
   134     *
       
   135     * @param aError Error code
       
   136     */      
       
   137     void HandleLeaveErrorL( TInt aError );
       
   138     
       
   139     /**
       
   140     * Handles leave error withot leaving
       
   141     *
       
   142     * @param aError Error code
       
   143     */      
       
   144     void HandleLeaveErrorWithoutLeave( TInt aError );
       
   145             
       
   146     /**
       
   147     * Called when async update list refresh is completed
       
   148     *
       
   149     * @param aError Error code
       
   150     */
       
   151     void RefreshCompleteL( TBool aWithViewActivation, TInt aError );
       
   152     
       
   153     /**
       
   154     * Called when async updating is completed
       
   155     *
       
   156     * @param aError Error code
       
   157     */     
       
   158     void UpdateCompleteL( TInt aError );
       
   159     
       
   160 private:  //new methods
       
   161 
       
   162     /**
       
   163     * Informs an observer that its async request is completed 
       
   164     *
       
   165     * @param aError  Error code 
       
   166     */ 
       
   167     void InformRequestObserver( TInt aError );
       
   168     
       
   169     /**
       
   170      * Sets the default connection method used for network access.
       
   171      * Connection can be set as an accesspoint or as a snap for example.
       
   172      *
       
   173      * @param aTotalSilent Set to ETrue if want silent connection
       
   174      *
       
   175      * @note Not stored persistently. A client needs to set this 
       
   176      * again every time it creates the controller.
       
   177      *
       
   178      * @note Leaves with KErrNotFound if connection method was not
       
   179      * set in the repocitory.
       
   180      */
       
   181     void SetDefaultConnectionMethodL( TBool aTotalSilent );   
       
   182     
       
   183      /**
       
   184      * Choose a usable IAP from all SNAPs
       
   185      *
       
   186      * @param aCmManagerExt handle of connection manager
       
   187      */  
       
   188     TUint32 GetBestIAPInAllSNAPsL( RCmManagerExt& aCmManagerExt  );
       
   189         
       
   190      /**
       
   191      * Choose a usable IAP from Internet SNAP
       
   192      *
       
   193      * @param aCmManagerExt handle of connection manager
       
   194      */
       
   195     TUint32 GetBestIAPInInternetSNAPL( RCmManagerExt& aCmManagerExt  );
       
   196 
       
   197      /**
       
   198      * Choose the best IAP under the given SNAP
       
   199      *
       
   200      * @param aCmManagerExt handle of connection manager
       
   201      * @param aSNAP SNAP ID
       
   202      */  
       
   203      TUint32 GetBestIAPInThisSNAPL( RCmManagerExt& aCmManagerExt, TUint32 aSNAP = 0);
       
   204      
       
   205      /**
       
   206      * Shows update query dialog (now/later) 
       
   207      */ 
       
   208      void ShowUpdateQueryL();
       
   209 
       
   210      void HideApplicationInFSWL( TBool aHide ) const;
       
   211      
       
   212      /**
       
   213      * CIdle callback function, that shows update query dialog
       
   214      * To be used because a client to be informed immediately that its 
       
   215      * async request is issued. Waiting dialog cannot be shown before responding to a client  
       
   216      *
       
   217      * @param aPtr  Pointer to this instance
       
   218      */
       
   219      static TInt UpdateQueryCallbackL( TAny* aPtr );
       
   220          
       
   221      
       
   222     
       
   223 public: //temp
       
   224 //private:
       
   225     IAUpdateServiceProvider *mServiceProvider;
       
   226     
       
   227 private:
       
   228     CIAUpdateUiController* iController;
       
   229     CIAUpdateGlobalLockHandler* iGlobalLockHandler;
       
   230     CEikonEnv* iEikEnv; //not owned
       
   231     CIdle* iIdle;
       
   232     
       
   233     IAUpdateUiDefines::TIAUpdateUiRequestType iRequestType;
       
   234     TBool iUpdateNow;
       
   235     RArray<TUint32> iDestIdArray;
       
   236     TBool iRequestIssued;
       
   237     TBool iStartedFromApplication;
       
   238     TUint iUpdatequeryUid;
       
   239     TInt iWgId;
       
   240   
       
   241     
       
   242     };
       
   243 
       
   244 #endif /* IAUPDATEENGINE_H_ */