ncdengine/provider/client/inc/ncdinstalloperationproxy.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:   CNcdInstallOperationProxy declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDINSTALLOPERATIONPROXY_H	
       
    20 #define C_NCDINSTALLOPERATIONPROXY_H	
       
    21 
       
    22 #include <f32file.h>
       
    23 
       
    24 #include "ncdoperationimpl.h"
       
    25 #include "ncdbaseoperationproxy.h"
       
    26 #include "ncdinstalloperation.h"
       
    27 #include "ncdoperationdatatypes.h"
       
    28 #include "ncdinstallationserviceobserver.h"
       
    29 #include "ncditempurpose.h"
       
    30 
       
    31 class MNcdInstallationService;
       
    32 class MNcdInstallOperationObserver;
       
    33 class CNcdNodeProxy;
       
    34 class CNcdInstallInfo;
       
    35 class CNcdFileInfo;
       
    36 
       
    37 class CNcdInstallOperationProxy : 
       
    38     public CNcdOperation< MNcdInstallOperation >,
       
    39     public MNcdInstallationServiceObserver
       
    40     {
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Constructor
       
    45      *
       
    46      * @param aSession is the session that is used between
       
    47      *                 the proxy and the server.
       
    48      * @param aDownloadType Download type
       
    49      * @param aHandle is the handle that identifies the serverside
       
    50      *                object that this proxy uses.
       
    51      * @param aRemoveHandler An observer that is called during destruction.
       
    52      * @param aNode The node this operation was started from.
       
    53      */    
       
    54     static CNcdInstallOperationProxy* NewLC( MCatalogsClientServer& aSession,                        
       
    55                         TInt aHandle,
       
    56                         MNcdOperationProxyRemoveHandler* aRemoveHandler,
       
    57                         CNcdNodeProxy* aNode,
       
    58                         CNcdNodeManagerProxy* aNodeManager,
       
    59                         MNcdInstallOperationObserver* aObserver,
       
    60                         MNcdInstallationService& aInstallationService );
       
    61 
       
    62         
       
    63 public: // From MNcdInstallOperation
       
    64     
       
    65     /**
       
    66      * @see MNcdInstallOperation::FileCount()
       
    67      */
       
    68     TInt FileCount();
       
    69     
       
    70     /**
       
    71      * @see MNcdInstallOperation::CurrentFile()
       
    72      */
       
    73     TInt CurrentFile();    
       
    74 
       
    75 
       
    76 public: // From MNcdOperation
       
    77 
       
    78     /**
       
    79      * @see MNcdOperation::OperationType();
       
    80      */
       
    81     void StartOperationL();
       
    82 
       
    83    /**
       
    84      * @see MNcdOperation::CancelOperation()
       
    85      */
       
    86     void CancelOperation();
       
    87 
       
    88     
       
    89     /**
       
    90      * @see MNcdOperation::OperationType()
       
    91      */
       
    92     TNcdInterfaceId OperationType() const;
       
    93 
       
    94     
       
    95 protected: // Constructor and destructor
       
    96 
       
    97     /**
       
    98      * Constructor
       
    99      *
       
   100      */
       
   101     CNcdInstallOperationProxy( MNcdInstallationService& aInstallationService );
       
   102     
       
   103     virtual ~CNcdInstallOperationProxy();
       
   104 
       
   105 
       
   106     /**
       
   107      * ConstructL
       
   108      *
       
   109      * @param aSession is the session that is used between
       
   110      *                 the proxy and the server.
       
   111      * @param aHandle is the handle that identifies the serverside
       
   112      *                object that this proxy uses.
       
   113      * @param aRemoveHandler An observer that is called during destruction.
       
   114      * @param aNode The node this operation was started from.
       
   115      */
       
   116     void ConstructL( MCatalogsClientServer& aSession,
       
   117                     TInt aHandle,
       
   118                     MNcdOperationProxyRemoveHandler* aRemoveHandler,
       
   119                     CNcdNodeProxy* aNode,
       
   120                     CNcdNodeManagerProxy* aNodeManager,
       
   121                     MNcdInstallOperationObserver* aObserver );
       
   122     
       
   123     
       
   124 protected: // From CNcdBaseOperationProxy
       
   125 
       
   126     /**
       
   127      * @see CNcdBaseOperationProxy::ProgressCallback()
       
   128      */
       
   129     void ProgressCallback();
       
   130     
       
   131     
       
   132     /**
       
   133      * @see CNcdBaseOperationProxy::QueryReceivedCallback()
       
   134      */
       
   135     void QueryReceivedCallback( CNcdQuery* aQuery );
       
   136     
       
   137     
       
   138     /**
       
   139      * @see CNcdBaseOperationProxy::CompleteCallback()
       
   140      */
       
   141     void CompleteCallback( TInt aError );
       
   142     
       
   143 
       
   144     /**
       
   145      * @see CNcdBaseOperationProxy::CreateInitializationBufferL()
       
   146      */    
       
   147     HBufC8* CreateInitializationBufferL();
       
   148     
       
   149     
       
   150     /**
       
   151      * @see CNcdBaseOperationProxy::InitializationCallback()    
       
   152      */
       
   153     void InitializationCallback( RReadStream& aReadStream, 
       
   154         TInt aDataLength );    
       
   155 
       
   156 
       
   157 protected: // MNcdInstallationServiceObserver
       
   158 
       
   159     /**
       
   160      * @see MNcdInstallationServiceObserver::InstallationCompleteL()
       
   161      */
       
   162     void InstallationCompleteL( const TDesC& aFileName,
       
   163                                 const TUid& aAppUid,
       
   164                                 TInt aError );
       
   165 
       
   166 protected: // CActive
       
   167 
       
   168     /**
       
   169      * @see CActive::RunL
       
   170      */
       
   171     void RunL();
       
   172 
       
   173     /**
       
   174      * @see CActive::DoCancel
       
   175      */    
       
   176     void DoCancel();
       
   177     
       
   178     /**
       
   179      * @see CActive::RunError
       
   180      */
       
   181     TInt RunError( TInt aError );
       
   182 
       
   183 protected:
       
   184 
       
   185     /**
       
   186      * This function uses the correct installer functions that are class
       
   187      * specific. Child classes may have their own implementations that
       
   188      * are automatically used when installation is handled.
       
   189      * 
       
   190      * @param aFile The file that is going to be installed.
       
   191      */ 
       
   192     virtual void UseInstallServiceL( const CNcdFileInfo& aFile );
       
   193 
       
   194     /** 
       
   195      * @return MNcdInstallationService& Service that is used to
       
   196      * handle the installation of the files.
       
   197      */
       
   198     MNcdInstallationService& Installer();
       
   199     
       
   200     /**
       
   201      * @return CNcdInstallInfo& File(s) currently being installed.
       
   202      */
       
   203     CNcdInstallInfo& CurrentInfo();
       
   204 
       
   205 
       
   206     /**
       
   207      * Updates the file's information to the server side.
       
   208      * This should be called only after succesfull installation
       
   209      * because iCurrentFile count is increased by one.
       
   210      *
       
   211      * For parameter descriptions:
       
   212      * @see MNcdInstallationServiceObserver::InstallationCompleteL
       
   213      */
       
   214     void UpdateInfoToServerL( const TDesC& aFileName,
       
   215                               const TUid& aAppUid,
       
   216                               TInt aError );
       
   217 
       
   218 
       
   219     /**
       
   220      * @aErrorCode Current error code for the installation operation.
       
   221      */
       
   222     void SetInstallationErrorCode( const TInt& aErrorCode );
       
   223     
       
   224     /**
       
   225      * @return TInt Current error code for the installation operation.
       
   226      */
       
   227     TInt InstallationErrorCode() const;
       
   228 
       
   229 
       
   230     /**
       
   231      * Inform server side install report that the installing has been started.
       
   232      */
       
   233     void StartInstallReportL();
       
   234     
       
   235     
       
   236     /**
       
   237      * Inform server side install report that the installing has been completed
       
   238      * with the given error code.
       
   239      */
       
   240     void CompleteInstallReportL( TInt aErrorCode );
       
   241 
       
   242 
       
   243     /**
       
   244      * Deletes the current content file that has been set for the installation.
       
   245      */ 
       
   246     void DeleteCurrentFileL();
       
   247     
       
   248                               
       
   249 private: // new methods
       
   250 
       
   251     void InstallNextFileL();
       
   252     CNcdInstallInfo* InstallInfoL( TInt aIndex );
       
   253     
       
   254     RFile OpenFileL( TInt aFileIndex );
       
   255     
       
   256     void DeleteFileL( TInt aFileIndex );
       
   257 
       
   258 protected: // data
       
   259         
       
   260     RFile iFileHandle; // file that is currently being installed    
       
   261     
       
   262 private: // data
       
   263 
       
   264     /**
       
   265      * Operation observer, for callbacks.
       
   266      * Observer not own.
       
   267      */    
       
   268     MNcdInstallOperationObserver* iObserver;        
       
   269     
       
   270     // Installer, not own
       
   271     MNcdInstallationService* iInstaller;
       
   272     
       
   273     // Total number of files      
       
   274     TInt iFileCount;
       
   275     
       
   276     // Number of the currently downloaded file
       
   277     TInt iCurrentFile;                
       
   278     
       
   279     RPointerArray<HBufC> iMimeTypes;
       
   280     RArray<TNcdItemPurpose> iPurposes;
       
   281     
       
   282     // File(s) currently being installed
       
   283     CNcdInstallInfo* iCurrentInfo;
       
   284     
       
   285     TInt iInstallationError;        
       
   286         
       
   287     };
       
   288 
       
   289 #endif // C_NCDINSTALLOPERATIONPROXY_H