ncdengine/provider/client/inc/ncdnodefolderproxy.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 CNcdNodeFolderProxy class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCD_NODE_FOLDER_PROXY
       
    20 #define C_NCD_NODE_FOLDER_PROXY
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "ncdnodeproxy.h"
       
    26 #include "ncdnodecontainer.h"
       
    27 
       
    28 
       
    29 class MNcdLoadNodeOperationObserver;
       
    30 class CNcdNodeIdentifier;
       
    31 class CNcdLoadNodeOperationProxy;
       
    32 class CNcdNodeSearch;
       
    33 class CNcdChildEntity;
       
    34 class CNcdFavoriteManagerProxy;
       
    35 class CNcdNodeSeenFolderProxy;
       
    36 
       
    37 /**
       
    38  *  Node folder contains other nodes that may also be containers.
       
    39  *
       
    40  *  @lib ?library
       
    41  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    42  */
       
    43 class CNcdNodeFolderProxy: public CNcdNodeProxy,
       
    44                            public MNcdNodeContainer 
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * NewL
       
    51      *
       
    52      * @param aSession The session between the client proxy and the
       
    53      * corresponding server object.
       
    54      * @param aHandle The handle which identifies the server object
       
    55      * that this proxy uses.
       
    56      * @param aNodeManager The manager that creates the nodes and keeps
       
    57      * track of the existing nodes.
       
    58      * @param aOperationManager This manager is used to create operations
       
    59      * for the node.
       
    60      * @param aFavoriteManager This manager is used to add or remove favorite nodes.
       
    61      * @return CNcdNodeFolderProxy* Pointer to the created object 
       
    62      * of this class.
       
    63      */
       
    64     static CNcdNodeFolderProxy* NewL( MCatalogsClientServer& aSession, 
       
    65                                       TInt aHandle,
       
    66                                       CNcdNodeManagerProxy& aNodeManager,
       
    67                                       CNcdOperationManagerProxy& aOperationManager,
       
    68                                       CNcdFavoriteManagerProxy& aFavoriteManager );
       
    69 
       
    70     /**
       
    71      * NewL
       
    72      *
       
    73      * @param aSession The session between the client proxy and the
       
    74      * corresponding server object.
       
    75      * @param aHandle The handle which identifies the server object
       
    76      * that this proxy uses.
       
    77      * @param aNodeManager The manager that creates the nodes and keeps
       
    78      * track of the existing nodes.
       
    79      * @param aOperationManager This manager is used to create operations
       
    80      * for the node.
       
    81      * @param aFavoriteManager This manager is used to add or remove favorite nodes.
       
    82      * @return CNcdNodeFolderProxy* Pointer to the created object 
       
    83      * of this class.
       
    84      */
       
    85     static CNcdNodeFolderProxy* NewLC( MCatalogsClientServer& aSession, 
       
    86                                        TInt aHandle,
       
    87                                        CNcdNodeManagerProxy& aNodeManager,
       
    88                                        CNcdOperationManagerProxy& aOperationManager,
       
    89                                        CNcdFavoriteManagerProxy& aFavoriteManager );
       
    90 
       
    91 
       
    92     /**
       
    93      * Destructor
       
    94      *
       
    95      * @note Usually Release function should be used instead of
       
    96      * directly calling delete for this class object.
       
    97      *
       
    98      */
       
    99     virtual ~CNcdNodeFolderProxy();
       
   100 
       
   101 
       
   102 
       
   103     /**
       
   104      * When link information has been loaded for the node, the number
       
   105      * of the children that the container will have is given.
       
   106      */
       
   107     TInt ExpectedChildCount() const;
       
   108 
       
   109 
       
   110 public: // MNcdNode
       
   111 
       
   112     /**
       
   113      * @see MNcdNode::LoadL
       
   114      */
       
   115     virtual MNcdLoadNodeOperation* LoadL( MNcdLoadNodeOperationObserver& aObserver );
       
   116 
       
   117 
       
   118 public: // MNcdNodeContainer
       
   119 
       
   120     /**
       
   121      * @see MNcdNodeContainer
       
   122      * 
       
   123      * When the container node metadata is loaded then the node contains
       
   124      * the ids of its children. This function returns the count of the
       
   125      * children whose ids are given for this container.
       
   126      *
       
   127      * @note ChildExpectedCount and this function should give the same
       
   128      * results after both link and metadata have been loaded.
       
   129      *
       
   130      */
       
   131     virtual TInt ChildCount() const;
       
   132 
       
   133     /**
       
   134      * @see MNcdNodeContainer:: ChildL
       
   135      */
       
   136     virtual MNcdNode* ChildL( TInt aIndex );
       
   137 
       
   138     /**
       
   139      * @see MNcdNodeContainer::LoadChildrenL
       
   140      */
       
   141     virtual MNcdLoadNodeOperation* LoadChildrenL( TInt aIndex, 
       
   142                                                   TInt aSize,
       
   143                                                   TNcdChildLoadMode aMode,
       
   144                                                   MNcdLoadNodeOperationObserver& aObserver );
       
   145 
       
   146     /**
       
   147      * @see MNcdNodeContainer::ContainerType
       
   148      */
       
   149     virtual TNcdContainerType ContainerType() const;
       
   150     
       
   151     /**
       
   152      * @see MNcdLoadNodeOperationObserver::OperationComplete
       
   153      * Calls the internalize function to update the node data.
       
   154      */
       
   155     virtual void OperationComplete( MNcdLoadNodeOperation& aOperation,
       
   156                                     TInt aError );
       
   157     
       
   158                                                   
       
   159 public: // CNcdNodeProxy
       
   160     
       
   161     /**
       
   162      * This function calls additional folder specific
       
   163      * internalization functions that have not been called 
       
   164      * from the CNcdNodeProxy::InternalizeL.
       
   165      *
       
   166      * @see CNcdNodeProxy::InternalizeL
       
   167      */
       
   168     virtual void InternalizeL();
       
   169     
       
   170     
       
   171 protected: // CNcdNodeProxy
       
   172 
       
   173     /**
       
   174      * This function is called from the CNcdNodeProxy::InternalizeL
       
   175      *
       
   176      * @see CNcdNodeProxy::InternalizeNodeDataL
       
   177      */
       
   178     virtual void InternalizeNodeDataL( RReadStream& aStream );
       
   179 
       
   180     /**
       
   181      * This function is called from the CNcdNodeProxy::InternalizeL
       
   182      *
       
   183      * @see CNcdNodeProxy::InternalizeNodeLinkDataL
       
   184      */
       
   185     virtual void InternalizeNodeLinkDataL( RReadStream& aStream );
       
   186 
       
   187 
       
   188 protected:
       
   189 
       
   190     /**
       
   191      * Constructor
       
   192      *
       
   193      * @param aSession The session between the client proxy and the
       
   194      * corresponding server object.
       
   195      * @param aHandle The handle which identifies the server object
       
   196      * that this proxy uses.
       
   197      * @param aNodeManager The manager that creates the nodes and keeps
       
   198      * track of the existing nodes.
       
   199      * @param aOperationManager This manager is used to create operations
       
   200      * for the node.
       
   201      * @param aFavoriteManager This manager is used to add or remove favorite nodes.
       
   202      */
       
   203     CNcdNodeFolderProxy( MCatalogsClientServer& aSession,
       
   204                          TInt aHandle,
       
   205                          CNcdNodeManagerProxy& aNodeManager,
       
   206                          CNcdOperationManagerProxy& aOperationManager,
       
   207                          CNcdFavoriteManagerProxy& aFavoriteManager );
       
   208 
       
   209     /**
       
   210      * ConstructL
       
   211      */
       
   212     virtual void ConstructL();
       
   213     
       
   214     /**
       
   215      * Checks whether search is supported for this folder.
       
   216      *
       
   217      * @return ETrue if search is supported, EFalse otherwise.
       
   218      */
       
   219     virtual TBool IsSearchSupportedL();
       
   220     
       
   221     /**
       
   222      * Internalizes the MNcdNodeSeenFolder interface.
       
   223      */
       
   224     virtual void InternalizeNodeSeenFolderL();
       
   225 
       
   226 
       
   227 private:
       
   228     // Prevent if not implemented
       
   229     CNcdNodeFolderProxy( const CNcdNodeFolderProxy& aObject );
       
   230     CNcdNodeFolderProxy& operator =( const CNcdNodeFolderProxy& aObject );
       
   231 
       
   232 
       
   233 protected: // data
       
   234     
       
   235     // This is the count that the link information gives.
       
   236     TInt iExpectedChildCount;
       
   237     
       
   238     // This is the count that informs how many children are actually
       
   239     // set to the node.
       
   240     RPointerArray<CNcdChildEntity> iChildren;
       
   241 
       
   242     // These are the possible additional interface objects that this node
       
   243     // may use. If the pointer value is NULL then the node does not provide
       
   244     // functionality for that interface at that moment. Mainly these objects
       
   245     // are created after certain operations have been done for the node.
       
   246 
       
   247     CNcdNodeSearch* iSearch;
       
   248     
       
   249     // Implements the MNcdNodeSeenFolder interface for this object.
       
   250     CNcdNodeSeenFolderProxy* iNodeSeenFolder;
       
   251         
       
   252     };
       
   253 
       
   254 
       
   255 #endif // C_NCD_NODE_FOLDER_PROXY