contentmgmt/contentaccessfwfordrm/source/f32agent/f32agentcontent.cpp
branchRCL_3
changeset 62 a71299154b21
parent 61 641f389e9157
equal deleted inserted replaced
61:641f389e9157 62:a71299154b21
    40 	self->ConstructL(aFile);
    40 	self->ConstructL(aFile);
    41 	CleanupStack::Pop(self);
    41 	CleanupStack::Pop(self);
    42 	return self;
    42 	return self;
    43 	}
    43 	}
    44 
    44 
    45 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    46 CF32AgentContent* CF32AgentContent::NewL(const TDesC8& aHeaderData)
       
    47 	{
       
    48 	CF32AgentContent* self = new (ELeave) CF32AgentContent;
       
    49 	CleanupStack::PushL(self);
       
    50 	self->ConstructL(aHeaderData);
       
    51 	CleanupStack::Pop(self);
       
    52 	return self;
       
    53 	}
       
    54 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    55 	
    45 	
    56 CF32AgentContent::CF32AgentContent()
    46 CF32AgentContent::CF32AgentContent()
    57 	{
    47 	{
    58 	}
    48 	}
    59 
    49 
    64 		{
    54 		{
    65 		// file session only created when file is opened by name
    55 		// file session only created when file is opened by name
    66 		iFs.Close();
    56 		iFs.Close();
    67 		}
    57 		}
    68 	delete iURI;
    58 	delete iURI;
    69 	
       
    70 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT	
       
    71 	delete iHeaderData;
       
    72 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
    73 	}
    59 	}
    74   
    60   
    75 void CF32AgentContent::ConstructL(const TDesC& aURI, TContentShareMode aShareMode)
    61 void CF32AgentContent::ConstructL(const TDesC& aURI, TContentShareMode aShareMode)
    76 	{
    62 	{
    77 	iURI = aURI.AllocL();
    63 	iURI = aURI.AllocL();
    85 
    71 
    86 void CF32AgentContent::ConstructL(RFile& aFile)
    72 void CF32AgentContent::ConstructL(RFile& aFile)
    87 	{
    73 	{
    88 	User::LeaveIfError(iFile.Duplicate(aFile));
    74 	User::LeaveIfError(iFile.Duplicate(aFile));
    89 	}
    75 	}
    90 
       
    91 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT	
       
    92 void CF32AgentContent::ConstructL(const TDesC8& aHeaderData)
       
    93 	{
       
    94 	if(aHeaderData.Length() > 0)
       
    95 		iHeaderData = aHeaderData.AllocL();
       
    96 	else
       
    97 		User::Leave(KErrMissingWmdrmHeaderData);
       
    98 	}
       
    99 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   100 
    76 
   101 TInt CF32AgentContent::OpenContainer(const TDesC&)
    77 TInt CF32AgentContent::OpenContainer(const TDesC&)
   102 	{
    78 	{
   103 	return KErrNotFound;
    79 	return KErrNotFound;
   104 	}
    80 	}
   180 	{
   156 	{
   181 	TRAPD( err, SearchL(aArray, aMimeType, aRecurse) );
   157 	TRAPD( err, SearchL(aArray, aMimeType, aRecurse) );
   182 	return err;
   158 	return err;
   183 	}
   159 	}
   184 
   160 
   185 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   186 TInt CF32AgentContent::GetAttribute(TInt aAttribute, TInt& aValue, const TDesC& aUniqueId)
   161 TInt CF32AgentContent::GetAttribute(TInt aAttribute, TInt& aValue, const TDesC& aUniqueId)
   187 	{
   162 	{
   188 	
       
   189 	// check that the unique Id exists
   163 	// check that the unique Id exists
   190 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   164 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   191 		{
   165 		{
   192 		return KErrNotFound;	
   166 		return KErrNotFound;	
   193 		}
   167 		}
   195 	TInt err = KErrNone;
   169 	TInt err = KErrNone;
   196 	if(iURI)
   170 	if(iURI)
   197 		{
   171 		{
   198 		err = TF32DefaultAttributes::GetAttribute(aAttribute, aValue, *iURI);
   172 		err = TF32DefaultAttributes::GetAttribute(aAttribute, aValue, *iURI);
   199 		}
   173 		}
   200 	else if(iHeaderData)
       
   201 		{
       
   202 		err = TF32DefaultAttributes::GetAttribute(*iHeaderData, aAttribute, aValue);
       
   203 		}
       
   204 	else
   174 	else
   205 		{
   175 		{
   206 		err = TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   176 		err = TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   207 		}
   177 		}
   208 	return err;
   178 	return err;
   209 	}
   179 	}
   210 
   180 
   211 #else
   181 
   212 TInt CF32AgentContent::GetAttribute(TInt aAttribute, TInt& aValue, const TDesC& aUniqueId)
   182 TInt CF32AgentContent::GetAttributeSet(RAttributeSet& aAttributeSet, const TDesC& aUniqueId)
   213 	{
   183 	{
   214 	// check that the unique Id exists
   184 	// check that the unique Id exists
   215 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   185 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   216 		{
   186 		{
   217 		return KErrNotFound;	
   187 		return KErrNotFound;	
   218 		}
   188 		}
   219 	
   189 		
   220 	TInt err = KErrNone;
   190 	TInt err = KErrNone;
   221 	if(iURI)
   191 	if(iURI)
   222 		{
   192 		{
   223 		err = TF32DefaultAttributes::GetAttribute(aAttribute, aValue, *iURI);
   193 		err = TF32DefaultAttributes::GetAttributeSet(aAttributeSet, *iURI);
   224 		}
   194 		}
   225 	else
   195 	else
   226 		{
   196 		{
   227 		err = TF32DefaultAttributes::GetAttribute(aAttribute, aValue, iFile);
   197 		err = TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
   228 		}
   198 		}
   229 	return err;
   199 	return err;
   230 	}
   200 	}
   231 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   201 
   232 
   202 TInt CF32AgentContent::GetStringAttribute(TInt aAttribute, TDes& aValue, const TDesC& aUniqueId)
   233 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   234 
       
   235 TInt CF32AgentContent::GetAttributeSet(RAttributeSet& aAttributeSet, const TDesC& aUniqueId)
       
   236 	{
   203 	{
   237 	// check that the unique Id exists
   204 	// check that the unique Id exists
   238 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   205 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   239 		{
   206 		{
   240 		return KErrNotFound;	
   207 		return KErrNotFound;	
   241 		}
   208 		}
   242 		
   209 		
   243 	TInt err = KErrNone;
   210 	TInt err = KErrNone;
   244 	if(iURI)
   211 	if(iURI)
   245 		{
   212 		{
   246 		err = TF32DefaultAttributes::GetAttributeSet(aAttributeSet, *iURI);
   213 		err = TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, *iURI);
   247 		}
   214 		}
   248 	else if(iHeaderData)
   215 	else
   249 		{
   216 		{
   250 		err = TF32DefaultAttributes::GetAttributeSet(*iHeaderData, aAttributeSet);
   217 		err = TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
   251 		}
   218 		}
   252 	else
   219 	return err;
   253 		{
   220 	}
   254 		err = TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
   221 
   255 		}
   222 
   256 	return err;
   223 TInt CF32AgentContent::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TDesC& aUniqueId)
   257 	}
       
   258 
       
   259 #else
       
   260 
       
   261 TInt CF32AgentContent::GetAttributeSet(RAttributeSet& aAttributeSet, const TDesC& aUniqueId)
       
   262 	{
   224 	{
   263 	// check that the unique Id exists
   225 	// check that the unique Id exists
   264 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   226 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
   265 		{
   227 		{
   266 		return KErrNotFound;	
   228 		return KErrNotFound;	
   267 		}
   229 		}
   268 		
   230 	
   269 	TInt err = KErrNone;
   231 	TInt err = KErrNone;
   270 	if(iURI)
   232 	if(iURI)
   271 		{
   233 		{
   272 		err = TF32DefaultAttributes::GetAttributeSet(aAttributeSet, *iURI);
       
   273 		}
       
   274 	else
       
   275 		{
       
   276 		err = TF32DefaultAttributes::GetAttributeSet(aAttributeSet, iFile);
       
   277 		}
       
   278 	return err;
       
   279 	}
       
   280 
       
   281 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   282 
       
   283 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   284 
       
   285 TInt CF32AgentContent::GetStringAttribute(TInt aAttribute, TDes& aValue, const TDesC& aUniqueId)
       
   286 	{
       
   287 	// check that the unique Id exists
       
   288 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
       
   289 		{
       
   290 		return KErrNotFound;	
       
   291 		}
       
   292 		
       
   293 	TInt err = KErrNone;
       
   294 	if(iURI)
       
   295 		{
       
   296 		err = TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, *iURI);
       
   297 		}
       
   298 	else if(iHeaderData)
       
   299 		{
       
   300 		err = TF32DefaultAttributes::GetStringAttribute(*iHeaderData, aAttribute, aValue);
       
   301 		}
       
   302 	else
       
   303 		{
       
   304 		err = TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
       
   305 		}
       
   306 	return err;
       
   307 	}
       
   308 
       
   309 #else
       
   310 TInt CF32AgentContent::GetStringAttribute(TInt aAttribute, TDes& aValue, const TDesC& aUniqueId)
       
   311 	{
       
   312 	// check that the unique Id exists
       
   313 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
       
   314 		{
       
   315 		return KErrNotFound;	
       
   316 		}
       
   317 		
       
   318 	TInt err = KErrNone;
       
   319 	if(iURI)
       
   320 		{
       
   321 		err = TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, *iURI);
       
   322 		}
       
   323 	else
       
   324 		{
       
   325 		err = TF32DefaultAttributes::GetStringAttribute(aAttribute, aValue, iFile);
       
   326 		}
       
   327 	return err;
       
   328 	}
       
   329 #endif
       
   330 
       
   331 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   332 
       
   333 TInt CF32AgentContent::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TDesC& aUniqueId)
       
   334 	{
       
   335 	// check that the unique Id exists
       
   336 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
       
   337 		{
       
   338 		return KErrNotFound;	
       
   339 		}
       
   340 	
       
   341 	TInt err = KErrNone;
       
   342 	if(iURI)
       
   343 		{
       
   344 		err = TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, *iURI);
   234 		err = TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, *iURI);
   345 		}
   235 		}
   346 	else if(iHeaderData)
       
   347 		{
       
   348 		err = TF32DefaultAttributes::GetStringAttributeSet(*iHeaderData, aStringAttributeSet);
       
   349 		}
       
   350 	else
   236 	else
   351 		{
   237 		{
   352 		err = TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
   238 		err = TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
   353 		}
   239 		}
   354 	return err;
   240 	return err;
   355 	}
   241 	}
   356 
       
   357 #else
       
   358 
       
   359 TInt CF32AgentContent::GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TDesC& aUniqueId)
       
   360 	{
       
   361 	// check that the unique Id exists
       
   362 	if(TF32DefaultAttributes::CheckUniqueId(aUniqueId) != KErrNone)
       
   363 		{
       
   364 		return KErrNotFound;	
       
   365 		}
       
   366 	
       
   367 	TInt err = KErrNone;
       
   368 	if(iURI)
       
   369 		{
       
   370 		err = TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, *iURI);
       
   371 		}
       
   372 	else
       
   373 		{
       
   374 		err = TF32DefaultAttributes::GetStringAttributeSet(aStringAttributeSet, iFile);
       
   375 		}
       
   376 	return err;
       
   377 	}
       
   378 
       
   379 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
       
   380 
   242 
   381 TInt CF32AgentContent::AgentSpecificCommand(TInt , const TDesC8& , TDes8& )
   243 TInt CF32AgentContent::AgentSpecificCommand(TInt , const TDesC8& , TDes8& )
   382 	{
   244 	{
   383 	return KErrCANotSupported;
   245 	return KErrCANotSupported;
   384 	}
   246 	}