ncdengine/inc/ncdpurchasehistory.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:   Definition of MNcdPurchaseHistory interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_NCD_PURCHASE_HISTORY_H
       
    20 #define M_NCD_PURCHASE_HISTORY_H
       
    21 
       
    22 #include "catalogsbase.h"
       
    23 #include "ncdinterfaceids.h"
       
    24 
       
    25 class MNcdPurchaseHistoryFilter;
       
    26 class MNcdPurchaseDetails;
       
    27 class CNcdPurchaseDetails;
       
    28 
       
    29 /**
       
    30  *  Purchase history interface.
       
    31  *
       
    32  *  This interface gives access to the purchase history. Purchase details can
       
    33  *  be inserted into the purchase history and list of previously inserted
       
    34  *  details can be asked through this interface.
       
    35  *
       
    36  *  
       
    37  */
       
    38 
       
    39 class MNcdPurchaseHistory : public virtual MCatalogsBase
       
    40     {
       
    41     
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Unique identifier for the interface, required for all MCatalogsBase
       
    46      * interfaces.
       
    47      * 
       
    48      */
       
    49     enum { KInterfaceUid = ENcdPurchaseHistoryUid };
       
    50 
       
    51     /**
       
    52      * Save purchase into the purchase history. Purchase details of previous
       
    53      * purchase will be overwritten, if Namespace, Entity ID, purchase time
       
    54      * and client UID of new details matches to the previous details.
       
    55      *
       
    56      * 
       
    57      * @param aDetails Details of the purchase.
       
    58      * @param aSaveIcon ETrue by default, which means that a purchase detail icon 
       
    59      * is also saved with other purchase details. If EFalse, a new icon will not be saved 
       
    60      * into the purchase history. This is useful, for example, if an icon was not 
       
    61      * loaded when PurchaseDetailsL function was used and the old icon should be
       
    62      * left into the purchase history when purchase details are saved. 
       
    63      */
       
    64     virtual void SavePurchaseL( const MNcdPurchaseDetails& aDetails,
       
    65                                 TBool aSaveIcon = ETrue ) = 0;
       
    66 
       
    67     /**
       
    68      * Get purchase IDs from purchase history.
       
    69      *
       
    70      * 
       
    71      * @param aFilter Filter used to get certain purchase IDs from the
       
    72      *  purchase history.
       
    73      * @return Array of purchase IDs. Can be empty.
       
    74      * @exception Leave System wide error code.
       
    75      */
       
    76     virtual RArray<TUint> PurchaseIdsL(
       
    77         const MNcdPurchaseHistoryFilter& aFilter ) = 0;
       
    78 
       
    79     /**
       
    80      * Get purchase details from purchase history.
       
    81      *
       
    82      * 
       
    83      * @param aPurchaseId ID of the purchase. PurchaseIdsL function can be
       
    84      * used to get purchase IDs.
       
    85      * @param aLoadIcon If EFalse, icon is not loaded from the purchase history. 
       
    86      * ETrue by default.
       
    87      * @return Purchase details. Ownership is transferred to the caller.
       
    88      * @exception KErrNotFound if purchase is not found.
       
    89      */
       
    90     virtual CNcdPurchaseDetails* PurchaseDetailsL( TUint aPurchaseId, 
       
    91         TBool aLoadIcon = ETrue ) = 0;
       
    92 
       
    93     /**
       
    94      * Remove purchase from purchase history.
       
    95      *
       
    96      * 
       
    97      * @param aPurchaseId ID of the purchase. PurchaseIdsL function can be
       
    98      * used to get purchase IDs.
       
    99      * @exception KErrNotFound if purchase is not found.
       
   100      */
       
   101     virtual void RemovePurchaseL( TUint aPurchaseId ) = 0;
       
   102 
       
   103     /**
       
   104      * Get count of all purchase events.
       
   105      *
       
   106      * 
       
   107      * @return Total purchase event count.
       
   108      */
       
   109     virtual TUint EventCountL() = 0;
       
   110 
       
   111 
       
   112 protected: // Destruction
       
   113 
       
   114     /**
       
   115     * Destructor.
       
   116     *
       
   117     * @see MCatalogsBase::~MCatalogsBase
       
   118     */
       
   119     virtual ~MNcdPurchaseHistory() {}
       
   120 
       
   121     };
       
   122 
       
   123 #endif // M_NCD_PURCHASE_HISTORY_H