ncdengine/provider/client/inc/ncdnodepreviewproxy.h
changeset 0 ba25891c3a9e
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 CNcdNodePreviewProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDNODEPREVIEWPROXY_H
       
    20 #define C_NCDNODEPREVIEWPROXY_H
       
    21 
       
    22 
       
    23 // For the streams
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "ncdinterfacebaseproxy.h"
       
    27 #include "ncdnodepreview.h"
       
    28 #include "ncddownloadoperationobserver.h"
       
    29 
       
    30 class CNcdNodeMetadataProxy;
       
    31 
       
    32 
       
    33 /**
       
    34  *  This class implements the functionality for the
       
    35  *  MNcdNodeProxy interfaces. The interface is provided for
       
    36  *  API users.
       
    37  *
       
    38  *  @since S60 v3.2
       
    39  */
       
    40 class CNcdNodePreviewProxy : public CNcdInterfaceBaseProxy, 
       
    41                              public MNcdNodePreview,
       
    42                              public MNcdDownloadOperationObserver
       
    43     {
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * @param aSession The session between the client proxy and the
       
    49      * corresponding server object.
       
    50      * @param aHandle The handle which identifies the server object
       
    51      * that this proxy uses.
       
    52      * @param aMetadata Owns and uses the information of this proxy.
       
    53      * The node also keeps track of the refence counts of its objects. 
       
    54      * And handles the deletion of these objects when the total reference 
       
    55      * count reaches zero. 
       
    56      * @return CNcdNodePreviewProxy* Pointer to the created object 
       
    57      * of this class.
       
    58      */
       
    59     static CNcdNodePreviewProxy* NewL(
       
    60         MCatalogsClientServer& aSession,
       
    61         TInt aHandle,
       
    62         CNcdNodeMetadataProxy& aMetadata );
       
    63 
       
    64     /**
       
    65      * @param aSession The session between the client proxy and the
       
    66      * corresponding server object.
       
    67      * @param aHandle The handle which identifies the server object
       
    68      * that this proxy uses.
       
    69      * @param aMetadata Owns and uses the information of this proxy.
       
    70      * The node also keeps track of the refence counts of its objects. 
       
    71      * And handles the deletion of these objects when the total reference 
       
    72      * count reaches zero. 
       
    73      * @return CNcdNodePreviewProxy* Pointer to the created object 
       
    74      * of this class.
       
    75      */
       
    76     static CNcdNodePreviewProxy* NewLC(
       
    77         MCatalogsClientServer& aSession, 
       
    78         TInt aHandle,
       
    79         CNcdNodeMetadataProxy& aMetadata );
       
    80 
       
    81 
       
    82     /**
       
    83      * Destructor.
       
    84      * The destructor is set public. So, the node that owns this object may
       
    85      * delete it directly when the reference count of the node reaches zero
       
    86      * and the destructor of the node is called.
       
    87      */
       
    88     virtual ~CNcdNodePreviewProxy();
       
    89 
       
    90 
       
    91     /**
       
    92      * @return CNcdNodeMetadataProxy& Gives the metadata proxy that owns this class object.
       
    93      * @exception KNcdErrorObsolete if the object has been set as obsolete. Then, we
       
    94      * cannot be sure if the original metadata still exists because it is not the parent
       
    95      * of this class object anymore.
       
    96      */
       
    97     CNcdNodeMetadataProxy& MetadataL() 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 public: // MNcdNodePreview
       
   110 
       
   111     /**
       
   112      * @see MNcdNodePreview::PreviewCount
       
   113      */ 
       
   114     TInt PreviewCount() const;
       
   115     
       
   116     /**
       
   117      * @see MNcdNodePreview::IsPreviewLoaded
       
   118      */ 
       
   119     TBool IsPreviewLoadedL( TInt aIndex ) const;
       
   120     
       
   121     /**
       
   122      * @see MNcdNodePreview::PreviewMimeType
       
   123      */ 
       
   124     const TDesC& PreviewMimeType( TInt aIndex ) const;
       
   125     
       
   126     /**
       
   127      * @see MNcdNodePreview::LoadPreviewL
       
   128      */ 
       
   129     MNcdDownloadOperation* LoadPreviewL( TInt aIndex,
       
   130         MNcdDownloadOperationObserver* aObserver );
       
   131     
       
   132     /**
       
   133      * @see MNcdNodePreview::PreviewFileL
       
   134      */ 
       
   135     RFile PreviewFileL( TInt aIndex ) const;
       
   136 
       
   137 
       
   138 public: // MNcdDownloadOperationObserver
       
   139 
       
   140     /**
       
   141      * @see MNcdDownloadOperationObserver::DownloadProgress
       
   142      */ 
       
   143     void DownloadProgress( MNcdDownloadOperation& aOperation,
       
   144         TNcdProgress aProgress );
       
   145         
       
   146     /**
       
   147      * @see MNcdDownloadOperationObserver::QueryReceived
       
   148      */ 
       
   149     void QueryReceived( MNcdDownloadOperation& aOperation,
       
   150         MNcdQuery* aQuery );
       
   151 
       
   152     /**
       
   153      * @see MNcdDownloadOperationObserver::OperationComplete
       
   154      */ 
       
   155     void OperationComplete( MNcdDownloadOperation& aOperation,
       
   156         TInt aError );
       
   157 
       
   158 protected:
       
   159 
       
   160     /**
       
   161      * Constructor
       
   162      *
       
   163      * @param aSession The session between the client proxy and the
       
   164      * corresponding server object.
       
   165      * @param aHandle The handle which identifies the server object
       
   166      * that this proxy uses.
       
   167      * @param aNode Owns and uses the information of this proxy.
       
   168      * The node also keeps track of the refence counts of its objects. 
       
   169      * And handles the deletion of these objects when the total reference 
       
   170      * count reaches zero.
       
   171      * @param aOperationManager This class uses operation manager to get the
       
   172      * operations for certain tasks. 
       
   173      * @return CNcdNodePreviewProxy* Pointer to the created object 
       
   174      * of this class.
       
   175      */
       
   176     CNcdNodePreviewProxy(
       
   177         MCatalogsClientServer& aSession,
       
   178         TInt aHandle,
       
   179         CNcdNodeMetadataProxy& aMetadata );
       
   180 
       
   181     /**
       
   182      * ConstructL
       
   183      */
       
   184     virtual void ConstructL();
       
   185 
       
   186 
       
   187     /**
       
   188      * @return TBool ETrue if this object has been set as obsolete.
       
   189      */
       
   190     TBool IsObsolete() const;
       
   191     
       
   192     /**
       
   193      * @param aObsolete ETrue if the object should be set as obsolete else EFalse.
       
   194      */
       
   195     void SetObsolete( TBool aObsolete );
       
   196         
       
   197     
       
   198     // These functions are used to update the data of this class object
       
   199 
       
   200     /**
       
   201      * @param aStream This stream will contain all the data content for
       
   202      * this class object. The stream is gotten from the server side. The
       
   203      * memeber variables will be updated according to the data from
       
   204      * the stream. 
       
   205      */
       
   206     virtual void InternalizeDataL( RReadStream& aStream );
       
   207 
       
   208 
       
   209 private:
       
   210 
       
   211     // Prevent if not implemented
       
   212     CNcdNodePreviewProxy( const CNcdNodePreviewProxy& aObject );
       
   213     CNcdNodePreviewProxy& operator =( const CNcdNodePreviewProxy& aObject );
       
   214     
       
   215     
       
   216 private: // data
       
   217 
       
   218     CNcdNodeMetadataProxy& iMetadata;
       
   219     MNcdDownloadOperationObserver* iOperationObserver;
       
   220     TBool iObsolete;
       
   221     TInt iPreviewCount;
       
   222     RPointerArray<HBufC> iPreviewMimeTypes;
       
   223 
       
   224     };
       
   225 
       
   226 
       
   227 #endif // C_NCD_NODE_PREVIEW_PROXY_H