iaupdate/IAD/ui/inc/iaupdateappui.h
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 30 398876c4ffa7
child 33 8110bf1194d1
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
     1 /*
       
     2 * Copyright (c) 2007-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 CIAUpdateAppUi class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __IAUPDATE_APPUI_H__
       
    21 #define __IAUPDATE_APPUI_H__
       
    22 
       
    23 //INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <aknViewAppUi.h> 
       
    26 #include <cmmanagerext.h>
       
    27 
       
    28 #include "iaupdateuidefines.h"
       
    29 #include "iaupdateuicontrollerobserver.h"
       
    30 #include "iaupdatedialogutil.h"
       
    31 #include "iaupdateuitimerobserver.h"
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CIAUpdateMainView;
       
    35 class CIAUpdateHistoryView;
       
    36 class CIAUpdateUiController;
       
    37 class CIAUpdateParameters;
       
    38 class MIAUpdateRequestObserver;
       
    39 class CIAUpdateGlobalLockHandler;
       
    40 class CIAUpdateUITimer;
       
    41 
       
    42 /*! 
       
    43 @class CIAUpdateAppUi
       
    44   
       
    45 An instance of class CIAUpdateAppUi is the UserInterface part of the AVKON
       
    46 application framework for the IAUpdate example application
       
    47 */
       
    48 class CIAUpdateAppUi : 
       
    49     public CAknViewAppUi, 
       
    50     public MIAUpdateUiControllerObserver,
       
    51     public MIAUpdateTextLinkObserver,
       
    52     public MIAUpdateUITimerObserver
       
    53     {
       
    54 public:
       
    55 
       
    56     /*
       
    57      * Perform the second phase construction of a CIAUpdateAppUi object
       
    58      * this needs to be public due to the way the framework constructs the AppUi 
       
    59      */
       
    60     void ConstructL();
       
    61     
       
    62     /*!
       
    63      * Perform the first phase of two phase construction.
       
    64      * This needs to be public due to the way the framework constructs the AppUi 
       
    65      */
       
    66     CIAUpdateAppUi();
       
    67 
       
    68 
       
    69     /*
       
    70      * Destroy the object and release all memory objects
       
    71      */
       
    72     virtual ~CIAUpdateAppUi();
       
    73     
       
    74     void StartedByLauncherL( MIAUpdateRequestObserver& aObserver, 
       
    75                              TBool aRefreshFromNetworkDenied );
       
    76     
       
    77     /**
       
    78      * When the update check operation is started through
       
    79      * the API, the session directs the requests for the UI. UI will
       
    80      * handle the operation and inform the observer when the operation is
       
    81      * completed.
       
    82      * @param aObserver This observer is informed when the operation has
       
    83      * been completed.
       
    84      * @param aFilterParams These parameters are used when update items
       
    85      * are filtered for the UI list.
       
    86      */
       
    87     void CheckUpdatesRequestL( MIAUpdateRequestObserver& aObserver,
       
    88                                CIAUpdateParameters* aFilterParams );
       
    89 
       
    90     /**
       
    91      * When the show update operation is started through
       
    92      * the API, the session directs the requests for the UI. UI will
       
    93      * hanle the operation and inform the observer when the operation is
       
    94      * completed.
       
    95      * @param aObserver This observer is informed when the operation has
       
    96      * been completed.
       
    97      * @param aFilterParams These parameters are used when update items
       
    98      * are filtered for the UI list.
       
    99      */
       
   100     void ShowUpdatesRequestL( MIAUpdateRequestObserver& aObserver,
       
   101                               CIAUpdateParameters* aFilterParams );
       
   102     
       
   103              
       
   104     
       
   105     /** 
       
   106      * When the update operation is started through
       
   107      * the API, the session directs the requests for the UI. UI will
       
   108      * hanle the operation and inform the observer when the operation is
       
   109      * completed.
       
   110      * @param aObserver This observer is informed when the operation has
       
   111      * been completed.
       
   112      * @param aUid  Uid of the caller of the request
       
   113      */
       
   114     void ShowUpdateQueryRequestL( MIAUpdateRequestObserver& aObserver, TUint aUid );
       
   115     
       
   116     /**
       
   117      *  Handle removal of observer
       
   118      */    
       
   119     void HandleObserverRemoval();
       
   120     
       
   121     /**
       
   122     * Set this application visible/unvisible
       
   123     * @param aVisible If EFalse application is put background and is hidden in FSW 
       
   124     */
       
   125     void SetVisibleL( TBool aVisible );
       
   126     
       
   127     /**
       
   128     * Show status dialog of update
       
   129     */ 
       
   130     void ShowStatusDialogL();
       
   131     
       
   132     /**
       
   133     * Starts CIdle. Status dialog is shown in callback function. 
       
   134     */ 
       
   135     void ShowStatusDialogDeferredL();
       
   136     
       
   137     /**
       
   138     * Get CIAUpdateUiController instance
       
   139     * @return Returns pointer of iController
       
   140     */    
       
   141     CIAUpdateUiController* Controller() const;
       
   142     
       
   143     /**
       
   144     * Performs cancel depending on ongoing request and state
       
   145     */   
       
   146     void PotentialCancel();
       
   147     
       
   148     /**
       
   149     * Set ordinal position to foreground and 
       
   150     * set iClientMovedToBackground to EFalse
       
   151     */  
       
   152     void HandleClientToForegroundL();
       
   153     
       
   154     /**
       
   155     * Handle situation when iaupdate.exe leaves running although 
       
   156     * client session has been closed
       
   157     */
       
   158     void HandleAllClientsClosedL();
       
   159     
       
   160     /**
       
   161     * Indicates whether Status dialog to be shown or not when history view is deactivated
       
   162     *
       
   163     * @return ETrue when status dialog to be re-shown
       
   164     */ 
       
   165     TBool ShowStatusDialogAgain() const;
       
   166         
       
   167     /**
       
   168     * Starts monitoring of window group list changes 
       
   169     */
       
   170     void StartWGListChangeMonitoring();
       
   171     
       
   172     /**
       
   173     * Stops monitoring of window group list changes 
       
   174     */
       
   175     void StopWGListChangeMonitoring();
       
   176     
       
   177     /**
       
   178     * Set window group id of client application 
       
   179     *
       
   180     * @param aWgId Window group id
       
   181     */
       
   182     void SetClientWgId( TInt aWgId );
       
   183     
       
   184     /**
       
   185     * Is client application in backround
       
   186     *
       
   187     * @param True value if client application is in background
       
   188     */
       
   189     TInt ClientInBackgroundL() const;
       
   190     
       
   191     
       
   192     /**
       
   193     * Set DM support
       
   194     * 
       
   195     * @param True value if DM is supported
       
   196     */
       
   197     void SetDMSupport( TBool aDMSupport );
       
   198     
       
   199     /**
       
   200     * Check DM support
       
   201     * 
       
   202     * @return True value if DM is supported
       
   203     */
       
   204     TBool IsDMSupport();
       
   205     
       
   206     /**
       
   207      * Check if DM support is set
       
   208      * 
       
   209      * @return True value if DM support is set
       
   210      */
       
   211     TBool IsDMSupportSet();
       
   212     
       
   213     /**
       
   214     * Check if UI refresh allowed
       
   215     * 
       
   216     * @return True value if UI refresh is allowed 
       
   217     */
       
   218     TBool UiRefreshAllowed();
       
   219     
       
   220         
       
   221 private: // from CAknViewAppUi
       
   222     
       
   223     /*!
       
   224      * @function HandleCommandL  
       
   225      * @discussion Handle user menu selections
       
   226      * @param aCommand the enumerated code for the option selected
       
   227      */
       
   228     void HandleCommandL( TInt aCommand );
       
   229     
       
   230     /**
       
   231     * Handle window server event
       
   232     *
       
   233     * @param aEvent The window server event that occurred
       
   234     * @param aDestination The controller associated with the event 
       
   235     */
       
   236     void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
       
   237     
       
   238              
       
   239 private: // From MIAUpdateTextLinkObserver    
       
   240     void TextLinkL( TInt aLinkId );
       
   241 
       
   242     
       
   243 private: // From MIAUpdateUiControllerObserver   
       
   244     /**
       
   245     * Called when async engine start-up is completed
       
   246     *
       
   247     * @param aError Error code
       
   248     */
       
   249     void StartupComplete( TInt aError ); 
       
   250     
       
   251     /**
       
   252     * Leaving method, called as trapped in StartupComplete
       
   253     */
       
   254     void StartupCompleteL(); 
       
   255  
       
   256     
       
   257     /**
       
   258     * Handles leave error. 
       
   259     *
       
   260     * @param aError Error code
       
   261     */      
       
   262     void HandleLeaveErrorL( TInt aError );
       
   263     
       
   264     /**
       
   265     * Handles leave error withot leaving
       
   266     *
       
   267     * @param aError Error code
       
   268     */      
       
   269     void HandleLeaveErrorWithoutLeave( TInt aError );
       
   270             
       
   271     /**
       
   272     * Called when async update list refresh is completed
       
   273     *
       
   274     * @param aError Error code
       
   275     */
       
   276     void RefreshCompleteL( TBool aWithViewActivation, TInt aError );
       
   277     
       
   278     /**
       
   279     * Called when async updating is completed
       
   280     *
       
   281     * @param aError Error code
       
   282     */     
       
   283     void UpdateCompleteL( TInt aError );
       
   284     
       
   285     /**
       
   286     * Choose a usable IAP from all SNAPs
       
   287     *
       
   288     * @param aCmManagerExt handle of connection manager
       
   289     */  
       
   290     TUint32 GetBestIAPInAllSNAPsL( RCmManagerExt& aCmManagerExt  );
       
   291     
       
   292     /**
       
   293      * Choose a usable IAP from Internet SNAP
       
   294      *
       
   295      * @param aCmManagerExt handle of connection manager
       
   296      */
       
   297     TUint32 GetBestIAPInInternetSNAPL( RCmManagerExt& aCmManagerExt  );
       
   298 
       
   299     /**
       
   300     * Choose the best IAP under the given SNAP
       
   301     *
       
   302     * @param aCmManagerExt handle of connection manager
       
   303     * @param aSNAP SNAP ID
       
   304     */  
       
   305     TUint32 GetBestIAPInThisSNAPL( RCmManagerExt& aCmManagerExt, TUint32 aSNAP = 0);
       
   306 
       
   307 private: // from MIAUpdateUITimerObserver
       
   308 
       
   309      virtual void BackgroundDelayComplete( TInt aError );   
       
   310      
       
   311      virtual void ForegroundDelayComplete( TInt aError );
       
   312      
       
   313      virtual void ProcessStartDelayComplete( TInt aError );
       
   314 
       
   315 private: // new methods
       
   316            
       
   317     /**
       
   318     * Refreshes main view 
       
   319     * @param aError  Error code
       
   320     */              
       
   321     void RefreshL( TInt aError );
       
   322     
       
   323     /**
       
   324     * Informs an observer that its async request is completed 
       
   325     *
       
   326     * @param aError  Error code 
       
   327     */ 
       
   328     void InformRequestObserver( TInt aError );
       
   329     
       
   330     /**
       
   331      * Sets the default connection method used for network access.
       
   332      * Connection can be set as an accesspoint or as a snap for example.
       
   333      *
       
   334      * @param aTotalSilent Set to ETrue if want silent connection
       
   335      *
       
   336      * @note Not stored persistently. A client needs to set this 
       
   337      * again every time it creates the controller.
       
   338      *
       
   339      * @note Leaves with KErrNotFound if connection method was not
       
   340      * set in the repocitory.
       
   341      */
       
   342     void SetDefaultConnectionMethodL( TBool aTotalSilent );
       
   343         
       
   344     
       
   345     /**
       
   346     * Shows update query dialog (now/later) 
       
   347     */ 
       
   348     void ShowUpdateQueryL();
       
   349     
       
   350     /**
       
   351     * Hides this application from fast swap window 
       
   352     *
       
   353     * @param aAlwaysAsk
       
   354     */ 
       
   355     void HideApplicationInFSWL( TBool aHide);
       
   356     
       
   357     /**
       
   358     * Shows global error note 
       
   359     *
       
   360     * @param aError Symbian error code
       
   361     */ 
       
   362     void ShowGlobalErrorNoteL( TInt aError ) const;
       
   363        
       
   364     /**
       
   365     * CIdle callback function, that shows status dialog
       
   366     * To be used to guarantee that possible old status dialog is totally 
       
   367     * removed by AVKON before showing new one  
       
   368     *
       
   369     * @param aPtr  Pointer to this instance
       
   370     */ 
       
   371     static TInt ShowStatusDialogCallbackL( TAny* aPtr );
       
   372     
       
   373     /**
       
   374     * CIdle callback function, that shows update query dialog
       
   375     * To be used because a client to be informed immediately that its 
       
   376     * async request is issued. Waiting dialog cannot be shown before responding to a client  
       
   377     *
       
   378     * @param aPtr  Pointer to this instance
       
   379     */
       
   380     static TInt UpdateQueryCallbackL( TAny* aPtr );
       
   381     
       
   382     /**
       
   383     * CIdle callback function, that performs automatic update check ann query
       
   384     *
       
   385     * @param aPtr  Pointer to this instance
       
   386     */
       
   387     static TInt AutomaticCheckCallbackL( TAny* aPtr );
       
   388     
       
   389     /**
       
   390     * History view is activated from a link in message query
       
   391     */
       
   392     void HandleTextLinkL();
       
   393             
       
   394 private:  //data
       
   395 
       
   396     CIAUpdateMainView* iMainView;
       
   397 
       
   398     CIAUpdateHistoryView* iHistoryView;
       
   399         
       
   400     CIAUpdateUiController* iController;
       
   401     
       
   402     CIAUpdateGlobalLockHandler* iGlobalLockHandler;
       
   403     
       
   404     CIAUpdateUITimer* iForegroundTimer; 
       
   405     
       
   406     CIAUpdateUITimer* iBackgroundTimer;
       
   407     
       
   408     MIAUpdateRequestObserver* iRequestObserver;
       
   409     
       
   410     TIAUpdateDialogParam* iDialogParam;
       
   411     
       
   412     IAUpdateUiDefines::TIAUpdateUiRequestType iRequestType;
       
   413     
       
   414     CIdle* iIdle;
       
   415     
       
   416     CIdle* iIdleAutCheck;
       
   417            
       
   418     TBool iShowStatusDialogAgain;
       
   419     
       
   420     TUint iUpdatequeryUid;
       
   421     
       
   422     TBool iUpdateNow;
       
   423     
       
   424     TBool iInstUiOnTop;
       
   425     
       
   426     TBool iStartedFromApplication;
       
   427     
       
   428     TBool iClientMovedToBackground;
       
   429     
       
   430     RArray<TUint32> iDestIdArray;
       
   431     
       
   432     TInt iWgId;
       
   433     
       
   434     TBool iIsDMSupported;
       
   435     
       
   436     TBool iIsDMSet;
       
   437     
       
   438     TBool iUiRefreshAllowed;
       
   439     
       
   440     TBool iRebootAfterInstall;
       
   441     };
       
   442 
       
   443 
       
   444 #endif // __IAUPDATE_APPUI_H__
       
   445