iaupdate/IAD/engine/controller/inc/iaupdatenodeimpl.h
changeset 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2007-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:   This file contains the header file of CIAUpdateNode class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IA_UPDATE_NODE_IMPL_H
       
    20 #define IA_UPDATE_NODE_IMPL_H
       
    21 
       
    22 
       
    23 #include "iaupdatebasenodeimpl.h"
       
    24 #include "iaupdatenode.h"
       
    25 #include "iaupdatecontentoperationobserver.h"
       
    26 
       
    27 class CIAUpdateNodeDependency;
       
    28 
       
    29 
       
    30 /**
       
    31  *
       
    32  */
       
    33 class CIAUpdateNode : public CIAUpdateBaseNode, 
       
    34                       public MIAUpdateNode,
       
    35                       public MIAUpdateContentOperationObserver
       
    36     {
       
    37 
       
    38 public:
       
    39 
       
    40     /** 
       
    41      *
       
    42      */
       
    43     enum TDependencyCheckStatus
       
    44         {
       
    45         EDependencyCheckNotSet,
       
    46         EDependencyCheckGoing,
       
    47         EDependencyCheckPassed,
       
    48         EDependencyCheckFailed
       
    49         };
       
    50 
       
    51 
       
    52     /**
       
    53      * @see IAUpdateNodeFactory::CreateNodeLC
       
    54      **/
       
    55     static CIAUpdateNode* NewLC( MNcdNode* aNode,
       
    56                                  CIAUpdateController& aController );
       
    57     
       
    58     /**
       
    59      * @see CIAUpdateNode::NewLC
       
    60      **/
       
    61     static CIAUpdateNode* NewL( MNcdNode* aNode,
       
    62                                 CIAUpdateController& aController );
       
    63     
       
    64     
       
    65     /**
       
    66      * Destructor
       
    67      **/
       
    68     virtual ~CIAUpdateNode();
       
    69 
       
    70 
       
    71 public: // CIAUpdateBaseNode
       
    72 
       
    73     /**
       
    74      * @note This implementation also includes all OwnContentSizesL of 
       
    75      * the non-hidden nodes of the dependency tree.
       
    76      * @see CIAUpdateBaseNode::ContentSize
       
    77      */
       
    78     virtual TInt ContentSizeL() const;   
       
    79 
       
    80 
       
    81 public: // MIAUpdateNode
       
    82 
       
    83     /**
       
    84      * @see MIAUpdateNode::Type
       
    85      **/
       
    86     virtual TPackageType Type() const;
       
    87         
       
    88     /**
       
    89      * This implementation always returns EFalse.
       
    90      * @see MIAUpdateNode::IsSelfUpdate
       
    91      */
       
    92     virtual TBool IsSelfUpdate() const;
       
    93 
       
    94     /**
       
    95      * @see MIAUpdateNode::GetDependenciesL
       
    96      **/
       
    97     virtual void GetDependenciesL( 
       
    98         RPointerArray< MIAUpdateNode >& aDependencies,
       
    99         TBool aIncludeHidden ) const;
       
   100     
       
   101     /**
       
   102      * @see MIAUpdateNode::GetDependantsL
       
   103      */
       
   104     virtual void GetDependantsL( 
       
   105         RPointerArray< MIAUpdateNode >& aDependants,
       
   106         TBool aIncludeHidden ) const;
       
   107 
       
   108     /**
       
   109      * @see MIAUpdateNode::IsDownloaded
       
   110      **/
       
   111     virtual TBool IsDownloaded() const;
       
   112     
       
   113     /**
       
   114      * @see MIAUpdateNode::IsInstalled
       
   115      **/
       
   116     virtual TBool IsInstalled() const;
       
   117 
       
   118     /**
       
   119      * @see MIAUpdateNode::DownloadL
       
   120      **/
       
   121     virtual void DownloadL( MIAUpdateNodeObserver& aObserver );
       
   122 
       
   123     /**
       
   124      * @see MIAUpdateNode::InstallL
       
   125      **/
       
   126     virtual void InstallL( MIAUpdateNodeObserver& aObserver );
       
   127 
       
   128     /**
       
   129      * @see MIAUpdateNode::CancelOperation
       
   130      **/    
       
   131     virtual void CancelOperation();
       
   132 
       
   133     /** 
       
   134      * @notice That this value has to be set by other objects. 
       
   135      * If it is not set, it returns zero.
       
   136      *
       
   137      * @see MIAUpdateNode::Depth
       
   138      */
       
   139     virtual TInt Depth() const;
       
   140 
       
   141     /**
       
   142      * @see MIAUpdateNode:::NodeType
       
   143      */
       
   144     virtual TNodeType NodeType() const;
       
   145     
       
   146     /**
       
   147      * @see MIAUpdateNode::Base
       
   148      */
       
   149     virtual MIAUpdateBaseNode& Base();
       
   150 
       
   151 
       
   152 public: // MIAUpdateContentOperationObserver
       
   153 
       
   154     /**
       
   155      * @see MIAUpdateContentOperationObserver::ContentOperationComplete
       
   156      */
       
   157     virtual void ContentOperationComplete( CIAUpdateBaseNode& aNode, 
       
   158                                            TInt aError );
       
   159 
       
   160     /**
       
   161      * @see MIAUpdateContentOperationObserver::ContentOperationProgress
       
   162      */
       
   163     virtual void ContentOperationProgress( CIAUpdateBaseNode& aNode, 
       
   164                                            TInt aProgress, 
       
   165                                            TInt aMaxProgress );
       
   166 
       
   167     
       
   168 public: // ** New functions
       
   169 
       
   170     /**
       
   171      * Can be used to reset variables that are set externally.
       
   172      * Variables such as depth and leaf distance and check status.
       
   173      */
       
   174     void Reset();
       
   175 
       
   176 
       
   177     /**
       
   178      * @return TBool ETrue if the node content has been purchased.
       
   179      * Else EFalse.
       
   180      */
       
   181     TBool IsPurchased() const;
       
   182 
       
   183 
       
   184     /**
       
   185      * This method provides means to add extra dependencies for this node.
       
   186      * If the dependency corresponding to the given node already exists, then the
       
   187      * old dependency is kept. If given dependency will create a loop, then nothing
       
   188      * is done.
       
   189      *
       
   190      * @note This function supposes that the dependency tree below aDependencyNode
       
   191      * is fullfilled and intact.
       
   192      *
       
   193      * @param aDependencyNode This node depends on aDependencyNode.
       
   194      * @param aAddDependency If ETrue, then dependency chain is
       
   195      * updated and the dependant depths are updated. If EFalse, then dependency
       
   196      * is not added but still dependant depths are updated. This can be usefull, 
       
   197      * if dependency chain should not be changed, but still the depths of the 
       
   198      * dependant items should know about some excess dependency nodes that may 
       
   199      * affect the operation flow order.
       
   200      */
       
   201     void SetExcessDependencyL( CIAUpdateNode& aDependencyNode,
       
   202                                TBool aAddDependency );
       
   203 
       
   204     /**
       
   205      * @see CIAUpdateNode::GetDependenciesL
       
   206      */
       
   207     void GetDependencyNodesL( 
       
   208         RPointerArray< CIAUpdateNode >& aDependencies,
       
   209         TBool aIncludeHidden ) const;
       
   210 
       
   211     /**
       
   212      * Sets the status that informs if the dependency chain check for this node and
       
   213      * all the nodes it depends on were passed or failed.
       
   214      *
       
   215      * @param aStatus
       
   216      */
       
   217     void SetDependencyCheckStatus( TDependencyCheckStatus aStatus );
       
   218 
       
   219     /**
       
   220      * @return TDependencyCheckStatus Dependency check status of this node and
       
   221      * all the nodes it depends on.
       
   222      */
       
   223     TDependencyCheckStatus DependencyCheckStatus() const;
       
   224        
       
   225     /**
       
   226      * @notice That this value has to be set by other objects. 
       
   227      * If it is not set, it returns zero. 
       
   228      *
       
   229      * @return TInt This value informs the distance of this node
       
   230      * from the furthest leaf node.
       
   231      */
       
   232     TInt LeafDistance() const;    
       
   233 
       
   234     /**
       
   235      * @param aDistance This value informs the distance of this node
       
   236      * from the furthest leaf node.
       
   237      */
       
   238     void SetLeafDistance( TInt aDistance );
       
   239 
       
   240     /**
       
   241      * @param aDepth This value informs the distance of this node from
       
   242      * the furthest root. Root has zero depth.
       
   243      */
       
   244     void SetDepth( TInt aDepth );
       
   245 
       
   246 
       
   247     /**
       
   248      * RPointerArray< CIAUpdateNode >& Reference to the dependant node array. 
       
   249      * Ownership is not transferred.
       
   250      */
       
   251     const RPointerArray< CIAUpdateNode >& DependantNodes() const;
       
   252 
       
   253     /**
       
   254      * Adds dependant node for this node. 
       
   255      * @param aDependantNode Dependant node
       
   256      */
       
   257     void AddDependantL( CIAUpdateNode& aDependantNode );
       
   258 
       
   259 
       
   260     /**
       
   261      * Updates the depths of the dependency nodes
       
   262      * starting from this node and then recursively
       
   263      * its dependencies.
       
   264      *
       
   265      * @note Depth is updated only if the new depth will be greater
       
   266      * than the old depth or if a negative value is given for refresh.
       
   267      *
       
   268      * @param aDepth The depth of this node.
       
   269      */
       
   270     void UpdateDependencyDepthsL( TInt aDepth );
       
   271 
       
   272 
       
   273 protected:
       
   274 
       
   275     /**
       
   276      * @see CIAUpdateBaseNode::CIAUpdateBaseNode
       
   277      */
       
   278     CIAUpdateNode( CIAUpdateController& aController );
       
   279 
       
   280     /**
       
   281      * @see CIAUpdateBaseNode::ConstructL
       
   282      */    
       
   283     virtual void ConstructL( MNcdNode* aNode );
       
   284 
       
   285     /**
       
   286      * @see CIAUpdateNode::IsPurchased
       
   287      */
       
   288     virtual TBool IsPurchasedL() const;
       
   289     
       
   290     /**
       
   291      * @see CIAUpdateNode::IsDownloaded
       
   292      */
       
   293     virtual TBool IsDownloadedL() const;
       
   294 
       
   295     /**
       
   296      * @see CIAUpdateNode::IsInstalled
       
   297      */
       
   298     virtual TBool IsInstalledL() const;
       
   299 
       
   300     /**
       
   301      * @return MIAUpdateNodeObserver* Operation observer.
       
   302      * NULL if not set and then operation is not going on.
       
   303      * Ownership is not transferred.
       
   304      */
       
   305     MIAUpdateNodeObserver* OperationObserver() const;
       
   306 
       
   307 
       
   308 private:
       
   309 
       
   310     // Prevent these if not implemented
       
   311     CIAUpdateNode( const CIAUpdateNode& aObject );
       
   312     CIAUpdateNode& operator =( const CIAUpdateNode& aObject );
       
   313 
       
   314     // Updates the leaf distances of the dependant nodes
       
   315     // starting from this node and then recursively
       
   316     // its dependants. aLeafDistance is the distance of 
       
   317     // this node from the furthest leaf node.
       
   318     void UpdateDependantLeafDistancesL( TInt aLeafDistance );
       
   319 
       
   320 
       
   321 private: // data
       
   322 
       
   323     TDependencyCheckStatus              iDependencyCheckStatus;
       
   324     TInt                                iLeafDistance;
       
   325     TInt                                iDepth;
       
   326 
       
   327     // These arrays do not own the nodes.
       
   328     RPointerArray< CIAUpdateNode >      iDependants;
       
   329     RPointerArray< CIAUpdateNode >      iExcessDependencyNodes;
       
   330 
       
   331     // Not owned.
       
   332     MIAUpdateNodeObserver*              iOperationObserver;
       
   333 
       
   334     };
       
   335     
       
   336     
       
   337 #endif  //  IA_UPDATE_NODE_IMPL_H