contentmgmt/referencedrmagent/TestAgent/testagentrightsmanager.cpp
changeset 15 da2ae96f639b
child 33 cf642210ecb7
equal deleted inserted replaced
10:afc583cfa176 15:da2ae96f639b
       
     1 /*
       
     2 * Copyright (c) 2003-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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <caf/caf.h>
       
    20 #include "testagentrightsmanager.h"
       
    21 
       
    22 using namespace ContentAccess;
       
    23 
       
    24 _LIT(KRightsDescription,"Rights");
       
    25 _LIT(KRightsUniqueId, "UniqueId");
       
    26 
       
    27 CTestAgentRightsManager* CTestAgentRightsManager::NewL()
       
    28 	{
       
    29 	CTestAgentRightsManager* self=new(ELeave) CTestAgentRightsManager();
       
    30 	return self;
       
    31 	}
       
    32 
       
    33 CTestAgentRightsManager::CTestAgentRightsManager()
       
    34 	{
       
    35 	}
       
    36 
       
    37 CTestAgentRightsManager::~CTestAgentRightsManager()
       
    38 	{
       
    39 	}
       
    40   
       
    41 void  CTestAgentRightsManager::ListAllRightsL (RStreamablePtrArray< CRightsInfo > &aArray) const
       
    42 	{
       
    43 	TRightsStatus rightsStatus= ERightsStatusNone;
       
    44 	CRightsInfo *rightsInfo = CRightsInfo::NewL(KRightsDescription(), KRightsUniqueId(), ERightsTypeConsumable , rightsStatus);
       
    45 	aArray.AppendL(rightsInfo);
       
    46 	}
       
    47 	
       
    48 void  CTestAgentRightsManager::ListRightsL (RStreamablePtrArray< CRightsInfo > &aArray, const TDesC &) const
       
    49 	{
       
    50 	TRightsStatus rightsStatus= ERightsStatusNone;
       
    51 	CRightsInfo *rightsInfo = CRightsInfo::NewL(KRightsDescription(), KRightsUniqueId(), ERightsTypeConsumable , rightsStatus);
       
    52 	aArray.AppendL(rightsInfo);
       
    53 	}
       
    54 	
       
    55 void  CTestAgentRightsManager::ListRightsL (RStreamablePtrArray< CRightsInfo > &aArray, TVirtualPathPtr& /*aVirtualPath*/) const
       
    56 	{
       
    57 	TRightsStatus rightsStatus= ERightsStatusNone;
       
    58 	CRightsInfo *rightsInfo = CRightsInfo::NewL(KRightsDescription(), KRightsUniqueId(), ERightsTypeConsumable , rightsStatus);
       
    59 	aArray.AppendL(rightsInfo);
       
    60 	}
       
    61 	
       
    62 void  CTestAgentRightsManager::ListContentL (RStreamablePtrArray< CVirtualPath > &aArray, CRightsInfo &aRightsInfo) const
       
    63 	{
       
    64 	CVirtualPath *virtualPath= CVirtualPath::NewL(aRightsInfo.Description());
       
    65 	aArray.AppendL(virtualPath);
       
    66 	}
       
    67 	
       
    68 MAgentRightsBase *CTestAgentRightsManager::GetRightsDataL (const CRightsInfo& /*aRightsInfo*/) const
       
    69 	{
       
    70 	return NULL;
       
    71 	}
       
    72 	
       
    73 TInt CTestAgentRightsManager::DeleteRightsObject (const CRightsInfo &aRightsInfo)
       
    74 	{
       
    75 	if(aRightsInfo.RightsType() == ERightsTypeConsumable)
       
    76 		{
       
    77 		return KErrAccessDenied;
       
    78 		}
       
    79 	else
       
    80 		{	
       
    81 		return KErrNone;
       
    82 		}
       
    83 	}
       
    84 	
       
    85 TInt CTestAgentRightsManager::DeleteAllRightsObjects (const TVirtualPathPtr& /*aVirtualPath*/)
       
    86 	{
       
    87 	return KErrNone;
       
    88 	}
       
    89 
       
    90 TInt CTestAgentRightsManager::SetProperty(TAgentProperty , TInt)
       
    91 	{
       
    92 	return KErrNotSupported;
       
    93 	}