commondrm/drmsettingsplugin/inc/drmsettingsmodel.h
branchRCL_3
changeset 72 1481bf457703
equal deleted inserted replaced
71:1221b68b8a5f 72:1481bf457703
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  DRMSettinsPlugin model.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef  DRMSETTINGSMODEL_H
       
    19 #define  DRMSETTINGSMODEL_H
       
    20 
       
    21 // INCLUDES
       
    22 #include    <centralrepository.h>
       
    23 #include    <e32property.h>
       
    24 #include    "RoapStorageClient.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CDRMRIContext;
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KDRMTransactionTrackingDisabled = 0;
       
    31 const TInt KDRMTransactionTrackingEnabled = 1;
       
    32 
       
    33 const TInt KDRMAutomaticActivationNotAllowed = 0;
       
    34 const TInt KDRMAutomaticActivationAllowed = 1;
       
    35 
       
    36 
       
    37 // CLASS DEFINITIONS
       
    38 
       
    39 /**
       
    40 *  CDRMSettingsModel is the model class of DRMSettingsPlugin.
       
    41 *  It provides functions to get and set setting values.
       
    42 */
       
    43 class   CDRMSettingsModel : public CBase
       
    44     {
       
    45 
       
    46     public:  // Constructor and destructor
       
    47         /**
       
    48         * Two-phased constructor
       
    49         */
       
    50         static CDRMSettingsModel* NewL();
       
    51 
       
    52         /**
       
    53         * Destructor
       
    54         */
       
    55         ~CDRMSettingsModel();
       
    56 
       
    57     public: // New
       
    58 
       
    59         /**
       
    60         * Get transaction tracking state
       
    61         * @return KDRMTransactionTrackingDisabled
       
    62         *         KDRMTransactionTrackingEnabled
       
    63         */
       
    64         TInt TransactionTrackingStateL();
       
    65 
       
    66         /**
       
    67         * Set transaction tracking state
       
    68         * @param aValue updated value
       
    69         */
       
    70         void SetTransactionTrackingStateL( TInt aValue );
       
    71 
       
    72         /**
       
    73         * Get automatic activation state
       
    74         * @return KDRMAutomaticActivationNotAllowed
       
    75         *         KDRMAutomaticActivationAllowed
       
    76         */
       
    77         TInt AutomaticActivationStateL();
       
    78 
       
    79         /**
       
    80         * Set automatic activation state
       
    81         * @param aValue updated value
       
    82         */
       
    83         void SetAutomaticActivationStateL( TInt aValue );
       
    84 
       
    85         /**
       
    86         * Get usage reporting state
       
    87         * @return count of services for which reporting is allowed
       
    88         */
       
    89         TInt UsageReportingCount();
       
    90 
       
    91         /**
       
    92         * Get RI alias
       
    93         *
       
    94         * @param aIndex : Index of the RI context
       
    95         *
       
    96         * @return RI alias name or RI url if no alias available
       
    97         */
       
    98         HBufC* GetSingleRIAliasL( TInt aIndex );
       
    99 
       
   100         /**
       
   101         * Get the first RI alias, where metering is allowed
       
   102         * @return RI alias name or RI url if no alias available
       
   103         */
       
   104         HBufC* GetFirstAllowedMeteringRIAliasL();
       
   105 
       
   106         /**
       
   107         * Get number of RI contexts
       
   108         * @return number of RIContexts
       
   109         */
       
   110         TInt GetRiContextCount();
       
   111 
       
   112         /**
       
   113         * Get metering status of RI Context
       
   114         *
       
   115         * @param aIndex : Index of the RI context
       
   116         *
       
   117         * @return Status of metering
       
   118         */
       
   119         TBool IsMeteringAllowed( TInt aIndex );
       
   120 
       
   121         /**
       
   122         * Find out if metering is allowed for all RI Contexts
       
   123         *
       
   124         * @return Status of metering
       
   125         */
       
   126         TBool IsMeteringAllowedForAll();
       
   127 
       
   128         /**
       
   129         * Sets the value for metering to be enabled or disabled
       
   130         *
       
   131         * @param aIndex : Index of the RI context
       
   132         * @param aIsAllowed : ETrue if set to allowed, EFalse if not allowed
       
   133         */
       
   134         void SetMeteringStatus( TInt aIndex, TBool aIsAllowed );
       
   135 
       
   136         /**
       
   137         * Save the changes done to RI Contexs
       
   138         */
       
   139         void SaveMeteringChanges();
       
   140 
       
   141     private: // Private constructors
       
   142 
       
   143         /**
       
   144         * Default C++ contructor
       
   145         */
       
   146         CDRMSettingsModel();
       
   147 
       
   148         /**
       
   149         * Symbian OS default constructor
       
   150         * @return void
       
   151         */
       
   152         void ConstructL();
       
   153 
       
   154     private: // Data
       
   155 
       
   156         // DRM Settings Central Repository.
       
   157         CRepository* iDRMSettingsRepository;
       
   158 
       
   159         // Roap storage client
       
   160         Roap::RRoapStorageClient* iRoapStorageClient;
       
   161 
       
   162         // List of service providers with which device has been registered
       
   163         RPointerArray<CDRMRIContext> iRIContextList;
       
   164 
       
   165     };
       
   166 
       
   167 #endif // DRMSETTINGSMODEL_H
       
   168 
       
   169 // End of File