ncdengine/provider/client/inc/ncdnodemetadataproxy.h
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     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 CNcdNodeMetadataProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NCD_NODE_METADATA_PROXY_H
       
    20 #define NCD_NODE_METADATA_PROXY_H
       
    21 
       
    22 
       
    23 #include <s32mem.h>
       
    24 
       
    25 #include "ncdinterfacebaseproxy.h"
       
    26 #include "ncdnodemetadata.h"
       
    27 
       
    28 class CNcdNodeProxy;
       
    29 class CNcdNodeDisclaimerProxy;
       
    30 class CNcdNodeDownloadProxy;
       
    31 class CNcdNodeIconProxy;
       
    32 class CNcdNodeScreenshotProxy;
       
    33 class CNcdNodePurchaseProxy;
       
    34 class CNcdNodeUriContentProxy;
       
    35 class CNcdNodeContentInfoProxy;
       
    36 class CNcdNodeInstallProxy;
       
    37 class CNcdNodePreviewProxy;
       
    38 class CNcdNodeActivate;
       
    39 class CNcdNodeUpgradeProxy;
       
    40 class CNcdNodeDependencyProxy;
       
    41 class CNcdNodeUserDataProxy;
       
    42 class CNcdNodeSkinProxy;
       
    43 class CNcdNodeIdentifier;
       
    44 class CNcdKeyValuePair;
       
    45 
       
    46 
       
    47 /**
       
    48  * Base class for the proxies.
       
    49  * Provides basic methods for client server session function calls.
       
    50  *
       
    51  *  @lib ?library
       
    52  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    53  */
       
    54 class CNcdNodeMetadataProxy: public CNcdInterfaceBaseProxy, 
       
    55                              public MNcdNodeMetadata
       
    56     {
       
    57 
       
    58 public:
       
    59 
       
    60     /**
       
    61      * @param aSession The session between the client proxy and the
       
    62      * corresponding server object.
       
    63      * @param aHandle The handle which identifies the server object
       
    64      * that this proxy uses.
       
    65      * @param aNode The node that owns this metadata.
       
    66      * @return CNcdNodeMetadataProxy* Pointer to the created object 
       
    67      * of this class.
       
    68      */
       
    69     static CNcdNodeMetadataProxy* NewL( MCatalogsClientServer& aSession, 
       
    70                                         TInt aHandle,
       
    71                                         CNcdNodeProxy& aNode );
       
    72 
       
    73     /**
       
    74      * @param aSession The session between the client proxy and the
       
    75      * corresponding server object.
       
    76      * @param aHandle The handle which identifies the server object
       
    77      * that this proxy uses.
       
    78      * @param aNode The node that owns this metadata.
       
    79      * @return CNcdNodeMetadataProxy* Pointer to the created object 
       
    80      * of this class.
       
    81      */
       
    82     static CNcdNodeMetadataProxy* NewLC( MCatalogsClientServer& aSession, 
       
    83                                          TInt aHandle,
       
    84                                          CNcdNodeProxy& aNode );
       
    85 
       
    86 
       
    87     /**
       
    88      * Destructor
       
    89      * The destructor is set public. So, the node that owns
       
    90      * the metadata may delete its metadata directly
       
    91      * when the reference count of the node reaches zero
       
    92      * and the destructor of the node is called.
       
    93      */
       
    94     virtual ~CNcdNodeMetadataProxy();
       
    95 
       
    96     /**
       
    97      * @return CNcdNodeIdentifier& Identifier of this metadata.
       
    98      */
       
    99     CNcdNodeIdentifier& Identifier() const;
       
   100 
       
   101     /**
       
   102      * @return CNcdNodeProxy& The parent node that owns this metadata. 
       
   103      */
       
   104     CNcdNodeProxy& Node() const;
       
   105 
       
   106     /**
       
   107      * @return CNcdNodeDownloadProxy* Download object if it exists. 
       
   108      * NULL if the download has not been set. Ownership is not transferred.
       
   109      */
       
   110     CNcdNodeDownloadProxy* Download() const;
       
   111 
       
   112     
       
   113     /** 
       
   114      * @return CNcdNodeInstallProxy* Install class object pointer.
       
   115      * NULL if the object does not exist. Ownership is not transferred.
       
   116      */
       
   117     CNcdNodeInstallProxy* Install() const;
       
   118 
       
   119 
       
   120     /**
       
   121      * @return The uri content object. 
       
   122      * NULL if the uri content has not been set for this metadata.
       
   123      * Ownership is not transferred.
       
   124      */
       
   125     CNcdNodeUriContentProxy* UriContent() const;
       
   126 
       
   127     /**
       
   128      * @return Content info object.
       
   129      * NULL if the content info has not been set for this metadata.
       
   130      * Ownerhsip is not transferred.
       
   131      */
       
   132     CNcdNodeContentInfoProxy* ContentInfo() const;            
       
   133 
       
   134 
       
   135     /**
       
   136      * Gets the data for descriptors from the server side.
       
   137      * This function is called to update proxy data.
       
   138      * The function uses the protected virtual internalize functions. 
       
   139      * So, the child classes may provide their own implementations 
       
   140      * for internalizations of certain metadata.
       
   141      *
       
   142      * @exception KErrNotFound if the internalization could not
       
   143      * find any data for this metadata object. Then the owner
       
   144      * may delete this class object.
       
   145      */
       
   146     void InternalizeL();
       
   147     
       
   148 
       
   149 public: // MNcdNodeMetadata
       
   150 
       
   151     /**
       
   152      * @see MNcdNodeMetaData::Id
       
   153      */
       
   154     virtual const TDesC& Id() const;
       
   155 
       
   156 
       
   157     /**
       
   158      * @see MNcdNodeMetaData::Namespace
       
   159      */
       
   160     virtual const TDesC& Namespace() const;
       
   161 
       
   162 
       
   163     /**
       
   164      * @see MNcdNodeMetaData::Name
       
   165      */
       
   166     virtual const TDesC& Name() const;
       
   167 
       
   168 
       
   169     /**
       
   170      * @see MNcdNodeMetaData::Descripton
       
   171      */
       
   172     virtual const TDesC& Description() const;
       
   173 
       
   174 
       
   175     /**
       
   176      * @see MNcdNodeMetaData::Disclaimer
       
   177      */
       
   178     virtual MNcdQuery* Disclaimer() const;
       
   179 
       
   180 
       
   181     /**
       
   182      * @see MNcdNodeMetaData::ActionName
       
   183      */
       
   184     virtual const TDesC& ActionName() const;
       
   185 
       
   186     /**
       
   187      * @see MNcdNodeMetaData::IsAlwaysVisible
       
   188      */
       
   189     virtual TBool IsAlwaysVisible() const;
       
   190     
       
   191     /**
       
   192      * @see MNcdNodeMetaData::LayoutType
       
   193      */
       
   194     virtual const TDesC& LayoutType() const;
       
   195 
       
   196     /**
       
   197      * @see MNcdNodeMetaData::MoreInfo
       
   198      */
       
   199     virtual MNcdQuery* MoreInfo() const;
       
   200     
       
   201     /**
       
   202      * @see MNcdNodeMetadata::Details
       
   203      */
       
   204     virtual const RPointerArray< CNcdKeyValuePair >& Details() const;
       
   205 
       
   206 
       
   207 protected:
       
   208 
       
   209     /**
       
   210      * Constructor
       
   211      *
       
   212      * @param aSession The session between the client proxy and the
       
   213      * corresponding server object.
       
   214      * @param aHandle The handle which identifies the server object
       
   215      * that this proxy uses.
       
   216      * @param aNode The node that owns this metadata
       
   217      */
       
   218     CNcdNodeMetadataProxy( MCatalogsClientServer& aSession,
       
   219                            TInt aHandle,
       
   220                            CNcdNodeProxy& aNode );
       
   221 
       
   222     /**
       
   223      * ConstructL
       
   224      */
       
   225     virtual void ConstructL();
       
   226 
       
   227     // These functions are used to update the data of this class object
       
   228 
       
   229     // Leaves with KErrNotFound if the internalization could
       
   230     // not find any data for this metadata. Then, the
       
   231     // owner of this class may delete this class object.
       
   232     virtual void InternalizeDataL( RReadStream& aStream );
       
   233 
       
   234     void InternalizeDownloadL();
       
   235     void InternalizeUpgradeL();
       
   236     void InternalizeDependencyL();
       
   237     void InternalizeIconL();
       
   238     void InternalizeScreenshotL();
       
   239     void InternalizePurchaseL();
       
   240     void InternalizeUriContentL();
       
   241     void InternalizeContentInfoL();
       
   242     void InternalizeInstallL();
       
   243     void InternalizePreviewL();
       
   244     void InternalizeSkinL();
       
   245     void InternalizeActivateL();         
       
   246 
       
   247 
       
   248 private:
       
   249 
       
   250     // Prevent if not implemented
       
   251     CNcdNodeMetadataProxy( const CNcdNodeMetadataProxy& aObject );
       
   252     CNcdNodeMetadataProxy& operator =( const CNcdNodeMetadataProxy& aObject );
       
   253 
       
   254 
       
   255     
       
   256     // Internalizes the user data object if the data can be found from
       
   257     // the server side.
       
   258     void InternalizeUserDataL();
       
   259 
       
   260     // Internalizes the disclaimer. 
       
   261     // Also, creates the disclaimer proxy if necessary.
       
   262     void InternalizeDisclaimerL();
       
   263 
       
   264     // Internalizes the more info. 
       
   265     // Also, creates the more info proxy if necessary.
       
   266     void InternalizeMoreInfoL();
       
   267 
       
   268     
       
   269 private: // data
       
   270 
       
   271     CNcdNodeProxy& iNode;
       
   272 
       
   273     // MNcdNodeMetaData data
       
   274     
       
   275     TBool iIsAlwaysVisible;
       
   276     CNcdNodeIdentifier* iIdentifier;
       
   277     HBufC* iName;
       
   278     HBufC* iDescription;
       
   279     HBufC* iLayoutType;
       
   280     HBufC* iActionName;
       
   281     
       
   282     // Disclaimer is part of the metadata information.
       
   283     // The disclaimer information of the metadata will be given to the UI
       
   284     // as a query object.
       
   285     CNcdNodeDisclaimerProxy* iDisclaimer;
       
   286     CNcdNodeDisclaimerProxy* iMoreInfo;
       
   287 
       
   288     // Details
       
   289     RPointerArray< CNcdKeyValuePair > iDetails;
       
   290 
       
   291     // These are the possible additional interface objects that this node
       
   292     // may use. If the pointer value is NULL then the node does not provide
       
   293     // functionality for that interface at that moment. Mainly these objects
       
   294     // are created after certain operations have been done for the node.
       
   295 
       
   296     // Node user data
       
   297     CNcdNodeUserDataProxy* iUserData;
       
   298     
       
   299     // Node icon
       
   300     CNcdNodeIconProxy* iIcon;    
       
   301 
       
   302     // Node screenshot
       
   303     CNcdNodeScreenshotProxy* iScreenshot;    
       
   304     
       
   305     // Preview data
       
   306     CNcdNodePreviewProxy* iPreview;
       
   307     
       
   308      // Content info
       
   309     CNcdNodeContentInfoProxy* iContentInfo;   
       
   310 
       
   311     // Uri content
       
   312     CNcdNodeUriContentProxy* iUriContent;
       
   313         
       
   314     // Purchase data
       
   315     CNcdNodePurchaseProxy* iPurchase;
       
   316 
       
   317     // Node install
       
   318     CNcdNodeInstallProxy* iInstall;
       
   319 
       
   320     // Node download
       
   321     CNcdNodeDownloadProxy* iDownload;
       
   322 
       
   323     // If this node provides upgrades to some other nodes.
       
   324     CNcdNodeUpgradeProxy* iUpgrade;
       
   325 
       
   326     // If this node provides upgrades to some other nodes.
       
   327     CNcdNodeDependencyProxy* iDependency;
       
   328 
       
   329     // Skin data
       
   330     CNcdNodeSkinProxy* iSkin;
       
   331 
       
   332     // Node activate
       
   333     CNcdNodeActivate* iActivate;
       
   334         
       
   335     };
       
   336 
       
   337 
       
   338 #endif // NCD_NODE_METADATA_PROXY_H