ncdengine/provider/client/inc/ncdnodeinstallproxy.h
changeset 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Contains CNcdNodeInstallProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCD_NODE_INSTALL_PROXY_H
       
    20 #define C_NCD_NODE_INSTALL_PROXY_H
       
    21 
       
    22 
       
    23 // For the streams
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "ncdinterfacebaseproxy.h"
       
    27 #include "ncdnodeinstall.h"
       
    28 #include "ncdinstalloperationobserver.h"
       
    29 #include "ncditempurpose.h"
       
    30 
       
    31 class CNcdNodeMetadataProxy;
       
    32 class CNcdInstallInfo;
       
    33 class MNcdInstallationService;
       
    34 class CNcdExtendedInstallInfo;
       
    35 
       
    36 /**
       
    37  *  This class implements the functionality for the
       
    38  *  MNcdNodeInstall interfaces. The interface is provided for
       
    39  *  API users.
       
    40  *
       
    41  *  @since S60 v3.2
       
    42  */
       
    43 class CNcdNodeInstallProxy : public CNcdInterfaceBaseProxy, 
       
    44                              public MNcdNodeInstall,
       
    45                              public MNcdInstallOperationObserver
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * @param aSession The session between the client proxy and the
       
    52      * corresponding server object.
       
    53      * @param aHandle The handle which identifies the server object
       
    54      * that this proxy uses.
       
    55      * @param aMetadata Owns and uses the information of this proxy.
       
    56      * The metadata also keeps track of the refence counts of its objects. 
       
    57      * And handles the deletion of these objects when the total reference 
       
    58      * count reaches zero.
       
    59      * @return CNcdNodeInstallProxy* Pointer to the created object 
       
    60      * of this class.
       
    61      */
       
    62     static CNcdNodeInstallProxy* NewL(
       
    63         MCatalogsClientServer& aSession,
       
    64         TInt aHandle,
       
    65         CNcdNodeMetadataProxy& aMetadata );
       
    66 
       
    67     /**
       
    68      * @param aSession The session between the client proxy and the
       
    69      * corresponding server object.
       
    70      * @param aHandle The handle which identifies the server object
       
    71      * that this proxy uses.
       
    72      * @param aMetadata Owns and uses the information of this proxy.
       
    73      * The metadata also keeps track of the refence counts of its objects. 
       
    74      * And handles the deletion of these objects when the total reference 
       
    75      * count reaches zero.
       
    76      * @return CNcdNodeInstallProxy* Pointer to the created object 
       
    77      * of this class.
       
    78      */
       
    79     static CNcdNodeInstallProxy* NewLC(
       
    80         MCatalogsClientServer& aSession, 
       
    81         TInt aHandle,
       
    82         CNcdNodeMetadataProxy& aMetadata );
       
    83 
       
    84 
       
    85     /**
       
    86      * Destructor.
       
    87      * The destructor is set public. So, the node that owns the Install may
       
    88      * delete it directly when the reference count of the node reaches zero
       
    89      * and the destructor of the node is called.
       
    90      */
       
    91     virtual ~CNcdNodeInstallProxy();
       
    92 
       
    93 
       
    94     /**
       
    95      * @return CNcdNodeMetadataProxy& Gives the proxy that owns this class object.
       
    96      */
       
    97     CNcdNodeMetadataProxy& Metadata() const;
       
    98 
       
    99 
       
   100     /**
       
   101      * Gets the data for descriptors from the server side. This function is
       
   102      * called to update proxy data. The function uses the protected virtual
       
   103      * internalize functions. So, the child classes may provide their own
       
   104      * implementations for internalizations of certain metadata.
       
   105      */
       
   106     void InternalizeL();
       
   107     
       
   108 
       
   109     /**
       
   110      * The item may have multiple purposes. The given purpose is compared
       
   111      * to the item purposes and returned boolean value informs if 
       
   112      * the item has the given purpose.
       
   113      * 
       
   114      * @return ETrue if the item purpose is specified to contain the
       
   115      * given purpose. EFalse if the item purpose does not match the
       
   116      * given purpose.
       
   117      */
       
   118     TBool IsPurpose( TNcdItemPurpose aPurpose ) const;
       
   119     
       
   120 
       
   121 public: // MNcdNodeInstall
       
   122 
       
   123     /**
       
   124      * @see MNcdNodeInstall::InstallL()
       
   125      */ 
       
   126     MNcdInstallOperation* InstallL( MNcdInstallOperationObserver& aObserver );
       
   127 
       
   128 
       
   129     /**
       
   130      * @see MNcdNodeInstall::SilentInstallL()
       
   131      */ 
       
   132     MNcdInstallOperation* SilentInstallL( MNcdInstallOperationObserver& aObserver,
       
   133                                           const SwiUI::TInstallOptions& aInstallOptions );
       
   134     
       
   135 
       
   136     /**
       
   137      * @see MNcdNodeInstall::IsInstalledL()
       
   138      */ 
       
   139     TBool IsInstalledL() const;
       
   140 
       
   141     
       
   142     /**
       
   143      * @see MNcdNodeInstall::IsLaunchable()
       
   144      */
       
   145     TBool IsLaunchable() const;
       
   146     
       
   147     
       
   148     /**
       
   149      * @see MNcdNodeInstall::InstalledContentL()
       
   150      */
       
   151     RCatalogsArray<MNcdInstalledContent> InstalledContentL();
       
   152 
       
   153 
       
   154     /**
       
   155      * @see MNcdNodeInstall::SetApplicationInstalledL()
       
   156      */
       
   157     void SetApplicationInstalledL( TInt aErrorCode );
       
   158     
       
   159 
       
   160 public: // New methods
       
   161 
       
   162     /**
       
   163      * Installation service getter
       
   164      */
       
   165     MNcdInstallationService& InstallationService();
       
   166     
       
   167 
       
   168     /**
       
   169      * File session getter
       
   170      */
       
   171     RFs& FileSession();
       
   172     
       
   173     
       
   174     /**
       
   175      * File opener
       
   176      */
       
   177     RFile OpenFileL( TInt aFileIndex );
       
   178 
       
   179     
       
   180 public: // From MNcdInstallOperationObserver
       
   181 
       
   182     /**
       
   183      * @see MNcdInstallOperationObserver::InstallProgress()
       
   184      */
       
   185     void InstallProgress( MNcdInstallOperation& aOperation,
       
   186         TNcdProgress aProgress );
       
   187 
       
   188     /**
       
   189      * @see MNcdInstallOperationObserver::QueryReceived()
       
   190      */
       
   191     void QueryReceived( MNcdInstallOperation& aOperation,
       
   192         MNcdQuery* aQuery );
       
   193 
       
   194     /**
       
   195      * @see MNcdInstallOperationObserver::OperationComplete()
       
   196      */
       
   197     void OperationComplete( MNcdInstallOperation& aOperation, TInt aError );
       
   198     
       
   199 
       
   200 protected:
       
   201 
       
   202     /**
       
   203      * Constructor
       
   204      *
       
   205      * @param aSession The session between the client proxy and the
       
   206      * corresponding server object.
       
   207      * @param aHandle The handle which identifies the server object
       
   208      * that this proxy uses.
       
   209      * @param aMetadata Owns and uses the information of this proxy.
       
   210      * The metadata also keeps track of the refence counts of its objects. 
       
   211      * And handles the deletion of these objects when the total reference 
       
   212      * count reaches zero.
       
   213      * @return CNcdNodeInstallProxy* Pointer to the created object 
       
   214      * of this class.
       
   215      */
       
   216     CNcdNodeInstallProxy(
       
   217         MCatalogsClientServer& aSession,
       
   218         TInt aHandle,
       
   219         CNcdNodeMetadataProxy& aMetadata );
       
   220 
       
   221     /**
       
   222      * ConstructL
       
   223      */
       
   224     virtual void ConstructL();
       
   225     
       
   226     
       
   227     // These functions are used to update the data of this class object
       
   228 
       
   229     /**
       
   230      * @param aStream This stream will contain all the data content for
       
   231      * this class object. The stream is gotten from the server side. The
       
   232      * memeber variables will be updated according to the data from
       
   233      * the stream. 
       
   234      */
       
   235     virtual void InternalizeDataL( RReadStream& aStream );
       
   236 
       
   237     
       
   238 private:
       
   239 
       
   240     // Prevent if not implemented
       
   241     CNcdNodeInstallProxy( const CNcdNodeInstallProxy& aObject );
       
   242     CNcdNodeInstallProxy& operator =( const CNcdNodeInstallProxy& aObject );
       
   243 
       
   244     void CreateInstalledContentL(
       
   245         const CNcdExtendedInstallInfo& aInfo, 
       
   246         TInt aFileIndex );
       
   247     
       
   248     
       
   249 private: // data
       
   250 
       
   251     CNcdNodeMetadataProxy& iMetadata;
       
   252     
       
   253     MNcdInstallOperationObserver* iOperationObserver;
       
   254     
       
   255     TBool iInstalled; // Installed status
       
   256     
       
   257     TBool iLaunchable; // Is launchable
       
   258     
       
   259     
       
   260     // item's purpose
       
   261     TUint iPurpose;  
       
   262     
       
   263     // Installation service, not owned
       
   264     MNcdInstallationService* iInstallationService;      
       
   265     
       
   266     RCatalogsArray<MNcdInstalledContent> iContent;
       
   267     };
       
   268 
       
   269 
       
   270 #endif // C_NCD_NODE_INSTALL_PROXY_H