iaupdate/IAD/engine/controller/inc/iaupdatebasenodeimpl.h
changeset 0 ba25891c3a9e
child 18 3ba40be8e484
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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 CIAUpdateBaseNode class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IA_UPDATE_BASE_NODE_IMPL_H
       
    20 #define IA_UPDATE_BASE_NODE_IMPL_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "iaupdatebasenode.h"
       
    26 #include "iaupdateversion.h"
       
    27 
       
    28 
       
    29 class MNcdNode;
       
    30 class MNcdNodeMetadata;
       
    31 class CNcdPurchaseDetails;
       
    32 class CIAUpdateNodeDetails;
       
    33 class CIAUpdateController;
       
    34 
       
    35 
       
    36 /**
       
    37  *
       
    38  */
       
    39 class CIAUpdateBaseNode : public CBase, 
       
    40                           public MIAUpdateBaseNode
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Destructor
       
    47      **/
       
    48     virtual ~CIAUpdateBaseNode();
       
    49     
       
    50     
       
    51 public: // MIAUpdateBaseNode
       
    52 
       
    53     /**
       
    54      * @see MIAUpdateBaseNode::MetaNamespace
       
    55      */ 
       
    56     virtual const TDesC& MetaNamespace() const;
       
    57 
       
    58     /**
       
    59      * @see MIAUpdateBaseNode::MetaId
       
    60      */ 
       
    61     virtual const TDesC& MetaId() const;
       
    62 
       
    63     /**
       
    64      * @see MIAUpdateBaseNode::Uid
       
    65      **/
       
    66     virtual const TUid& Uid() const;
       
    67 
       
    68     /**
       
    69      * @see MIAUpdateBaseNode::Name
       
    70      **/
       
    71     virtual const TDesC& Name() const;
       
    72 
       
    73     /**
       
    74      * @see MIAUpdateBaseNode::Description
       
    75      */
       
    76     virtual const TDesC& Description() const;
       
    77 
       
    78     /** 
       
    79      * @see MIAUpdateBaseNode::ContentSizeL
       
    80      */
       
    81     virtual TInt ContentSizeL() const;
       
    82 
       
    83     /**
       
    84      * @see MIAUpdateBaseNode::Version
       
    85      **/
       
    86     virtual const TIAUpdateVersion& Version() const;
       
    87     
       
    88     /**
       
    89      * @see MIAUpdateBaseNode::Importance
       
    90      **/
       
    91     virtual TImportance Importance() const;
       
    92     virtual void SetImportance( TImportance aImportance );
       
    93 
       
    94     /**
       
    95      * @see MIAUpdateBaseNode::SearchCriteria
       
    96      */
       
    97     virtual const TDesC& SearchCriteria() const;
       
    98     
       
    99     /**
       
   100      * @see MIAUpdateBaseNode:: RebootAfterInstall
       
   101      */
       
   102     virtual TBool RebootAfterInstall() const;
       
   103     
       
   104     /**
       
   105      * @see MIAUpdateBaseNode::Hidden
       
   106      */
       
   107     virtual TBool Hidden() const;
       
   108 
       
   109     /**
       
   110      * @see MIAUpdateBaseNode::SetSelected
       
   111      */
       
   112     virtual void SetSelected( TBool aSelected );
       
   113 
       
   114     /**
       
   115      * @see MIAUpdateBaseNode::IsSelected
       
   116      */
       
   117     virtual TBool IsSelected() const;
       
   118 
       
   119     /**
       
   120      * @note This function decodes the error code from the purchase history.
       
   121      *
       
   122      * @see MIAUpdateBaseNode::LastUpdateErrorCodeL
       
   123      * @see CIAUpdateBaseNode::LastUpdateErrorCodeFromPurchaseHistoryL
       
   124      **/
       
   125     virtual TInt LastUpdateErrorCodeL() const;
       
   126             
       
   127     /**
       
   128      * @see MIAUpdateBaseNode::SetIdleCancelToPurchaseHistoryL
       
   129      */
       
   130     virtual void SetIdleCancelToPurchaseHistoryL( 
       
   131         TBool aForceVisibleInHistory );
       
   132 
       
   133     /**
       
   134      * @see MIAUpdateBaseNode::SetInstallStatusToPurchaseHistoryL
       
   135      */
       
   136     virtual void SetInstallStatusToPurchaseHistoryL( 
       
   137         TInt aErrorCode, TBool aForceVisibleInHistory );
       
   138     
       
   139     
       
   140 public: // ** New functions
       
   141 
       
   142     /**
       
   143      * Sets the error information into NCD Purchase history.
       
   144      * Usually this function can be used when the update flow has been finished 
       
   145      * before this node has started its update operation. Also, notice that 
       
   146      * the node may have some old history, for example fail or success. But after this
       
   147      * operation, the information will be the latest purchase history information.
       
   148      * @param aError Error code of the operation.
       
   149      * @param aForceVisibleInHistory ETrue means that even if node would be at the moment
       
   150      * hidden, it will be forced as visible in purchase history. EFalse means that
       
   151      * items are saved normally in history.
       
   152      */
       
   153     virtual void SetIdleErrorToPurchaseHistoryL( 
       
   154         TInt aError, TBool aForceVisibleInHistory );
       
   155 
       
   156 
       
   157     /**
       
   158      * Checks if the node identifications or contents are equal.
       
   159      *
       
   160      * @param aNode Node that is compared with this class object.
       
   161      * @return TBool ETrue if the node or node content is thought to be same.
       
   162      * Else EFalse.
       
   163      */
       
   164     TBool Equals( const CIAUpdateBaseNode& aNode ) const;
       
   165 
       
   166 
       
   167     /**
       
   168      * Noramlly hidden info comes from the details gotten from the server.
       
   169      * But, by using this function the node can be forced hidden for 
       
   170      * specific purposes.
       
   171      *
       
   172      * @param aHidden ETrue if this node should be thought as hidden. 
       
   173      */
       
   174     void ForceHidden( TBool aHidden );
       
   175 
       
   176 
       
   177     /** 
       
   178      * @return TInt The content size of this node. This value is gotten from the
       
   179      * backend server. Does not include dependency contents.
       
   180      * @exception Leaves with system wide error code.
       
   181      */
       
   182     TInt OwnContentSizeL() const;
       
   183         
       
   184 
       
   185     /**
       
   186      * @return CIAUpdateNodeDetails& Additional node details info.
       
   187      */
       
   188     CIAUpdateNodeDetails& Details() const;
       
   189 
       
   190 
       
   191     /**
       
   192      * @return CIAUpdateController& Controller
       
   193      */
       
   194     CIAUpdateController& Controller() const;    
       
   195 
       
   196 
       
   197     /**
       
   198      * @return MNcdNode& Actual NCD Node that this iaupdate node wraps.
       
   199      */
       
   200     MNcdNode& Node() const;
       
   201     
       
   202 
       
   203     /**
       
   204      * This gives the exact error code from the purchase history without
       
   205      * first decoding IAD specific base codes from it.
       
   206      *
       
   207      * @see MIAUpdateBaseNode::LastUpdateErrorCodeL
       
   208      *
       
   209      * @return TInt Error code that has been saved into the purchase history.
       
   210      */
       
   211     TInt LastUpdateErrorCodeFromPurchaseHistoryL() const;
       
   212 
       
   213     
       
   214 protected:
       
   215 
       
   216     /**
       
   217      * @param aController Controller of the IAUpdate engine.
       
   218      */
       
   219     CIAUpdateBaseNode( CIAUpdateController& aController );
       
   220 
       
   221     /**
       
   222      * @param aNode NCD Engine node that this IAUpdate node is wrapping.
       
   223      */    
       
   224     virtual void ConstructL( MNcdNode* aNode );
       
   225 
       
   226 
       
   227     /**
       
   228      * @note This function sets the purchase detail MIME by using 
       
   229      * CIAUpdateBaseNode::MimeL function instead of using the purchase 
       
   230      * history value. This way the latest value can be put automatically
       
   231      * into the purchase history if purchase detail is saved after this.
       
   232      *
       
   233      * @see CIAUpdateBaseNode::MimeL
       
   234      *
       
   235      * @notice Even if purhcase details are updated and saved into the
       
   236      * purchase history, information may not necessary be updated into
       
   237      * NCD Nodes before they are released and reloaded. So, the values in
       
   238      * IAD node objects may differ from the actual NCD Engine node value
       
   239      * until the NCD Nodes are reloaded. So, be careful when using this.
       
   240      *
       
   241      * @return CNcdPurchaseDetails* Purchase details that was found from the
       
   242      * purchase history. If right purchase details was not found, then new one
       
   243      * is created.
       
   244      * Ownership is transferred.
       
   245      */
       
   246     CNcdPurchaseDetails* PurchaseDetailsLC(); 
       
   247 
       
   248 
       
   249     /**
       
   250      * @note This function will check if MIME should 
       
   251      * contain certain postfixes that relate to the node
       
   252      * settings. If necessary, original MIME value is
       
   253      * replaced here by new value that is returned.
       
   254      *
       
   255      * @return const TDesC& MIME type of the content.
       
   256      */
       
   257     const TDesC& MimeL();
       
   258     
       
   259     virtual void SetNameL( const MNcdNodeMetadata& aMetaData );
       
   260 
       
   261 
       
   262 private:
       
   263 
       
   264     // Prevent these if not implemented
       
   265     CIAUpdateBaseNode( const CIAUpdateBaseNode& aObject );
       
   266     CIAUpdateBaseNode& operator =( const CIAUpdateBaseNode& aObject );
       
   267  
       
   268 protected: // data
       
   269     HBufC*                              iName;
       
   270     
       
   271 private: // data
       
   272 
       
   273     MNcdNode*                           iNode;
       
   274     CIAUpdateController&                iController;
       
   275     HBufC*                              iMetaNamespace;
       
   276     HBufC*                              iMetaId;
       
   277     HBufC*                              iDescription;
       
   278     HBufC*                              iMime;
       
   279     TUid                                iUid;
       
   280     TIAUpdateVersion                    iVersion;
       
   281     CIAUpdateNodeDetails*               iDetails;
       
   282     TBool                               iSelected;
       
   283     TBool                               iForcedHidden;
       
   284 
       
   285     };
       
   286     
       
   287     
       
   288 #endif  //  IA_UPDATE_BASE_NODE_IMPL_H