292 } |
292 } |
293 #endif |
293 #endif |
294 |
294 |
295 // ============================ MEMBER FUNCTIONS =============================== |
295 // ============================ MEMBER FUNCTIONS =============================== |
296 |
296 |
|
297 // CUsageUrl: |
|
298 |
|
299 //-------------------------------------------------------------------------- |
|
300 // CUsageUrl::CUsageUrl |
|
301 // Storage class default constructor |
|
302 //-------------------------------------------------------------------------- |
|
303 // |
|
304 CUsageUrl::CUsageUrl() |
|
305 { |
|
306 } |
|
307 |
|
308 //-------------------------------------------------------------------------- |
|
309 // CUsageUrl::~CUsageUrl |
|
310 // Storage class destructor |
|
311 //-------------------------------------------------------------------------- |
|
312 // |
|
313 CUsageUrl::~CUsageUrl() |
|
314 { |
|
315 delete iUrl; |
|
316 } |
|
317 |
|
318 // CDRMRightsServer: |
|
319 |
297 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
298 // CDRMRightsServer::NewLC |
321 // CDRMRightsServer::NewLC |
299 // Two-phased constructor. |
322 // Two-phased constructor. |
300 // ----------------------------------------------------------------------------- |
323 // ----------------------------------------------------------------------------- |
301 // |
324 // |
597 |
622 |
598 GetIMSIL(); |
623 GetIMSIL(); |
599 |
624 |
600 #ifndef RD_MULTIPLE_DRIVE |
625 #ifndef RD_MULTIPLE_DRIVE |
601 |
626 |
602 iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI ); |
627 iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI, const_cast<CDRMRightsServer*>(this) ); |
603 |
628 |
604 #else //RD_MULTIPLE_DRIVE |
629 #else //RD_MULTIPLE_DRIVE |
605 |
630 |
606 tempPath.Format( KRightsDir, (TUint)driveLetter ); |
631 tempPath.Format( KRightsDir, (TUint)driveLetter ); |
607 |
632 |
608 iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI ); |
633 iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI, const_cast<CDRMRightsServer*>(this) ); |
609 |
634 |
610 #endif |
635 #endif |
611 |
636 |
612 key.FillZ(); |
637 key.FillZ(); |
613 |
638 |
1334 if ( !HasActiveCountConstraint( aContentId ) ) |
1359 if ( !HasActiveCountConstraint( aContentId ) ) |
1335 { |
1360 { |
1336 iActiveCountConstraints.AppendL( aContentId.AllocL() ); |
1361 iActiveCountConstraints.AppendL( aContentId.AllocL() ); |
1337 } |
1362 } |
1338 } |
1363 } |
|
1364 |
|
1365 |
|
1366 |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // CDRMRightsServer::IsAccessingUrl |
|
1369 // Add ID to count constraint list |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 // |
|
1372 TInt CDRMRightsServer::IsAccessingUrl( const TDesC8& aContentId ) |
|
1373 { |
|
1374 for( TInt i = 0; i < iActiveUrls.Count(); i++ ) |
|
1375 { |
|
1376 if( !iActiveUrls[i]->iUrl->Compare( aContentId ) ) |
|
1377 { |
|
1378 return i; |
|
1379 } |
|
1380 } |
|
1381 return KErrNotFound; |
|
1382 } |
|
1383 |
|
1384 // ----------------------------------------------------------------------------- |
|
1385 // CDRMRightsServer::RemoveAccessingUrl |
|
1386 // Add ID to count constraint list |
|
1387 // ----------------------------------------------------------------------------- |
|
1388 // |
|
1389 void CDRMRightsServer::RemoveAccessingUrl( const TDesC8& aContentId ) |
|
1390 { |
|
1391 CUsageUrl* usage = NULL; |
|
1392 TInt index = KErrNotFound; |
|
1393 |
|
1394 index = IsAccessingUrl( aContentId ); |
|
1395 |
|
1396 if( index != KErrNotFound ) |
|
1397 { |
|
1398 // If there are negative or 0 values in the list for some reason |
|
1399 // remove them |
|
1400 if( iActiveUrls[index]->iRefCounter <= 1 ) |
|
1401 { |
|
1402 usage = iActiveUrls[index]; |
|
1403 iActiveUrls.Remove( index ); |
|
1404 delete usage; |
|
1405 } |
|
1406 else |
|
1407 { |
|
1408 iActiveUrls[index]->iRefCounter--; |
|
1409 } |
|
1410 } |
|
1411 } |
|
1412 |
|
1413 // ----------------------------------------------------------------------------- |
|
1414 // CDRMRightsServer::AddAccessingUrlL |
|
1415 // Add ID to count constraint list |
|
1416 // ----------------------------------------------------------------------------- |
|
1417 // |
|
1418 void CDRMRightsServer::AddAccessingUrlL( const TDesC8& aContentId ) |
|
1419 { |
|
1420 CUsageUrl* usage = NULL; |
|
1421 TInt index = KErrNotFound; |
|
1422 |
|
1423 index = IsAccessingUrl( aContentId ); |
|
1424 |
|
1425 if( index == KErrNotFound ) |
|
1426 { |
|
1427 usage = new ( ELeave ) CUsageUrl(); |
|
1428 CleanupStack::PushL( usage ); |
|
1429 usage->iUrl = aContentId.AllocL(); |
|
1430 usage->iRefCounter = 1; |
|
1431 iActiveUrls.AppendL( usage ); |
|
1432 CleanupStack::Pop( usage ); |
|
1433 } |
|
1434 else |
|
1435 { |
|
1436 usage = iActiveUrls[index]; |
|
1437 usage->iRefCounter++; |
|
1438 } |
|
1439 } |
|
1440 |
|
1441 |
|
1442 |
1339 |
1443 |
1340 // ----------------------------------------------------------------------------- |
1444 // ----------------------------------------------------------------------------- |
1341 // CDRMRightsServer::StopWatchingL |
1445 // CDRMRightsServer::StopWatchingL |
1342 // Delete the watchers |
1446 // Delete the watchers |
1343 // ----------------------------------------------------------------------------- |
1447 // ----------------------------------------------------------------------------- |