Merge heads.
authorPat Downey <patd@symbian.org>
Wed, 23 Jun 2010 17:42:58 +0100
changeset 50 cc6512173aee
parent 39 3b43e6ea6c9d (diff)
parent 8 ce0d1c675e43 (current diff)
child 51 4c9c835a54d0
Merge heads.
--- a/commondrm/drmencryptor/inc/DRMEncryptorDocument.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmencryptor/inc/DRMEncryptorDocument.h	Wed Jun 23 17:42:58 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  
+* Description:
 *
 */
 
@@ -20,8 +20,8 @@
 #define DRMEncryptorDOCUMENT_H
 
 // INCLUDES
-#include <akndoc.h>
-   
+#include <AknDoc.h>
+
 // CONSTANTS
 
 // FORWARD DECLARATIONS
--- a/commondrm/drmencryptor/src/DRMEncryptorContainer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmencryptor/src/DRMEncryptorContainer.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -25,7 +25,7 @@
 #include <barsread.h>
 #include <eikenv.h>
 #include <aknenv.h>
-#include <aknutils.h>
+#include <AknUtils.h>
 #include <aknconsts.h>
 #include <txtfrmat.h>
 #include <AknBidiTextUtils.h>
--- a/commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmencryptor/src/DrmBb5KeyStorage.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -25,7 +25,7 @@
 #include <asymmetric.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DrmKeyStorage.h"
--- a/commondrm/drmencryptor/src/DrmEncryptor.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmencryptor/src/DrmEncryptor.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -30,18 +30,18 @@
 
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
-#include <DrmRights.h>
+#include <DRMRights.h>
 #include <DcfCommon.h>
 #include <DRMMessageParser.h>
 #include <Oma1DcfCreator.h>
-#include <DrmRightsClient.h>
+#include <DRMRightsClient.h>
 #include "DRMClockClient.h"
 
-#include <dcfrep.h>
-#include <dcfentry.h>
+#include <DcfRep.h>
+#include <DcfEntry.h>
 
 #include <DRMEncryptor.rsg>
 
@@ -371,14 +371,14 @@
         }
 
     fs.Close();
-    
+
     TRequestStatus status;
     CDcfRep* rep = CDcfRep::NewL();
     CleanupStack::PushL(rep);
     rep->RefreshDcf(status);
     User::WaitForRequest( status );
     CleanupStack::PopAndDestroy( rep );
-    
+
     delete files;
 
     return (aEncryptedCount*aMultiplier + aRightsCount + aMessagesProcessed);
--- a/commondrm/drmencryptor/src/DrmKeyStorage.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmencryptor/src/DrmKeyStorage.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -25,10 +25,10 @@
 #include <asymmetric.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
-#include <ZipFile.h>
+#include <zipfile.h>
 #include <aknnotewrappers.h>
 
 #include "DrmKeyStorage.h"
--- a/commondrm/drmencryptor/src/Performance.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmencryptor/src/Performance.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,19 +18,20 @@
 
 // INCLUDE FILES
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <f32file.h>
 #include <s32strm.h>
 #include <s32file.h>
-#include <oma1dcfcreator.h>
-#include <drmmessageparser.h>
+#include <Oma1DcfCreator.h>
+#include <DRMMessageParser.h>
 #include <e32math.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
-#include "base64.h"
-#include "performance.h"
+#include "Base64.h"
+#include "Performance.h"
 #include "DRMEncryptor.hrh"
 
 _LIT(KLogDir, "DRM");
--- a/commondrm/drmrightsmanagerui/data/DRMRightsManager_reg.rss	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/data/DRMRightsManager_reg.rss	Wed Jun 23 17:42:58 2010 +0100
@@ -17,7 +17,7 @@
 
 
 #include <appinfo.rh>
-#include <drmrightsmanager.rsg>
+#include <DRMRightsManager.rsg>
 #include <data_caging_paths_strings.hrh>
 
 
@@ -32,13 +32,13 @@
     localisable_resource_file = APP_RESOURCE_DIR"\\DRMRightsManager";
 
     localisable_resource_id = R_DRMUI_LOCALISABLE_APP_INFO;
-    
+
 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL
 
     hidden = KAppIsHidden;
-    
+
 #endif //RD_DRM_RIGHTS_MANAGER_REMOVAL
-    
+
     embeddability = KAppEmbeddableUiNotStandAlone;
     newfile = KAppDoesNotSupportNewFile;
     }
--- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrAppUi.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,14 +21,16 @@
 #define DRMRIGHTSMGRAPPUI_H
 
 // INCLUDES
-#include <aknviewappui.h>
-#include <aknprogressdialog.h>
+#include <aknViewAppUi.h>
+#include <AknProgressDialog.h>
 #include <apparc.h>
-#include <drmrightsclient.h>
+#include <DRMRightsClient.h>
+#include <DrmConstraint.h>
 
-#include "drmviewitems.h"
+#include "DRMClockClient.h"
+#include "DrmViewItems.h"
 
-#include "drmrightsmanager.hrh"
+#include "DRMRightsManager.hrh"
 
 
 // FORWARD DECLARATIONS
@@ -173,9 +175,42 @@
         void CheckIndividualConstraint( const TDesC8& aContentURI,
                                         TBool& aIndividualConstraint,
                                         TBool& aUsageAllowed );
-
+        
+        /**
+        * Checks the composition of best rights to be shown in the details view.
+        * Leaves with KErrNotFound if no rights are found.
+        * @param aContentURI            ContentURI for object to be opened when
+        *                               application is launched
+        * @param aRights                Pointer to instance of CDRMRights for
+        *                               storing the rights                                                            
+        */                               
+        void FindBestCompositionRightsL( const TDesC8& aContentURI,
+                                         CDRMRights*& aRights ); 
 
-
+        /**
+        * Compares the permissions in the the permission list one by one and 
+        * constraint by constraint and stores the best constraint to the given 
+        * composition permission. The function should be called only for a list of 
+        * valid permissions. Puts the composition permission to cleanup stack. 
+        * @param aCompositionPermission Permission which includes a composition of best 
+        *                               constraints (or full rights information) from 
+        *                               the given permission list.                                 
+        * @param aPermissionList        List which includes permissions to be checked
+        *                               constraint by constraint in order to create the
+        *                               best composition permission.                                                                                          
+        */                  
+        void CheckBetterPermissionsAndStoreCompositionLC( 
+                CDRMPermission*& aCompositionPermission,
+                RPointerArray<CDRMPermission>& aList );
+        /**
+        * Compares two permissions, and returns ETrue if aNewOne is more suitable
+        * for the usage. Assumes both are valid, i.e. not expired.
+        * @param aNewOne                New constraint to be compared to the old one                             
+        * @param aOldOne                Old constraint to be compared to the new one 
+        */
+        TBool BetterPermission( const CDRMConstraint& aNewOne,
+                                const CDRMConstraint& aOldOne );
+                                                    
     public: // New functions
         /**
         * @param aContentURI    ContentURI for object to be opened when
@@ -347,7 +382,7 @@
 
     public: // From MCoeForegroundObserver
         /**
-        * Handles the application coming to the foreground 
+        * Handles the application coming to the foreground
         *
         */
         void HandleGainingForeground();
@@ -379,22 +414,25 @@
 
         // The DRM protection of the given file.
         TInt iDrmScheme;
-        
+
         // The local ID of the rights
         TUint32 iLocalID;
-        
+
         // Content URI of the file for which the details view has been opened
-        HBufC8* iContentURI;  
-        
+        HBufC8* iContentURI;
+
         // The details view has been opened once. This information is used to
         // update the details view when returning to details view from another
         // application
         TBool iForegroundHasBeenActive;
-
+        
+        // Drm clock client
+        RDRMClockClient iClockClient;
+        
     };
 
 // Include inline functions
-#include "drmrightsmgrappui.inl"
+#include "DRMRightsMgrAppUi.inl"
 
 
 #endif
--- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsContainer.h	Wed Jun 23 17:42:58 2010 +0100
@@ -33,7 +33,7 @@
 #include <caf/caftypes.h>
 #include <caf/rightsinfo.h>
 
-#include "drmrightsmgrdetailscontainer.h"
+#include "DRMRightsMgrDetailsContainer.h"
 
 // FORWARD DECLARATIONS
 class CDRMRightsConstraints;
--- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsView.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDetailsView.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 
 // INCLUDES
 #include <aknview.h>
-#include "drmrightsmgrdetailscontainer.h"
+#include "DRMRightsMgrDetailsContainer.h"
 
 // FORWARD DECLARATIONS
 class CDRMRightsMgrDetailsContainer;
--- a/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDocument.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/inc/DRMRightsMgrDocument.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,11 +21,11 @@
 #define DRMRIGHTSMGRDOCUMENT_H
 
 // INCLUDES
-#include <akndoc.h>
+#include <AknDoc.h>
 
-#include <genericparamconsumer.h>
+#include <GenericParamConsumer.h>
 
-#include "drmrightsmanager.hrh"
+#include "DRMRightsManager.hrh"
 
 
 // FORWARD DECLARATIONS
--- a/commondrm/drmrightsmanagerui/inc/DrmViewItems.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/inc/DrmViewItems.h	Wed Jun 23 17:42:58 2010 +0100
@@ -28,11 +28,11 @@
 * Class containing data for the items to be showed in the view
 */
 class TItemData
-	{
+    {
     public:  // Constructor
         /**
         * C++ default constructor.
-        */      
+        */
         TItemData();
 
         /**
@@ -49,14 +49,14 @@
         * @param aUnlimitedRights       Rights unlimited or not
         * @param aIndividualConstraint  Individual constraint exists or not
         * @param aUsageAllowed          Content usage allowed or not with current SIM
-        */      
+        */
         TItemData( const TInt aIndexInArray,
-                   const TDesC& aItemName, 
-                   const TDesC& aItemFullName, 
-                   const TInt aIndexIcon, 
+                   const TDesC& aItemName,
+                   const TDesC& aItemFullName,
+                   const TInt aIndexIcon,
                    const TInt aTypeOfObject,
                    const TBool aContentCanBeSent,
-                   const TDesC8& aContentURI, 
+                   const TDesC8& aContentURI,
                    const TTime& aFutureActivationTime,
                    const TBool aUnlimitedRights,
                    const TBool aIndividualConstraint,
@@ -74,19 +74,19 @@
         * @param aFutureActivationTime  Time in the future when the RO will be
         *                               activated.
         * @param aUnlimitedRights       Rights unlimited or not
-        */      
+        */
         TItemData( const TInt aIndexInArray,
-                   const TDesC& aItemName, 
-                   const TDesC& aItemFullName, 
-                   const TInt aIndexIcon, 
+                   const TDesC& aItemName,
+                   const TDesC& aItemFullName,
+                   const TInt aIndexIcon,
                    const TInt aTypeOfObject,
                    const TUint32 aLocalID,
-                   const TDesC8& aContentURI, 
+                   const TDesC8& aContentURI,
                    const TTime& aFutureActivationTime,
                    const TBool aUnlimitedRights,
                    const TBool aIndividualConstraint,
                    const TBool aUsageAllowed );
-                   
+
 
 
     public:     // New functions
@@ -204,7 +204,7 @@
         * @param aUnlimitedRights ETrue if unlimited rights.
         */
         inline void SetUnlimitedRights( const TBool aUnlimitedRights );
-        
+
         /**
         * Sets the individual constraint attribute.
         * @param aIndividualConstraint ETrue if individual constraint
@@ -243,22 +243,22 @@
         TBuf8<KMaxFileName> iContentURI;
 
         // Time in the future when the RO will be activated
-        TTime iFutureActivationTime;    
-        
+        TTime iFutureActivationTime;
+
         // ETrue if unlimited rights
         TBool iUnlimitedRights;
-        
+
         // ETrue if individual constraint exists
         TBool iIndividualConstraint;
-        
+
         // ETrue if content usage is allowed with current SIM
         TBool iUsageAllowed;
-             
-	};
+
+    };
 
 
 // Include inline functions
-#include "DRMViewItems.inl"
+#include "DrmViewItems.inl"
 
 #endif
 
--- a/commondrm/drmrightsmanagerui/src/DRMCommonUtilities.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMCommonUtilities.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -17,20 +17,20 @@
 
 
 // INCLUDE FILES
-#include <stringloader.h>
-#include <aknquerydialog.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
 #include <aknnotewrappers.h>
-#include <oma2agent.h>
+#include <Oma2Agent.h>
 
-#include <drmrightsmanager.rsg>
+#include <DRMRightsManager.rsg>
 #include <data_caging_path_literals.hrh>
 
 #include <utf.h>
 
-#include "drmcommonutilities.h"
-#include "drmrightsmgrapp.h"
-#include "drmuilogger.h"
-#include "drmrightsmgrappui.h"
+#include "DRMCommonUtilities.h"
+#include "DRMRightsMgrApp.h"
+#include "DRMUILogger.h"
+#include "DRMRightsMgrAppUi.h"
 #include "drmutilityinternaltypes.h"
 
 // CONSTANTS
@@ -308,10 +308,18 @@
     TUint32 drmScheme( EDrmSchemeUnknownDrm );
     params = new( ELeave )CArrayFixFlat<TPtrC>( sizeof( TPtrC ) );
     CleanupStack::PushL( params );
+    TChar ch;
 
+    aLex.Mark();
     while ( !aLex.Eos() )                // Extract the parameters
         {
-        params->AppendL( aLex.NextToken() );
+        ch = aLex.Get();
+        if ( ch == '\x00' ) {
+            aLex.UnGet();
+            params->AppendL( aLex.MarkedToken() );
+            aLex.Get();
+            aLex.Mark();
+            }
         }
 
     TInt startParam = KMaxTInt;
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrApp.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrApp.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,8 +19,8 @@
 // INCLUDE FILES
 #include <eikstart.h>
 
-#include "drmrightsmgrapp.h"
-#include "drmrightsmgrdocument.h"
+#include "DRMRightsMgrApp.h"
+#include "DRMRightsMgrDocument.h"
 
 
 // ================= MEMBER FUNCTIONS =======================
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,19 +17,19 @@
 
 
 // INCLUDE FILES
-#include <dcfrep.h>
-#include <dcfentry.h>
-#include <drmcommon.h>
-#include <dcfcommon.h>
+#include <DcfRep.h>
+#include <DcfEntry.h>
+#include <DRMCommon.h>
+#include <DcfCommon.h>
 #include <wmdrmagent.h> // for WMDRM file details view
 
-#include <drmrightsmanager.rsg>
+#include <DRMRightsManager.rsg>
 
-#include <aknwaitdialog.h>
+#include <AknWaitDialog.h>
 #include <aknlistquerydialog.h>
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <aknnavide.h>
-#include <akndef.h>
+#include <AknDef.h>
 #include <barsread.h>  // for resource reader
 #include <centralrepository.h>
 #include <coeutils.h>
@@ -43,22 +43,85 @@
 #include <caf/data.h>
 #include <caf/caftypes.h>
 
-#include "drmrightsmgrappui.h"
-#include "drmrightsmgrdetailsview.h"
-#include "drmrightsmgrdocument.h"
-#include "drmcommonutilities.h"
-#include "drmuilogger.h"
-#include "drmrightsmanagerprivatecrkeys.h"
-#include "drmclockclient.h"
+#include "DRMRightsMgrAppUi.h"
+#include "DRMRightsMgrDetailsView.h"
+#include "DRMRightsMgrDocument.h"
+#include "DRMCommonUtilities.h"
+#include "DRMUILogger.h"
+#include "DRMRightsManagerPrivateCRKeys.h"
+#include "DRMClockClient.h"
 #include "drmutilityinternaltypes.h"
 
-#include "oma1dcf.h"
+#include "Oma1Dcf.h"
 #include "oma2dcf.h"
 // CONSTANTS
 _LIT8( Kflk, "flk:" );
 _LIT8( Kldf, "ldf:" );
 
-// ================= MEMBER FUNCTIONS =======================
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+// DoResetAndDestroy
+// Does RPointerArray< >->ResetAndDestroy() for the given array aPtr.
+// ----------------------------------------------------------------------------
+//
+LOCAL_C void DoResetAndDestroyPermission( TAny* aPtr )
+    {
+    ( reinterpret_cast< RPointerArray< CDRMPermission >* >( aPtr ) )->
+        ResetAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+// PrepareRightsObjectL
+// Creates rights object based on the given permission.
+// ----------------------------------------------------------------------------
+//
+LOCAL_C void PrepareRightsObjectL( CDRMRights*& aRights,
+                                   CDRMPermission* aPermission )
+    {
+    CDRMAsset* asset( NULL );
+    
+    if ( !aPermission )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    aRights = CDRMRights::NewL();
+    CleanupStack::PushL( aRights );
+    aRights->SetPermissionL( *aPermission );
+                         
+    asset = CDRMAsset::NewLC();
+    aRights->SetAssetL( *asset );
+    CleanupStack::PopAndDestroy( asset );
+    CleanupStack::Pop( aRights );
+                         
+    // Content URI and Local Id are not set
+    }
+
+// ----------------------------------------------------------------------------
+// EndTime
+// Calculate the true end time: pick the smaller one of aTime1 & aTime2,
+// but ignore Time::NullTTime anyhow.
+// ----------------------------------------------------------------------------
+//
+LOCAL_C TTime EndTime( const TTime& aTime1, const TTime& aTime2 )
+    {
+    TTime nullTime = Time::NullTTime();
+
+    if ( aTime1 == nullTime )
+        {
+        return aTime2;
+        }
+
+    if ( aTime2 == nullTime )
+        {
+        return aTime1;
+        }
+
+    return Min( aTime1, aTime2 );
+    }
+       
+// ================= MEMBER FUNCTIONS ==========================================
 //
 // -----------------------------------------------------------------------------
 // CDRMRightsMgrAppUi::CDRMRightsMgrAppUi
@@ -83,15 +146,16 @@
 void CDRMRightsMgrAppUi::ConstructL()
     {
     CLOG_WRITE( "-->ConstructL" );
-    
+
     iCoeEnv->AddForegroundObserverL( *this );
-    
+
     CDRMRightsMgrDetailsView* detailsView( NULL );
 
-    BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | 
-    	EAknEnableMSK | EAknSingleClickCompatible  );
+    BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic |
+        EAknEnableMSK | EAknSingleClickCompatible  );
 
     User::LeaveIfError( iRightsClient.Connect() );
+    User::LeaveIfError( iClockClient.Connect() );
     iDRMCommon = DRMCommon::NewL();
     if ( !iDRMCommon )
         {
@@ -121,25 +185,27 @@
 //
 CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi()
     {
-    
+
     iCoeEnv->RemoveForegroundObserver( *this );
-    
+
     delete iWaitDialog;
 
     delete iDRMCommon;
 
     iRightsClient.Close();
+    
+    iClockClient.Close();
 
     if ( iStartEmbedded && iDoorObserver )
         {
         iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::ENoChanges );
         }
-        
+
     if ( iContentURI )
         {
         delete iContentURI;
         }
-        
+
     }
 
 
@@ -200,7 +266,7 @@
                                                const TInt aDrmScheme )
     {
 
-    // Store the content related information when the details view 
+    // Store the content related information when the details view
     // is to be shown for the first time so that the information will be
     // available for details view refreshing in the future.
     if ( !iContentURI )
@@ -209,7 +275,7 @@
         iLocalID = aLocalID;
         iContentURI = aContentURI.AllocL();
         }
-    
+
     // For storing WM DRM rights information
     ContentAccess::RStreamablePtrArray<ContentAccess::CRightsInfo> array;
     CleanupClosePushL( array );
@@ -231,7 +297,7 @@
         {
         case EDrmSchemeOmaDrm:
             CheckOmaDrmRightsL( aContentURI, aLocalID, rights, status );
-            if ( status ) 
+            if ( status < 0 )
                 {
                 rights = NULL;
                 }
@@ -331,6 +397,7 @@
                                        const TBool aIsGroup )
     {
     CDcfCommon* dcf = NULL;
+    HBufC8* buffer( NULL );
     TBool getName = ETrue;
     TParse parse;
 
@@ -356,19 +423,52 @@
 
         if ( err == KErrNotFound || itemNameBuf->Length() == 0 )
             {
-            if ( aIsGroup )
+            // Do not show name if group rights or forward lock
+            if ( !aIsGroup )
                 {
-                aItemName = aFullName;
-                }
-            else
-                {
-                parse.Set( aFullName, NULL, NULL );
-                aItemName = parse.NameAndExt();
+                if ( ( iRightsClient.ForwardLockURI( buffer ) ==
+                        KErrNone ) && buffer )
+                    {
+
+                    // Not forward lock
+                    if ( aID.Compare( *buffer ) != 0 )
+                        {
+                        parse.Set( aFullName, NULL, NULL );
+                        aItemName = parse.NameAndExt();
+                        }
+                    delete buffer;
+                    buffer = NULL;
+
+                    }
+                else
+                    {
+                    parse.Set( aFullName, NULL, NULL );
+                    aItemName = parse.NameAndExt();
+                    }
                 }
             }
         else if ( err == KErrNone )
             {
-            aItemName = *itemNameBuf;
+            // Forward lock or combined delivery
+            // If forward lock, do not show name
+            if ( iRightsClient.ForwardLockURI( buffer ) == KErrNone &&
+                    buffer )
+                {
+                if ( aID.Compare( *buffer ) != 0 )
+                    {
+                    // Combined delivery
+                    aItemName = *itemNameBuf;
+                    }
+                delete buffer;
+                }
+            else
+                {
+                // Do not show name if having group rights
+                if ( !aIsGroup )
+                    {
+                    aItemName = *itemNameBuf;
+                    }
+                }
             }
         else
             {
@@ -523,8 +623,8 @@
     // from the background to the foreground.
     if ( iForegroundHasBeenActive && iContentURI )
         {
-        StartOnlyForDetailsL( iContentURI->Des(), iLocalID, 
-            iStartEmbedded, iDrmScheme );
+        TRAP_IGNORE( StartOnlyForDetailsL( iContentURI->Des(), iLocalID, 
+            iStartEmbedded, iDrmScheme ) );
         }
     }
 
@@ -705,7 +805,10 @@
     {
     TBool listable( EFalse ), sendable( EFalse );
     TBool individualConstraint( EFalse ), usageAllowed( EFalse );
+    TInt err( KErrNone );
+    
 
+    aStatus = KErrNone;
     CDcfRep* dcfRep = CDcfRep::NewL();
     CleanupStack::PushL( dcfRep );
 
@@ -720,11 +823,21 @@
             if ( entry )
                 {
                 fullName = entry->FileName();
-                delete entry;
                 SetSelectedItemFullName( fullName );
 
                 TFileName itemName;
-                GetItemNameL( fullName, itemName, aContentURI, EFalse );
+
+                if ( entry->GroupId().Length() > 0 )
+                    {
+                    GetItemNameL( fullName, itemName, aContentURI, ETrue );
+                    }
+                else
+                    {
+                    GetItemNameL( fullName, itemName, aContentURI, EFalse );
+                    }
+
+                delete entry;
+
                 SetSelectedItemName( itemName );
 
                 if ( GetItemDataL( fullName, aContentURI, listable,
@@ -738,6 +851,7 @@
             {
             SetSelectedItemFullName( KNullDesC );
             TFileName itemName;
+            // Treat in GetItemNameL as if having group rights
             GetItemNameL( KNullDesC, itemName, aContentURI, ETrue );
             SetSelectedItemName( itemName );
 
@@ -753,23 +867,32 @@
         {
         aStatus = iDRMCommon->GetSingleRightsObject( aContentURI,
             aLocalID, aRights );
+        CheckIndividualConstraint( aContentURI, individualConstraint, usageAllowed );
+        SetSelectedIndividualConstraint( individualConstraint );
+        SetSelectedUsageAllowed( usageAllowed );
         }
-        else
+    else
         {
-        aStatus = iDRMCommon->GetActiveRights( aContentURI, 0, aRights );
+        SetSelectedIndividualConstraint( EFalse );
+        SetSelectedUsageAllowed( ETrue );
+        
+        // Get active rights if available
+        err = iDRMCommon->GetActiveRights( aContentURI, 0, aRights );
+        
+        if ( err < 0 )
+            {
+            // Find out the best composition of rights that should be shown in the
+            // details view. Checks also individual constraint.
+            TRAP( aStatus, FindBestCompositionRightsL( aContentURI, aRights ) );
+            }
         }
+    
     if ( aStatus )
         {
         aRights = NULL;
         }
 
-    CheckIndividualConstraint( aContentURI, individualConstraint, usageAllowed );
-    SetSelectedIndividualConstraint( individualConstraint );
-    SetSelectedUsageAllowed( usageAllowed );
-
     CleanupStack::PopAndDestroy( dcfRep );
-
-    // Do not show the note, show license information in the details view.
     }
 
 // ---------------------------------------------------------
@@ -835,23 +958,18 @@
                                                     TBool& aIndividualConstraint,
                                                     TBool& aUsageAllowed )
     {
+    
+    TTime time;
+    RPointerArray<HBufC8> individuals;
+    
     RPointerArray<CDRMRights>* uriList = NULL;
     TInt r = KErrNone;
     TUint32 retval(0);
+    TInt timeZone(0);
     DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure;
     CDRMRightsConstraints* constraint = NULL;
-    RDRMClockClient client;
-    RDRMRightsClient rclient;
-    TTime time;
-    RPointerArray<HBufC8> individuals;
-
-    r = client.Connect();
-    if ( r == KErrNone )
-        {
-        TTime time;
-        TInt timeZone(0);
-        client.GetSecureTime(time, timeZone, secLevel);
-        }
+    
+    iClockClient.GetSecureTime(time, timeZone, secLevel);
 
     r = iDRMCommon->GetDetailedContentRights(aContentURI, uriList);
     if ( r )
@@ -864,19 +982,13 @@
     if ( !uriList || !uriList->Count() )
         {
         // no rights found
-        client.Close();
         delete uriList;
         uriList = NULL;
         }
     else
         {
         // supported IMSI information is provided by rights client
-        r = rclient.Connect();
-        if( r == KErrNone)
-            {
-            TRAP( r, r = rclient.GetSupportedIndividualsL( individuals ) );
-            rclient.Close();
-            }
+        TRAP( r, r = iRightsClient.GetSupportedIndividualsL( individuals ) );
 
         // Check only the first entry in the list. This is to be expanded to check
         // all the entries in the list.
@@ -914,7 +1026,6 @@
             constraint = NULL;
             }
 
-        client.Close();
         uriList->ResetAndDestroy();
 
         delete uriList;
@@ -924,4 +1035,498 @@
         }
     }
 
+// ---------------------------------------------------------
+// CDRMRightsMgrAppUi::FindBestCompositionRightsL
+// ---------------------------------------------------------
+//
+void CDRMRightsMgrAppUi::FindBestCompositionRightsL( const TDesC8& aContentURI,
+                                                     CDRMRights*& aRights )
+    {
+    TInt i, j, k;
+    RPointerArray<CDRMPermission> permissionList;
+    RPointerArray<CDRMPermission> permissionTempList;
+    RPointerArray<HBufC8> parentUidList;
+    RPointerArray<HBufC8> individuals;
+    
+    TInt count( 0 );
+    TInt status( KErrNone );
+    TTime time( Time::NullTTime() );
+    TInt err( KErrNone );
+    TUint32 reason( EConstraintNone );
+    TBool individualConstraintFound( EFalse );
+    
+    // Composition object of best rights to be shown in the 
+    // details view
+    CDRMPermission* perm( NULL ); 
+    
+    TCleanupItem cleanupPerm( DoResetAndDestroyPermission, &permissionList );
+    CleanupStack::PushL( cleanupPerm );
+    
+    TCleanupItem cleanupPerm2( DoResetAndDestroyPermission, 
+            &permissionTempList );
+    CleanupStack::PushL( cleanupPerm2 );
+    
+    CleanupClosePushL( parentUidList );
+    
+    // First get list of child ROs with the given Content URI
+    iRightsClient.GetDBEntriesL( aContentURI, permissionList );            
+    
+    if ( permissionList.Count() > 0 )
+        {        
+        // Check the UIDs of the possible parent rights objects
+        // and store the found ones to another pointer array for evaluation
+        for ( i = 0; i < permissionList.Count(); i++ )
+            {
+            if ( permissionList[i]->iParentUID )
+                {
+                if ( i == 0 )
+                    {
+                    // No need to check if the parent UID is a duplicate
+                    parentUidList.Append( permissionList[i]->iParentUID );
+                    }
+                else 
+                    {
+                    // Check parent UID list whether we have already stored the
+                    // UID or not
+                    for( j = 0; j < parentUidList.Count(); j++ )
+                        {
+                        if ( parentUidList[j]->Des().Compare(
+                                permissionList[i]->iParentUID->Des() ) != 0 )
+                            {
+                            parentUidList.Append( 
+                                    permissionList[i]->iParentUID );
+                            break;
+                            }
+                        }
+                    }
+                }
+            }
+        
+        // Get the list of parent rights objects based on the parent UID 
+        // and store the pointers from temporary array to the main list 
+        for ( j = 0; j < parentUidList.Count(); j++ )
+            {
+            // We do not want to leave if nothing is found from the database
+            TRAP( status, iRightsClient.GetDBEntriesL( parentUidList[j]->Des(),
+                    permissionTempList ) );
+            
+            if ( status )
+                {
+                continue;
+                }
+                    
+            for ( k = 0; k < permissionTempList.Count(); k++ ) 
+                {
+                // Store the pointer to the main list of permissions
+                permissionList.Append( permissionTempList[k] );
+                }    
+                    
+            // Close the temporary pointer array so that the referenced 
+            // objects of it will not be deleted in the next round of the 
+            // loop because the method for getting database entries deletes 
+            // also the objects (by calling reset and destroy to the given 
+            // pointer array) by default.
+            permissionTempList.Close();
+            }
+        
+        parentUidList.Close();
+        time.HomeTime();
+        
+        // supported IMSI information is provided by rights client
+        TRAP( err, err = iRightsClient.GetSupportedIndividualsL( individuals ) );
+        
+        // Filter expired parent and child rights from the list
+        // Index defines the index of the list to be operated (next)
+        for ( count = permissionList.Count() ; count > 0; count-- )
+            {
+            if ( permissionList[count - 1]->Expired( time ) ) 
+                {
+                permissionList.Remove( count - 1 );
+                }
+            else if ( !( permissionList[count - 1]->Valid( 
+                    time, individuals, reason ) ) )
+                {
+                if ( reason & EConstraintIndividual )
+                    {
+                    individualConstraintFound = ETrue;
+                    permissionList.Remove( count - 1 );
+                    }
+                }
+            }        
+        
+        individuals.ResetAndDestroy();
+        individuals.Close();
+        
+        if ( permissionList.Count() == 0 )
+            {
+            if ( individualConstraintFound )
+                {
+                SetSelectedIndividualConstraint( ETrue );
+                SetSelectedUsageAllowed( EFalse );
+                }
+            User::Leave( KErrNotFound );
+            }
+        else if ( permissionList.Count() == 1  )
+            {
+            // Keep this permission because it is the only valid (left)
+            PrepareRightsObjectL( aRights, permissionList[0] );
+            }
+        else if ( permissionList.Count() > 1 )
+            {    
+            // Compare constraints from successive items of the 
+            // permission list and update the composition permission 
+            // accordingly. 
+            CheckBetterPermissionsAndStoreCompositionLC( perm, permissionList );
+                
+            // Prepare the rights object with the composition permission
+            PrepareRightsObjectL( aRights, perm );
+            CleanupStack::PopAndDestroy( perm );   
+            }     
+        }
+        
+        CleanupStack::PopAndDestroy( 3, &permissionList ); // cleanupPerm, 
+                                                           // cleanupPerm2, 
+                                                           // parentUidList
+    }
+
+// -------------------------------------------------------------------
+// CDRMRightsMgrAppUi::CheckBetterPermissionsAndStoreCompositionLC
+// -------------------------------------------------------------------
+//
+void CDRMRightsMgrAppUi::CheckBetterPermissionsAndStoreCompositionLC( 
+            CDRMPermission*& aCompositionPermission,
+            RPointerArray<CDRMPermission>& aList )
+    {       
+    
+    TBool firstBetter( EFalse );
+    TUint i, j;
+    
+    if ( aList.Count() <= 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    // create permission if needed and set the first item
+    // in the permission list as the reference permission.
+    if ( !aCompositionPermission )
+        {
+        aCompositionPermission = CDRMPermission::NewL();
+        }
+         
+    CleanupStack::PushL( aCompositionPermission );
+    aCompositionPermission->DuplicateL( *aList[0] );
+    
+    // The double loop goes through the permissions and associated 
+    // constraints beginning from the second entry in the permission list. 
+    for ( i = 1; i < aList.Count(); i++ )
+        {
+        // Enumeration for TIntent from Content Access Framework used
+        for ( j = EPlay; j < EPause; j++ )
+            { 
+            switch ( j )
+                {
+                case EPlay:
+                    {
+                    // The constraint from the permission in the list
+                    // is set to composition permission if it is better
+                    // than the "old" best or reference permission.
+                    firstBetter = BetterPermission( *aList[i]->iPlay,
+                            *aCompositionPermission->iPlay );
+                    if ( firstBetter )
+                        {
+                        aCompositionPermission->iPlay->DuplicateL( 
+                                *aList[i]->iPlay );
+                        }
+                    break;
+                    }
+                case EView:
+                    {
+                    firstBetter = BetterPermission( *aList[i]->iDisplay, 
+                            *aCompositionPermission->iDisplay );
+                    if ( firstBetter )
+                        {
+                        aCompositionPermission->iDisplay->DuplicateL( 
+                                *aList[i]->iDisplay );
+                        }
+                    break;
+                    }
+                case EExecute:
+                    {
+                    firstBetter = BetterPermission( *aList[i]->iExecute,
+                            *aCompositionPermission->iExecute );
+                    if ( firstBetter )
+                        {
+                        aCompositionPermission->iExecute->DuplicateL(
+                                *aList[i]->iExecute );
+                        }
+                    break;
+                    }
+                case EPrint:
+                    {
+                    firstBetter = BetterPermission( *aList[i]->iPrint,
+                            *aCompositionPermission->iPrint );
+                    if ( firstBetter )
+                        {
+                        aCompositionPermission->iPrint->DuplicateL( 
+                                *aList[i]->iPrint );
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                }
+            }
+        }        
+    }                     
+
+// -----------------------------------------------------------------------------
+// CDrmRightsMgrAppUi::BetterPermission
+// -----------------------------------------------------------------------------
+TBool CDRMRightsMgrAppUi::BetterPermission( const CDRMConstraint& aNewOne,
+                                            const CDRMConstraint& aOldOne )
+        {
+        // Check Order:
+        // 1. Full
+        // 2. Start End, closest end time first
+        // 3. Interval, shortest first
+        // 4. Accumulated, shortest first
+        // 5. Timed Counter, least counters first, longest time first
+        // 6. Counter, least counters first or the first one found
+
+        const TTime nullTime = Time::NullTTime();
+        TTime oldTime = nullTime;
+        TTime newTime = nullTime;
+        TTime oldTimePos = nullTime;
+        TTime newTimePos = nullTime;
+        TTime trustedTime = nullTime;
+        
+        // 1. Full
+        // If the old or new one is the ultimate one, don't bother to
+        // check anything else.
+        if ( aOldOne.iActiveConstraints == EConstraintNone )
+            {
+            return EFalse;
+            }
+
+        if ( aNewOne.iActiveConstraints == EConstraintNone )
+            {
+            return ETrue;
+            }
+
+        // 2. Start & End Time
+        // Choose the one with the closest end time first
+        // All RO's to this check are already checked to be valid
+        // ActiveIntervals Also hit this spot
+        
+        trustedTime.HomeTime();
+            
+        // First get the start and end times from the intervals if they are active or inactive:
+        if ( aOldOne.iActiveConstraints & EConstraintInterval )
+            {
+            if( aOldOne.iIntervalStart == nullTime )
+                {
+                oldTimePos = trustedTime;
+                oldTimePos += TTimeIntervalSeconds( aOldOne.iInterval );
+                }
+            else
+                {
+                oldTime = aOldOne.iIntervalStart;
+                oldTime += TTimeIntervalSeconds( aOldOne.iInterval );
+                }
+            }
+
+        if( aNewOne.iActiveConstraints & EConstraintInterval )
+            {
+            if( aNewOne.iIntervalStart == nullTime )
+                {
+                newTimePos = trustedTime;
+                newTimePos += TTimeIntervalSeconds( aNewOne.iInterval );
+                }
+            else
+                {
+                newTime = aNewOne.iIntervalStart;
+                newTime += TTimeIntervalSeconds( aNewOne.iInterval );
+                }
+            }
+
+        if ( aOldOne.iActiveConstraints & EConstraintEndTime || oldTime != nullTime )
+            {
+            oldTime = EndTime( oldTime, aOldOne.iEndTime );
+
+            if ( aNewOne.iActiveConstraints & EConstraintEndTime || newTime != nullTime )
+                {
+                newTime = EndTime( newTime, aNewOne.iEndTime );
+
+                if( newTime != oldTime )
+                    {
+                    return ( newTime < oldTime );
+                    }
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        else if ( aNewOne.iActiveConstraints & EConstraintEndTime || newTime != nullTime )
+            {
+            return ETrue;
+            }
+
+        // 3. Inactive Intervals:
+        // Choose the one with the interval ending first:
+        // Continue here if the no SE's exist or SE's are the same
+        if( aOldOne.iActiveConstraints & EConstraintInterval )
+            {
+            if( aNewOne.iActiveConstraints & EConstraintInterval )
+                {
+                oldTimePos = EndTime( oldTime, oldTimePos );
+                newTimePos = EndTime( newTime, newTimePos );
+
+                if( oldTimePos != newTimePos )
+                    {
+                    return ( newTimePos < oldTimePos );
+                    }
+                }
+            else
+                {
+                if( aNewOne.iActiveConstraints & EConstraintAccumulated ||
+                    aNewOne.iActiveConstraints & EConstraintTimedCounter ||
+                    aNewOne.iActiveConstraints & EConstraintCounter )
+                    {
+                    return EFalse;
+                    }
+                else
+                    {
+                    return ETrue;
+                    }
+                }
+            }
+        else if( aNewOne.iActiveConstraints & EConstraintInterval )
+            {
+            if( aOldOne.iActiveConstraints & EConstraintAccumulated ||
+                aOldOne.iActiveConstraints & EConstraintTimedCounter ||
+                aOldOne.iActiveConstraints & EConstraintCounter )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+
+        // 4. Accumulated:
+        // Choose the shortest accumulated first
+        // Continue here if SE's or intervals do not exist or they are the same
+        if( aOldOne.iActiveConstraints & EConstraintAccumulated )
+            {
+            if( aNewOne.iActiveConstraints & EConstraintAccumulated )
+                {
+                if( aNewOne.iAccumulatedTime != aOldOne.iAccumulatedTime )
+                    {
+                    return ( aNewOne.iAccumulatedTime < aOldOne.iAccumulatedTime );
+                    }
+                }
+            else
+                {
+                if( aNewOne.iActiveConstraints & EConstraintTimedCounter ||
+                    aNewOne.iActiveConstraints & EConstraintCounter )
+                    {
+                    return EFalse;
+                    }
+                else
+                    {
+                    return ETrue;
+                    }
+                }
+            }
+        else if( aNewOne.iActiveConstraints & EConstraintAccumulated )
+            {
+            if( aOldOne.iActiveConstraints & EConstraintTimedCounter ||
+                aOldOne.iActiveConstraints & EConstraintCounter )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+
+
+        // 5. Timed Counter
+        // Choose the one with least counters first. If there is an equal number of counters
+        // left, use the one with the longest time
+        // Continue here if SE's or intervals or accumulateds do not exist or they are the same
+        if( aOldOne.iActiveConstraints & EConstraintTimedCounter )
+            {
+            if( aNewOne.iActiveConstraints & EConstraintTimedCounter )
+                {
+                if( aNewOne.iTimedCounter == aOldOne.iTimedCounter )
+                    {
+                    if( aNewOne.iTimedInterval != aOldOne.iTimedInterval )
+                        {
+                        return ( aNewOne.iTimedInterval < aOldOne.iTimedInterval );
+                        }
+                    else
+                        {
+                        if( aNewOne.iActiveConstraints & EConstraintCounter )
+                            {
+
+                            }
+                        }
+                    }
+                else
+                    {
+                    return ( aNewOne.iTimedCounter < aOldOne.iTimedCounter );
+                    }
+
+                }
+            else
+                {
+                if( aNewOne.iActiveConstraints & EConstraintCounter )
+                    {
+                    return EFalse;
+                    }
+                else
+                    {
+                    return ETrue;
+                    }
+                }
+            }
+        else if( aNewOne.iActiveConstraints & EConstraintTimedCounter )
+            {
+            if( aOldOne.iActiveConstraints & EConstraintCounter )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+
+        // 6. Counter
+        // Choose the one with least counters:
+        // if they are the same choose the first one.
+        // Continue here if SE's or intervals or accumulateds or timed counters
+        // do not exist or they are the same
+        if( aOldOne.iActiveConstraints & EConstraintCounter )
+            {
+            if( aNewOne.iActiveConstraints & EConstraintCounter )
+                {
+                return ( aNewOne.iCounter < aOldOne.iCounter );
+                }
+            else
+                {
+                return ETrue;
+                }
+            }
+
+        // If all else fails use the old one:
+        return EFalse;
+        }
+
 // End of File
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,15 +17,15 @@
 
 
 // INCLUDE FILES
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <aknlists.h>
-#include <cdirectorylocalizer.h>
-#include <drmrights.h>
+#include <CDirectoryLocalizer.h>
+#include <DRMRights.h>
 
-#include <drmrightsmanager.rsg>
+#include <DRMRightsManager.rsg>
 
-#include "drmrightsmgrdetailscontainer.h"
-#include "drmcommonutilities.h"
+#include "DRMRightsMgrDetailsContainer.h"
+#include "DRMCommonUtilities.h"
 #include "drmutilityinternaltypes.h"
 
 // CONSTANTS
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,16 +21,16 @@
 #include <avkon.rsg>
 #include <akntitle.h>
 #include <aknview.h>
-#include <aknviewappui.h>
-#include <stringloader.h>
+#include <aknViewAppUi.h>
+#include <StringLoader.h>
 #include <eikbtgpc.h>
 
-#include <drmrightsmanager.rsg>
+#include <DRMRightsManager.rsg>
 
-#include "drmrightsmgrdetailsview.h"
-#include "drmcommonutilities.h"
-#include "drmrightsmgrappui.h"
-#include "drmrightsmanager.hrh"
+#include "DRMRightsMgrDetailsView.h"
+#include "DRMCommonUtilities.h"
+#include "DRMRightsMgrAppUi.h"
+#include "DRMRightsManager.hrh"
 #include "drmutilitywmdrmutilities.h"
 #include "drmutilityinternaltypes.h"
 
@@ -336,12 +336,8 @@
                 break;
             }
 
-#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
-
         DrmUtilityWmDrmUtilities::ParseWmDrmStringL( *aRights[0],
             rights.iPlayConstraint );
-#endif
-
         }
     else
         {
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDocument.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDocument.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,14 +17,14 @@
 
 
 // INCLUDE FILES
-#include <aiwgenericparam.h>
-#include <genericparamconsumer.h>
+#include <AiwGenericParam.h>
+#include <GenericParamConsumer.h>
 
-#include "drmrightsmgrdocument.h"
-#include "drmrightsmgrappui.h"
-#include "drmcommonutilities.h"
+#include "DRMRightsMgrDocument.h"
+#include "DRMRightsMgrAppUi.h"
+#include "DRMCommonUtilities.h"
 
-#include "drmuilogger.h"
+#include "DRMUILogger.h"
 
 
 // ================= MEMBER FUNCTIONS =======================
--- a/commondrm/drmrightsmanagerui/src/DRMViewItems.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmrightsmanagerui/src/DRMViewItems.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 #include <e32std.h>
 
-#include "DRMViewItems.h"
+#include "DrmViewItems.h"
 
 
 // ================= MEMBER FUNCTIONS =======================
@@ -30,9 +30,9 @@
 //
 TItemData::TItemData()
 : iIndexInArray( -1 ),
-  iItemName( NULL ), 
-  iItemFullName( NULL ), 
-  iIndexIcon( -1 ), 
+  iItemName( NULL ),
+  iItemFullName( NULL ),
+  iIndexIcon( -1 ),
   iTypeOfObject( -1 ),
   iContentCanBeSent( EFalse ),
   iLocalID( 0 ),
@@ -50,20 +50,20 @@
 // -----------------------------------------------------------------------------
 //
 TItemData::TItemData( const TInt aIndexInArray,
-                      const TDesC& aItemName, 
-                      const TDesC& aItemFullName, 
-                      const TInt aIndexIcon, 
+                      const TDesC& aItemName,
+                      const TDesC& aItemFullName,
+                      const TInt aIndexIcon,
                       const TInt aTypeOfObject,
-                      const TBool aContentCanBeSent, 
-                      const TDesC8& aContentURI, 
-                      const TTime& aFutureActivationTime, 
+                      const TBool aContentCanBeSent,
+                      const TDesC8& aContentURI,
+                      const TTime& aFutureActivationTime,
                       const TBool aUnlimitedRights,
                       const TBool aIndividualConstraint,
                       const TBool aUsageAllowed )
 : iIndexInArray( aIndexInArray ),
-  iItemName( aItemName ), 
-  iItemFullName( aItemFullName ), 
-  iIndexIcon( aIndexIcon ), 
+  iItemName( aItemName ),
+  iItemFullName( aItemFullName ),
+  iIndexIcon( aIndexIcon ),
   iTypeOfObject( aTypeOfObject ),
   iContentCanBeSent( aContentCanBeSent ),
   iLocalID( 0 ),
@@ -81,20 +81,20 @@
 // -----------------------------------------------------------------------------
 //
 TItemData::TItemData( const TInt aIndexInArray,
-                      const TDesC& aItemName, 
-                      const TDesC& aItemFullName, 
-                      const TInt aIndexIcon, 
+                      const TDesC& aItemName,
+                      const TDesC& aItemFullName,
+                      const TInt aIndexIcon,
                       const TInt aTypeOfObject,
                       const TUint32 aLocalID,
-                      const TDesC8& aContentURI, 
-                      const TTime& aFutureActivationTime, 
+                      const TDesC8& aContentURI,
+                      const TTime& aFutureActivationTime,
                       const TBool aUnlimitedRights,
                       const TBool aIndividualConstraint,
                       const TBool aUsageAllowed )
 : iIndexInArray( aIndexInArray ),
-  iItemName( aItemName ), 
-  iItemFullName( aItemFullName ), 
-  iIndexIcon( aIndexIcon ), 
+  iItemName( aItemName ),
+  iItemFullName( aItemFullName ),
+  iIndexIcon( aIndexIcon ),
   iTypeOfObject( aTypeOfObject ),
   iContentCanBeSent( EFalse ),
   iLocalID( aLocalID ),
@@ -107,4 +107,4 @@
     }
 
 
-// End of File  
+// End of File
--- a/commondrm/drmsettingsplugin/data/102750CC.rss	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM plugin resource file for DRMSettingsPlugin.
-*
-*/
-
-#include <ecom/registryinfo.rh>
-
-
-RESOURCE REGISTRY_INFO theInfo
-	{
-	dll_uid     = 0x102750CC;
-	interfaces  = 
-		{
-		INTERFACE_INFO
-			{
-			interface_uid   = 0x10207236; // UID for CGSPluginInterface
-			implementations = 
-				{ 
-				IMPLEMENTATION_INFO
-					{
-					implementation_uid  = 0x102750CD;
-					version_no          = 1;
-					display_name        = "DRM Settings Plugin";
-					default_data        = "0x1020743A";
-					opaque_data         = "2";//Order number
-					}
-				};
-			}
-		};
-	}
-
-
-// End of File
-
--- a/commondrm/drmsettingsplugin/data/drmsettingspluginrsc.rss	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,512 +0,0 @@
-/*
-* Copyright (c) 2006 - 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Resource file for DRMSettinsPlugin
-*
-*/
-
-
-
-//  RESOURCE IDENTIFIER
-NAME    DRMS // 4 letter ID
-
-//  INCLUDES
-#include    <eikon.rh>
-#include    <uikon.rh>
-#include    <avkon.rsg>
-#include    <avkon.rh>
-#include    <avkon.mbg>
-#include    <eikcore.rsg>
-#include    <eikon.rsg>
-#include    <appinfo.rh>
-#include    <avkon.loc>
-#include    <AvkonIcons.hrh>
-#include    <data_caging_paths_strings.hrh>
-#include    <gs.loc>
-#include    <drmsettingsplugin.loc>
-
-#include    "drmsettingsplugin.hrh"
-#include    "drmsettingsplugin.rh"
-
-
-// CONSTANTS
-
-//  RESOURCE DEFINITIONS
-
-RESOURCE RSS_SIGNATURE
-    {
-    }
-
-
-RESOURCE TBUF
-    {
-    buf="DRMS";
-    }
-
-//----------------------------------------------------
-//
-//    EIK_APP_INFO
-//    It contains application information.
-//
-//----------------------------------------------------
-//
-RESOURCE EIK_APP_INFO
-    {
-    }
-
-
-
-//----------------------------------------------------
-//  r_drm_settings_view_caption
-//
-// Caption for DRM Settings plugin
-//----------------------------------------------------
-//
-RESOURCE TBUF r_drm_settings_view_caption
-    {
-    buf = qtn_set_protected_content;
-    }
-
-
-//----------------------------------------------------
-//
-//    r_drm_settings_view_title
-//    Title of DRM Settings view
-//
-//----------------------------------------------------
-//
-RESOURCE TITLE_PANE r_drm_settings_view_title
-    {
-    txt = qtn_set_protected_content;
-    }
-
-
-//----------------------------------------------------
-//
-//    r_drm_softkeys_options_back_change
-//    Text association with MSK ( CHANGE )
-//
-//----------------------------------------------------
-//
-RESOURCE CBA r_drm_softkeys_options_back_change
-    {
-    buttons =
-        {
-        CBA_BUTTON
-            {
-            id=EAknSoftkeyOptions;
-            txt = text_softkey_option;
-            },
-        CBA_BUTTON
-            {
-            id=EAknSoftkeyBack;
-            txt = text_softkey_back;
-            },
-        CBA_BUTTON
-            {
-            id=EDRMSettingsCmdAppChangeMSK;
-            txt = qtn_msk_change;
-            }
-        };
-    }
-
-
-
-
-//----------------------------------------------------
-//
-//    r_drm_settings_view
-//    DRM Settings view.
-//
-//----------------------------------------------------
-//
-RESOURCE AVKON_VIEW r_drm_settings_view
-    {
-    menubar = r_drm_settings_menubar_change_exit;
-    cba = r_drm_softkeys_options_back_change;
-    }
-
-
-// -----------------------------------------------------------------------------
-//
-// r_drm_settings_menubar_change_exit
-// Menu with 'change' and 'exit' items.
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_drm_settings_menubar_change_exit
-    {
-    titles =
-        {
-        MENU_TITLE
-            {
-            menu_pane = r_drm_settings_menu_item_exit;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_drm_settings_menu_item_change;
-            }
-        };
-    }
-
-
-    // -----------------------------------------------------------------------------
-    //
-    // r_drm_settings_menu_item_exit
-    // Options menu items 'Help' and 'Exit'. Used instead of plain 'Exit' when help
-    // is wanted to be shown in UI.
-    //
-    // -----------------------------------------------------------------------------
-    //
-    RESOURCE MENU_PANE r_drm_settings_menu_item_exit
-        {
-        items =
-            {
-            MENU_ITEM
-                {
-                command = EAknCmdHelp;
-                txt = qtn_options_help;
-                },
-            MENU_ITEM
-                {
-                command = EAknCmdExit;
-                txt = qtn_options_exit;
-                }
-            };
-        }
-
-
-// -----------------------------------------------------------------------------
-//
-// r_drm_settings_menu_item_change
-// Change item.
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_drm_settings_menu_item_change
-    {
-    items =
-        {
-        MENU_ITEM
-            {
-            command = EDRMSettingsCmdAppChange;
-            txt = qtn_set_options_change;
-            flags = EEikMenuItemAction;
-            }
-        };
-    }
-
-
-//----------------------------------------------------
-//
-//    r_drm_settings_lbx
-//    DRM Settings view's listbox.
-//
-//----------------------------------------------------
-//
-RESOURCE DRM_SETTINGS_FEATURE_ARRAY r_drm_settings_lbx
-    {
-    items =
-        {
-#ifdef __DRM_OMA2        
-#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
-        DRM_SETTINGS_FEATURE
-            {
-            txt = " \t"qtn_set_automatic_activation"\t\t";
-            item = EDRMSettingsIdAutomaticActivation;
-            },
-#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
-        
-#ifdef RD_DRM_METERING
-        DRM_SETTINGS_FEATURE
-            {
-            txt = " \t"qtn_drm_set_usage_reporting"\t\t";
-            item = EDRMSettingsIdUsageReporting;
-            },
-#endif // RD_DRM_METERING
-   
-        DRM_SETTINGS_FEATURE
-            {
-            txt = " \t"qtn_set_transaction_tracking"\t\t";
-            item = EDRMSettingsIdTransactionTracking;
-            },
-#endif // __DRM_OMA2
-
-        DRM_SETTINGS_FEATURE
-            {
-            txt = " \t"qtn_drm_set_license_deletion"\t\t";
-            item = EDRMSettingsIdWMDRMLicenseDeletion;
-            }
-        };    
-    }
-
-
-//----------------------------------------------------
-//
-//    r_drm_settings_setting_listbox
-//    Common listbox editor resource for setting pages.
-//
-//----------------------------------------------------
-//
-RESOURCE LISTBOX r_drm_settings_setting_listbox
-    {
-    flags = EEikListBoxMultipleSelection;
-    }
-
-
-//----------------------------------------------------
-//
-//    r_ttracking_setting_page
-//    Transaction tracking setting page.
-//
-//----------------------------------------------------
-//
-RESOURCE AVKON_SETTING_PAGE r_ttracking_setting_page
-    {
-    number = EAknSettingPageNoOrdinalDisplayed;
-    label = qtn_drm_set_popup_trans_track;
-    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
-    type = EAknSetListBox;
-    editor_resource_id = r_drm_settings_setting_listbox;
-    }
-
-
-//----------------------------------------------------
-//
-//    r_ttracking_setting_page_lbx
-//    Transaction tracking setting page's listbox.
-//
-//----------------------------------------------------
-//
-RESOURCE ARRAY r_ttracking_setting_page_lbx
-    {
-    items =
-        {
-        LBUF
-            {
-            txt = qtn_set_transact_tracking_on;
-            },
-        LBUF
-            {
-            txt = qtn_set_transact_tracking_off;
-            }
-        };
-    }
-
-
-//----------------------------------------------------
-//  r_drm_settings_ttracking_on
-//
-// DRM Settings text for Transaction tracking "On"
-//----------------------------------------------------
-//
-RESOURCE TBUF r_drm_settings_ttracking_on
-    {
-    buf = qtn_set_transact_tracking_on;
-    }
-
-
-//----------------------------------------------------
-//  r_drm_settings_ttracking_off
-//
-// DRM Settings text for Transaction tracking "Off"
-//----------------------------------------------------
-//
-RESOURCE TBUF r_drm_settings_ttracking_off
-    {
-    buf = qtn_set_transact_tracking_off;
-    }
-
-
-//----------------------------------------------------
-//
-//    r_autom_activ_setting_page
-//    Automatic activation setting page.
-//
-//----------------------------------------------------
-//
-RESOURCE AVKON_SETTING_PAGE r_autom_activ_setting_page
-    {
-    number = EAknSettingPageNoOrdinalDisplayed;
-    label = qtn_drm_set_popup_autom_activat;
-    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
-    type = EAknSetListBox;
-    editor_resource_id = r_drm_settings_setting_listbox;
-    }
-
-
-//----------------------------------------------------
-//
-//    r_autom_activ_setting_page_lbx
-//    Automatic activation setting page's listbox.
-//
-//----------------------------------------------------
-//
-RESOURCE ARRAY r_autom_activ_setting_page_lbx
-    {
-    items =
-        {
-        LBUF
-            {
-            txt = qtn_set_automat_act_allowed;
-            },
-        LBUF
-            {
-            txt = qtn_set_automat_act_not_allowed;
-            }
-        };
-    }
-
-
-//----------------------------------------------------
-//  r_drm_settings_autom_activ_on
-//
-// DRM Settings text for Automatic activation "Allowed"
-//----------------------------------------------------
-//
-RESOURCE TBUF r_drm_settings_autom_activ_on
-    {
-    buf = qtn_set_automat_act_allowed;
-    }
-
-
-//----------------------------------------------------
-//  r_drm_settings_autom_activ_off
-//
-// DRM Settings text for Automatic activation "Not allowed"
-//----------------------------------------------------
-//
-RESOURCE TBUF r_drm_settings_autom_activ_off
-    {
-    buf = qtn_set_automat_act_not_allowed;
-    }
-
-// ---------------------------------------------------------
-//
-//      r_drm_settings_metering_checkbox_page
-//      Used in checkbox list.
-//
-// ---------------------------------------------------------
-//
-RESOURCE AVKON_SETTING_PAGE r_drm_settings_metering_checkbox_page
-    {
-    number = EAknSettingPageNoOrdinalDisplayed;
-    label = qtn_drm_set_popup_usage_report;
-    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__MARK;
-    type =  EAknSetListBox;
-    editor_resource_id = r_drm_settings_metering_checkbox_list;
-    invalid_contents_softkey_resource = R_AVKON_SOFTKEYS_CANCEL;
-    }
-
-// ---------------------------------------------------------
-//
-//      r_drm_settings_metering_checkbox_list
-//      Used in checkbox list.
-//
-// ---------------------------------------------------------
-//
-RESOURCE AVKON_MULTISELECTION_LIST r_drm_settings_metering_checkbox_list
-    {
-    }
-
-//------------------------------------------------------------------------------
-//
-//    r_usage_reporting_list_title
-//    Title text for usage reporting listbox
-//
-//------------------------------------------------------------------------------
-//
-RESOURCE TBUF r_usage_reporting_list_title
-    {
-    buf=qtn_drm_set_popup_usage_report;
-    }
-
-
-//------------------------------------------------------------------------------
-//
-//    r_usage_reporting_list_empty
-//    Empty text for usage reporting listbox
-//
-//------------------------------------------------------------------------------
-//
-RESOURCE TBUF r_usage_reporting_list_empty
-    {
-    buf=qtn_drm_set_pane_no_providers;
-    }
-
-
-//------------------------------------------------------------------------------
-//
-//    r_drm_set_several_services
-//    'Several' value for 'Allow usage reporting for' field
-//
-//------------------------------------------------------------------------------
-//
-RESOURCE TBUF r_drm_set_several_services
-    {
-    buf=qtn_drm_set_several_services;
-    }
-
-
-//------------------------------------------------------------------------------
-//
-//    r_drm_set_usage_report_none
-//    'None' value for 'Allow usage reporting for' field
-//
-//------------------------------------------------------------------------------
-//
-RESOURCE TBUF r_drm_set_usage_report_none
-    {
-    buf=qtn_drm_set_usage_report_none;
-    }
-
-
-//------------------------------------------------------------------------------
-//
-//    r_drm_confirmation_query_metering
-//    Confirmation query dialog.
-//
-//------------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_drm_confirmation_query_metering
-    {
-    flags=EGeneralQueryFlags;
-    buttons=R_AVKON_SOFTKEYS_YES_NO__YES;
-    items=
-        {
-        DLG_LINE
-            {
-            type=EAknCtQuery;
-            id=EGeneralQuery;
-            control= AVKON_CONFIRMATION_QUERY
-                {
-                layout = EConfirmationQueryLayout;
-                label = " ";
-                };
-            }
-        };
-    }
-
-//------------------------------------------------------------------------------
-//
-//    r_drm_conf_query_metering
-//    Confirmation query text.
-//
-//------------------------------------------------------------------------------
-//
-RESOURCE TBUF r_drm_conf_query_metering
-    {
-    buf=qtn_drm_conf_query_metering;
-    }
-
-//End of File
--- a/commondrm/drmsettingsplugin/group/drmsettingsplugin.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Project specification file.
-*
-*/
-
-
-#include <data_caging_paths.hrh>    // For RESOURCE_FILES_DIR
-#include <platform_paths.hrh>
-
-CAPABILITY          CAP_ECOM_PLUGIN
-TARGET              drmsettingsplugin.dll
-TARGETTYPE          PLUGIN
-UID                 0x10009D8D 0x102750CC
-VENDORID            VID_DEFAULT
-
-
-SOURCEPATH      ../src
-SOURCE          drmsettingspluginimplementationtable.cpp
-SOURCE          drmsettingsplugin.cpp
-SOURCE          drmsettingsplugincontainer.cpp
-SOURCE          drmsettingsmodel.cpp
-SOURCE          drmsettingsusagecheckbox.cpp
-SOURCE          drmsettingsusagelist.cpp
-
-//User include paths
-USERINCLUDE     ../inc
-USERINCLUDE     ../data // For *.rh
-USERINCLUDE     ../../../inc   // ADo level inc dir
-USERINCLUDE     ../../../omadrm/drmengine/roapstorage/inc
-
-//System include paths
-// Default system include paths for middleware layer modules.
-// App layer include path needed for help launcher
-APP_LAYER_SYSTEMINCLUDE
-
-SOURCEPATH      ../data
-
-START RESOURCE  102750CC.rss
-TARGET          drmsettingsplugin.rsc
-END
-
-START RESOURCE  drmsettingspluginrsc.rss
-HEADER
-TARGETPATH      RESOURCE_FILES_DIR
-LANGUAGE_IDS
-END
-
-
-LIBRARY   aknskins.lib          // for enhanced skinning
-LIBRARY   aknskinsrv.lib        // for enhanced skinning
-LIBRARY   avkon.lib
-LIBRARY   bafl.lib
-LIBRARY   centralrepository.lib
-LIBRARY   commonengine.lib      // For RConeResourceLoader
-LIBRARY   cone.lib
-LIBRARY   ecom.lib
-LIBRARY   efsrv.lib
-LIBRARY   egul.lib
-LIBRARY   eikcoctl.lib
-LIBRARY   eikcore.lib
-LIBRARY   euser.lib
-LIBRARY   featmgr.lib           // Feature manager
-LIBRARY   flogger.lib           // For GSLogger
-LIBRARY   gsecomplugin.lib
-LIBRARY   gsframework.lib       // For base classes
-LIBRARY   gslistbox.lib         // For CGSListBoxItemTextArray
-LIBRARY   hlplch.lib            // for "Help" options menu
-LIBRARY   drmserverinterfaces.lib  // Roap storage
-LIBRARY   charconv.lib
-
-SMPSAFE
-// End of File
--- a/commondrm/drmsettingsplugin/inc/drmsettingsmodel.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  DRMSettinsPlugin model.
-*
-*/
-
-#ifndef  DRMSETTINGSMODEL_H
-#define  DRMSETTINGSMODEL_H
-
-// INCLUDES
-#include    <centralrepository.h>
-#include    <e32property.h>
-#include    "roapstorageclient.h"
-
-// FORWARD DECLARATIONS
-class CDRMRIContext;
-
-// CONSTANTS
-const TInt KDRMTransactionTrackingDisabled = 0;
-const TInt KDRMTransactionTrackingEnabled = 1;
-
-const TInt KDRMAutomaticActivationNotAllowed = 0;
-const TInt KDRMAutomaticActivationAllowed = 1;
-    
-
-// CLASS DEFINITIONS
-
-/**
-*  CDRMSettingsModel is the model class of DRMSettingsPlugin.
-*  It provides functions to get and set setting values.
-*/
-class   CDRMSettingsModel : public CBase
-    {
-    
-    public:  // Constructor and destructor
-        /**
-        * Two-phased constructor
-        */
-        static CDRMSettingsModel* NewL();
-
-        /**
-        * Destructor
-        */
-        ~CDRMSettingsModel();
-
-    public: // New 
-         
-        /**
-        * Get transaction tracking state
-        * @return KDRMTransactionTrackingDisabled
-        *         KDRMTransactionTrackingEnabled
-        */
-        TInt TransactionTrackingStateL();
-
-        /**
-        * Set transaction tracking state
-        * @param aValue updated value
-        */
-        void SetTransactionTrackingStateL( TInt aValue );
-       
-        /**
-        * Get automatic activation state
-        * @return KDRMAutomaticActivationNotAllowed
-        *         KDRMAutomaticActivationAllowed
-        */
-        TInt AutomaticActivationStateL();
-
-        /**
-        * Set automatic activation state
-        * @param aValue updated value
-        */
-        void SetAutomaticActivationStateL( TInt aValue );
-        
-        /**
-        * Get usage reporting state
-        * @return count of services for which reporting is allowed
-        */
-        TInt UsageReportingCount();
-
-        /**
-        * Get RI alias
-        *
-        * @param aIndex : Index of the RI context
-        *
-        * @return RI alias name or RI url if no alias available
-        */
-        HBufC* GetSingleRIAliasL( TInt aIndex );
-        
-        /**
-        * Get the first RI alias, where metering is allowed 
-        * @return RI alias name or RI url if no alias available
-        */
-        HBufC* GetFirstAllowedMeteringRIAliasL();
-        
-        /**
-        * Get number of RI contexts 
-        * @return number of RIContexts
-        */
-        TInt GetRiContextCount();
-        
-        /**
-        * Get metering status of RI Context
-        * 
-        * @param aIndex : Index of the RI context
-        *
-        * @return Status of metering
-        */
-        TBool IsMeteringAllowed( TInt aIndex );
-        
-        /**
-        * Find out if metering is allowed for all RI Contexts
-        * 
-        * @return Status of metering
-        */
-        TBool IsMeteringAllowedForAll();
-        
-        /**
-        * Sets the value for metering to be enabled or disabled
-        *
-        * @param aIndex : Index of the RI context
-        * @param aIsAllowed : ETrue if set to allowed, EFalse if not allowed
-        */        
-        void SetMeteringStatus( TInt aIndex, TBool aIsAllowed );
-        
-        /**
-        * Save the changes done to RI Contexs
-        */
-        void SaveMeteringChanges();
-       
-    private: // Private constructors
-        
-        /**
-        * Default C++ contructor
-        */
-        CDRMSettingsModel();
-
-        /**
-        * Symbian OS default constructor
-        * @return void
-        */
-        void ConstructL();
-        
-    private: // Data
-        
-        // DRM Settings Central Repository.
-        CRepository* iDRMSettingsRepository;
-
-        // Roap storage client
-        Roap::RRoapStorageClient* iRoapStorageClient;
-
-        // List of service providers with which device has been registered
-        RPointerArray<CDRMRIContext> iRIContextList;
-        
-    };
-    
-#endif // DRMSETTINGSMODEL_H  
-
-// End of File
--- a/commondrm/drmsettingsplugin/inc/drmsettingsplugin.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  View for DRMSettingsPlugin.
-*
-*/
-
-
-#ifndef DRMSETTINGSPLUGIN_H
-#define DRMSETTINGSPLUGIN_H
-
-// INCLUDES
-#include <aknsettingpage.h>
-#include <coneresloader.h>
-#include <gsplugininterface.h>
-#include <gsfwviewuids.h>
-#include <gsbaseview.h>
-#include <eikmenup.h>
-
-#include "drmsettingsplugincontainer.h"
-
-//CONSTANTS
-const TUid KDRMSettingsPluginUid = { 0x1020750CC };
-
-// Listbox item indexes of the transcaction tracking setting items
-const TInt KDRMTTItemIndexDisabled  = 1;
-const TInt KDRMTTItemIndexEnabled   = 0;
-
-// Listbox item indexes of the automatic activation setting items
-const TInt KDRMAAItemIndexDisabled  = 1;
-const TInt KDRMAAItemIndexEnabled   = 0;
-
-// FORWARD DECLARATIONS
-class CAknViewAppUi;
-class CDRMSettingsPluginContainer;
-class CDRMSettingsModel;
-
-// CLASS DECLARATION
-
-/**
-*  CDRMSettingsPlugin view class
-*
-*  View class for DRM Settings plugin
-*/
-class CDRMSettingsPlugin : public CGSBaseView
-    {
-    
-    public: // Constructors and destructor
-
-        /**
-        * Symbian OS two-phased constructor
-        * @return connection view.
-        */
-        static CDRMSettingsPlugin* NewL( TAny* aInitParams );
-
-        /**
-        * Destructor.
-        */
-        ~CDRMSettingsPlugin();
-
-    private:
-        /**
-        * Symbian OS default constructor.
-        * 
-        */
-        void ConstructL();
-
-        /**
-        * C++ default constructor.
-        */
-        CDRMSettingsPlugin();
-
-    public: // from CAknView
-        
-        /**
-        * Returns view id.
-        * @return An unsigned integer (view id).
-        */
-        TUid Id() const;
-
-    public: // from MEikCommandObserver 
-
-        /**
-        * Handles commands.
-        * @param aCommand Command to be handled.
-        * 
-        */
-        void HandleCommandL( TInt aCommand );
-
-    public: //new
-
-        /**
-        * Updates listbox's item's value.
-        * @param aItemId An item which is updated.
-        * 
-        */
-        void UpdateListBoxL( TInt aItemId );
-
-    public: // From CGSPluginInterface
-
-        /**
-        * @see CGSPluginInterface header file.
-        */
-        void GetCaptionL( TDes& aCaption ) const;
-        
-        /**
-        * @see CGSPluginInterface header file.
-        */
-        TInt PluginProviderCategory() const;
-
-        /**
-        * @see CGSPluginInterface header file.
-        */
-        TBool Visible() const;
-
-    private: // from CGSBaseView
-        //
-        void NewContainerL();
-        //
-        void HandleListBoxSelectionL();
-
-    private: // new
-        
-        /**
-        * Update transaction tracking setting
-        */
-        void UpdateTransactionTrackingSettingL( TBool aShowSettingPage );
-
-        /**
-        * Update automatic activation setting
-        */
-        void UpdateAutomaticActivationSettingL( TBool aShowSettingPage );
-
-        /**
-        * Update usage reporting setting
-        */
-        void UpdateUsageReportingSettingL();
-
-        /**
-        * Delete WMDRM license store
-        */
-        void DoWMDRMLicenseDeletionL();
-
-        /**
-        * Display setting page
-        * @param aTTState Current state. This will be updated.
-        * @return ETrue if value is updated.
-        *         EFalse if value is not updated.
-        */
-        TBool ShowTransactionTrackingSettingPageL( TInt& aTTState );
-
-        /**
-        * Display setting page
-        * @param aAAState Current state. This will be updated.
-        * @return ETrue if value is updated.
-        *         EFalse if value is not updated.
-        */
-        TBool ShowAutomaticActivationSettingPageL( TInt& aAAState );
-
-        /**
-        * Get DRMSettingsPlugin's ccontainer.
-        */
-        CDRMSettingsPluginContainer* Container();
-
-    protected: // From MEikMenuObserver
-
-        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
-        
-    private: // data
-        //resource loader
-        RConeResourceLoader iResourceLoader;
-        
-        TBool iWmdrmSupported;
-    };
-
-#endif //DRMSETTINGSPLUGIN_H
-
-// End of File
-
--- a/commondrm/drmsettingsplugin/inc/drmsettingsplugin.hrh	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Contains common definitions for menu id:s
-*
-*/
-
-
-#ifndef DRMSETTINGSPLUGIN_HRH
-#define DRMSETTINGSPLUGIN_HRH
-
-   
-enum TSettingId
-    {
-    EDRMSettingsIdAutomaticActivation,
-    EDRMSettingsIdUsageReporting,
-    EDRMSettingsIdTransactionTracking,
-    EDRMSettingsIdWMDRMLicenseDeletion
-    };
-
-enum TMenuCmd
-    {
-    EDRMSettingsCmdAppChange = 1,
-    EDRMSettingsCmdAppChangeMSK 
-    };
-
-enum TListBoxItemVisibility
-    {
-    EDRMSettingsListBoxItemTypeIsAlwaysVisible = 0,
-    EDRMSettingsListBoxItemTypeIsDynamic
-    };
-
-#endif //  DRMSETTINGSPLUGIN_HRH
-
-//End of File
-
--- a/commondrm/drmsettingsplugin/inc/drmsettingsplugin.rh	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Contains common declarations for resources.
-*                 The file can be included only in resource file.
-*
-*/
-
-#ifndef DRMSETTINGSPLUGIN_RH
-#define DRMSETTINGSPLUGIN_RH
-
-
-// Global definitions
-
-
-// ---------------------------------------------------------
-//    drm_settings_feature_array
-//    Defines a structure to contain information about items 
-//    to be able to included in the listbox.
-// ---------------------------------------------------------
-//
-STRUCT DRM_SETTINGS_FEATURE_ARRAY
-    {
-    STRUCT items[];
-    }
-
-// ---------------------------------------------------------
-//    drm_settings_feature
-//    Defines a structure that contains information about 
-//    a single listbox item.
-// ---------------------------------------------------------
-//
-STRUCT DRM_SETTINGS_FEATURE
-    {
-    LTEXT txt = "";    
-    WORD item = -1;
-    BYTE type = EDRMSettingsListBoxItemTypeIsAlwaysVisible;
-    }
-
-#endif // DRMSETTINGSPLUGIN_RH
-// End of File
--- a/commondrm/drmsettingsplugin/inc/drmsettingsplugincontainer.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Container for DRMSettinsPlugin view.
-*
-*/
-
-
-#ifndef DRMSETTINGSPLUGINCONTAINER_H
-#define DRMSETTINGSPLUGINCONTAINER_H
-
-// INCLUDES
-#include <gsbasecontainer.h>
-
-// FORWARD DECLARATIONS
-class CGSListBoxItemTextArray;
-class CDRMSettingsModel;
-
-// CLASS DECLARATION
-
-/**
-*  CDRMSettingsPluginContainer container class
-*  @since Series 60_3.1
-*
-*  Container class for DRM Settings view
-*/
-class CDRMSettingsPluginContainer : public CGSBaseContainer
-    {
-        
-    public: // Constructors and destructor
-
-        /**
-        * Symbian OS constructor.
-        * @param aRect Listbox's rect.
-        */
-        void ConstructL( const TRect& aRect );
-
-        CDRMSettingsPluginContainer( TBool aWmdrmSupported );
-        
-        /**
-        * Destructor.
-        */
-        ~CDRMSettingsPluginContainer();
-
-    public: // new
-
-        /**
-        * Updates listbox's item's value.
-        * @param aFeatureId An item which is updated.
-        */
-        void UpdateListBoxL( TInt aFeatureId );
-
-        /**
-        * Retrieves the currently selected listbox feature id
-        * @return feature id.
-        */
-        TInt CurrentFeatureId() const;
-        
-        /**
-        * @return Model for the plugin.
-        */
-        CDRMSettingsModel* Model();
-        
-    protected: // from CGSBaseContainer
-    
-        /**
-        * See base class.
-        */
-        void ConstructListBoxL( TInt aResLbxId );
-        
-    private: // new
-
-        void CreateListBoxItemsL();
-        void MakeTransactionTrackingItemL();
-        void MakeAutomaticActivationItemL();
-        void MakeUsageReportingItemL();
-        void MakeWMDRMLicenseDeletionItemL();
-
-    private:
-    
-        /**
-        * Required for help.
-        */
-        void GetHelpContext( TCoeHelpContext& aContext ) const;
-
-    private: // data
-
-        // GS listbox item array
-        CGSListBoxItemTextArray* iListboxItemArray;
-        
-        // Model for DRMSettingsPlugin.
-        CDRMSettingsModel* iModel;
-        TBool iWmdrmSupported;
-    };
-
-#endif //DRMSETTINGSPLUGINCONTAINER_H
-
-// End of File
--- a/commondrm/drmsettingsplugin/inc/drmsettingsusagecheckbox.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  CheckBox class for Usage Reporting settings
-*
-*/
-
-
-#ifndef C_DRMSETTINGSUSAGECHECKBOX_H
-#define C_DRMSETTINGSUSAGECHECKBOX_H
-
-// INCLUDES
-#include <akncheckboxsettingpage.h>
-#include <aknsettingpage.h>
-
-// FORWARD DECLARATIONS
-class CDRMSettingUsageList;
-class CDRMSettingsModel;
-class CAknInfoPopupNoteController;
-
-/**
- * CDrmSettingUsageCheckBox class
- */
-NONSHARABLE_CLASS( CDrmSettingUsageCheckBox ) : public CAknCheckBoxSettingPage
-    {
-
-    public: // New functions
-
-        /**
-		* C++ default constructor.
-		*/
-		CDrmSettingUsageCheckBox( TInt aResourceId,
-		                          CDRMSettingUsageList* aList,
-		                          CDRMSettingsModel* aModel );
-		                          
-		/**
-		* Destructor.
-        */
-        virtual ~CDrmSettingUsageCheckBox();	
-
-	private: // From CAknSettingPage
-	
-	    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
-	                                 TEventCode aType );
-	
-	    void DynamicInitL();
-	
-	    TBool OkToExitL(TBool aAccept);
-	    
-	    void AcceptSettingL();    
-	
-	private: // New functions
-	
-	    void ShowInfoPopupL();
-
-    private: // Data
-		
-		// Not owned
-		CDRMSettingUsageList* iList;
-		
-		// Not owned
-        CDRMSettingsModel* iModel;
-        
-        // Owned
-        CAknInfoPopupNoteController* iPopupController;
-
-    };
-
-#endif // C_DRMSETTINGSUSAGECHECKBOX_H
--- a/commondrm/drmsettingsplugin/inc/drmsettingsusagelist.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  List class for Usage Reporting checkbox
-*
-*/
-
-
-#ifndef C_DRMSETTINGSUSAGELIST_H
-#define C_DRMSETTINGSUSAGELIST_H
-
-// INCLUDES
-#include <akncheckboxsettingpage.h>
-
-// FORWARD DECLARATIONS
-class CDRMSettingsModel;
-
-/**
- * CDRMSettingUsageList class
- */
-NONSHARABLE_CLASS( CDRMSettingUsageList ) : public CSelectionItemList
-	{
-
-    public: // New functions
-	
-	    /**
-		* Two-phased constructor.
-        */
-		static CDRMSettingUsageList* NewL( CDRMSettingsModel* aModel );
-
-        /**
-		* Destructor.
-        */
-        virtual ~CDRMSettingUsageList();
-        
-	    /**
-	    * Updates contexts
-	    */
-	    void UpdateContexts();
-	
-	private:
-	
-	    /**
-	    * Default constructor.
-	    */
-	    CDRMSettingUsageList( CDRMSettingsModel* aModel );
-	    
-	    /**
-        * Symbian OS constructor.
-        */
-	    void ConstructL();
-	    
-	private: // Data
-	
-	    // Not owned
-	    CDRMSettingsModel* iModel;
-	
-	};
-	
-#endif // C_DRMSETTINGSUSAGELIST_H
\ No newline at end of file
--- a/commondrm/drmsettingsplugin/src/drmsettingsmodel.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Model for DRMSettinsPlugin.
-*
-*/
-
-
-// INCLUDE FILES
-#include <utf.h>
-#include <commdb.h>
-#include <featmgr.h>
-
-#include "drmsettingsmodel.h"
-#include "drmsettingsplugininternalcrkeys.h"
-#include "drmricontext.h"
-
-// CONSTANTS
-#ifdef _DEBUG
-// debug panic
-_LIT( KDRMSettingsDebugPanicMessage, "DrmSettingsDebugPanic" );
-const TInt KDRMSettingsDebugPanicCode( 1 );
-#endif
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsModel::NewL
-//
-// EPOC two-phased constructor
-// ----------------------------------------------------------------------------
-//
-CDRMSettingsModel* CDRMSettingsModel::NewL()
-    {
-    CDRMSettingsModel* self = new( ELeave ) CDRMSettingsModel;
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsModel::CDRMSettingsModel
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// ----------------------------------------------------------------------------
-//
-CDRMSettingsModel::CDRMSettingsModel()
-    {
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsModel::ConstructL
-//
-// EPOC default constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CDRMSettingsModel::ConstructL()
-    {
-    // create an instance of Central Repository
-    iDRMSettingsRepository = CRepository::NewL( KCRUidDRMSettings );
-
-#ifdef RD_DRM_METERING
-
-    // Create an instance of roap storage client
-    iRoapStorageClient = new (ELeave) Roap::RRoapStorageClient;
-
-    // Connect to server
-    User::LeaveIfError( iRoapStorageClient->Connect() );
-
-    // Fill the list
-    iRoapStorageClient->GetAllRIContextsL( iRIContextList );
-
-#endif // RD_DRM_METERING
-
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsModel::~CDRMSettingsModel
-//
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CDRMSettingsModel::~CDRMSettingsModel()
-    {
-    if ( iDRMSettingsRepository )
-        {
-        delete iDRMSettingsRepository;
-        }
-    if ( iRoapStorageClient )
-        {
-        iRoapStorageClient->Close();
-        delete iRoapStorageClient;
-        }
-
-    iRIContextList.ResetAndDestroy();
-    iRIContextList.Close();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::SetTransactionTrackingStateL()
-//
-// Set transaction tracking state
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsModel::SetTransactionTrackingStateL( TInt aValue )
-    {
-    User::LeaveIfError( iDRMSettingsRepository->
-                                Set( KDRMSettingsTransactionTracking,
-                                     aValue ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::TransactionTrackingStateL()
-//
-// Get transaction tracking state
-// ---------------------------------------------------------------------------
-//
-TInt CDRMSettingsModel::TransactionTrackingStateL()
-    {
-    TInt value( KErrNone );
-
-    User::LeaveIfError( iDRMSettingsRepository->Get(
-                                    KDRMSettingsTransactionTracking,
-                                    value ) );
-
-    return value;
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::SetAutomaticActivationStateL()
-//
-// Set automatic activation state
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsModel::SetAutomaticActivationStateL( TInt aValue )
-    {
-    User::LeaveIfError( iDRMSettingsRepository->
-                                Set( KDRMSettingsSilentRightsAcquisition,
-                                     aValue ) );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::AutomaticActivationStateL()
-//
-// Get automatic activation state
-// ---------------------------------------------------------------------------
-//
-TInt CDRMSettingsModel::AutomaticActivationStateL()
-    {
-    TInt value( KErrNone );
-
-    User::LeaveIfError( iDRMSettingsRepository->Get(
-                                KDRMSettingsSilentRightsAcquisition,
-                                value ) );
-
-    return value;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::UsageReportingCount()
-//
-// Get usage reporting state. Return count of allowed services.
-// ---------------------------------------------------------------------------
-//
-TInt CDRMSettingsModel::UsageReportingCount()
-    {
-    TInt count( 0 );
-
-    for ( TInt i( 0 ); i < iRIContextList.Count(); i++ )
-        {
-        if ( iRIContextList[i]->IsMeteringAllowed() )
-            {
-            count++;
-            }
-        }
-
-    return count;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::GetSingleRIAliasL()
-// ---------------------------------------------------------------------------
-//
-HBufC* CDRMSettingsModel::GetSingleRIAliasL( TInt aIndex )
-    {
-    __ASSERT_DEBUG( aIndex >= 0 ||
-                    aIndex < iRIContextList.Count(),
-                        User::Panic( KDRMSettingsDebugPanicMessage,
-                                     KDRMSettingsDebugPanicCode ) );
-
-    HBufC* alias( NULL );
-
-    if ( &iRIContextList[aIndex]->RIAlias() )
-        {
-        alias =
-            CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-                iRIContextList[aIndex]->RIAlias() );
-        }
-    else
-        {
-        alias =
-            CnvUtfConverter::ConvertToUnicodeFromUtf8L(
-                iRIContextList[aIndex]->RightsIssuerURL() );
-        }
-
-    return alias;
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::GetFirstAllowedMeteringRIAliasL()
-// ---------------------------------------------------------------------------
-//
-HBufC* CDRMSettingsModel::GetFirstAllowedMeteringRIAliasL()
-    {
-    for ( TInt i( 0 ); i < iRIContextList.Count(); i++ )
-        {
-        if( IsMeteringAllowed( i ) )
-            {
-            return GetSingleRIAliasL( i );
-            }
-        }
-    return NULL;
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::GetRiContextCount()
-// ---------------------------------------------------------------------------
-//
-TInt CDRMSettingsModel::GetRiContextCount()
-    {
-    return iRIContextList.Count();
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::IsMeteringAllowed()
-// ---------------------------------------------------------------------------
-//
-TBool CDRMSettingsModel::IsMeteringAllowed( TInt aIndex )
-    {
-    __ASSERT_DEBUG( aIndex >= 0 ||
-                    aIndex < iRIContextList.Count(),
-                        User::Panic( KDRMSettingsDebugPanicMessage,
-                                     KDRMSettingsDebugPanicCode ) );
-
-    return iRIContextList[aIndex]->IsMeteringAllowed();
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::IsMeteringAllowedForAll()
-// ---------------------------------------------------------------------------
-//
-TBool CDRMSettingsModel::IsMeteringAllowedForAll()
-    {
-    TBool isAllowed( ETrue );
-
-    for ( TInt i( 0 ); i < iRIContextList.Count() && isAllowed; i++ )
-        {
-        if( !IsMeteringAllowed( i ) )
-            {
-            isAllowed = EFalse;
-            }
-        }
-
-    return isAllowed;
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::SetMeteringStatus()
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsModel::SetMeteringStatus( TInt aIndex, TBool aIsAllowed )
-    {
-    __ASSERT_DEBUG( aIndex >= 0 ||
-                    aIndex < iRIContextList.Count(),
-                        User::Panic( KDRMSettingsDebugPanicMessage,
-                                     KDRMSettingsDebugPanicCode ) );
-
-    iRIContextList[aIndex]->SetMeteringStatus( aIsAllowed );
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsModel::SaveMeteringChanges()
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsModel::SaveMeteringChanges()
-    {
-    for ( TInt i( 0 ); i < iRIContextList.Count(); i++ )
-        {
-        TRAP_IGNORE(
-            iRoapStorageClient->UpdateRIContextL( *iRIContextList[i] ) );
-        }
-    }
-
-//  End of File
--- a/commondrm/drmsettingsplugin/src/drmsettingsplugin.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,728 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  View for DRMSettinsPlugin
-*
-*/
-
-
-// INCLUDE FILES
-#include <coeaui.h>
-#include <hlplch.h>             // For HlpLauncher
-#include <bautils.h>
-#include <eikfrlbd.h>
-#include <featmgr.h>
-#include <stringloader.h>
-#include <aknviewappui.h>
-#include <aknradiobuttonsettingpage.h>
-#include <gsfwviewuids.h>
-#include <gsprivatepluginproviderids.h>
-#include <gscommon.hrh>
-#include <drmsettingspluginrsc.rsg>
-
-#include "drmsettingsplugin.h"
-#include "drmsettingsplugincontainer.h"
-#include "drmsettingsplugin.hrh"
-#include "drmsettingsmodel.h"
-#include "drmsettingsusagecheckbox.h"
-#include "drmsettingsusagelist.h"
-#include "wmdrmpkclientwrapper.h"
-
-// CONSTANTS
-_LIT( KDRMSettingsPluginResourceFileName, "z:drmsettingspluginrsc.rsc" );
-
-
-// ============================= LOCAL FUNCTIONS ==============================
-
-// ========================= MEMBER FUNCTIONS ================================
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::CDRMSettingsPlugin()
-//
-// Constructor
-// ----------------------------------------------------------------------------
-//
-CDRMSettingsPlugin::CDRMSettingsPlugin()
-  : iResourceLoader( *iCoeEnv )
-    {
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::NewL()
-//
-// Symbian OS default constructor
-// ---------------------------------------------------------------------------
-CDRMSettingsPlugin* CDRMSettingsPlugin::NewL( TAny* /*aInitParams*/ )
-    {
-    CDRMSettingsPlugin* self = new( ELeave ) CDRMSettingsPlugin;
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::ConstructL()
-//
-// Symbian OS two-phased constructor
-// ---------------------------------------------------------------------------
-void CDRMSettingsPlugin::ConstructL()
-    {
-    FeatureManager::InitializeLibL();
-    // Find the resource file
-    TParse parse;
-    parse.Set( KDRMSettingsPluginResourceFileName,
-               &KDC_RESOURCE_FILES_DIR,
-               NULL );
-    TFileName fileName( parse.FullName() );
-
-    // Get language of resource file
-    BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
-
-    // Open resource file
-    iResourceLoader.OpenL( fileName );
-
-    BaseConstructL( R_DRM_SETTINGS_VIEW );
-
-    if ( FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) )
-        {
-        iWmdrmSupported = ETrue;
-        }
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::~CDRMSettingsPlugin
-//
-// Destructor
-// ----------------------------------------------------------------------------
-CDRMSettingsPlugin::~CDRMSettingsPlugin()
-    {
-    FeatureManager::UnInitializeLib();
-    iResourceLoader.Close();
-    }
-
-
-// ---------------------------------------------------------------------------
-// TUid CDRMSettingsPlugin::Id()
-//
-// Returns view's ID.
-// ---------------------------------------------------------------------------
-TUid CDRMSettingsPlugin::Id() const
-    {
-    return KDRMSettingsPluginUid;
-    }
-
-
-// ========================= From CGSPluginInterface ==================
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::GetCaption
-//
-// Return application/view caption.
-// ----------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::GetCaptionL( TDes& aCaption ) const
-    {
-    // the resource file is already opened.
-    HBufC* result( StringLoader::LoadL( R_DRM_SETTINGS_VIEW_CAPTION ) );
-    aCaption.Copy( *result );
-    delete result;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::PluginProviderCategory
-//
-// A means to identify the location of this plug-in in the framework.
-// ----------------------------------------------------------------------------
-//
-TInt CDRMSettingsPlugin::PluginProviderCategory() const
-    {
-    //To identify internal plug-ins.
-    return KGSPluginProviderInternal;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::Visible
-//
-// Provides the visibility status of self to framework.
-// ----------------------------------------------------------------------------
-//
-TBool CDRMSettingsPlugin::Visible() const
-    {
-    TBool visible( EFalse );
-
-    // The plugin is visible if __DRM_OMA2 or __WINDOWS_MEDIA_DRM are enabled.
-    if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) ||
-        FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) )
-        {
-        visible = ETrue;
-        }
-
-    return visible;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::HandleCommandL(TInt aCommand)
-//
-// Handles commands directed to this class.
-// ---------------------------------------------------------------------------
-void CDRMSettingsPlugin::HandleCommandL( TInt aCommand )
-    {
-    switch ( aCommand )
-        {
-        case EDRMSettingsCmdAppChangeMSK:
-            {
-            const TInt currentFeatureId( Container()->CurrentFeatureId() );
-
-            switch ( currentFeatureId )
-                {
-#ifdef __DRM_OMA2
-                case EDRMSettingsIdTransactionTracking:
-
-                    UpdateTransactionTrackingSettingL( EFalse );
-
-                    break;
-
-#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
-                case EDRMSettingsIdAutomaticActivation:
-
-                    UpdateAutomaticActivationSettingL( EFalse );
-
-                    break;
-#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
-
-#ifdef RD_DRM_METERING
-                case EDRMSettingsIdUsageReporting:
-
-                    UpdateUsageReportingSettingL();
-
-                    break;
-#endif // RD_DRM_METERING
-#endif // __DRM_OMA2
-
-                case EDRMSettingsIdWMDRMLicenseDeletion:
-
-                    if ( iWmdrmSupported )
-                        {
-                        DoWMDRMLicenseDeletionL();
-                        }
-
-                    break;
-
-                default:
-
-                    break;
-                }
-
-            break;
-            }
-        case EDRMSettingsCmdAppChange:
-            {
-            const TInt currentFeatureId( Container()->CurrentFeatureId() );
-
-            switch ( currentFeatureId )
-                {
-#ifdef __DRM_OMA2
-                case EDRMSettingsIdTransactionTracking:
-
-                    UpdateTransactionTrackingSettingL( ETrue );
-
-                    break;
-
-#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
-                case EDRMSettingsIdAutomaticActivation:
-
-                    UpdateAutomaticActivationSettingL( ETrue );
-
-                    break;
-#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
-
-#ifdef RD_DRM_METERING
-                case EDRMSettingsIdUsageReporting:
-
-                    UpdateUsageReportingSettingL();
-
-                    break;
-#endif // RD_DRM_METERING
-#endif // __DRM_OMA2
-
-                case EDRMSettingsIdWMDRMLicenseDeletion:
-
-                    if ( iWmdrmSupported )
-                        {
-                        DoWMDRMLicenseDeletionL();
-                        }
-
-                    break;
-
-                default:
-
-                    break;
-                }
-            break;
-            }
-        case EAknSoftkeyBack:
-
-            iAppUi->ActivateLocalViewL( KGSSecurityPluginUid );
-
-            break;
-
-        case EAknCmdHelp:
-            {
-
-            if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
-                {
-                HlpLauncher::LaunchHelpApplicationL(
-                                                iEikonEnv->WsSession(),
-                                                iAppUi->AppHelpContextL() );
-                }
-
-            break;
-
-            }
-        default:
-
-            iAppUi->HandleCommandL( aCommand );
-
-            break;
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::UpdateListBoxL
-//
-// Updates listbox items.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::UpdateListBoxL( TInt aItemId )
-    {
-    Container()->UpdateListBoxL( aItemId );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::Container
-//
-// Return handle to container class.
-// ----------------------------------------------------------------------------
-//
-CDRMSettingsPluginContainer* CDRMSettingsPlugin::Container()
-    {
-    return static_cast<CDRMSettingsPluginContainer*>( iContainer );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::NewContainerL()
-//
-// Creates new iContainer.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::NewContainerL()
-    {
-    iContainer = new( ELeave ) CDRMSettingsPluginContainer( iWmdrmSupported );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::HandleListBoxSelectionL()
-//
-// Handles events raised through a rocker key.
-// ---------------------------------------------------------------------------
-void CDRMSettingsPlugin::HandleListBoxSelectionL()
-    {
-    const TInt currentFeatureId( Container()->CurrentFeatureId() );
-
-    switch ( currentFeatureId )
-        {
-#ifdef __DRM_OMA2
-        case EDRMSettingsIdTransactionTracking:
-
-            UpdateTransactionTrackingSettingL( EFalse );
-
-            break;
-
-#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
-        case EDRMSettingsIdAutomaticActivation:
-
-            UpdateAutomaticActivationSettingL( EFalse );
-
-            break;
-#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
-
-#ifdef RD_DRM_METERING
-        case EDRMSettingsIdUsageReporting:
-
-            UpdateUsageReportingSettingL();
-
-            break;
-#endif // RD_DRM_METERING
-#endif // __DRM_OMA2
-
-        case EDRMSettingsIdWMDRMLicenseDeletion:
-
-            if ( iWmdrmSupported )
-                {
-                DoWMDRMLicenseDeletionL();
-                }
-
-            break;
-
-       default:
-
-            break;
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::UpdateTransactionTrackingSettingL
-//
-// Display Transaction tracking setting page.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::UpdateTransactionTrackingSettingL( TBool aShowSettingPage )
-    {
-    if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
-        {
-        TInt currentValue( Container()->Model()->TransactionTrackingStateL() );
-        TBool isValueUpdated( EFalse );
-
-        if ( aShowSettingPage )
-            {
-            isValueUpdated = ShowTransactionTrackingSettingPageL( currentValue );
-            }
-        else
-            {
-            switch ( currentValue )
-                {
-                case KDRMTransactionTrackingDisabled:
-
-                    currentValue = KDRMTransactionTrackingEnabled;
-
-                    break;
-
-                case KDRMTransactionTrackingEnabled:
-
-                    currentValue = KDRMTransactionTrackingDisabled;
-
-                    break;
-
-                default:
-
-                    break;
-                }
-            isValueUpdated = ETrue;
-            }
-        // If value is updated, store it to model:
-        if ( isValueUpdated )
-            {
-            Container()->Model()->SetTransactionTrackingStateL( currentValue );
-            UpdateListBoxL( EDRMSettingsIdTransactionTracking );
-            }
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::ShowTransactionTrackingSettingPageL()
-//
-// Display transaction tracking setting page. Selected listbox item index
-// must be mapped to transaction tracking state because index value is
-// different from state value.
-// ---------------------------------------------------------------------------
-//
-TBool CDRMSettingsPlugin::ShowTransactionTrackingSettingPageL(
-    TInt& aTTState )
-    {
-    // in case DRM Phase 2 is not supported, return EFalse.
-    TBool isValueUpdated( EFalse );
-    TInt selectedTTItemIndex( 0 );
-    TInt originalTTState( aTTState );
-
-    // Set selected listbox item to current transaction tracking state:
-    switch ( aTTState )
-        {
-        case KDRMTransactionTrackingDisabled:
-
-            selectedTTItemIndex = KDRMTTItemIndexDisabled;
-
-            break;
-
-        case KDRMTransactionTrackingEnabled:
-
-            selectedTTItemIndex = KDRMTTItemIndexEnabled;
-
-            break;
-        }
-
-    CDesCArrayFlat* items(
-        iCoeEnv->ReadDesC16ArrayResourceL( R_TTRACKING_SETTING_PAGE_LBX ) );
-    CleanupStack::PushL( items );
-    CAknRadioButtonSettingPage* dlg(
-        new (ELeave) CAknRadioButtonSettingPage( R_TTRACKING_SETTING_PAGE,
-                                                 selectedTTItemIndex,
-                                                 items ) );
-
-    dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
-    CleanupStack::PopAndDestroy( items );
-
-    // Map selected listbox item to correct state:
-    switch ( selectedTTItemIndex )
-        {
-        case KDRMTTItemIndexDisabled:
-
-            aTTState = KDRMTransactionTrackingDisabled;
-
-            break;
-
-        case KDRMTTItemIndexEnabled:
-
-            aTTState = KDRMTransactionTrackingEnabled;
-
-            break;
-        }
-
-    // Check is value updated:
-    if( aTTState != originalTTState )
-        {
-        isValueUpdated = ETrue;
-        }
-
-    return isValueUpdated;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::UpdateAutomaticActivationSettingL
-//
-// Display Automatic activation setting page.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::UpdateAutomaticActivationSettingL( TBool aShowSettingPage )
-    {
-    if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
-        {
-        TInt currentValue( Container()->Model()->AutomaticActivationStateL() );
-        TBool isValueUpdated( EFalse );
-
-        if ( aShowSettingPage )
-            {
-            isValueUpdated = ShowAutomaticActivationSettingPageL( currentValue );
-            }
-        else
-            {
-            switch ( currentValue )
-                {
-                case KDRMAutomaticActivationNotAllowed:
-
-                    currentValue = KDRMAutomaticActivationAllowed;
-
-                    break;
-
-                case KDRMAutomaticActivationAllowed:
-
-                    currentValue = KDRMAutomaticActivationNotAllowed;
-
-                    break;
-
-                default:
-
-                    break;
-                }
-            isValueUpdated = ETrue;
-            }
-        // If value is updated, store it to model:
-        if ( isValueUpdated )
-            {
-            Container()->Model()->SetAutomaticActivationStateL( currentValue );
-            UpdateListBoxL( EDRMSettingsIdAutomaticActivation );
-            }
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::ShowAutomaticActivationSettingPageL()
-//
-// Display Automatic activation setting page. Selected listbox item index
-// must be mapped to automatic activation state because index value is
-// different from state value.
-// ---------------------------------------------------------------------------
-//
-TBool CDRMSettingsPlugin::ShowAutomaticActivationSettingPageL(
-    TInt& aAAState )
-    {
-    // in case DRM Phase 2 is not supported, return EFalse.
-    TBool isValueUpdated( EFalse );
-    TInt selectedAAItemIndex( 0 );
-    TInt originalAAState( aAAState );
-
-    // Set selected listbox item to current state:
-    switch ( aAAState )
-        {
-        case KDRMAutomaticActivationNotAllowed:
-
-            selectedAAItemIndex = KDRMAAItemIndexDisabled;
-
-            break;
-
-        case KDRMAutomaticActivationAllowed:
-
-            selectedAAItemIndex = KDRMAAItemIndexEnabled;
-
-            break;
-        }
-
-    CDesCArrayFlat* items(
-        iCoeEnv->ReadDesC16ArrayResourceL( R_AUTOM_ACTIV_SETTING_PAGE_LBX ) );
-    CleanupStack::PushL( items );
-    CAknRadioButtonSettingPage* dlg(
-        new (ELeave) CAknRadioButtonSettingPage( R_AUTOM_ACTIV_SETTING_PAGE,
-                                                 selectedAAItemIndex,
-                                                 items ) );
-
-    dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
-    CleanupStack::PopAndDestroy( items );
-
-    // Map selected listbox item to correct state:
-    switch ( selectedAAItemIndex )
-        {
-        case KDRMAAItemIndexDisabled:
-
-            aAAState = KDRMAutomaticActivationNotAllowed;
-
-            break;
-
-        case KDRMAAItemIndexEnabled:
-
-            aAAState = KDRMAutomaticActivationAllowed;
-
-            break;
-
-        }
-
-    // Check is value updated:
-    if( aAAState != originalAAState )
-        {
-        isValueUpdated = ETrue;
-        }
-
-    return isValueUpdated;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::UpdateUsageReportingSettingL
-//
-// Display Usage Reporting setting page.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::UpdateUsageReportingSettingL()
-    {
-    TBool isValueUpdated( EFalse );
-
-    if( FeatureManager::FeatureSupported( KFeatureIdDrmOma2 ) )
-        {
-        CDRMSettingsModel* model( this->Container()->Model() );
-
-        CDRMSettingUsageList* usageList( CDRMSettingUsageList::NewL( model ) );
-        CleanupStack::PushL( usageList );
-
-        CDrmSettingUsageCheckBox* usageCheckBox(
-            new (ELeave) CDrmSettingUsageCheckBox(
-                R_DRM_SETTINGS_METERING_CHECKBOX_PAGE,
-                usageList,
-                model ) );
-
-        isValueUpdated =
-            usageCheckBox->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted );
-
-        CleanupStack::PopAndDestroy( usageList );
-        }
-
-    if ( isValueUpdated )
-        {
-        UpdateListBoxL( EDRMSettingsIdUsageReporting );
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPlugin::DoWMDRMLicenseDeletionL
-//
-// Display WMDRM license deletion setting page.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPlugin::DoWMDRMLicenseDeletionL()
-    {
-    if ( iWmdrmSupported )
-        {
-        TInt r = KErrNone;
-        RLibrary library;
-        r = library.Load( KWmdrmPkClientWrapperName );
-        if( !r )
-            {
-            CleanupClosePushL( library );
-            CWmDrmPkClientWrapper* wrapper =
-                (CWmDrmPkClientWrapper*)library.Lookup( KWmdrmPkClientNewL )();
-            CleanupStack::PushL( wrapper );
-            User::LeaveIfError( wrapper->Connect() );
-            wrapper->DeleteRights();
-            wrapper->Close();
-            CleanupStack::PopAndDestroy( 2, &library );
-            }
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CDRMSettingsPlugin::DynInitMenuPaneL()
-//
-// Display the dynamic menu
-// ----------------------------------------------------------------------------
-void CDRMSettingsPlugin::DynInitMenuPaneL(
-    TInt aResourceId,
-    CEikMenuPane* aMenuPane )
-    {
-    // show or hide the 'help' menu item when supported
-    if( aResourceId == R_DRM_SETTINGS_MENU_ITEM_EXIT )
-        {
-        User::LeaveIfNull( aMenuPane );
-
-#ifdef __DRM_OMA2
-        if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
-            {
-            aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
-            }
-        else
-            {
-            aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
-            }
-#else
-
-        aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
-
-#endif // __DRM_OMA2
-        }
-    }
-
-
-
-// End of File
--- a/commondrm/drmsettingsplugin/src/drmsettingsplugincontainer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Container for DRMSettinsPlugin
-*
-*/
-
-
-// INCLUDE FILES
-#include <aknlists.h>
-#include <aknutils.h>
-#include <csxhelp/drm.hlp.hrh>
-#include <gslistbox.h>
-#include <stringloader.h>
-#include <drmsettingspluginrsc.rsg>
-
-#include "drmsettingsplugincontainer.h"
-#include "drmsettingsplugin.hrh"
-#include "drmsettingsmodel.h"
-
-const TUid KUidRightsManager = { 0x101F85C7 };
-
-// ========================= MEMBER FUNCTIONS ================================
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::ConstructL()
-// 
-// Symbian OS two phased constructor
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::ConstructL( const TRect& aRect )
-    {
-    iListBox = new( ELeave ) CAknSettingStyleListBox;
-    iModel = CDRMSettingsModel::NewL();
-    BaseConstructL( aRect, R_DRM_SETTINGS_VIEW_TITLE, R_DRM_SETTINGS_LBX );
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::CDRMSettingsPluginContainer()
-// 
-// Constructor 
-// ---------------------------------------------------------------------------
-//
-CDRMSettingsPluginContainer::CDRMSettingsPluginContainer( 
-    TBool aWmdrmSupported ) : iWmdrmSupported( aWmdrmSupported )
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::~CDRMSettingsPluginContainer()
-// 
-// Destructor 
-// ---------------------------------------------------------------------------
-//
-CDRMSettingsPluginContainer::~CDRMSettingsPluginContainer()
-    {
-    if ( iModel )
-        {
-        delete iModel;
-        }
-    // delete listbox item array
-    if ( iListboxItemArray )
-        {
-        delete iListboxItemArray;
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::ConstructListBoxL()
-// 
-// Construct the listbox from resource array.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::ConstructListBoxL( TInt aResLbxId )
-    {
-    iListBox->ConstructL( this, EAknListBoxSelectionList /* | 
-        EAknListBoxItemSpecificMenuDisabled */ );
-    iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, 
-                                                       *iListBox, 
-                                                       *iCoeEnv );
-    iListBox->Model()->SetItemTextArray( iListboxItemArray );
-    iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
-    CreateListBoxItemsL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::CreateListBoxItemsL()
-// 
-// Create listbox items.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::CreateListBoxItemsL()
-    {
-#ifdef __DRM_OMA2
-    MakeTransactionTrackingItemL();
-    
-#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
-    MakeAutomaticActivationItemL();
-#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
-
-#ifdef RD_DRM_METERING
-    MakeUsageReportingItemL();
-#endif // RD_DRM_METERING
-#endif // __DRM_OMA2
-
-
-    MakeWMDRMLicenseDeletionItemL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::UpdateListBoxL()
-// 
-// Update listbox item.
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::UpdateListBoxL( TInt aFeatureId )
-    {
-    switch( aFeatureId )
-        {
-#ifdef __DRM_OMA2
-        case EDRMSettingsIdTransactionTracking:
-            MakeTransactionTrackingItemL();
-            break;
-            
-#ifdef RD_DRM_SILENT_RIGHTS_ACQUISITION
-        case EDRMSettingsIdAutomaticActivation:
-            MakeAutomaticActivationItemL();
-            break;
-#endif // RD_DRM_SILENT_RIGHTS_ACQUISITION
-            
-#ifdef RD_DRM_METERING
-        case EDRMSettingsIdUsageReporting:
-            MakeUsageReportingItemL();
-            break;
-#endif // RD_DRM_METERING     
-#endif // __DRM_OMA2
-       
-        case EDRMSettingsIdWMDRMLicenseDeletion:
-            
-            MakeWMDRMLicenseDeletionItemL();
-            
-            break;
-       
-        default:
-            break;
-        }
-
-    iListBox->HandleItemAdditionL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::MakeTransactionTrackingItemL()
-// 
-// Create Transaction tracking list item 
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::MakeTransactionTrackingItemL()
-    {
-    HBufC* dynamicText( NULL );
-    TInt trxTrState( iModel->TransactionTrackingStateL() );
-    
-    switch ( trxTrState )
-        {
-        case KDRMTransactionTrackingEnabled:
-            dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_TTRACKING_ON );
-            break;
-        default:
-            dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_TTRACKING_OFF );
-            break;
-        }
-    
-    TPtr ptrBuffer ( dynamicText->Des() );
-
-    
-    // Finally, set the dynamic text
-    iListboxItemArray->SetDynamicTextL( EDRMSettingsIdTransactionTracking, ptrBuffer );
-
-    CleanupStack::PopAndDestroy( dynamicText );
-
-    // And add to listbox
-    iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdTransactionTracking, 
-        CGSListBoxItemTextArray::EVisible );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::MakeAutomaticActivationItemL()
-// 
-// Create Automatic activation list item 
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::MakeAutomaticActivationItemL()
-    {
-    TInt automActivState( iModel->AutomaticActivationStateL() );
-    
-    HBufC* dynamicText( NULL );
-    
-    switch ( automActivState )
-        {
-        case KDRMTransactionTrackingEnabled:
-            dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_AUTOM_ACTIV_ON );
-            break;
-        default:
-            dynamicText = StringLoader::LoadLC( R_DRM_SETTINGS_AUTOM_ACTIV_OFF );
-            break;
-        }
-    
-    TPtr ptrBuffer ( dynamicText->Des() );
-
-    // Finally, set the dynamic text
-    iListboxItemArray->SetDynamicTextL( EDRMSettingsIdAutomaticActivation, 
-                                        ptrBuffer );
-
-    CleanupStack::PopAndDestroy( dynamicText );
-
-    // And add to listbox
-    iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdAutomaticActivation, 
-                                           CGSListBoxItemTextArray::EVisible );
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::MakeUsageReportingItemL()
-// 
-// Create Usage reporting list item 
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::MakeUsageReportingItemL()
-    {
-    TInt count( iModel->UsageReportingCount() );
-    
-    HBufC* dynamicText( NULL );
-    
-    switch ( count )
-        {
-        case 0:
-            dynamicText = StringLoader::LoadL( R_DRM_SET_USAGE_REPORT_NONE );
-            break;
-        case 1:
-            dynamicText = iModel->GetFirstAllowedMeteringRIAliasL();
-            break;
-        default:
-            dynamicText = StringLoader::LoadL( R_DRM_SET_SEVERAL_SERVICES );
-            break;
-        }
-    CleanupStack::PushL( dynamicText );
-    
-    TPtr ptrBuffer ( dynamicText->Des() );
-
-    // Finally, set the dynamic text
-    iListboxItemArray->SetDynamicTextL( EDRMSettingsIdUsageReporting, 
-                                        ptrBuffer );
-
-    CleanupStack::PopAndDestroy( dynamicText );
-
-    // And add to listbox
-    iListboxItemArray->SetItemVisibilityL( EDRMSettingsIdUsageReporting, 
-                                           CGSListBoxItemTextArray::EVisible );
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::MakeWMDRMLicenseDeletionItemL()
-// 
-// Create WMDRM license deletion list item 
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::MakeWMDRMLicenseDeletionItemL()
-    {
-    if ( iWmdrmSupported )
-        {
-        // Add to listbox
-        iListboxItemArray->
-            SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, 
-                                CGSListBoxItemTextArray::EVisible );
-        }
-    else
-        {
-        // Add to listbox
-        iListboxItemArray->
-            SetItemVisibilityL( EDRMSettingsIdWMDRMLicenseDeletion, 
-                                CGSListBoxItemTextArray::EInvisible );
-        
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::GetHelpContext() const
-//  
-// Gets Help 
-// ---------------------------------------------------------------------------
-//
-void CDRMSettingsPluginContainer::GetHelpContext( 
-    TCoeHelpContext& aContext ) const
-    {
-    aContext.iMajor = KUidRightsManager;
-    aContext.iContext = KSET_HLP_PROTECTED_CONTENT;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::CurrentFeatureId()
-//
-// Return the feature id of selected listitem  
-// ---------------------------------------------------------------------------
-//
-TInt CDRMSettingsPluginContainer::CurrentFeatureId( ) const
-    {
-    return iListboxItemArray->CurrentFeature();
-    }
-
-
-// -----------------------------------------------------------------------------
-// CDRMSettingsPluginContainer::Model()
-//
-//
-// -----------------------------------------------------------------------------
-//
-CDRMSettingsModel* CDRMSettingsPluginContainer::Model()
-    {
-    return iModel;
-    }
-    
-// End of File
--- a/commondrm/drmsettingsplugin/src/drmsettingspluginimplementationtable.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2006 - 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM proxy table for DRMSettinsPlugin
-*
-*/
-
-
-// INCLUDES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "drmsettingsplugin.h"
-
-
-// CONSTANTS
-const TImplementationProxy KDRMSettingsPluginImplementationTable[] =
-    {
-    IMPLEMENTATION_PROXY_ENTRY( 0x102750CD, CDRMSettingsPlugin::NewL )
-    };
-
-
-// ---------------------------------------------------------------------------
-// ImplementationGroupProxy
-//
-// Gate/factory function
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
-                                                  TInt& aTableCount )
-    {
-    aTableCount = sizeof( KDRMSettingsPluginImplementationTable )
-        / sizeof( TImplementationProxy );
-    return KDRMSettingsPluginImplementationTable;
-    }
-
-
-
-// End of File
--- a/commondrm/drmsettingsplugin/src/drmsettingsusagecheckbox.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  CheckBox class for Usage Reporting settings
-*
-*/
-
-
-// INCLUDE FILES
-#include <stringloader.h>
-#include <aknquerydialog.h>
-#include <akninfopopupnotecontroller.h>
-#include <drmsettingspluginrsc.rsg>
-
-#include "drmsettingsusagecheckbox.h"
-#include "drmsettingsusagelist.h"
-#include "drmsettingsmodel.h"
-
-// ================= MEMBER FUNCTIONS =======================
-
-// -----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::CDrmSettingUsageCheckBox
-// Default constructor.
-// -----------------------------------------------------------------------------
-//
-CDrmSettingUsageCheckBox::CDrmSettingUsageCheckBox( 
-    TInt aResourceId,
-    CDRMSettingUsageList* aList,
-    CDRMSettingsModel* aModel ) : CAknCheckBoxSettingPage( aResourceId, aList ),
-                                  iList( aList ),
-                                  iModel( aModel )
-    {
-	}
-
-// ----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::~CDrmSettingUsageCheckBox
-//
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CDrmSettingUsageCheckBox::~CDrmSettingUsageCheckBox()
-    {
-    delete iPopupController;
-    }
-
-// -----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::OfferKeyEventL
-// -----------------------------------------------------------------------------
-//
-TKeyResponse CDrmSettingUsageCheckBox::OfferKeyEventL( 
-    const TKeyEvent& aKeyEvent,
-    TEventCode aType )
-    {
-    TKeyResponse response( EKeyWasNotConsumed );
-    if ( aKeyEvent.iCode != EKeyApplicationF )
-        {
-        response = this->ListBoxControl()->OfferKeyEventL( aKeyEvent, aType );
-        }
-    
-    if ( aType == EEventKeyUp )
-        {
-        ShowInfoPopupL();
-        }
-    
-    return response;
-    }
-
-// -----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::DynamicInitL
-// -----------------------------------------------------------------------------
-//
-void CDrmSettingUsageCheckBox::DynamicInitL()
-    {
-    HBufC* emptyText( StringLoader::LoadLC( R_USAGE_REPORTING_LIST_EMPTY,
-                                            iEikonEnv ) );
-	this->ListBoxControl()->View()->SetListEmptyTextL( *emptyText );
-	CleanupStack::PopAndDestroy( emptyText );
-	}
-
-// -----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::OkToExitL
-// -----------------------------------------------------------------------------
-//
-TBool CDrmSettingUsageCheckBox::OkToExitL( TBool aAccept )
-    {
-    TBool exit( ETrue );
-    
-    if ( aAccept )
-        {
-        iList->UpdateContexts();
-    
-        if ( !iModel->IsMeteringAllowedForAll() )
-            {
-            HBufC* query( StringLoader::LoadLC( R_DRM_CONF_QUERY_METERING,
-                                                iEikonEnv ) );
-        
-            CAknQueryDialog* queryDialog( CAknQueryDialog::NewL() );
-        
-            TBool retVal( queryDialog->ExecuteLD( R_DRM_CONFIRMATION_QUERY_METERING,
-                                                  *query ) );
-            CleanupStack::PopAndDestroy( query );
-            
-            if ( !retVal )
-                {
-                exit = EFalse;
-                }
-            }
-        }
-    
-    return exit;
-    }
-
-// -----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::AcceptSettingL
-// -----------------------------------------------------------------------------
-//
-void CDrmSettingUsageCheckBox::AcceptSettingL()
-    {
-    iModel->SaveMeteringChanges();
-    }
-
-// -----------------------------------------------------------------------------
-// CDrmSettingUsageCheckBox::ShowInfoPopupL
-// -----------------------------------------------------------------------------
-//
-void CDrmSettingUsageCheckBox::ShowInfoPopupL()
-    {
-    if ( !iPopupController )
-        {
-        iPopupController = CAknInfoPopupNoteController::NewL();
-        }
-    TInt index( this->ListBoxControl()->View()->CurrentItemIndex() );
-    if ( index != -1 )
-        {
-        iPopupController->SetTextL( iList->At(index)->ItemText() );
-        iPopupController->ShowInfoPopupNote();    
-        }
-    }
-
-//  End of File
--- a/commondrm/drmsettingsplugin/src/drmsettingsusagelist.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  List class for Usage Reporting checkbox
-*
-*/
-
-
-// INCLUDE FILES
-#include "drmsettingsusagelist.h"
-#include "drmsettingsmodel.h"
-
-// CONSTANTS
-const TInt KDRMSettingsListGranularity( 5 );
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ----------------------------------------------------------------------------
-// CDRMSettingUsageList::NewL
-// Two-phased constructor.
-// ----------------------------------------------------------------------------
-//
-CDRMSettingUsageList* CDRMSettingUsageList::NewL( 
-    CDRMSettingsModel* aModel )
-    {
-    CDRMSettingUsageList* self( 
-        new( ELeave ) CDRMSettingUsageList( aModel ) );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-	CleanupStack::Pop( self );
-    return self;
-    }
-    
-// ----------------------------------------------------------------------------
-// CDRMSettingUsageList::CDRMSettingUsageList
-// Default constructor.
-// ----------------------------------------------------------------------------
-//
-CDRMSettingUsageList::CDRMSettingUsageList( CDRMSettingsModel* aModel ) 
-    : CSelectionItemList( KDRMSettingsListGranularity ), iModel( aModel )
-    {
-	}
-
-// ----------------------------------------------------------------------------
-// CDRMSettingUsageList::ConstructL
-// ----------------------------------------------------------------------------
-//
-void CDRMSettingUsageList::ConstructL()
-    {
-    for ( TInt i( 0 ); i < iModel->GetRiContextCount(); i++ )
-        {
-        HBufC* alias( iModel->GetSingleRIAliasL( i ) );
-        CleanupStack::PushL( alias );
-        TBool isAllowed( iModel->IsMeteringAllowed( i ) );
-        CSelectableItem* selItem( new (ELeave) CSelectableItem( *alias, 
-                                                                isAllowed ) );
-        selItem->ConstructL();
-        this->AppendL( selItem );
-        CleanupStack::PopAndDestroy( alias );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CDRMSettingUsageList::~CDRMSettingUsageList
-//
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CDRMSettingUsageList::~CDRMSettingUsageList()
-    {
-    this->ResetAndDestroy();
-    }
-
-// ----------------------------------------------------------------------------
-// CDRMSettingUsageList::UpdateContexts
-// ----------------------------------------------------------------------------
-//
-void CDRMSettingUsageList::UpdateContexts()
-    {
-    for ( TInt i( 0 ); i < iModel->GetRiContextCount(); i++ )
-        {
-        CSelectableItem* selItem( this->At( i ) );
-        iModel->SetMeteringStatus( i, selItem->SelectionStatus() );
-        }
-    }
-	
-//  End of File
--- a/commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/group/DrmUtilityDmgrWrapper.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -28,6 +28,7 @@
 
 #ifdef __DRM
 SOURCE         ../src/DrmUtilityDmgrWrapper.cpp
+SOURCE         ../src/drmutilityconnection.cpp
 #endif
 
 START RESOURCE ../data/DrmUtilityDmgrWrapper.rss
@@ -39,13 +40,14 @@
 USERINCLUDE    ../inc
 USERINCLUDE    ../../../omadrm/drmengine/roap/inc
 USERINCLUDE    ../../../inc   // ADo level inc dir
-
+USERINCLUDE    ../traces      // OST definitions 
 // Default system include paths for middleware layer modules.
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY        euser.lib
-LIBRARY        centralrepository.lib
-LIBRARY        cmmanager.lib
+LIBRARY        cmmanager.lib // RCmManager CCmApplicationSettingsUi
+LIBRARY        esock.lib // RConnection, RSocketServ
+LIBRARY        extendedconnpref.lib netmeta.lib // TExtendedConnPref
 LIBRARY        downloadmgr.lib
 LIBRARY        roaphandler.lib
 LIBRARY        efsrv.lib
--- a/commondrm/drmutility/inc/DrmAutomatedUsageImpl.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/DrmAutomatedUsageImpl.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,12 +23,12 @@
 #include <f32file.h>
 #include <caf/caftypes.h>
 #include <caf/data.h>
-#include <drmrightsclient.h>
+#include <DRMRightsClient.h>
 #include <drmautomatedusage.h>
 #include <drmautomatedusageobserver.h>
 
 #include "rdrmhelperclient.h"
-#include "drmqueue.h"
+#include "DrmQueue.h"
 
 //forward declarations
 class CDRMConstraint;
@@ -607,7 +607,7 @@
     * From CActive Called if RunL leaves
     */
     TInt RunError( TInt aError );
-	    
+
 
 private: // Member functions
 
@@ -615,7 +615,7 @@
                             CDrmUtility* aDrmUtility );
 
     void ConstructL();
-    
+
     void Activate( TRequestStatus*& aStatus );
 
     // Checks whether there exists suitable oma RO for automated use
@@ -661,10 +661,10 @@
     // own
     CDrmUtilityUI* iDrmUtilityUi;
 
-	 // Async observer and current operation id for async operations
-	 // not own
+     // Async observer and current operation id for async operations
+     // not own
     MDrmAsyncObserver* iObserver;
-	 // not own
+     // not own
     TInt iOperationId;
     };
 }
--- a/commondrm/drmutility/inc/DrmQueue.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/DrmQueue.h	Wed Jun 23 17:42:58 2010 +0100
@@ -83,11 +83,11 @@
     C* PopFront();
 
     /**
-    * Checks 
+    * Checks
     * implementation
     * @param[in]   aId : ID representing data to be popped from queue
-    * @return      Pointer to data object in queue, NULL if not found 
-    * 
+    * @return      Pointer to data object in queue, NULL if not found
+    *
     */
     C* PopItem( TInt aId );
 
@@ -119,6 +119,6 @@
 }
 
 // Since it's a template class include the implementation
-#include "drmqueue.inl"
+#include "DrmQueue.inl"
 
 #endif // CDRMAUTOMATEDUSAGE_H
--- a/commondrm/drmutility/inc/DrmRightsInfoImpl.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/DrmRightsInfoImpl.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,17 +22,17 @@
 //*** system include files go here:
 #include <e32base.h>
 #include <f32file.h>
-#include <caf/caftypes.h> 
-#include <drmrightsclient.h>
+#include <caf/caftypes.h>
+#include <DRMRightsClient.h>
 #include <drmutilitytypes.h>
 
-namespace DRM 
+namespace DRM
 {
     //*** Forward declarations
     class CDrmRightsInfoData;
     class MDrmAsyncObserver;
     class CDrmUtilityCommon;
-    
+
  /**
   *  Utility class for DRM related rights information handling
   *
@@ -43,7 +43,7 @@
     {
 
 public:
-	
+
     IMPORT_C static CDrmRightsInfoImpl* NewL();
 
     IMPORT_C static CDrmRightsInfoImpl* NewLC();
@@ -56,12 +56,12 @@
      *
      * @param[in]   aUniqueId : The unique identifier or the content
      * @param[in]   aIntent : The intent for the rights to check
-     * @param[out]  aDetails : Details of the rights status 
+     * @param[out]  aDetails : Details of the rights status
      * @return none
      * @leave System wide error code
-     */	
-    IMPORT_C void CheckRightsL( 
-        const TDesC& aUniqueId, 
+     */
+    IMPORT_C void CheckRightsL(
+        const TDesC& aUniqueId,
         ContentAccess::TIntent aIntent,
         TDrmRightsInfo& aDetails );
 
@@ -70,16 +70,16 @@
      *
      * @param[in]   aUniqueId   The unique identifier or the content
      * @param[in]   aIntent     The intent for the rights to check
-     * @param[out]  aDetails    Details of the rights status 
+     * @param[out]  aDetails    Details of the rights status
      * @param[in]   aObserver   Observer which gets reported of
      *                          the async operation
      *
      * @return Operation identifier
      *
      * @leave System wide error code
-     */	
-    IMPORT_C TInt CheckRightsAsyncL( 
-        const TDesC& aUniqueId, 
+     */
+    IMPORT_C TInt CheckRightsAsyncL(
+        const TDesC& aUniqueId,
         ContentAccess::TIntent aIntent,
         TDrmRightsInfo& aDetails,
         MDrmAsyncObserver& aObserver );
@@ -90,18 +90,18 @@
      *
      * @since S60 v5.0
      * @param[in]   aOperationId    identifier of the async operation
-     *                              to be cancelled      
+     *                              to be cancelled
      * @return KErrNotFound if the operation has already been executed
      *         or it does not exist
      */
-    IMPORT_C TInt CancelOperation( TInt aOperationId ); 
-    
+    IMPORT_C TInt CancelOperation( TInt aOperationId );
+
 
 public: // From base classes
 
 
 protected: // Functions from base classes
-        
+
     /**
     * From CActive Cancels async request.
     */
@@ -115,7 +115,7 @@
     /**
     * From CActive Called when RunL leaves
     */
- 	TInt RunError( TInt aError );
+    TInt RunError( TInt aError );
 
 private:
 
@@ -126,7 +126,7 @@
     void PerformCheckRightsL( CDrmRightsInfoData& aData );
 
     void AppendToQueue( CDrmRightsInfoData* aData );
-    
+
     CDrmRightsInfoData* PopFront();
 
 
@@ -134,25 +134,25 @@
 
     // DrmUtilityCommon
     CDrmUtilityCommon* iDrmUtilityCommon;
-    
+
     // Oma Drm client
     RDRMRightsClient iOmaClient;
-    
+
     // WM Drm Client
     // RWMDrmClient iWmClient;
-    
+
     // current request status:
     MDrmAsyncObserver* iObserver;
     TInt iOperationId;
-    
+
     // Operation Queue:
     CDrmRightsInfoData* iFirst;
     CDrmRightsInfoData* iLast;
-    
+
     // To prevent queue handling from being messed up by threads
     RSemaphore iSemaphore;
     };
-    
+
 }
 
 #endif // CDRMRIGHTSINFOIMPL_H
--- a/commondrm/drmutility/inc/DrmUiHandlingImpl.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/DrmUiHandlingImpl.h	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,11 +22,11 @@
 //*** system include files go here:
 #include <e32base.h>
 #include <f32file.h>
-#include <aknserverapp.h>
+#include <AknServerApp.h>
 #include <caf/caftypes.h>
 #include <caf/caferr.h>
 #include <drmagents.h>
-#include <drmrightsclient.h>
+#include <DRMRightsClient.h>
 #include <drmutilitytypes.h>
 
 //*** forward declarations go here:
@@ -518,12 +518,12 @@
     /**
     * From CActive Called when async request completes.
     */
-	void RunL();
+    void RunL();
 
     /**
     * From CActive Called when RunL leaves
     */
-	TInt RunError( TInt aError );
+    TInt RunError( TInt aError );
 
 private:
 
@@ -768,7 +768,7 @@
     TBool LaunchBrowserL( const HBufC* aUrl );
 
     /**
-    * Get rights silently, if notes are not intended to be shown, put aShowNotes to EFalse 
+    * Get rights silently, if notes are not intended to be shown, put aShowNotes to EFalse
     */
     TInt GetSilentRightsL( const TDesC8& aUrl, const TBool aShowNotes );
 
@@ -778,20 +778,10 @@
     TBool SilentRightsAllowedL();
 
     /**
-    * Check if browser AP has been defined
-    */
-    TBool BrowserAPDefinedL();
-
-    /**
-    * Returns the number of access points on phone
-    */
-    TInt APCountL();
-
-    /**
     * Handles exit from service
     * from MAknServerAppExitObserver
     */
-	void HandleServerAppExit(TInt aReason);
+    void HandleServerAppExit(TInt aReason);
 
     /**
      * Appends new async request data to async operation queue.
@@ -813,7 +803,7 @@
 
     /**
     * Gets SilentRights and
-    * checks status after 
+    * checks status after
     * CallSilentAvailble after right
     * @return Etrue, if silent RO rerieval led to usable content
     */
--- a/commondrm/drmutility/inc/DrmUtilityDmgrWrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  
-*
-*/
-
-
-#ifndef CDRMUTILITYDMGRWRAPPER_H
-#define CDRMUTILITYDMGRWRAPPER_H
-
-#include <DownloadMgrClient.h>
-#include <aknprogressdialog.h>
-#include <eikprogi.h>
-
-/**
-* Environment gate function
-*
-* @since S60 v5.0
-* @return pointer to DMgr handler
-*/
-IMPORT_C TAny* GateFunctionDMgr();
-
-class MDrmUtilityDmgrWrapper
-    {
-
-public:
-    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0;
-
-    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl,
-        CCoeEnv& aCoeEnv ) = 0;
-
-    virtual HBufC8* GetErrorUrlL() = 0;
-
-    };
-
-/**
-*  Class for downloading ROAP triggers
-*
-*  @lib DrmUtilityDmgrWrapper
-*  @since S60 v5.0
-*/
-class CDrmUtilityDmgrWrapper : CBase, 
-    public MHttpDownloadMgrObserver, 
-    public MDrmUtilityDmgrWrapper,
-    public MProgressDialogCallback
-    {
-
-public:
-
-    static CDrmUtilityDmgrWrapper* NewL();
-
-    static CDrmUtilityDmgrWrapper* NewLC();
-
-    virtual ~CDrmUtilityDmgrWrapper();
-
-    /**
-    * Download a ROAP trigger from URL and handle it
-    *
-    * @param aUrl  URL of ROAP trigger
-    */
-    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
-
-    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl,  
-        CCoeEnv& aCoeEnv );
-
-    HBufC8* GetErrorUrlL();
-
-
-    // from base class MHttpDownloadMgrObserver
-
-    /**
-    * From MHttpDownloadMgrObserver.
-    * Handle download manager events
-    *
-    * @param aDownload the download
-    * @param aEvent the event
-    */
-    void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
-
-public: // Call back methods of MAknProgressDialogCallback
-
-    /**
-    * ProgressDialog call back method.
-    * Get's called when a dialog is dismissed.
-    *
-    * @param aButtonId ID of the button pressed
-    */
-    void DialogDismissedL( TInt aButtonId );
-
-protected:
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    CDrmUtilityDmgrWrapper();
-
-    void ConstructL();
-
-    /**
-    * Set the browser default access point to be used
-    */
-    void SetDefaultAccessPointL();
-
-    void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
-
-    void ShowProgressNoteL( );
-
-    void RemoveProgressNoteL( );
-
-    void HandlePostResponseUrlL();
-
-
-private: // data
-
-    /**
-    * Download manager session
-    */
-    RHttpDownloadMgr iDlMgr;
-
-    /**
-    * Used to make downloads synchronous
-    */
-    CActiveSchedulerWait iWait;
-
-    /**
-    * to store information on download
-    */
-    TBool iDownloadSuccess;
-    TBool iConnectionError;
-
-    TBool iDialogDismissed;
-
-    /**
-    * Progess note dialog and progress info
-    */
-    CAknProgressDialog* iProgressNoteDialog;        // owned
-    CEikProgressInfo* iProgressInfo;                // not owned
-    TInt iCurrentProgressValue;                     // owned
-    TInt iProgressIncrement;                        // owned
-
-    /**
-    * Control environment
-    */
-    CCoeEnv* iCoeEnv;
-
-    /**
-    * Is CoeEnv given
-    */
-    TBool iUseCoeEnv;
-
-    /**
-    * Error url for ROAP temporary error
-    */
-    HBufC8* iErrorUrl;
-
-    /**
-    * Post response url for ROAP prUrl
-    */
-    HBufC8* iPostResponseUrl;
-
-    };
-
-#endif // CDRMUTILITYDMGRWRAPPER_H
--- a/commondrm/drmutility/inc/DrmUtilityInfoNoteWrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/DrmUtilityInfoNoteWrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,9 +22,9 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <aknglobalnote.h>
+#include <AknGlobalNote.h>
 
-namespace DRM 
+namespace DRM
 {
 
 /**
@@ -33,14 +33,14 @@
 NONSHARABLE_CLASS ( CDrmUtilityInfoNoteWrapper ) : public CActive
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static CDrmUtilityInfoNoteWrapper* NewL();
-        
+
         static CDrmUtilityInfoNoteWrapper* NewLC();
-        
+
         /**
         * Destructor.
         */
@@ -52,31 +52,31 @@
         /**
         * Synchronous wrapper for showing global note.
         * @param aType type of Info note to be displayed
-        * @param aNoteText string containing note text       
+        * @param aNoteText string containing note text
         * @param aResource resource identifier
-        * @param aString is transferred for CoverUi string data     
+        * @param aString is transferred for CoverUi string data
         * @param aValue is transferred for CoverUi numerical data
         * @return button code
         */
-        void ShowNoteL(  TAknGlobalNoteType aType, 
+        void ShowNoteL(  TAknGlobalNoteType aType,
                          const TDesC& aNoteText,
-                         TInt aResourceId = -1, 
+                         TInt aResourceId = -1,
                          const TDesC& aString = KNullDesC,
                          TInt aValue = -1 );
 
         /**
         * Synchronous wrapper for showing global note.
         * @param[inout] aResourceId takes primary display
-        *               resource ID and returns CoverUiId     
+        *               resource ID and returns CoverUiId
         * @return       boolean if ID was valid CoverUiId
         */
         static TBool EvaluateCoverResourceId( TInt& aResourceId );
-    
+
     private: // From CActive
-    
-    	void DoCancel();
-    	void RunL();
-        
+
+        void DoCancel();
+        void RunL();
+
     private:
 
         /**
@@ -87,16 +87,16 @@
         /**
         * By default Symbian 2nd phase constructor is private.
         */
-        void ConstructL();        
-       
+        void ConstructL();
+
     private: // Data
-        
-        CAknGlobalNote* iNote; 
+
+        CAknGlobalNote* iNote;
     };
 
 }
 
-#endif      // __DRMUTILITYINFONOTEWRAPPER_H__   
-            
+#endif      // __DRMUTILITYINFONOTEWRAPPER_H__
+
 // End of File
 
--- a/commondrm/drmutility/inc/drmutilitycommon.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/drmutilitycommon.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,16 +21,16 @@
 
 //*** system include files go here:
 #include <e32base.h>
-#include <caf/caftypes.h> 
-#include <drmrightsclient.h>
+#include <caf/caftypes.h>
+#include <DRMRightsClient.h>
 #include <drmutilitytypes.h>
 
 //*** forward declarations go here:
 class CDRMConstraint;
 
-namespace DRM 
+namespace DRM
 {
-    
+
  /**
   *  Utility class for DRM related common functions
   *
@@ -47,7 +47,7 @@
      *
      * @return A functional CDrmUtilityCommon -object
      * @leave System wide error code
-     */	
+     */
     IMPORT_C static CDrmUtilityCommon* NewL();
 
     /**
@@ -56,14 +56,14 @@
      *
      * @return A functional CDrmUtilityCommon -object
      * @leave System wide error code
-     */	
+     */
     IMPORT_C static CDrmUtilityCommon* NewLC();
 
     /**
      * Destructor
      */
     virtual ~CDrmUtilityCommon();
-     
+
     /**
      * Checks the rights and their status for a specific unique id
      * implementation
@@ -72,16 +72,16 @@
      * @param[in]   aIntent     The intent for the rights to check
      * @param[out]  aConstraint A Constraint of the future rights,
      *                          must be initialized
-     * 
+     *
      * @return Rights status
      * @leave System wide error code
      * @see ContentAccess:TIntent
-     */	
-    IMPORT_C TDrmRightsInfo GetOmaRightsStatusL( 
-                                            HBufC8*& aContentUri, 
+     */
+    IMPORT_C TDrmRightsInfo GetOmaRightsStatusL(
+                                            HBufC8*& aContentUri,
                                             ContentAccess::TIntent aIntent,
                                             CDRMConstraint* aConstraint );
-                                        
+
 
 protected:
 
@@ -90,9 +90,9 @@
     CDrmUtilityCommon();
 
     void ConstructL();
-    
+
 private: // Data members
-    
+
     // Oma Drm client
     RDRMRightsClient iOmaClient;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commondrm/drmutility/inc/drmutilityconnection.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef   DRMUTILITYCONNECTION_H
+#define   DRMUTILITYCONNECTION_H
+
+#include <e32base.h> // CActive
+#include <es_sock.h> // RConnection, RSocketServ
+
+namespace DRM
+{
+
+ /**
+  *  Utility class for DRMutility dmgr wrapper  related common functions
+  *
+  *  @since S60 v9.2
+  */
+
+
+// CLASS DECLARATION
+// Class for handling internal connectivity logic
+NONSHARABLE_CLASS( CDrmUtilityConnection ): public CActive
+    {
+public:     // Constructors and destructor.
+
+    /**
+    *
+    */
+    static CDrmUtilityConnection * NewL( const TBool aAllowQueries );
+
+    /**
+    *
+    */
+    static CDrmUtilityConnection * NewLC( const TBool aAllowQueries );
+
+    /**
+    * Destructor
+    */
+    ~CDrmUtilityConnection();
+
+public:     // new methods
+
+    /**
+    *
+    */
+    void ConnectL( TRequestStatus* aStatus );
+
+    /**
+    *
+    */
+    void Close();
+
+    /**
+    *
+    */
+    TBool HasMoreConnectionAttempts();
+
+    /**
+    *
+    */
+    TBool IsConnected( TUint32& aIap );
+
+    /**
+    * Check if default connection has been defined
+    * @see RCmManager::ReadDefConnL
+    */
+    static TBool HasDefaultConnectionL();
+
+    /**
+    * Check if system has access points defined
+    */
+    static TBool HasAccessPointsL();
+
+
+
+private: //enumerations
+    enum TConnectionType
+        {
+        EAttachExisting, //0
+        EUsingDefault, //1
+        EUsingPurposeOperator, // 2
+        EUsingPurposeInternet, // 3
+        EUsingQuery, // 4
+        EFail // 5
+        };
+
+    enum TState
+        {
+        EInit, // 0
+        EConnecting, // 1
+        EConnected, // 2
+        EConnectFailed // 3
+        };
+
+private:    // Constructors and destructor.
+
+    /**
+    * Default constructor (for preventing inheritance)
+    */
+    CDrmUtilityConnection( TBool aAllowQueries );
+
+    /**
+    * Second phase constructor
+    */
+    void ConstructL();
+
+private:  // from CActive
+
+    virtual void DoCancel();
+
+    virtual void RunL();
+
+    virtual TInt RunError( TInt aError );
+
+private:    // new methods
+
+    /**
+    *
+    */
+    void DoClose();
+
+    /**
+    *
+    */
+    void Done();
+
+    /**
+    *
+    */
+    void InitL();
+
+    /**
+    *
+    */
+    void AttachExistingConnectionL();
+
+    /**
+    *
+    */
+    void ConnectUsingDefaultL();
+
+    /**
+    *
+    */
+    void ConnectUsingSnapPurposeL( const TUint32 aPurpose );
+
+    /**
+    *
+    */
+    void ConnectUsingQueryL();
+
+    /**
+    *
+    */
+    void UpdateIapIdL();
+
+    /**
+    *
+    */
+    void CompleteSelf( TInt aError );
+
+    /**
+    *
+    */
+    void CompleteParent( TInt aError );
+
+private:    // data
+
+    RSocketServ iSocketServ;
+    RConnection iConnection;
+    TState iState;
+    TConnectionType iType;
+    TRequestStatus* iParentStatus;
+    const TBool iAllowQueries;
+    TUint32 iIapId;
+    };
+}
+#endif /* DRMUTILITYCONNECTION_H */
--- a/commondrm/drmutility/inc/drmutilityui.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/drmutilityui.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 //*** system include files go here:
 #include <e32base.h>
 #include <f32file.h>
-#include <aknnotifystd.h>
+#include <AknNotifyStd.h>
 
 //*** forward declarations go here:
 class CDRMConstraint;
@@ -37,12 +37,12 @@
     class CData;
     }
 
-namespace DRM 
+namespace DRM
 {
-    
+
     //*** forward declarations go here:
     class CDrmUtilityInfoNoteWrapper;
-    
+
  /**
   *  Utility class for DRM utility related graphic functions
   *
@@ -59,7 +59,7 @@
      *
      * @return A functional CDrmUtilityUI -object
      * @leave System wide error code
-     */	
+     */
     IMPORT_C static CDrmUtilityUI* NewL( CCoeEnv* aCoeEnv = NULL );
 
     /**
@@ -68,36 +68,36 @@
      *
      * @return A functional CDrmUtilityUI -object
      * @leave System wide error code
-     */	
+     */
     IMPORT_C static CDrmUtilityUI* NewLC( CCoeEnv* aCoeEnv = NULL );
 
     /**
      * Destructor
      */
     virtual ~CDrmUtilityUI();
-     
+
     /**
     * Display query dialog
     */
-    IMPORT_C TInt DisplayQueryWithIdL( TInt aTextResourceId, 
+    IMPORT_C TInt DisplayQueryWithIdL( TInt aTextResourceId,
                                        TInt aQueryResourceId );
-    
-    IMPORT_C TInt DisplayQueryWithIdValueL( TInt aTextResourceId, 
-                                            TInt aQueryResourceId, 
+
+    IMPORT_C TInt DisplayQueryWithIdValueL( TInt aTextResourceId,
+                                            TInt aQueryResourceId,
                                             const TDesC& aString );
-    
+
     IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, TInt aValue );
-    
+
     IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, const TDesC& aString );
-    
-    IMPORT_C TInt DisplayQueryL( TInt aTextResourceId, 
-        	                     const TDesC& aString, 
+
+    IMPORT_C TInt DisplayQueryL( TInt aTextResourceId,
+                                 const TDesC& aString,
                                  TInt aValue,
-        	                     TInt aStringPos = -1,
-        	                     TInt aValuePos = -1 );
-    
+                                 TInt aStringPos = -1,
+                                 TInt aValuePos = -1 );
+
     IMPORT_C TInt DisplayQueryL( TDesC& aPromptText, TInt aQueryResourceId );
-    
+
     IMPORT_C TInt SetAutomatedQueryL( CDRMConstraint* aConstraint );
 
    /**
@@ -106,22 +106,22 @@
     IMPORT_C void ShowFutureRightsNoteL( CDRMConstraint* aConstraint );
 
     IMPORT_C void DisplayNoteL( TInt aTextResourceId );
-    
+
     IMPORT_C void DisplayNoteL( TInt aTextResourceId, const TDesC& aString );
-    
+
     IMPORT_C void DisplayNoteL( TInt aTextResourceId, TInt aValue );
-    
-    IMPORT_C void DisplayNoteL( TDesC& aPromptText, 
-                                TInt aResourceId, 
-                                const TDesC& aString = KNullDesC, 
-                                TInt aValue = -1 );   
-                                
+
+    IMPORT_C void DisplayNoteL( TDesC& aPromptText,
+                                TInt aResourceId,
+                                const TDesC& aString = KNullDesC,
+                                TInt aValue = -1 );
+
    /**
     * Display list query
     */
-    IMPORT_C TInt DisplayPopupWindowsForPreviewL( 
+    IMPORT_C TInt DisplayPopupWindowsForPreviewL(
                                                 ContentAccess::CData& aContent,
-                                                TInt aPreviewType, 
+                                                TInt aPreviewType,
                                                 TInt aMediaType );
 
 
@@ -132,21 +132,21 @@
     CDrmUtilityUI( CCoeEnv* aCoeEnv );
 
     void ConstructL();
-    
+
     CAknResourceNoteDialog* CreateNoteForResourceL( TInt aResId );
-    
+
     TAknGlobalNoteType GlobalNoteTypeForResource( TInt aResId );
-    
+
     TInt GetOmaStartTime( CDRMConstraint* aConstraint, TTime& aStartTime );
-    
+
     TInt EvaluatePreviewMediaTypeL( ContentAccess::CData& aContent,
                                     TInt aPreviewType );
-    
-    void PrepareSecondaryDisplayL( CEikDialog& aDialog, 
+
+    void PrepareSecondaryDisplayL( CEikDialog& aDialog,
                                    TInt aResourceId,
-                                   const TDesC& aString = KNullDesC, 
+                                   const TDesC& aString = KNullDesC,
                                    TInt aValue = -1 );
-                                   
+
     void CancelSecondaryDisplayL( TInt aResourceId );
 
 
@@ -154,7 +154,7 @@
 
     // Control environment, not owned
     CCoeEnv* iCoeEnv;
-    
+
     // Paths of the resource files
     HBufC* iUtilityResourceFile;
     HBufC* iAvkonResourceFile;
@@ -166,10 +166,10 @@
     // Used to read resources when CoeEnv is not available
     CStringResourceReader* iUtilityStringResourceReader;
     CStringResourceReader* iAvkonStringResourceReader;
-    
+
     // File server
     RFs iFs;
-    
+
     // Used to queue up global notes
     RPointerArray<CDrmUtilityInfoNoteWrapper> iNoteList;
 
--- a/commondrm/drmutility/inc/drmutilitywmdrmwrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/inc/drmutilitywmdrmwrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,8 +22,9 @@
 //*** system include files go here:
 #include <e32base.h>
 #include <f32file.h>
-#include <aknserverapp.h>
+#include <AknServerApp.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <drmutilitytypes.h>
 
 //*** user include files go here:
--- a/commondrm/drmutility/src/DrmAutomatedUsage.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmAutomatedUsage.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 #include    <caf/data.h>
 #include    <drmautomatedusage.h>
 
-#include    "drmautomatedusageimpl.h"
+#include    "DrmAutomatedUsageImpl.h"
 #include    "drmautomatedusageerrorhandling.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -164,9 +164,9 @@
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
     iUtility->CheckFileHandleL( aFile );
-    iImplementation->SetAutomatedL( aFile, 
-                                    aIntent, 
-                                    aAutomatedType, 
+    iImplementation->SetAutomatedL( aFile,
+                                    aIntent,
+                                    aAutomatedType,
                                     aServiceType );
     }
 
@@ -184,10 +184,10 @@
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
     iUtility->CheckFileHandleL( aFile );
-    return iImplementation->SetAutomatedAsyncL( aFile, 
-                                                aIntent, 
-                                                aAutomatedType, 
-                                                aObserver, 
+    return iImplementation->SetAutomatedAsyncL( aFile,
+                                                aIntent,
+                                                aAutomatedType,
+                                                aObserver,
                                                 aServiceType );
     }
 
@@ -203,8 +203,8 @@
     const DRM::TDrmAutomatedType aAutomatedType,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    iImplementation->SetAutomatedL( aData, 
-                                    aIntent, 
+    iImplementation->SetAutomatedL( aData,
+                                    aIntent,
                                     aAutomatedType,
                                     aServiceType );
     }
@@ -222,10 +222,10 @@
     DRM::MDrmAsyncObserver& aObserver,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    return iImplementation->SetAutomatedAsyncL( aData, 
-                                                aIntent, 
-                                                aAutomatedType, 
-                                                aObserver, 
+    return iImplementation->SetAutomatedAsyncL( aData,
+                                                aIntent,
+                                                aAutomatedType,
+                                                aObserver,
                                                 aServiceType );
     }
 
@@ -242,9 +242,9 @@
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
     iUtility->CheckFileHandleL( aFile );
-    iImplementation->RemoveAutomatedL( aFile, 
-                                       aIntent, 
-                                       aAutomatedType, 
+    iImplementation->RemoveAutomatedL( aFile,
+                                       aIntent,
+                                       aAutomatedType,
                                        aServiceType );
     }
 
@@ -262,10 +262,10 @@
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
     iUtility->CheckFileHandleL( aFile );
-    return iImplementation->RemoveAutomatedAsyncL( aFile, 
-                                                   aIntent, 
-                                                   aAutomatedType, 
-                                                   aObserver, 
+    return iImplementation->RemoveAutomatedAsyncL( aFile,
+                                                   aIntent,
+                                                   aAutomatedType,
+                                                   aObserver,
                                                    aServiceType );
     }
 
@@ -281,9 +281,9 @@
     const DRM::TDrmAutomatedType aAutomatedType,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    iImplementation->RemoveAutomatedL( aData, 
-                                       aIntent, 
-                                       aAutomatedType, 
+    iImplementation->RemoveAutomatedL( aData,
+                                       aIntent,
+                                       aAutomatedType,
                                        aServiceType );
     }
 
@@ -300,10 +300,10 @@
     DRM::MDrmAsyncObserver& aObserver,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    return iImplementation->RemoveAutomatedAsyncL( aData, 
-                                                   aIntent, 
-                                                   aAutomatedType, 
-                                                   aObserver, 
+    return iImplementation->RemoveAutomatedAsyncL( aData,
+                                                   aIntent,
+                                                   aAutomatedType,
+                                                   aObserver,
                                                    aServiceType );
     }
 
@@ -319,9 +319,9 @@
     const DRM::TDrmAutomatedType aAutomatedType,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    iImplementation->RemoveAutomatedL( aUniqueId, 
-                                       aIntent, 
-                                       aAutomatedType, 
+    iImplementation->RemoveAutomatedL( aUniqueId,
+                                       aIntent,
+                                       aAutomatedType,
                                        aServiceType );
     }
 
@@ -338,10 +338,10 @@
     DRM::MDrmAsyncObserver& aObserver,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    return iImplementation->RemoveAutomatedAsyncL( aUniqueId, 
-                                                   aIntent, 
-                                                   aAutomatedType, 
-                                                   aObserver, 
+    return iImplementation->RemoveAutomatedAsyncL( aUniqueId,
+                                                   aIntent,
+                                                   aAutomatedType,
+                                                   aObserver,
                                                    aServiceType );
     }
 
--- a/commondrm/drmutility/src/DrmAutomatedUsageImpl.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmAutomatedUsageImpl.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,14 +19,14 @@
 // INCLUDE FILES
 #include    <caf/caftypes.h>
 #include    <caf/data.h>
-#include    <oma2agent.h>
+#include    <Oma2Agent.h>
 #include    <utf.h>
-#include    <drmrights.h>
+#include    <DRMRights.h>
 #include    <drmagents.h>
 #include    <e32cmn.h>
 #include    <drmutility.h>
 
-#include    "drmautomatedusageimpl.h"
+#include    "DrmAutomatedUsageImpl.h"
 #include    "drmautomatedusagedata.h"
 #include    "drmutilityui.h"
 
@@ -68,16 +68,16 @@
                               const CDRMConstraint *aSecond )
     {
     TBool equal( EFalse );
-    TInt64 startDifference( 
+    TInt64 startDifference(
         aFirst->iIntervalStart.Int64() - aSecond->iIntervalStart.Int64() );
 
-    if( aFirst->iInterval == aSecond->iInterval && 
-        -KTimeMarginal <= startDifference  && 
+    if( aFirst->iInterval == aSecond->iInterval &&
+        -KTimeMarginal <= startDifference  &&
         startDifference <= KTimeMarginal )
         {
         equal = ETrue;
         }
-    return equal;    
+    return equal;
     }
 
 
@@ -105,7 +105,7 @@
     // constraint has counters, timed counters or accumulated
     if ( aConstraint->iActiveConstraints &  ( EConstraintCounter |
                                               EConstraintTimedCounter |
-                                              EConstraintAccumulated ) ) 
+                                              EConstraintAccumulated ) )
         {
         return ETrue;
         }
@@ -128,7 +128,7 @@
                                      iCoeEnv( aCoeEnv ),
                                      iDrmUtility( aDrmUtility )
     {
-    
+
     }
 
 // -----------------------------------------------------------------------------
@@ -155,11 +155,11 @@
 // -----------------------------------------------------------------------------
 //
 EXPORT_C DRM::CDrmAutomatedUsageImpl* DRM::CDrmAutomatedUsageImpl::NewL(
-    CCoeEnv* aCoeEnv, 
+    CCoeEnv* aCoeEnv,
     DRM::CDrmUtility* aDrmUtility )
     {
-    DRM::CDrmAutomatedUsageImpl* self( 
-                        DRM::CDrmAutomatedUsageImpl::NewLC( aCoeEnv, 
+    DRM::CDrmAutomatedUsageImpl* self(
+                        DRM::CDrmAutomatedUsageImpl::NewLC( aCoeEnv,
                                                             aDrmUtility ) );
     CleanupStack::Pop( self );
     return self;
@@ -175,7 +175,7 @@
     CCoeEnv* aCoeEnv, DRM::CDrmUtility* aDrmUtility )
     {
     DRM::CDrmAutomatedUsageImpl* self(
-                     new( ELeave ) DRM::CDrmAutomatedUsageImpl( aCoeEnv, 
+                     new( ELeave ) DRM::CDrmAutomatedUsageImpl( aCoeEnv,
                                                                 aDrmUtility ) );
     CleanupStack::PushL( self );
     self->ConstructL();
@@ -187,7 +187,7 @@
 DRM::CDrmAutomatedUsageImpl::~CDrmAutomatedUsageImpl()
     {
     DRM::CDrmAutomatedUsageData* data( iDrmQueue->PopFront() );
-    
+
     // Empty the queue:
     while ( data )
         {
@@ -196,17 +196,17 @@
         delete data;
         data = iDrmQueue->PopFront();
         }
-    
+
     delete iDrmQueue;
-    
+
     delete iDrmUtilityUi;
-    
+
     iDrmHelperClient.Close();
-    
+
     //iWmClient.Close();
-    
+
     iOmaClient.Close();
-    
+
     // Remove the object from active scheduler etc.
     if ( IsAdded() )
         {
@@ -244,11 +244,11 @@
         return EFalse;
         }
 
-    ContentAccess::CData* data( 
-            ContentAccess::CData::NewLC( aFile, 
+    ContentAccess::CData* data(
+            ContentAccess::CData::NewLC( aFile,
                                          ContentAccess::KDefaultContentObject,
                                          ContentAccess::EPeek ) );
-                                                              
+
     returnValue = CanSetAutomatedL( *data, aIntent, aAutomatedType );
     CleanupStack::PopAndDestroy( data );
     return returnValue;
@@ -272,7 +272,7 @@
     TBool canSetAutomated( EFalse );
     TBool protectedFile( EFalse );
 
-    User::LeaveIfError( aData.GetAttribute( ContentAccess::EIsProtected, 
+    User::LeaveIfError( aData.GetAttribute( ContentAccess::EIsProtected,
                                             protectedFile ) );
     if ( !protectedFile )
         {
@@ -281,13 +281,13 @@
         }
 
     User::LeaveIfError( aData.GetAttribute( DRM::EDrmAgentUid, agentUid ) );
-                                                
+
     if ( agentUid == DRM::EDrmWmAgent )
         {
         //WMDRM not supported as automated. So no need to continue.
         return EFalse;
         }
-    
+
     uniqueId8 = GetContentIdL( aData );
     CleanupStack::PushL( uniqueId8 );
 
@@ -343,8 +343,8 @@
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
     ContentAccess::CData* data =
-        ContentAccess::CData::NewLC( aFile, 
-                                     ContentAccess::KDefaultContentObject, 
+        ContentAccess::CData::NewLC( aFile,
+                                     ContentAccess::KDefaultContentObject,
                                      ContentAccess::EPeek );
     SetAutomatedL( *data, aIntent, aAutomatedType, aServiceType);
     CleanupStack::PopAndDestroy( data );
@@ -366,14 +366,14 @@
     TInt ret( KErrNone );
 
     ContentAccess::CData* data =
-        ContentAccess::CData::NewLC( aFile, 
-                                     ContentAccess::KDefaultContentObject, 
+        ContentAccess::CData::NewLC( aFile,
+                                     ContentAccess::KDefaultContentObject,
                                      ContentAccess::EPeek );
 
     ret = SetAutomatedAsyncL( *data, aIntent, aAutomatedType, aObserver, aServiceType );
-    
+
     CleanupStack::PopAndDestroy( data );
-    
+
     return ret;
     }
 
@@ -394,17 +394,17 @@
         User::Leave( KErrArgument );
         }
 
-    DRM::CDrmAutomatedUsageData* data( 
-        DRM::CDrmAutomatedUsageData::NewLC( 
+    DRM::CDrmAutomatedUsageData* data(
+        DRM::CDrmAutomatedUsageData::NewLC(
                                 aData,
                                 aIntent,
-                                aAutomatedType, 
-                                NULL, 
+                                aAutomatedType,
+                                NULL,
                                 aServiceType,
                                 DRM::CDrmAutomatedUsageData::ESetAutomated ) );
-    
+
     User::LeaveIfError ( DoSetAutomatedL( data ) );
-    
+
     CleanupStack::PopAndDestroy( data );
     }
 
@@ -426,21 +426,21 @@
         User::Leave( KErrArgument );
         }
 
-    DRM::CDrmAutomatedUsageData* data( 
+    DRM::CDrmAutomatedUsageData* data(
         DRM::CDrmAutomatedUsageData::NewL(
-                                aData, 
-                                aIntent, 
-                                aAutomatedType, 
-                                &aObserver, 
+                                aData,
+                                aIntent,
+                                aAutomatedType,
+                                &aObserver,
                                 aServiceType,
                                 DRM::CDrmAutomatedUsageData::ESetAutomated ) );
 
     iDrmQueue->AppendToQueueL( data );
-    
+
     TRequestStatus* status( &iStatus );
-    
+
     Activate( status );
-    
+
     return data->iOperationId;
     }
 
@@ -457,9 +457,9 @@
     const DRM::TDrmAutomatedType aAutomatedType,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    ContentAccess::CData* data( 
-            ContentAccess::CData::NewLC( aFile, 
-                                         ContentAccess::KDefaultContentObject, 
+    ContentAccess::CData* data(
+            ContentAccess::CData::NewLC( aFile,
+                                         ContentAccess::KDefaultContentObject,
                                          ContentAccess::EPeek ) );
 
     RemoveAutomatedL( *data, aIntent, aAutomatedType, aServiceType );
@@ -480,18 +480,18 @@
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
     TInt ret( KErrNone );
-    
-    ContentAccess::CData* data( 
-            ContentAccess::CData::NewLC( aFile, 
-                                         ContentAccess::KDefaultContentObject, 
+
+    ContentAccess::CData* data(
+            ContentAccess::CData::NewLC( aFile,
+                                         ContentAccess::KDefaultContentObject,
                                          ContentAccess::EPeek ) );
-    
-    ret = RemoveAutomatedAsyncL( *data, 
-                                 aIntent, 
-                                 aAutomatedType, 
-                                 aObserver, 
+
+    ret = RemoveAutomatedAsyncL( *data,
+                                 aIntent,
+                                 aAutomatedType,
+                                 aObserver,
                                  aServiceType );
-    
+
     CleanupStack::PopAndDestroy( data );
     return ret;
     }
@@ -508,17 +508,17 @@
     const DRM::TDrmAutomatedType aAutomatedType,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    DRM::CDrmAutomatedUsageData* data ( 
+    DRM::CDrmAutomatedUsageData* data (
         DRM::CDrmAutomatedUsageData::NewLC(
                             aData,
-                            aIntent, 
-                            aAutomatedType, 
-                            NULL, 
+                            aIntent,
+                            aAutomatedType,
+                            NULL,
                             aServiceType,
                             DRM::CDrmAutomatedUsageData::ERemoveAutomated ) );
-    
+
     User::LeaveIfError( DoRemoveAutomated( data ) );
-    
+
     CleanupStack::PopAndDestroy( data );
     }
 
@@ -535,21 +535,21 @@
     DRM::MDrmAsyncObserver& aObserver,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    DRM::CDrmAutomatedUsageData* data( 
+    DRM::CDrmAutomatedUsageData* data(
         DRM::CDrmAutomatedUsageData::NewL(
-                            aData, 
-                            aIntent, 
-                            aAutomatedType, 
-                            &aObserver, 
+                            aData,
+                            aIntent,
+                            aAutomatedType,
+                            &aObserver,
                             aServiceType,
                             DRM::CDrmAutomatedUsageData::ERemoveAutomated ) );
 
     iDrmQueue->AppendToQueueL( data );
-    
+
     TRequestStatus* status( &iStatus );
-    
+
     Activate( status );
-    
+
     return data->iOperationId;
     }
 
@@ -565,7 +565,7 @@
     const DRM::TDrmAutomatedType aAutomatedType,
     const DRM::TDrmAutomatedServiceType aServiceType )
     {
-    DRM::CDrmAutomatedUsageData* data( 
+    DRM::CDrmAutomatedUsageData* data(
         DRM::CDrmAutomatedUsageData::NewLC(
                             aUniqueId,
                             aIntent,
@@ -573,9 +573,9 @@
                             NULL,
                             aServiceType,
                             DRM::CDrmAutomatedUsageData::ERemoveAutomated ) );
-    
+
     User::LeaveIfError( DoRemoveAutomated( data ) );
-    
+
     CleanupStack::PopAndDestroy( data );
     }
 
@@ -592,21 +592,21 @@
     MDrmAsyncObserver& aObserver,
     const TDrmAutomatedServiceType aServiceType )
     {
-    DRM::CDrmAutomatedUsageData* data( 
+    DRM::CDrmAutomatedUsageData* data(
         DRM::CDrmAutomatedUsageData::NewL(
-                            aUniqueId, 
-                            aIntent, 
-                            aAutomatedType, 
-                            &aObserver, 
+                            aUniqueId,
+                            aIntent,
+                            aAutomatedType,
+                            &aObserver,
                             aServiceType,
                             DRM::CDrmAutomatedUsageData::ERemoveAutomated ) );
 
     iDrmQueue->AppendToQueueL( data );
-    
+
     TRequestStatus* status( &iStatus );
-    
+
     Activate( status );
-    
+
     return data->iOperationId;
     }
 
@@ -651,14 +651,14 @@
     {
     TInt returnValue( KErrNotFound );
     DRM::CDrmAutomatedUsageData* data( iDrmQueue->PopItem( aOperationId ) );
-    
+
     if ( data )
         {
         data->iObserver->OperationCompleted( aOperationId, KErrCancel );
         delete data;
         returnValue = KErrNone;
         }
-    
+
     return returnValue;
     }
 #pragma mark -
@@ -948,49 +948,49 @@
     {
     DRM::CDrmAutomatedUsageData* data( iDrmQueue->PopFront() );
     TRequestStatus *status( &iStatus );
-    
+
     if ( !data )
         {
         return;
         }
-    
-    CleanupStack::PushL( data );        
-    
+
+    CleanupStack::PushL( data );
+
     // Take this into the "current" variable in case an error occurs
     iObserver = data->iObserver;
     iOperationId = data->iOperationId;
-    
+
     TInt err( KErrNone );
-        
+
     switch ( data->iOperation )
         {
         case DRM::CDrmAutomatedUsageData::ESetAutomated:
-            
+
             err = DoSetAutomatedL( data );
-            
+
             break;
-        
+
         case DRM::CDrmAutomatedUsageData::ERemoveAutomated:
-            
+
             err = DoRemoveAutomated( data );
-            
+
             break;
-        
+
         default:
-            
+
             err = KErrArgument;
-            
+
             break;
         }
-    
+
     iObserver->OperationCompleted( iOperationId, err );
-    
+
     CleanupStack::PopAndDestroy( data );
-    
-    // Get ready for another round:    
+
+    // Get ready for another round:
     SetActive();
-    
-    // complete internal request: 
+
+    // complete internal request:
     User::RequestComplete( status, KErrNone );
     }
 
@@ -998,7 +998,7 @@
 // DRM::CDrmAutomatedUsageImpl::RunError
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmAutomatedUsageImpl::RunError( 
+TInt DRM::CDrmAutomatedUsageImpl::RunError(
     TInt aError )
     {
     iObserver->OperationCompleted( iOperationId, aError );
@@ -1017,13 +1017,13 @@
         {
         CActiveScheduler::Add( this );
         }
-   
-    if ( !IsActive() ) 
+
+    if ( !IsActive() )
         {
-        SetActive();        
-    
-        // complete internal request: 
-        User::RequestComplete( aStatus, KErrNone ); 
+        SetActive();
+
+        // complete internal request:
+        User::RequestComplete( aStatus, KErrNone );
         }
     }
 
--- a/commondrm/drmutility/src/DrmRightsInfo.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmRightsInfo.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #include <drmrightsinfo.h>
 #include <drmasyncobserver.h>
 
-#include "drmrightsinfoimpl.h"
+#include "DrmRightsInfoImpl.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
@@ -56,7 +56,7 @@
 EXPORT_C DRM::CDrmRightsInfo* DRM::CDrmRightsInfo::NewL()
     {
     DRM::CDrmRightsInfo* self( NewLC() );
-    
+
     CleanupStack::Pop( self );
 
     return self;
@@ -71,14 +71,14 @@
 EXPORT_C DRM::CDrmRightsInfo* DRM::CDrmRightsInfo::NewLC()
     {
     DRM::CDrmRightsInfo* self( new( ELeave ) CDrmRightsInfo );
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
-    
+
     return self;
     }
 
-    
+
 // Destructor
 DRM::CDrmRightsInfo::~CDrmRightsInfo()
     {
@@ -90,7 +90,7 @@
 // CDrmRightsInfo::GetUtility
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
-//  
+//
 EXPORT_C DRM::CDrmUtility& DRM::CDrmRightsInfo::GetUtility() const
     {
     return *iUtility;
@@ -101,31 +101,31 @@
 // CDrmRightsInfo::CheckRightsL
 // Syncronous method
 // -----------------------------------------------------------------------------
-//	
-EXPORT_C void DRM::CDrmRightsInfo::CheckRightsL( 
-    const TDesC& aUniqueId, 
+//
+EXPORT_C void DRM::CDrmRightsInfo::CheckRightsL(
+    const TDesC& aUniqueId,
     ContentAccess::TIntent aIntent,
     DRM::TDrmRightsInfo& aDetails )
     {
-    iImplementation->CheckRightsL( aUniqueId, aIntent, aDetails );    
+    iImplementation->CheckRightsL( aUniqueId, aIntent, aDetails );
     }
 
 // -----------------------------------------------------------------------------
 // CDrmRightsInfo::CheckRightsL
 // Asyncronous method
 // -----------------------------------------------------------------------------
-//	
-EXPORT_C TInt DRM::CDrmRightsInfo::CheckRightsAsyncL( 
-    const TDesC& aUniqueId, 
+//
+EXPORT_C TInt DRM::CDrmRightsInfo::CheckRightsAsyncL(
+    const TDesC& aUniqueId,
     ContentAccess::TIntent aIntent,
     DRM::TDrmRightsInfo& aDetails,
     DRM::MDrmAsyncObserver& aObserver )
     {
-    TInt operation = iImplementation->CheckRightsAsyncL( aUniqueId, 
-                                                         aIntent, 
-                                                         aDetails, 
+    TInt operation = iImplementation->CheckRightsAsyncL( aUniqueId,
+                                                         aIntent,
+                                                         aDetails,
                                                          aObserver );
-    return operation;                                                
+    return operation;
     }
 
 // -----------------------------------------------------------------------------
@@ -137,6 +137,6 @@
 EXPORT_C TInt DRM::CDrmRightsInfo::CancelOperation( TInt aOperationId )
     {
     return iImplementation->CancelOperation( aOperationId );
-    } 
+    }
 
 //  End of File
--- a/commondrm/drmutility/src/DrmRightsInfoData.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmRightsInfoData.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,7 +17,7 @@
 
 
 // INCLUDE FILES
-#include "drmrightsinfodata.h"
+#include "DrmRightsInfoData.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
@@ -27,7 +27,7 @@
 // CDrmRightsInfoData::NewLC
 // Two-Phase constructor
 // -----------------------------------------------------------------------------
-//     
+//
 DRM::CDrmRightsInfoData* DRM::CDrmRightsInfoData::NewL()
     {
     DRM::CDrmRightsInfoData* self( NewLC() );
@@ -40,41 +40,41 @@
 // CDrmRightsInfoData::NewLC
 // Two-Phase constructor
 // -----------------------------------------------------------------------------
-//     
+//
 DRM::CDrmRightsInfoData* DRM::CDrmRightsInfoData::NewLC()
     {
     DRM::CDrmRightsInfoData* self( new (ELeave) CDrmRightsInfoData );
     CleanupStack::PushL( self );
     self->ConstructL();
-    return self;    
+    return self;
     }
 
 // -----------------------------------------------------------------------------
 // Constructor
 // -----------------------------------------------------------------------------
-//  
+//
 DRM::CDrmRightsInfoData::CDrmRightsInfoData()
-	{
-	}
-	
+    {
+    }
+
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
-//  
+//
 DRM::CDrmRightsInfoData::~CDrmRightsInfoData()
-	{
-	delete iUniqueId;
-	delete iUniqueId8;
-	}
-	
+    {
+    delete iUniqueId;
+    delete iUniqueId8;
+    }
+
 // -----------------------------------------------------------------------------
 // CDrmRightsInfoData::ConstructL
 // Second phase constructor
 // -----------------------------------------------------------------------------
-//  
+//
 void DRM::CDrmRightsInfoData::ConstructL()
     {
     }
-    
-    
+
+
 //  End of File
--- a/commondrm/drmutility/src/DrmRightsInfoImpl.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmRightsInfoImpl.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,13 +19,13 @@
 
 // INCLUDE FILES
 #include <caf/caftypes.h>
-#include <oma2agent.h>
+#include <Oma2Agent.h>
 #include <utf.h>
 #include <drmutilitytypes.h>
 #include <drmasyncobserver.h>
 
-#include "drmrightsinfoimpl.h"
-#include "drmrightsinfodata.h"
+#include "DrmRightsInfoImpl.h"
+#include "DrmRightsInfoData.h"
 #include "drmutilitycommon.h"
 
 // CONSTANTS
--- a/commondrm/drmutility/src/DrmUiHandling.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUiHandling.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 #include <coemain.h>
 
 #include "drmuierrorhandling.h"
-#include "drmuihandlingimpl.h"
+#include "DrmUiHandlingImpl.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
--- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
  * All rights reserved.
  * This component and the accompanying materials are made available
  * under the terms of "Eclipse Public License v1.0"
@@ -17,17 +17,10 @@
 
 // INCLUDE FILES
 
-// connection
-#include <cmconnectionmethod.h>
-#include <cmdestination.h>
-#include <cmconnectionmethoddef.h>
-#include <cmmanager.h>
-#include <sacls.h>
-#include <utf.h>
 
 // publish & subscribe
 #include <e32property.h>
-#include <psvariables.h>
+#include <PSVariables.h>
 #include <centralrepository.h>
 
 // coeenv
@@ -36,62 +29,64 @@
 #include <avkon.hrh>
 #include <aknenv.h>
 
-// browser
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <browseruisdkcrkeys.h>
-#endif
-
 // caf
 #include <caf/data.h>
 #include <caf/caftypes.h>
 
 // launching embedded details view
-#include <aknlaunchappservice.h>
-#include <aiwgenericparam.h>
+#include <AknLaunchAppService.h>
+#include <AiwGenericParam.h>
 #include <apgcli.h>
 
 // character conversions
 #include <utf.h>
 
 // handling urls
-#include <schemehandler.h>
+#include <SchemeHandler.h>
 
 // resources
 #include <data_caging_path_literals.hrh>
 #include <drmutility.rsg>
 
 // drm
-#include <oma2agent.h>
+#include <Oma2Agent.h>
 #include <drmagents.h>
-#include <drmpermission.h>
-#include <drmconstraint.h>
-#include <drmrightsclient.h>
+#include <DrmPermission.h>
+#include <DrmConstraint.h>
+#include <DRMRightsClient.h>
 #include <drmutility.h>
 #include <drmutilitytypes.h>
 #include <drmasyncobserver.h>
 #include <drmhandleerrorobserver.h>
 
+//connectivity logic
+#include <cmconnectionmethod.h> // RCmConnectionMethod
+#include <cmdestination.h> // RCmDestination
+#include <cmmanager.h> // RCmManager
+
+
+
 #ifdef _DEBUG
 #include <e32debug.h>
 #endif
 
 #include "drmutilitycommon.h"
 #include "drmutilityui.h"
-#include "drmuihandlingimpl.h"
+#include "DrmUiHandlingImpl.h"
 #include "drmuihandlingdata.h"
-#include "drmutilitydownloadmanager.h"
+#include "DrmUtilityDownloadManager.h"
 #include "drmutilityinternaltypes.h"
 #include "drmuicheckrightsobserver.h"
 #include "drmutilitywmdrm.h"
 #include "drmutilitywmdrmwrapper.h"
 
-#include "roapstorageclient.h"
-#include "drmtypes.h"
+#include "RoapStorageClient.h"
+#include "DRMTypes.h"
 #include "drmsettingsplugininternalcrkeys.h"
-#include "drmricontext.h"
-#include "drmdomaincontext.h"
-
-#include "drmutilityinternalcrkeys.h"      // Cenrep extension for OmaBased
+#include "DRMRIContext.h"
+#include "DRMDomainContext.h"
+
+#include "DrmUtilityInternalcrkeys.h"      // Cenrep extension for OmaBased
 
 // CONSTANTS
 const TInt KCommandHandleErrorFile( 1 );
@@ -104,14 +99,6 @@
 const TInt KCommandHandleUrlData( 8 );
 const TInt KCommandAvailableUrlsFile( 9 );
 const TInt KCommandAvailableUrlsData( 10 );
-// browser
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser =
-    {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint = 0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-const TUint32 KBrowserNGDefaultSnapId = 0x00000053;
-#endif
 
 _LIT( KEncryptedRightsIssuerMatchString, "flk*" );
 
@@ -140,6 +127,67 @@
 
 // ============================= LOCAL FUNCTIONS ===============================
 // -----------------------------------------------------------------------------
+// HasDefaultConnectionL
+// Finds default IAP id
+// @return Etrue: valid AP found
+//         EFalse: valid AP not found
+// @leave system wide error codes
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TBool HasDefaultConnectionL()
+    {
+    TBool hasDefault(EFalse);
+    TCmDefConnValue defConn;
+    RCmManager cmManager;
+    cmManager.OpenLC();
+    cmManager.ReadDefConnL(defConn);
+    if (defConn.iType == ECmDefConnConnectionMethod)
+        {
+        cmManager.GetConnectionMethodInfoIntL(defConn.iId,
+                CMManager::ECmIapId);
+        hasDefault = ETrue;
+        }
+    else if (defConn.iType == ECmDefConnDestination)
+        {
+        RCmDestination dest(cmManager.DestinationL(defConn.iId));
+        CleanupClosePushL(dest);
+
+        if (dest.ConnectionMethodCount() <= 0)
+            {
+            User::Leave(KErrNotFound);
+            }
+
+        RCmConnectionMethod cMeth(dest.ConnectionMethodL(0));
+        CleanupClosePushL(cMeth);
+
+        cMeth.GetIntAttributeL(CMManager::ECmIapId);
+        CleanupStack::PopAndDestroy(&cMeth);
+        CleanupStack::PopAndDestroy(&dest);
+        hasDefault = ETrue;
+        }
+    CleanupStack::PopAndDestroy(&cmManager);
+    return hasDefault;
+    }
+
+// -----------------------------------------------------------------------------
+// HasAccessPointsL
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TBool HasAccessPointsL()
+    {
+    TInt apCount(0);
+    RCmManager cmManager;
+    CleanupClosePushL(cmManager);
+    cmManager.OpenL();
+    RArray<TUint32> aps;
+    CleanupClosePushL(aps);
+    cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue);
+    apCount = aps.Count();
+    CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager
+    return apCount > 0;
+    }
+
+// -----------------------------------------------------------------------------
 // MapToCallError
 // -----------------------------------------------------------------------------
 //
@@ -154,32 +202,19 @@
     }
 
 // -----------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
+// HasDefConn
 // -----------------------------------------------------------------------------
 //
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
-    RCmManager& aCmManager,
-    const TUint32 aDefaultSnap )
+inline TBool HasDefConn()
     {
-    RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
-    CleanupClosePushL( dest );
-    TUint32 iapIdOfDest( 0 );
-
-    if ( dest.ConnectionMethodCount() <= 0 )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-    CleanupClosePushL( cMeth );
-
-    iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-    CleanupStack::PopAndDestroy( &cMeth );
-    CleanupStack::PopAndDestroy( &dest );
-    return iapIdOfDest;
+    TBool found( EFalse );
+
+    TRAP_IGNORE( found = HasDefaultConnectionL() );
+
+    return found;
     }
 
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -1612,12 +1647,12 @@
         {
         permission = iOmaClient.GetActiveRightsL( aIntent, *aContentUri,
             reason );
-            
+
         if( !permission )
             {
             User::Leave( KErrCANoPermission); //coverity check
             }
-            
+
         CleanupStack::PushL( permission );
 
         toplevel = permission->TopLevelConstraint();
@@ -3826,23 +3861,10 @@
     __ASSERT_DEBUG( !aLaunchParam && aUrl && aFullPath,
         User::Panic( KDRMUtilityDebugPanicMessage,
             KDRMUtilityDebugPanicCode ) );
-    _LIT( KSpace, " " );
-
-    RPointerArray<CDRMPermission> uriList;
+    _LIT( KMarker, "\x00" );
+
     TPtr ptr( NULL, 0 );
-
     TInt localId( 0 );
-    TInt err( KErrNone );
-
-        TRAP( err, iOmaClient.GetDBEntriesL( *aUrl, uriList ) );
-
-    if ( uriList.Count() == 1 )
-        {
-        localId = ( uriList[0] )->iUniqueID;
-        }
-
-    uriList.ResetAndDestroy();
-    uriList.Close();
 
     // MaxInt will fit into 10 characters
     HBufC* localIDBuf( HBufC::NewLC( KIntegerMaxLen ) );
@@ -3850,10 +3872,10 @@
     ptr.AppendNum( localId );
 
     // length of startparam and drm protection scheme are always 1 and
-    // 4 spaces are needed
-    const TInt KSpacesBetweenParams( 4 );
+    // 5 markers are needed
+    const TInt KMarkersForParams( 5 );
     TInt length( 1 + aUrl->Length() + ptr.Length() + aFullPath->Length()
-        + KSpacesBetweenParams + 1 );
+        + KMarkersForParams + 1 );
 
     aLaunchParam = HBufC::NewLC( length );
     ptr.Set( aLaunchParam->Des() );
@@ -3869,20 +3891,21 @@
         {
         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
         }
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     ptr.Append( *localIDBuf );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
 
     HBufC* contentUrl( CnvUtfConverter::ConvertToUnicodeFromUtf8L( *aUrl ) );
 
     ptr.Append( *contentUrl );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
 
     // OMA DRM protection scheme
     ptr.AppendNum( EDrmSchemeOmaDrm );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
 
     ptr.Append( *aFullPath );
+    ptr.Append( KMarker );
 
     delete contentUrl;
 
@@ -3902,13 +3925,13 @@
         User::Panic( KDRMUtilityDebugPanicMessage,
             KDRMUtilityDebugPanicCode ) );
     _LIT( KZero, "0" );
-    _LIT( KSpace, " " );
+    _LIT( KMarker, "\x00" );
 
     TPtr ptr( NULL, 0 );
 
     // Length of startparam and drm protection scheme and zero local id
-    // are always 1 and total of 3 spaces are needed
-    TInt length( 1 + aUrl->Length() + 1 + 3 + 1 );
+    // are always 1 and total of 4 markers are needed
+    TInt length( 1 + aUrl->Length() + 1 + 4 + 1 );
 
     aLaunchParam = HBufC::NewLC( length );
     ptr.Set( aLaunchParam->Des() );
@@ -3924,14 +3947,15 @@
         {
         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
         }
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     // Default value 0 for localId in case of WM DRM file
     ptr.Append( KZero );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     ptr.Append( *aUrl );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     // WM DRM protection scheme
     ptr.AppendNum( EDrmSchemeWmDrm );
+    ptr.Append( KMarker );
 
     CleanupStack::Pop( aLaunchParam );
     }
@@ -4032,7 +4056,7 @@
                 R_DRMUTILITY_CONFIRMATION_QUERY );
             }
         }
-    else if ( !BrowserAPDefinedL() )
+    else if ( !(HasDefConn()) )
         {
         buttonCode = EAknSoftkeyNo;
         if ( aShowNotes )
@@ -4045,7 +4069,7 @@
 
     if ( buttonCode == EAknSoftkeyYes || buttonCode == EAknSoftkeyOk )
         {
-        TInt APs( APCountL() );
+        TBool APs( HasAccessPointsL() );
         if ( !APs )
             {
             // No AP defined
@@ -4145,68 +4169,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CDrmUiHandlingImpl::BrowserAPDefinedL
-// -----------------------------------------------------------------------------
-//
-TBool DRM::CDrmUiHandlingImpl::BrowserAPDefinedL()
-    {
-    const TInt KDestinationSelectionMode( 2 );
-    TInt err( KErrNone );
-    TInt ap( 0 );
-    TInt alwaysAsk( 0 );
-    TInt defaultSnap( 0 );
-
-    CRepository* repository( CRepository::NewL( KCRUidBrowser ) );
-    repository->Get( KBrowserDefaultAccessPoint, ap );
-    repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-    repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-    delete repository;
-    if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
-        {
-        alwaysAsk = ETrue;
-        }
-    else
-        {
-        RCmManager cmManager;
-        CleanupClosePushL( cmManager );
-        cmManager.OpenL();
-        if ( !alwaysAsk )
-            {
-                TRAP( err, cmManager.GetConnectionMethodInfoIntL(
-                        ap, CMManager::ECmIapId ) );
-            }
-        else if ( alwaysAsk == KDestinationSelectionMode )
-            {
-                TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) );
-            }
-        CleanupStack::PopAndDestroy( &cmManager );
-        if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) )
-            {
-            return ETrue;
-            }
-        }
-    return EFalse;
-    }
-
-// -----------------------------------------------------------------------------
-// CDrmUiHandlingImpl::APCountL
-// -----------------------------------------------------------------------------
-//
-TInt DRM::CDrmUiHandlingImpl::APCountL()
-    {
-    TInt apCount( 0 );
-    RCmManager cmManager;
-    CleanupClosePushL( cmManager );
-    cmManager.OpenL();
-    RArray<TUint32> aps;
-    CleanupClosePushL( aps );
-    cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue );
-    apCount = aps.Count();
-    CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager
-    return apCount;
-    }
-
-// -----------------------------------------------------------------------------
 // CDrmUiHandlingImpl::HandleServerAppExit
 // -----------------------------------------------------------------------------
 //
--- a/commondrm/drmutility/src/DrmUtility.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUtility.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,11 +17,11 @@
 
 
 // INCLUDE FILES
-#include <Oma2Dcf.h>
+#include <oma2dcf.h>
 #include <drmagents.h>
 #include <drmutility.h>
 #include <centralrepository.h>
-#include <UTF.h>
+#include <utf.h>
 
 #include "Oma1Dcf.h"
 
@@ -65,7 +65,7 @@
         {
         copyGUID[i] = aGUID[13 - i];
         }
-    for ( i = 8; i < 16 ; i++) 
+    for ( i = 8; i < 16 ; i++)
         {
         copyGUID[i] = aGUID[i];
         }
@@ -97,26 +97,26 @@
 // -----------------------------------------------------------------------------
 // Default constructor
 // -----------------------------------------------------------------------------
-//  
+//
 DRM::CDrmUtility::CDrmUtility()
     {
     }
-    
+
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
-//  
+//
 DRM::CDrmUtility::~CDrmUtility()
     {
     delete iOmaBasedAgentName;
     delete iOmaBasedMimeType;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmUtility::NewLC
 // First phase constructor
 // -----------------------------------------------------------------------------
-//  
+//
 EXPORT_C DRM::CDrmUtility* DRM::CDrmUtility::NewLC()
     {
     DRM::CDrmUtility* self( new( ELeave ) CDrmUtility );
@@ -129,7 +129,7 @@
 // CDrmUtility::NewL
 // First phase constructor
 // -----------------------------------------------------------------------------
-//  
+//
 EXPORT_C DRM::CDrmUtility* DRM::CDrmUtility::NewL()
     {
     DRM::CDrmUtility* self( NewLC() );
@@ -140,7 +140,7 @@
 void DRM::CDrmUtility::ConstructL()
     {
     TInt err( KErrNone );
-             
+
      TRAP(err, FetchOmaBasedInfoL() );
      if( err)
          {
@@ -154,7 +154,7 @@
              delete iOmaBasedMimeType;
              }
          iOmaBasedMimeType = NULL;
-         }   
+         }
     }
 
 // -----------------------------------------------------------------------------
@@ -167,23 +167,23 @@
     CRepository* repository( NULL );
     RBuf bOmaBasedAgentName;
     RBuf bOmaBasedMimeType;
-    
+
     CleanupClosePushL(bOmaBasedAgentName);
     CleanupClosePushL(bOmaBasedMimeType);
     bOmaBasedAgentName.CreateL( KCenRepDataLength );
     bOmaBasedMimeType.CreateL( KCenRepDataLength );
- 
+
     TRAP( err, repository = CRepository::NewL( KCRUidOmaBased ) );
     if ( !err )
         {
         CleanupStack::PushL( repository );
-        
+
         err = repository->Get( KDrmOmaBasedName, bOmaBasedAgentName );
         if( !err )
             {
-            iOmaBasedAgentName = bOmaBasedAgentName.AllocL(); 
+            iOmaBasedAgentName = bOmaBasedAgentName.AllocL();
             }
-        
+
         err = repository->Get( KOmaBasedMimeType, bOmaBasedMimeType );
         if( !err )
             {
@@ -191,9 +191,9 @@
             }
         CleanupStack::PopAndDestroy( repository );
         }
-    
+
     CleanupStack::PopAndDestroy(2);
-    
+
     User::LeaveIfError( err );
     }
 
@@ -201,8 +201,8 @@
 // -----------------------------------------------------------------------------
 // CDrmUtility::GetDrmInfoL
 // -----------------------------------------------------------------------------
-//  
-EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL( 
+//
+EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL(
     RFile& aFileHandle,
     TPtrC& aAgent,
     DRM::TDrmProtectionStatus& aProtected ) const
@@ -215,44 +215,44 @@
     TInt64 headerSize( 0 );
     TBool isDrmFile( EFalse );
     TPtr8 headerPtr( NULL, 0 );
-        
+
     aProtected = DRM::EUUnprotected;
     aAgent.Set( KNullDesC );
-    
+
     CheckFileHandleL( aFileHandle );
     User::LeaveIfError( file.Duplicate( aFileHandle ) );
     CleanupClosePushL( file );
 
     User::LeaveIfError( file.Seek( ESeekStart, pos ) );
-    
+
     // Check if the file is an ASF file
     // To be Checked on runtime wether WM DRM is supporeted or not
     User::LeaveIfError( file.Read( 0, header, KMinContentLength ) );
     if ( header.Length() < KMinContentLength )
         {
-        User::Leave( KErrArgument ); 
-        }    
-        
+        User::Leave( KErrArgument );
+        }
+
     FormatGUID( header );
-    
+
     if ( header == KASFHeaderObject )
         {
         // It's ASF, check still whether it's WM DRM protected or not
         file.Read( header, KWMHeaderObjectLength );
         headerSize = ConvertToInt64( header );
-        if( headerSize <= KWMTopLevelHeaderObjectLength || 
+        if( headerSize <= KWMTopLevelHeaderObjectLength ||
             headerSize > KMaxWMHeaderLength )
             {
             User::Leave( KErrArgument );
             }
         buffer = HBufC8::NewLC( headerSize );
 
-        headerPtr.Set( buffer->Des() ); 
-        User::LeaveIfError( file.Read( headerPtr, 
+        headerPtr.Set( buffer->Des() );
+        User::LeaveIfError( file.Read( headerPtr,
                 headerSize - ( KMinContentLength + KWMHeaderObjectLength ) ) );
-    
+
         r = headerPtr.Find( KWrmHeader );
-        if ( r == KErrNotFound ) 
+        if ( r == KErrNotFound )
             {
             aProtected = DRM::EUUnprotected;
             }
@@ -260,33 +260,33 @@
             {
             isDrmFile = ETrue;
             aProtected = DRM::EUProtected;
-            aAgent.Set( DRM::KDrmWMAgentName );                            
+            aAgent.Set( DRM::KDrmWMAgentName );
             }
-        CleanupStack::PopAndDestroy( buffer ); // buffer    
+        CleanupStack::PopAndDestroy( buffer ); // buffer
         }
     else
         {
         // Check whether it's OMA DRM protected or not
         buffer = HBufC8::NewLC( KOmaHeaderLength );
-        
+
         headerPtr.Set( buffer->Des() );
         User::LeaveIfError( file.Read( 0, headerPtr ));
-        
+
         if ( COma1Dcf::IsValidDcf( headerPtr ) )
             {
             isDrmFile = ETrue;
-            aProtected = DRM::EUProtected;                             
-            aAgent.Set( DRM::KDrmOmaAgentName );                
+            aProtected = DRM::EUProtected;
+            aAgent.Set( DRM::KDrmOmaAgentName );
             }
         else if ( COma2Dcf::IsValidDcf( headerPtr ) )
             {
             isDrmFile = ETrue;
             _LIT8( KCommonHeadersBox, "ohdr" );
             pos = headerPtr.Find( KCommonHeadersBox );
-            
+
             // If no box can be found or if there isn't enough data
             // set protection as unknown
-            if( pos == KErrNotFound || 
+            if( pos == KErrNotFound ||
                 headerPtr.Length() < pos + KOma2EncryptionFieldOffset )
                 {
                 aProtected = DRM::EUUnknown;
@@ -299,31 +299,31 @@
             else
                 {
                 aProtected = DRM::EUProtected;
-                }                  
-            aAgent.Set( DRM::KDrmOmaAgentName );                
-            }   
+                }
+            aAgent.Set( DRM::KDrmOmaAgentName );
+            }
         else if ( (buffer->Des())[0] == 1)
             {
             // set the mimetype from the buffer which is in the beginning
-            // starting from byte 3 with the length specified at position 2		
+            // starting from byte 3 with the length specified at position 2
             TPtrC8 mimeType( buffer->Des().Mid(3, (buffer->Des())[1]) );
-            if( !mimeType.CompareF( *iOmaBasedMimeType ) ) 
-                {	
+            if( !mimeType.CompareF( *iOmaBasedMimeType ) )
+                {
                 aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName );
                 isDrmFile = ETrue;
                 }
             }
         CleanupStack::PopAndDestroy( buffer );
-        }  
+        }
     CleanupStack::PopAndDestroy( &file ); // file
     return isDrmFile;
-    }  
-  
+    }
+
 // -----------------------------------------------------------------------------
 // CDrmUtility::GetDrmInfoL
 // -----------------------------------------------------------------------------
-//  
-EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL( 
+//
+EXPORT_C TBool DRM::CDrmUtility::GetDrmInfoL(
     const TDesC8& aContent,
     TPtrC& aAgent,
     DRM::TDrmProtectionStatus& aProtected ) const
@@ -333,44 +333,44 @@
     TPtr8 asfPtr( NULL, 0 );
     TBuf8< 32 > asfGuidHex;
     TBool isDrmFile( EFalse );
-    
+
     aProtected = DRM::EUUnprotected;
     aAgent.Set( KNullDesC );
 
     if ( aContent.Length() < KMinContentLength )
         {
-        User::Leave( KErrArgument );   
+        User::Leave( KErrArgument );
         }
-        
+
     // Check if the file is an ASF file
-    asfPtr.Set( 
+    asfPtr.Set(
         const_cast<TUint8*>( asfGuidHex.Ptr() ), 0, KMinContentLength * 2 );
-    asfPtr.Copy( aContent.Left( KMinContentLength ) );    
+    asfPtr.Copy( aContent.Left( KMinContentLength ) );
     FormatGUID( asfPtr );
-    
+
     if ( asfPtr == KASFHeaderObject )
         {
         // It's ASF, check still whether it's WM DRM protected or not
         r = aContent.Find( KWrmHeader );
-        if ( r == KErrNotFound ) 
+        if ( r == KErrNotFound )
             {
-            aProtected = DRM::EUUnprotected;   
+            aProtected = DRM::EUUnprotected;
             }
         else
             {
             isDrmFile = ETrue;
-            aProtected = DRM::EUProtected;                               
-            aAgent.Set( DRM::KDrmWMAgentName ); 
-            }   
+            aProtected = DRM::EUProtected;
+            aAgent.Set( DRM::KDrmWMAgentName );
+            }
         }
     else
         {
         // Check whether it's OMA DRM protected or not.
-        if ( ( aContent.Length() >= KMinContentLengthOma1Based ) && 
+        if ( ( aContent.Length() >= KMinContentLengthOma1Based ) &&
             ( COma1Dcf::IsValidDcf( aContent ) ) )
             {
             isDrmFile = ETrue;
-            aProtected = DRM::EUProtected;                          
+            aProtected = DRM::EUProtected;
             aAgent.Set( DRM::KDrmOmaAgentName );
             }
         else if ( COma2Dcf::IsValidDcf( aContent ) )
@@ -378,32 +378,32 @@
             isDrmFile = ETrue;
             _LIT8( KCommonHeadersBox, "ohdr" );
             TInt pos( aContent.Find( KCommonHeadersBox ) );
-            
+
             // If no box can be found or if there isn't enough data
             // set protection as unknown
-            if ( pos == KErrNotFound || 
+            if ( pos == KErrNotFound ||
                  aContent.Length() < pos + KOma2EncryptionFieldOffset )
                 {
                 aProtected = DRM::EUUnknown;
                 }
-            // If encryption field is 0, then content isn't protected    
+            // If encryption field is 0, then content isn't protected
             else if ( !aContent[pos + KOma2EncryptionFieldOffset] )
                 {
-                aProtected = DRM::EUUnprotected;    
+                aProtected = DRM::EUUnprotected;
                 }
             else
                 {
-                aProtected = DRM::EUProtected;    
-                }                               
-            aAgent.Set( DRM::KDrmOmaAgentName );            
+                aProtected = DRM::EUProtected;
+                }
+            aAgent.Set( DRM::KDrmOmaAgentName );
             }
         else if ( (aContent)[0] == 1)
             {
             // set the mimetype from the buffer which is in the beginning
-            // starting from byte 3 with the length specified at position 2     
+            // starting from byte 3 with the length specified at position 2
             TPtrC8 mimeType( aContent.Mid(3, (aContent)[1]) );
             if( !mimeType.CompareF( *iOmaBasedMimeType ) )
-                {   
+                {
                 aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName );
                 isDrmFile = ETrue;
                 aProtected = DRM::EUProtected;
@@ -411,21 +411,21 @@
             }
         }
     return isDrmFile;
-    }      
+    }
 
 // -----------------------------------------------------------------------------
 // CDrmUtility::IsProtectedL
 // -----------------------------------------------------------------------------
-//  
+//
 EXPORT_C TBool DRM::CDrmUtility::IsProtectedL( RFile& aFileHandle ) const
     {
     DRM::TDrmProtectionStatus protection( DRM::EUUnknown );
     TPtrC agent( KNullDesC );
     TBool isDrmFile( EFalse );
     TBool isProtected( EFalse );
-    
+
     isDrmFile = GetDrmInfoL( aFileHandle, agent, protection );
-    
+
     if ( isDrmFile && protection == DRM::EUProtected )
         {
         isProtected = ETrue;
@@ -433,20 +433,20 @@
     return isProtected;
     }
 
-    
+
 // -----------------------------------------------------------------------------
 // CDrmUtility::IsProtectedL
 // -----------------------------------------------------------------------------
-//  
+//
 EXPORT_C TBool DRM::CDrmUtility::IsProtectedL( const TDesC8& aContent ) const
     {
     DRM::TDrmProtectionStatus protection( DRM::EUUnknown );
     TPtrC agent( KNullDesC );
     TBool isDrmFile( EFalse );
     TBool isProtected( EFalse );
-    
+
     isDrmFile = GetDrmInfoL( aContent, agent, protection );
-    
+
     if( isDrmFile && protection == DRM::EUProtected )
         {
         isProtected = ETrue;
@@ -458,8 +458,8 @@
 // -----------------------------------------------------------------------------
 // CDrmUtility::GetAgentL
 // -----------------------------------------------------------------------------
-//  
-EXPORT_C TBool DRM::CDrmUtility::GetAgentL( 
+//
+EXPORT_C TBool DRM::CDrmUtility::GetAgentL(
     RFile& aFileHandle,
     TPtrC& aAgent ) const
     {
@@ -470,12 +470,12 @@
 
     return isDrmFile;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmUtility::GetAgentL
 // -----------------------------------------------------------------------------
-//  
-EXPORT_C TBool DRM::CDrmUtility::GetAgentL( 
+//
+EXPORT_C TBool DRM::CDrmUtility::GetAgentL(
     const TDesC8& aContent,
     TPtrC& aAgent ) const
     {
@@ -486,14 +486,14 @@
 
     return isDrmFile;
     }
- 	
+
 
 // -----------------------------------------------------------------------------
 // CDrmUtility::CheckFileHandlerL
 // Checks whether given filehandle is valid if not leaves with KErrArgument
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
-// 
+//
 EXPORT_C void DRM::CDrmUtility::CheckFileHandleL( RFile& aFileHandle ) const
     {
     if ( !aFileHandle.SubSessionHandle() )
@@ -501,5 +501,5 @@
         User::Leave( KErrBadHandle );
         }
     }
-       
+
 //  End of File
--- a/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUtilityDmgrWrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,68 +1,58 @@
 /*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Dynamically loadable wrapper for Download manager
-*
-*/
-
+ * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Dynamically loadable wrapper for Download manager
+ *
+ */
 #include <centralrepository.h>
 #include <cdblen.h>
 #include <cmconnectionmethod.h>
 #include <cmdestination.h>
 #include <cmconnectionmethoddef.h>
 #include <cmmanager.h>
-
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <browseruisdkcrkeys.h>
-#endif
-
 #ifdef RD_MULTIPLE_DRIVE
 #include <driveinfo.h>
 #endif
-
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <data_caging_path_literals.hrh>
 
-#include <coneresloader.h>
-#include <apparc.h>
-#include <drmutilitydmgrwrapper.rsg>
+#include <DownloadMgrClient.h> //download manager
+#include <es_enum.h> // tconnectioninfo
+#include <es_enum_partner.h> // TConnectionInfoV2
+#include <es_sock.h> // rconnection rsocket
+#include <AknProgressDialog.h> // avkon classes
+#include <eikprogi.h>
 
-#include "roapeng.h"
-#include "roapsyncwrapper.h"
-#include "roapdef.h"
-
-#include "drmutilitydmgrwrapper.h"
-#include "drmutilitydmgrwrapperlogger.h"
+#include <ConeResLoader.h>
+#include <apparc.h>
+#include <DrmUtilityDmgrWrapper.rsg>
 
-// DEBUG macros
-#ifdef _DEBUG
-#define DRMDEBUGLIT( a, b ) \
-_LIT( a , b )
-#define DRMDEBUG( a ) \
-RDebug::Print( a )
-#define DRMDEBUG2( a, b ) \
-RDebug::Print( a, b )
-#else
-#define DRMDEBUGLIT( a, b )
-#define DRMDEBUG( a )
-#define DRMDEBUG2( a, b )
-#endif
+#include <RoapEng.h>
+#include <RoapDef.h>
+#include <RoapObserver.h>
 
-// CONSTANTS
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser = {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint = 0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
+#include "RoapSyncWrapper.h"
+#include "RoapDef.h"
+#include "DrmUtilityDmgrWrapper.h"
+#include "DrmUtilityDmgrWrapperLogger.h"
+#include "drmutilityconnection.h"
+#include "buffercontainers.h" //CnameContainer etc.
+#include "cleanupresetanddestroy.h"
+#include "buffercontainers.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "DrmUtilityDmgrWrapperTraces.h"
 #endif
 
 #ifndef RD_MULTIPLE_DRIVE
@@ -72,52 +62,64 @@
 _LIT( KRomDriveFormatter, "%c:" );
 _LIT( KKDrmUtilityTriggerFilePathFormatter, "%c:\\" );
 #endif
-
 _LIT( KCDrmUtilityDmgrWrapperResFileName,"DrmUtilityDmgrWrapper.rsc" );
-const TInt KProgressInfoFinalValue( 200 );
-const TInt KProgressInfoIncrementSmall( 5 );
-const TInt KProgressInfoIncrementMedium( 10 );
-const TInt KProgressInfoIncrementLarge( 30 );
+const TInt KProgressInfoFinalValue(200);
+const TInt KProgressInfoIncrementSmall(5);
+const TInt KProgressInfoIncrementMedium(10);
+const TInt KProgressInfoIncrementLarge(30);
 
 // ======== LOCAL FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
+// ClearIfNotRoapTemporaryError
+// ---------------------------------------------------------------------------
+//
+void ClearIfNotRoapTemporaryError(TInt aError, HBufC8*& aBuffer)
+    {
+    // ROAP ERROR CODES
+    switch (aError)
+        {
+        case KErrRoapGeneral:
+        case KErrRoapServer:
+        case KErrRoapDomainFull:
+        case KErrRoapNotRegistered:
+            break;
+        default:
+            delete aBuffer;
+            aBuffer = NULL;
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
 // DeleteHttpDowload
 // ---------------------------------------------------------------------------
 //
-LOCAL_C void DeleteHttpDowload( TAny* aDownload )
+LOCAL_C void DeleteHttpDowload(TAny* aDownload)
     {
-    reinterpret_cast< RHttpDownload* >( aDownload )->Delete();
+    reinterpret_cast<RHttpDownload*> (aDownload)->Delete();
     }
 
+
 // ---------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
+// UpdateBufferL
 // ---------------------------------------------------------------------------
 //
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
-    RCmManager& aCmManager,
-    const TUint32 aDefaultSnap )
+template<typename bufType, typename descType>
+LOCAL_C void UpdateBufferL(bufType*& aTargetBuf, const descType& aSourceBuf)
     {
-    RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
-    CleanupClosePushL( dest );
-    TUint32 iapIdOfDest( 0 );
-
-    if ( dest.ConnectionMethodCount() <= 0 )
+    if (aTargetBuf)
         {
-        User::Leave( KErrNotFound );
+        delete aTargetBuf;
+        aTargetBuf = NULL;
         }
-
-    RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-    CleanupClosePushL( cMeth );
-
-    iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-    CleanupStack::PopAndDestroy( &cMeth );
-    CleanupStack::PopAndDestroy( &dest );
-    return iapIdOfDest;
+    if (aSourceBuf.Length())
+        {
+        aTargetBuf = aSourceBuf.AllocL();
+        }
     }
 
-
 // ======== MEMBER FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
@@ -125,8 +127,10 @@
 // ---------------------------------------------------------------------------
 //
 CDrmUtilityDmgrWrapper::CDrmUtilityDmgrWrapper() :
-    iUseCoeEnv( EFalse )
+            CActive(CActive::EPriorityStandard),
+            iUseCoeEnv(EFalse), iIapId(0), iState(EInit)
     {
+    CActiveScheduler::Add(this);
     }
 
 // ---------------------------------------------------------------------------
@@ -137,14 +141,15 @@
     {
     CLOG_WRITE( "DMgrWrapper::ConstructL" );
     const TInt KDrmUtilityDmgrWrapperUid = 0x102830FE;
-    iDlMgr.ConnectL( TUid::Uid(KDrmUtilityDmgrWrapperUid), *this, EFalse );
+    iConnection = DRM::CDrmUtilityConnection::NewL(ETrue);
+    iDlMgr.ConnectL(TUid::Uid(KDrmUtilityDmgrWrapperUid), *this, EFalse);
     iProgressInfo = NULL;
     iProgressNoteDialog = NULL;
     iDialogDismissed = ETrue;
+    User::LeaveIfError(iFs.Connect());
+    User::LeaveIfError(iFs.ShareProtected());
     }
 
-
-
 // ---------------------------------------------------------------------------
 // CDrmUtilityDmgrWrapper::NewL
 // ---------------------------------------------------------------------------
@@ -152,12 +157,11 @@
 CDrmUtilityDmgrWrapper* CDrmUtilityDmgrWrapper::NewL()
     {
     CLOG_WRITE( "DMgrWrapper::NewL" );
-    CDrmUtilityDmgrWrapper* self( CDrmUtilityDmgrWrapper::NewLC() );
-    CleanupStack::Pop( self );
+    CDrmUtilityDmgrWrapper* self(CDrmUtilityDmgrWrapper::NewLC());
+    CleanupStack::Pop(self);
     return self;
     }
 
-
 // ---------------------------------------------------------------------------
 // CDrmUtilityDmgrWrapper::NewLC
 // ---------------------------------------------------------------------------
@@ -165,13 +169,12 @@
 CDrmUtilityDmgrWrapper* CDrmUtilityDmgrWrapper::NewLC()
     {
     CLOG_WRITE( "DMgrWrapper::NewLC" );
-    CDrmUtilityDmgrWrapper* self( new( ELeave ) CDrmUtilityDmgrWrapper() );
-    CleanupStack::PushL( self );
+    CDrmUtilityDmgrWrapper* self(new (ELeave) CDrmUtilityDmgrWrapper());
+    CleanupStack::PushL(self);
     self->ConstructL();
     return self;
     }
 
-
 // ---------------------------------------------------------------------------
 // CDrmUtilityDmgrWrapper::~CDrmUtilityDmgrWrapper
 // ---------------------------------------------------------------------------
@@ -179,22 +182,30 @@
 CDrmUtilityDmgrWrapper::~CDrmUtilityDmgrWrapper()
     {
     CLOG_WRITE( "DMgrWrapper destructor" );
-    if ( iProgressNoteDialog )
-       {
-       // deletes the dialog
-       TRAPD( err, iProgressNoteDialog->ProcessFinishedL() );
-       if ( err )
-           {
-           delete iProgressNoteDialog;
-           }
-       iProgressNoteDialog = NULL;
-       }
+    Cancel();
+    if (iProgressNoteDialog)
+        {
+        // deletes the dialog
+        TRAPD( err, iProgressNoteDialog->ProcessFinishedL() );
+        if (err)
+            {
+            delete iProgressNoteDialog;
+            }
+        iProgressNoteDialog = NULL;
+        }
     delete iErrorUrl;
+
     delete iPostResponseUrl;
+    delete iConnection;
+
+    delete iTriggerUrl;
+    delete iTriggerBuf;
+    delete iFileName;
+    delete iRoapEng;
 
 #ifdef _DEBUG
 
-    if ( iDlMgr.Handle() )
+    if (iDlMgr.Handle())
         {
         iDlMgr.Close();
         }
@@ -204,19 +215,9 @@
     iDlMgr.Close();
 
 #endif
-    }
-
 
-// ---------------------------------------------------------------------------
-// CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL
-// ---------------------------------------------------------------------------
-//
-void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl )
-    {
-    CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" );
-    iUseCoeEnv = EFalse;
-    DoDownloadAndHandleRoapTriggerL( aUrl );
-    HandlePostResponseUrlL();
+    iFs.Close();
+
     }
 
 
@@ -224,447 +225,429 @@
 // CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL
 // ---------------------------------------------------------------------------
 //
+void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL(const HBufC8* aUrl)
+    {
+    CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" );
+    iUseCoeEnv = EFalse;
+    if (iState != EInit || iWait.IsStarted())
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    UpdateBufferL<HBufC8, TDesC8> (iTriggerUrl, *aUrl);
+    CompleteToState(EInit, KErrNone);
+    iWait.Start();
+    }
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL
+// ---------------------------------------------------------------------------
+//
 void CDrmUtilityDmgrWrapper::DownloadAndHandleRoapTriggerL(
-    const HBufC8* aUrl, CCoeEnv& aCoeEnv )
+        const HBufC8* aUrl, CCoeEnv& aCoeEnv)
     {
     CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" );
     iCoeEnv = &aCoeEnv;
     iUseCoeEnv = ETrue;
-    DoDownloadAndHandleRoapTriggerL( aUrl );
-    HandlePostResponseUrlL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDrmUtilityDmgrWrapper::HandlePostResponseUrlL
-// ---------------------------------------------------------------------------
-//
-void CDrmUtilityDmgrWrapper::HandlePostResponseUrlL()
-    {
-    if ( iPostResponseUrl )
+    if (iState != EInit || iWait.IsStarted())
         {
-        DoDownloadAndHandleRoapTriggerL( iPostResponseUrl );
-        // prevent infinite post response fetches.
-        delete iPostResponseUrl;
-        iPostResponseUrl = NULL;
-
-        // Ensure progress note gets deleted.
-        // It remains open if prUrl initialted ROAP operation has PrUrl
-        // (unsupported chained metering report)
-        RemoveProgressNoteL();
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDrmUtilityDmgrWrapper::DoDownloadAndHandleRoapTriggerL
-// ---------------------------------------------------------------------------
-//
-void CDrmUtilityDmgrWrapper::DoDownloadAndHandleRoapTriggerL(
-    const HBufC8* aUrl )
-    {
-    RFs fs;
-    RFile roapTrigger;
-    HBufC8* triggerBuf( NULL );
-    TBool result( EFalse );
-    TFileName triggerFileName;
-
-    CLOG_WRITE( "DMgrWrapper::DoDownloadAndHandleRoapTriggerL" );
-    User::LeaveIfError( fs.Connect() );
-    CleanupClosePushL( fs );
-    User::LeaveIfError( fs.ShareProtected() );
-
-#ifndef RD_MULTIPLE_DRIVE
-
-    User::LeaveIfError( roapTrigger.Temp(
-            fs, KDrmUtilityTriggerFilePath, triggerFileName, EFileWrite ) );
-
-#else //RD_MULTIPLE_DRIVE
-
-    TInt driveNumber( -1 );
-    TChar driveLetter;
-    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber );
-    fs.DriveToChar( driveNumber, driveLetter );
-
-    TFileName utilityTriggerFilePath;
-
-    utilityTriggerFilePath.Format( KKDrmUtilityTriggerFilePathFormatter,
-        (TUint)driveLetter );
-
-    User::LeaveIfError( roapTrigger.Temp(
-            fs, utilityTriggerFilePath, triggerFileName, EFileWrite ) );
-
-#endif
-
-
-    TPtrC8 KNullPtr8( NULL, 0 );
-    RHttpDownload* downloadPtr( iDlMgr.FindDownload( *aUrl, KNullPtr8 ) );
-    if ( downloadPtr )
-        {
-        // Stale download found.
-        // Remove it, and re-create a new download.
-        downloadPtr->Delete();
-        downloadPtr = NULL;
-        }
-
-    // create and start download
-    RHttpDownload& download = iDlMgr.CreateDownloadL( *aUrl, result );
-    // Put download for proper cleanup.
-    TCleanupItem item( DeleteHttpDowload, &download );
-    CleanupStack::PushL( item );
-
-    CleanupClosePushL( roapTrigger );
-
-    if ( !iPostResponseUrl )
-        {
-        // No post response retieval. Note must be created.
-        ShowProgressNoteL();
+        User::Leave(KErrNotReady);
         }
 
-    if ( result )
-        {
-        const TInt KReadBufSize( 512 );
-        TInt triggerFileSize( 0 );
-
-        CLOG_WRITE(
-            "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download created" );
-        iDownloadSuccess = EFalse;
-        iConnectionError = EFalse;
-
-        SetDefaultAccessPointL();
-
-        User::LeaveIfError( download.SetFileHandleAttribute( roapTrigger ) );
-        User::LeaveIfError(
-            download.SetBoolAttribute( EDlAttrNoContentTypeCheck, ETrue ) );
-        User::LeaveIfError( download.Start() );
-
-        // wait until download is finished
-        iWait.Start();
-
-        // Check success of download
-        CLOG_WRITE(
-            "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download finished" );
-
-        CleanupStack::Pop( &roapTrigger );
-        roapTrigger.Close();
-        if ( !iDownloadSuccess )
-            {
-            RemoveProgressNoteL();
-            if ( iConnectionError )
-                {
-                User::Leave( KErrCouldNotConnect );
-                }
-            else
-                {
-                User::Leave( KErrGeneral );
-                }
-            }
-        User::LeaveIfError( roapTrigger.Open( fs,
-                                              triggerFileName,
-                                              EFileShareReadersOrWriters ) );
-        CleanupClosePushL( roapTrigger );
-
-        // Get filehandle of ROAP trigger
-        // Read file to buffer
-        User::LeaveIfError( roapTrigger.Size( triggerFileSize ) );
-        triggerBuf = HBufC8::NewLC( triggerFileSize );
-
-        RBuf8 readBuf;
-        readBuf.CleanupClosePushL();
-        readBuf.CreateL( KReadBufSize );
-
-        User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) );
-        triggerBuf->Des().Copy( readBuf );
-        while ( readBuf.Length() == KReadBufSize )
-            {
-            User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) );
-            triggerBuf->Des().Append( readBuf );
-            }
-
-        CleanupStack::PopAndDestroy( &readBuf );
-
-        if ( iUseCoeEnv && iProgressInfo )
-            {
-            iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium );
-            }
-
-        // And let ROAP handle it...
-        CRoapSyncWrapper* roapWrapper( CRoapSyncWrapper::NewL() );
-        CleanupStack::PushL( roapWrapper );
-        TRAPD( err, roapWrapper->HandleTriggerL( *triggerBuf ) );
-        if ( err )
-            {
-            TInt errorType( 0 );
-            TRAPD( err2,
-                iErrorUrl = roapWrapper->GetErrorUrlL( err, errorType ) );
-            if ( err2 )
-                {
-                RemoveProgressNoteL();
-                delete iErrorUrl;
-                iErrorUrl = NULL;
-                User::Leave( err2 );
-                }
-            else if ( errorType != KErrRoapTemporary )
-                {
-                RemoveProgressNoteL();
-                delete iErrorUrl;
-                iErrorUrl = NULL;
-                User::Leave( err );
-                }
-            else
-                {
-                RemoveProgressNoteL();
-                User::Leave( err );
-                }
-            }
-        if ( iPostResponseUrl )
-            {
-            delete iPostResponseUrl;
-            iPostResponseUrl = NULL;
-            }
-        iPostResponseUrl = roapWrapper->GetPostResponseUrlL();
-        CleanupStack::PopAndDestroy( 2, triggerBuf );
-
-        if ( iUseCoeEnv && iProgressInfo && !iPostResponseUrl )
-            {
-            // No PrUrl found. Progess is complete.
-            iProgressInfo->SetAndDraw( KProgressInfoFinalValue );
-            }
-        }
-
-    // Trick to keep note open long enough during prUrl retrieval
-    if ( !iPostResponseUrl )
-        {
-        RemoveProgressNoteL();
-        }
-    else
-        {
-        if ( iUseCoeEnv && iProgressInfo )
-            {
-            iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium );
-            }
-        }
-
-    CleanupStack::PopAndDestroy( &roapTrigger );
-    CleanupStack::PopAndDestroy( &download );
-
-    fs.Delete( triggerFileName );
-    CleanupStack::PopAndDestroy( &fs );
+    UpdateBufferL<HBufC8, TDesC8> (iTriggerUrl, *aUrl);
+    CompleteToState(EInit, KErrNone);
+    iWait.Start();
     }
 
-
-// ---------------------------------------------------------------------------
-// CDrmUtilityDmgrWrapper::SetDefaultAccessPointL
-// ---------------------------------------------------------------------------
-//
-void CDrmUtilityDmgrWrapper::SetDefaultAccessPointL()
-    {
-    const TInt KDestinationSelectionMode( 2 );
-    CRepository* repository( NULL );
-    TInt ap( 0 );
-    TInt alwaysAsk( 0 );
-    TUint32 iapd32( 0 );
-    TInt defaultSnap( 0 );
-    TInt err( KErrNone );
-
-    CLOG_WRITE( "DMgrWrapper::SetDefaultAccessPointL" );
-    DRMDEBUGLIT( KDuiBrApFormat,
-        "CDrmUtilityDmgrWrapper::SetDefaultAccessPointL %d" );
-    DRMDEBUGLIT( KDuiBrApFormat2, " KBrowserDefaultAccessPoint = %d" );
-    DRMDEBUGLIT( KDuiBrApFormat3, " KBrowserAccessPointSelectionMode = %d" );
-    DRMDEBUGLIT( KDuiBrApFormat4, " KBrowserNGDefaultSnapId = %d" );
-
-    repository = CRepository::NewL( KCRUidBrowser );
-    CleanupStack::PushL( repository );
-    repository->Get( KBrowserDefaultAccessPoint, ap );
-    repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-    repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-    DRMDEBUG2( KDuiBrApFormat(), __LINE__ );
-    DRMDEBUG2( KDuiBrApFormat2(), ap );
-    DRMDEBUG2( KDuiBrApFormat3(), alwaysAsk );
-    DRMDEBUG2( KDuiBrApFormat4(), defaultSnap );
-
-    if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
-        {
-        alwaysAsk = ETrue;
-        }
-    else
-        {
-        RCmManager cmManager;
-        cmManager.OpenLC();
-        if ( !alwaysAsk )
-            {
-            TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL(
-                    ap, CMManager::ECmIapId ) );
-            }
-        else if ( alwaysAsk == KDestinationSelectionMode )
-            {
-            TRAP( err, iapd32 =
-                IapIdOfDefaultSnapL( cmManager, defaultSnap ) );
-            }
-        CleanupStack::PopAndDestroy( &cmManager );
-        }
-    if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) )
-        {
-        err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 );
-        }
-    CleanupStack::PopAndDestroy( repository );
-    }
-
-
 // ---------------------------------------------------------------------------
 // CDrmUtilityDmgrWrapper::GetErrorUrlL
 // ---------------------------------------------------------------------------
 //
 HBufC8* CDrmUtilityDmgrWrapper::GetErrorUrlL()
     {
-    if( iErrorUrl )
+    if (iErrorUrl)
         {
         return iErrorUrl->AllocL();
         }
     return NULL;
     }
 
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::DoConnectL
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::DoConnectL(TDownloadState aNextState)
+    {
+    iConnection->ConnectL(&iStatus);
+    if (iUseCoeEnv && iProgressInfo)
+        {
+        iProgressInfo->SetAndDraw(0);
+        }
+    iState = aNextState;
+    SetActive();
+    }
 
+/////
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::DoDownloadRoapTriggerL
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::DoDownloadRoapTriggerL(TDownloadState aNextState)
+    {
+    // Fetch name of opend connection to be used as part of DMGR
+    // initialisation
+    TUint32 iapId(0);
+    if (iConnection->IsConnected(iapId))
+        {
+        iDlMgr.SetIntAttribute( EDlMgrIap, iapId );
+        }
+    RFile roapTrigger;
+    TBool result(EFalse);
+    DRM::CFileNameContainer* triggerFileName(NULL);
+
+    // If no Trigger URL then nothing to download. So finish transaction
+    if (!iTriggerUrl || iTriggerUrl->Length() <= 0)
+        {
+        if (iUseCoeEnv && iProgressInfo)
+            {
+            // No PrUrl found. Progess is complete.
+            iProgressInfo->SetAndDraw(KProgressInfoFinalValue);
+            }
+        CompleteToState(EComplete, KErrNone);
+        return;
+        }
+
+    TPtrC8 KNullPtr8(NULL, 0);
+    RHttpDownload* downloadPtr(iDlMgr.FindDownload(*iTriggerUrl, KNullPtr8));
+    if (downloadPtr)
+        {
+        // Stale download found.
+        // Remove it, and re-create a new download.
+        downloadPtr->Delete();
+        downloadPtr = NULL;
+        if (iFileName)
+            {
+            iFs.Delete(*iFileName);
+            }
+        }
+
+    triggerFileName=DRM::CFileNameContainer::NewLC();
+#ifndef RD_MULTIPLE_DRIVE
+
+    User::LeaveIfError( roapTrigger.Temp(
+                    iFs, KDrmUtilityTriggerFilePath, triggerFileName->iBuffer, EFileWrite ) );
+
+#else //RD_MULTIPLE_DRIVE
+    TInt driveNumber(-1);
+    TChar driveLetter;
+    DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, driveNumber);
+    iFs.DriveToChar(driveNumber, driveLetter);
+
+    DRM::CFileNameContainer*
+        utilityTriggerFilePath(DRM::CFileNameContainer::NewLC());
+
+    utilityTriggerFilePath->iBuffer.Format(
+            KKDrmUtilityTriggerFilePathFormatter, (TUint) driveLetter);
+
+    User::LeaveIfError(roapTrigger.Temp(iFs, utilityTriggerFilePath->iBuffer,
+            triggerFileName->iBuffer, EFileWrite));
+    CleanupStack::PopAndDestroy( utilityTriggerFilePath );
+    utilityTriggerFilePath=NULL;
+
+#endif
+    UpdateBufferL<HBufC, TFileName> (iFileName, triggerFileName->iBuffer);
+    CleanupStack::PopAndDestroy( triggerFileName );
+    triggerFileName=NULL;
+
+    // create and start download
+    RHttpDownload& download = iDlMgr.CreateDownloadL(*iTriggerUrl, result);
+    // Put download for proper cleanup.
+    TCleanupItem item(DeleteHttpDowload, &download);
+    CleanupStack::PushL(item);
+
+    CleanupClosePushL(roapTrigger);
+
+    if (result)
+        {
+        iDownloadSuccess = EFalse;
+        iConnectionError = EFalse;
+
+        User::LeaveIfError(download.SetFileHandleAttribute(roapTrigger));
+        User::LeaveIfError(download.SetBoolAttribute(
+                EDlAttrNoContentTypeCheck, ETrue));
+        User::LeaveIfError(download.Start());
+
+        // wait until download is finished
+        iState = aNextState;
+        TRequestStatus* status(&iStatus);
+        *status = KRequestPending;
+        SetActive();
+        }
+    CleanupStack::PopAndDestroy(&roapTrigger);
+    CleanupStack::Pop(&download); // Left open for DoSaveRoapTrigger
+    }
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::DoSaveRoapTriggerL(TDownloadState aNextState)
+    {
+    // Check success of download
+
+    // Fetch download created in DoDownloadRoapTriggerL
+    RHttpDownload* download = iDlMgr.FindDownload(*iTriggerUrl, KNullDesC8());
+    // Delete trigger URL so that it is possible to check
+    // whether or not meteringResponse has PrUrl.
+    delete iTriggerUrl;
+    iTriggerUrl = NULL;
+    iStatus = KRequestPending;
+    // Put download for proper cleanup.
+    TCleanupItem item(DeleteHttpDowload, download);
+    CleanupStack::PushL(item);
+    RFile roapTrigger;
+
+    if (!iDownloadSuccess)
+        {
+        RemoveProgressNoteL();
+        if (iConnectionError)
+            {
+            User::Leave(KErrCouldNotConnect);
+            }
+        else
+            {
+            User::Leave(KErrGeneral);
+            }
+        }
+    User::LeaveIfError(roapTrigger.Open(iFs, *iFileName,
+            EFileShareReadersOrWriters));
+    CleanupClosePushL(roapTrigger);
+    // Get filehandle of ROAP trigger
+    const TInt KReadBufSize = 512;
+
+    RBuf8 readBuf;
+    readBuf.CleanupClosePushL();
+    readBuf.CreateL(KReadBufSize);
+
+    // Read file to buffer
+    TInt triggerFileSize(0);
+    User::LeaveIfError(roapTrigger.Size(triggerFileSize));
+    if (iTriggerBuf)
+        {
+        delete iTriggerBuf;
+        iTriggerBuf = NULL;
+        }
+    iTriggerBuf = HBufC8::NewL(triggerFileSize);
+    User::LeaveIfError(roapTrigger.Read(readBuf, KReadBufSize));
+    iTriggerBuf->Des().Copy(readBuf);
+    while (readBuf.Length() == KReadBufSize)
+        {
+        User::LeaveIfError(roapTrigger.Read(readBuf, KReadBufSize));
+        iTriggerBuf->Des().Append(readBuf);
+        }
+
+    // And let ROAP handle it...
+    CleanupStack::PopAndDestroy(&readBuf);
+    CleanupStack::PopAndDestroy(&roapTrigger);
+    CleanupStack::PopAndDestroy(download);
+
+    iFs.Delete(*iFileName);
+    delete iFileName;
+    iFileName = NULL;
+    if (iUseCoeEnv && iProgressInfo)
+        {
+        iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium);
+        }
+
+    CompleteToState(aNextState, KErrNone);
+    }
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::DoHandleRoapTriggerL
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::DoHandleRoapTriggerL(TDownloadState aNextState)
+    {
+    Roap::TTriggerType triggerType;
+    Roap::TRiContextStatus contextStatus;
+    Roap::TDomainOperation domainOperation;
+
+    RPointerArray<HBufC8> contentIds;
+    CleanupResetAndDestroyPushL( contentIds );
+
+    iRoapEng = Roap::CRoapEng::NewL();
+
+    iRoapEng->SetTriggerL(*iTriggerBuf, NULL, triggerType, contextStatus,
+            domainOperation, contentIds);
+
+    CleanupStack::PopAndDestroy(&contentIds);
+
+    iRoapEng->AcceptL(this, &iStatus);
+    iState = aNextState;
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::CompleteToState
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::CompleteToState(
+        CDrmUtilityDmgrWrapper::TDownloadState aNextState, TInt aError)
+    {
+    iState = aNextState;
+    TRequestStatus* ownStatus(&iStatus);
+    User::RequestComplete(ownStatus, aError);
+    SetActive();
+    }
+
+// MHttpDownloadMgrObserver methods
 // ---------------------------------------------------------------------------
 // From class MHttpDownloadMgrObserver
 //
 // CDrmUtilityDmgrWrapper::HandleDMgrEventL
 // ---------------------------------------------------------------------------
 //
-void CDrmUtilityDmgrWrapper::HandleDMgrEventL(
-    RHttpDownload& aDownload,
-    THttpDownloadEvent aEvent )
+void CDrmUtilityDmgrWrapper::HandleDMgrEventL(RHttpDownload& aDownload,
+        THttpDownloadEvent aEvent)
     {
     _LIT8( KDrmUtilityMimeTypeROAPTrigger,
-        "application/vnd.oma.drm.roap-trigger+xml" );
+            "application/vnd.oma.drm.roap-trigger+xml" );
+
 
-    CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL" );
-    CLOG_WRITE_FORMAT( "iDownLoadState = %d", aEvent.iDownloadState );
-    CLOG_WRITE_FORMAT( "iProgressState = %d", aEvent.iProgressState );
 
-    if ( aEvent.iProgressState == EHttpContentTypeReceived )
+    if (aEvent.iProgressState == EHttpContentTypeReceived)
         {
         // check received mimetype
         RBuf8 contentType;
         contentType.CleanupClosePushL();
-        contentType.CreateL( KMaxContentTypeLength );
-        User::LeaveIfError(
-            aDownload.GetStringAttribute( EDlAttrContentType, contentType ) );
-        if ( !contentType.FindF( KDrmUtilityMimeTypeROAPTrigger ) )
+        contentType.CreateL(KMaxContentTypeLength);
+        User::LeaveIfError(aDownload.GetStringAttribute(EDlAttrContentType,
+                contentType));
+        if (!contentType.FindF(KDrmUtilityMimeTypeROAPTrigger))
             {
             // ROAP trigger found, continue download
-            User::LeaveIfError( aDownload.Start() );
+            User::LeaveIfError(aDownload.Start());
             }
         else
             {
             // wrong MIME type, so stop download
             iDownloadSuccess = EFalse;
-            User::LeaveIfError( aDownload.Delete() );
+            User::LeaveIfError(aDownload.Delete());
             }
-        CleanupStack::PopAndDestroy( &contentType );
+        CleanupStack::PopAndDestroy(&contentType);
         }
 
-    if ( aEvent.iDownloadState == EHttpDlCreated )
+    if (aEvent.iDownloadState == EHttpDlCreated)
         {
         CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCreated" );
-        if ( iUseCoeEnv )
+        if (iUseCoeEnv && iProgressInfo)
             {
-        iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium );
+            iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium);
             }
         }
-    else if ( aEvent.iProgressState == EHttpProgDisconnected )
+    else if (aEvent.iProgressState == EHttpProgDisconnected)
         {
         CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpProgDisconnected" );
+        
         // store failure
         iDownloadSuccess = EFalse;
         iConnectionError = ETrue;
         // finished
-        iWait.AsyncStop();
         }
-    else if ( aEvent.iDownloadState == EHttpDlInprogress )
+    else if (aEvent.iDownloadState == EHttpDlInprogress)
         {
         CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlInprogress" );
-        if ( iUseCoeEnv )
+        if (iUseCoeEnv)
             {
-        iProgressInfo->IncrementAndDraw( KProgressInfoIncrementSmall );
+            iProgressInfo->IncrementAndDraw(KProgressInfoIncrementSmall);
             }
         }
-    else if ( aEvent.iDownloadState == EHttpDlCompleted )
+    else if (aEvent.iDownloadState == EHttpDlCompleted)
         {
         // store success
         CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCompleted" );
         iDownloadSuccess = ETrue;
-        if ( iUseCoeEnv )
+        iConnectionError = EFalse;
+        if (iUseCoeEnv)
             {
-        iProgressInfo->IncrementAndDraw( KProgressInfoIncrementLarge );
+            iProgressInfo->IncrementAndDraw(KProgressInfoIncrementLarge);
             }
         // finished
-        iWait.AsyncStop();
+        TRequestStatus* status(&iStatus);
+        User::RequestComplete(status, KErrNone);
         }
-    else if ( aEvent.iDownloadState == EHttpDlFailed )
+    else if (aEvent.iDownloadState == EHttpDlFailed)
         {
-        TInt32 err( KErrNone );
+        TInt32 err(KErrNone);
 
         CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlFailed" );
         // store failure
         iDownloadSuccess = EFalse;
-        User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrErrorId, err ) );
+        User::LeaveIfError(aDownload.GetIntAttribute(EDlAttrErrorId, err));
         CLOG_WRITE_FORMAT( "EDlAttrErrorId = %d", err );
 
-        if ( err == EConnectionFailed ||
-             err == ETransactionFailed)
+        if (err == EConnectionFailed || err == ETransactionFailed)
             {
             CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EConnectionFailed" );
             iConnectionError = ETrue;
             }
-
+        User::LeaveIfError(aDownload.Delete()); // remove useless download
+        User::LeaveIfError(iDlMgr.Disconnect()); // disconnects Dmgr instantly.
         // finished
-        iWait.AsyncStop();
+        TRequestStatus* status(&iStatus);
+        if ( iConnection->HasMoreConnectionAttempts() )
+            {
+            iState = EInit; // re-try with another conection
+            User::RequestComplete(status, KErrNone);
+            }
+        else
+            {
+            User::RequestComplete(status, KErrCancel);        
+            }
         }
     }
 
-
 // ---------------------------------------------------------------------------
 // CDrmUtilityDmgrWrapper::ShowProgressNoteL
 // ---------------------------------------------------------------------------
 //
 void CDrmUtilityDmgrWrapper::ShowProgressNoteL()
     {
-    TFileName resFileName;
+    DRM::CFileNameContainer* resFileName(NULL);
 
     CLOG_WRITE( "DMgrWrapper::ShowProgressNoteL" );
-    if ( iUseCoeEnv )
+    if (iUseCoeEnv)
         {
         // Initialize the progress note dialog, it's values,
         // and execute it
+        resFileName=DRM::CFileNameContainer::NewLC();
 #ifndef RD_MULTIPLE_DRIVE
 
-        resFileName.Copy( KDriveZ );
+        resFileName->iBuffer.Copy( KDriveZ );
 
 #else //RD_MULTIPLE_DRIVE
-
-        TInt driveNumber( -1 );
+        TInt driveNumber(-1);
         TChar driveLetter;
-        DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
+        DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRom, driveNumber);
 
-        iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter );
+        iCoeEnv->FsSession().DriveToChar(driveNumber, driveLetter);
 
-        resFileName.Format( KRomDriveFormatter, (TUint)driveLetter );
+        resFileName->iBuffer.Format(KRomDriveFormatter, (TUint) driveLetter);
 
 #endif
 
-        resFileName.Append( KDC_RESOURCE_FILES_DIR );
-        resFileName.Append( KCDrmUtilityDmgrWrapperResFileName );
-        RConeResourceLoader loader( *iCoeEnv );
-        loader.OpenL( resFileName );
+        resFileName->iBuffer.Append(KDC_RESOURCE_FILES_DIR);
+        resFileName->iBuffer.Append(KCDrmUtilityDmgrWrapperResFileName);
+        RConeResourceLoader loader(*iCoeEnv);
+        loader.OpenL(resFileName->iBuffer);
+        CleanupStack::PopAndDestroy( resFileName );
+        resFileName=NULL;
 
         iProgressNoteDialog = new (ELeave) CAknProgressDialog(
-            reinterpret_cast< CEikDialog** >( &iProgressNoteDialog ) );
-        iProgressNoteDialog->PrepareLC( R_SILENT_PROGRESS_NOTE );
-        iProgressNoteDialog->SetCallback( this );
+                reinterpret_cast<CEikDialog**> (&iProgressNoteDialog));
+        iProgressNoteDialog->PrepareLC(R_SILENT_PROGRESS_NOTE);
+        iProgressNoteDialog->SetCallback(this);
         iProgressInfo = iProgressNoteDialog->GetProgressInfoL();
-        iProgressInfo->SetFinalValue( KProgressInfoFinalValue );
+        iProgressInfo->SetFinalValue(KProgressInfoFinalValue);
         iDialogDismissed = EFalse;
         iProgressNoteDialog->RunLD();
 
@@ -673,7 +656,6 @@
 
     }
 
-
 // ---------------------------------------------------------------------------
 // CDrmUtilityDmgrWrapper::RemoveProgressNoteL
 // ---------------------------------------------------------------------------
@@ -681,7 +663,7 @@
 void CDrmUtilityDmgrWrapper::RemoveProgressNoteL()
     {
 
-    if ( iUseCoeEnv )
+    if (iUseCoeEnv)
         {
         if (iProgressNoteDialog && !iDialogDismissed)
             {
@@ -689,22 +671,22 @@
             TRAPD(err, iProgressNoteDialog->ProcessFinishedL());
             if (err != KErrNone)
                 {
+                iProgressNoteDialog->SetCallback(NULL);
                 delete iProgressNoteDialog;
+                iDialogDismissed = ETrue;
                 }
             iProgressNoteDialog = NULL;
             }
         }
-
     }
 
-
 // ---------------------------------------------------------------------------
 // From class MAknProgressDialogCallback
 //
 // CDrmUtilityDmgrWrapper::DialogDismissedL
 // ---------------------------------------------------------------------------
 //
-void CDrmUtilityDmgrWrapper::DialogDismissedL( TInt /*aButtonId*/ )
+void CDrmUtilityDmgrWrapper::DialogDismissedL(TInt aButtonId )
     {
     iDialogDismissed = ETrue;
 
@@ -712,14 +694,193 @@
     iProgressNoteDialog = NULL;
     iProgressInfo = NULL;
 
-    if( iWait.IsStarted() )
+    if (IsActive() && aButtonId == EAknSoftkeyCancel)
+        {
+        if ((iState == EGetMeteringTrigger || iState == EGetPrUrlTrigger))
+            {
+            Cancel();
+            }
+        else
+            {
+            TRequestStatus* status(&iStatus);
+            User::RequestComplete(status, KErrCancel);
+            }
+        }
+    //For avoiding active object deadlock
+    iDlMgr.DeleteAll();
+
+    }
+
+// RoapObserver methods
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::PostResponseUrlL
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::PostResponseUrlL(const TDesC8& aPostResponseUrl)
+    {
+    UpdateBufferL<HBufC8, TDesC8> (iTriggerUrl, aPostResponseUrl);
+
+    if (iUseCoeEnv && iProgressInfo)
+        {
+        iProgressInfo->IncrementAndDraw(KProgressInfoIncrementMedium);
+        }
+    }
+
+// Trivial RoapObserver methods
+TBool CDrmUtilityDmgrWrapper::ConnectionConfL()
+    {
+    return ETrue;
+    }
+
+TBool CDrmUtilityDmgrWrapper::ContactRiConfL()
+    {
+    return ETrue;
+    }
+
+TBool CDrmUtilityDmgrWrapper::TransIdConfL()
+    {
+    return EFalse;
+    }
+
+void CDrmUtilityDmgrWrapper::RightsObjectDetailsL(const RPointerArray<
+        CDRMRights>& /*aRightsList*/)
+    {
+    // do nothing
+    }
+
+void CDrmUtilityDmgrWrapper::ContentDownloadInfoL(TPath& /*aTempFolder*/,
+        TFileName& /*aContentName*/, TInt& aMaxSize)
+    {
+    aMaxSize = -1;
+    }
+
+void CDrmUtilityDmgrWrapper::ContentDetailsL(const TDesC& /*aPath*/,
+        const TDesC8& /*aType*/, const TUid& /*aAppUid*/)
+    {
+    }
+
+void CDrmUtilityDmgrWrapper::RoapProgressInfoL(const TInt /*aProgressInfo*/)
+    {
+    // do nothing
+    }
+
+void CDrmUtilityDmgrWrapper::ErrorUrlL(const TDesC8& aErrorUrl)
+    {
+    UpdateBufferL<HBufC8, TDesC8> (iErrorUrl, aErrorUrl);
+    }
+
+// CActive methods
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::DoCancel()
+    {
+    delete iRoapEng;
+    iRoapEng = NULL;
+    iConnection->Close();
+    if (iWait.IsStarted())
+        {
+        iWait.AsyncStop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::RunL
+// ---------------------------------------------------------------------------
+//
+void CDrmUtilityDmgrWrapper::RunL()
+    {
+    TInt error(iStatus.Int());
+    
+    ClearIfNotRoapTemporaryError(error, iErrorUrl);
+    User::LeaveIfError(error);
+    switch (iState)
+        {
+        case EInit:
+            {
+            if (!iProgressNoteDialog)
+                {
+                ShowProgressNoteL();
+                }
+            DoConnectL(EGetMeteringTrigger);
+            }
+            break;
+        case EGetMeteringTrigger:
+            {
+            DoDownloadRoapTriggerL(ESaveMeteringTrigger);
+            }
+            break;
+        case ESaveMeteringTrigger:
+            {
+            DoSaveRoapTriggerL(EMeteringReportSubmit);
+            }
+            break;
+
+        case EMeteringReportSubmit:
+            {
+            DoHandleRoapTriggerL(EGetPrUrlTrigger);
+            }
+            break;
+        case EGetPrUrlTrigger:
+            {
+            delete iRoapEng;
+            iRoapEng = NULL;
+            DoDownloadRoapTriggerL(ESavePrUrlTrigger);
+            }
+            break;
+        case ESavePrUrlTrigger:
+            {
+            DoSaveRoapTriggerL(EPrRoapRequest);
+            }
+            break;
+        case EPrRoapRequest:
+            {
+            DoHandleRoapTriggerL(EComplete);
+            }
+            break;
+        case EComplete:
+            {
+            RemoveProgressNoteL();
+            delete iRoapEng;
+            iRoapEng = NULL;
+            iWait.AsyncStop();
+            }
+            break;
+
+        default:
+            User::Leave(KErrNotSupported);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CDrmUtilityDmgrWrapper::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CDrmUtilityDmgrWrapper::RunError(TInt /* aError */)
+    {
+    delete iRoapEng;
+    iRoapEng = NULL;
+    iConnection->Close();
+    if (iWait.IsStarted())
         {
         iWait.AsyncStop();
         }
 
+    if (iUseCoeEnv)
+        {
+        if (iProgressNoteDialog && !iDialogDismissed)
+            {
+            iProgressNoteDialog->SetCallback(NULL);
+            delete iProgressNoteDialog;
+            iDialogDismissed = ETrue;
+            }
+        iProgressNoteDialog = NULL;
+        }
+    return KErrNone;
     }
-
-
 // ======== GLOBAL FUNCTIONS ========
 
 //------------------------------------------------------------------------------
@@ -730,7 +891,7 @@
     {
     CDrmUtilityDmgrWrapper* launcher = NULL;
     TRAPD( err, launcher = CDrmUtilityDmgrWrapper::NewL() );
-    if( err != KErrNone )
+    if (err != KErrNone)
         {
         return NULL;
         }
--- a/commondrm/drmutility/src/DrmUtilityDownloadManager.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUtilityDownloadManager.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -17,11 +17,11 @@
 
 
 // INCLUDE FILES
-#include "drmutilitydownloadmanager.h"
-#include "drmutilitydmgrwrapper.h"
+#include "DrmUtilityDownloadManager.h"
+#include "DrmUtilityDmgrWrapper.h"
 
 // CONSTANTS
-_LIT( KDrmUtilityDmgrHandlerName, "\\system\\libs\\DrmUtilityDmgrWrapper.dll" );
+_LIT( KDrmUtilityDmgrHandlerName, "DrmUtilityDmgrWrapper.dll" );
 
 typedef TAny* (*NewDMgrL)();
 
@@ -63,9 +63,9 @@
 //
 CDrmUtilityDownloadManager* CDrmUtilityDownloadManager::NewL()
     {
-    CDrmUtilityDownloadManager* self( 
+    CDrmUtilityDownloadManager* self(
                                 new( ELeave ) CDrmUtilityDownloadManager() );
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -84,7 +84,7 @@
 // CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL
 //
 // -----------------------------------------------------------------------------
-//    
+//
 void CDrmUtilityDownloadManager::DownloadAndHandleRoapTriggerL(
     const HBufC8* aUrl, CCoeEnv& aCoeEnv )
     {
@@ -104,7 +104,7 @@
 
 // -----------------------------------------------------------------------------
 // CDrmUtilityDownloadManager::GetErrorUrlL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 HBufC8* CDrmUtilityDownloadManager::GetErrorUrlL()
--- a/commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUtilityGlobalNoteWrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,20 +18,20 @@
 
 
 // INCLUDE FILES
-#include <stringloader.h>
-#include <aknglobalconfirmationquery.h>
-#include <akngloballistquery.h>
+#include <StringLoader.h>
+#include <AknGlobalConfirmationQuery.h>
+#include <AknGlobalListQuery.h>
 #include <badesca.h>
 #include <avkon.hrh> // EAknSoftkeyNo
 #include <drmutility.rsg>
 
-#include <aknmediatorfacade.h>
-#include <aknsddata.h>
+#include <AknMediatorFacade.h>
+#include <aknSDData.h>
 #include <featmgr.h>
 
 #include "drmutilitysecondarydisplay.h"
-#include "drmutilityglobalnotewrapper.h"
-#include "drmutilityinfonotewrapper.h"
+#include "DrmUtilityGlobalNoteWrapper.h"
+#include "DrmUtilityInfoNoteWrapper.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
@@ -43,7 +43,7 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-DRM::CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper() 
+DRM::CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper()
     : CActive( EPriorityStandard )
     {
     CActiveScheduler::Add( this );
@@ -54,7 +54,7 @@
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
 //
-void DRM::CDrmUtilityGlobalNoteWrapper::ConstructL( 
+void DRM::CDrmUtilityGlobalNoteWrapper::ConstructL(
     CStringResourceReader* aResourceReader )
     {
     iResourceReader = aResourceReader;
@@ -66,10 +66,10 @@
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-DRM::CDrmUtilityGlobalNoteWrapper* DRM::CDrmUtilityGlobalNoteWrapper::NewLC( 
+DRM::CDrmUtilityGlobalNoteWrapper* DRM::CDrmUtilityGlobalNoteWrapper::NewLC(
     CStringResourceReader* aResourceReader )
     {
-    DRM::CDrmUtilityGlobalNoteWrapper* self( 
+    DRM::CDrmUtilityGlobalNoteWrapper* self(
                                 new (ELeave) CDrmUtilityGlobalNoteWrapper() );
     CleanupStack::PushL( self );
     self->ConstructL( aResourceReader );
@@ -84,7 +84,7 @@
     return self;
     }
 
-    
+
 // Destructor
 DRM::CDrmUtilityGlobalNoteWrapper::~CDrmUtilityGlobalNoteWrapper()
     {
@@ -95,15 +95,15 @@
 // CDrmUtilityGlobalNoteWrapper::ShowNoteL
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( 
-    TInt aResourceId, 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL(
+    TInt aResourceId,
     TInt aButtonsId )
     {
     TInt ret( 0 );
-    
+
     iTextBuffer = iResourceReader->ReadResourceString( aResourceId );
-    
-    iButtonsId = aButtonsId;   
+
+    iButtonsId = aButtonsId;
     ret = DoShowNoteL( aResourceId );
     iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES;
     return ret;
@@ -113,35 +113,35 @@
 // CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( 
-    TInt aResourceId, 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL(
+    TInt aResourceId,
     TInt aButtonsId,
     const TDesC& aString )
     {
     TInt ret( 0 );
-    
-    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( 
+
+    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer(
         iResourceReader->ReadResourceString( aResourceId ) );
-    
+
     StringLoader::Format( iTextBuffer, srcBuffer, -1, aString );
-            
-    iButtonsId = aButtonsId;   
+
+    iButtonsId = aButtonsId;
     ret = DoShowNoteL( aResourceId, aString );
     iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES;
     return ret;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmUtilityGlobalNoteWrapper::ShowNoteL
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( 
-    TInt aResourceId, 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL(
+    TInt aResourceId,
     TInt aValue )
     {
-    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( 
+    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer(
         iResourceReader->ReadResourceString( aResourceId ) );
-        
+
     StringLoader::Format( iTextBuffer, srcBuffer, -1, aValue );
     return DoShowNoteL( aResourceId, KNullDesC, aValue );
     }
@@ -150,13 +150,13 @@
 // CDrmUtilityGlobalNoteWrapper::ShowNoteL
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( 
-    TInt aResourceId, 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL(
+    TInt aResourceId,
     const TDesC& aString )
     {
-    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( 
+    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer(
         iResourceReader->ReadResourceString( aResourceId ) );
-        
+
     StringLoader::Format( iTextBuffer, srcBuffer, -1, aString );
     return DoShowNoteL( aResourceId, aString );
     }
@@ -165,16 +165,16 @@
 // CDrmUtilityGlobalNoteWrapper::ShowNoteL
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( 
-    TInt aResourceId, 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL(
+    TInt aResourceId,
     const TDesC& aString,
-    TInt aValue, 
+    TInt aValue,
     TInt aStringPos,
     TInt aValuePos)
     {
-    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( 
+    TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer(
         iResourceReader->ReadResourceString( aResourceId ) );
-    
+
     StringLoader::Format( iTextBuffer, srcBuffer, aValuePos, aValue );
     srcBuffer = iTextBuffer;
     StringLoader::Format( iTextBuffer, srcBuffer, aStringPos, aString );
@@ -187,62 +187,62 @@
 //
 #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
 
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL(
     TInt aResourceId )
     {
     TInt index( 0 );
     CAknGlobalListQuery* listQuery( CAknGlobalListQuery::NewLC() );
     HBufC* buffer( HBufC::NewLC( DRM::KDRMNoteBufferMaxSize ) );
     TPtr bufPtr( buffer->Des() );
-    
+
     bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE_PREVIEW );
     listQuery->SetHeadingL( bufPtr );
-    
+
     CDesCArray* listArray( new( ELeave ) CDesCArrayFlat( 2 ) );
     CleanupStack::PushL( listArray );
-    
+
     bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE );
     listArray->AppendL( bufPtr );
-    
+
     switch( aResourceId )
         {
         case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY:
-        
-            bufPtr = iResourceReader->ReadResourceString( 
+
+            bufPtr = iResourceReader->ReadResourceString(
                                             R_DRMUTILITY_GET_PREVIEW );
-            
-            
+
+
             break;
-            
+
         case R_DRMUTILITY_PREV_VIDEO_GET_LIST_QUERY:
-        
-            bufPtr = iResourceReader->ReadResourceString( 
+
+            bufPtr = iResourceReader->ReadResourceString(
                                             R_DRMUTILITY_GET_PREVIEW_VIDEO );
-            
+
             break;
-            
+
         case R_DRMUTILITY_PREV_AUDIO_PLAY_LIST_QUERY:
-        
-            bufPtr = iResourceReader->ReadResourceString( 
+
+            bufPtr = iResourceReader->ReadResourceString(
                                             R_DRMUTILITY_PLAY_PREVIEW );
-            
+
             break;
-            
+
         case R_DRMUTILITY_PREV_VIDEO_PLAY_LIST_QUERY:
-        
-            bufPtr = iResourceReader->ReadResourceString( 
+
+            bufPtr = iResourceReader->ReadResourceString(
                                             R_DRMUTILITY_PLAY_PREVIEW_VIDEO );
-            
+
             break;
-        
+
         default:
-        
+
             return 0;
 
         }
-    
+
     listArray->AppendL( bufPtr );
-    
+
     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) &&
         DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) )
         {
@@ -250,39 +250,39 @@
         TUid myProcessUid( KNullUid );
         RThread().Process( myProcess );
         myProcessUid = myProcess.Identity();
-   
+
         TUtilitySDData utilityData;
         // First field is DrmUtility's Uid
         utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
         // ProcessId which uses DrmUtility
-        utilityData.iHandlerProcessId = myProcessUid; 
-        TUtilitySDDataPckg pckg( utilityData );                   
-        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, 
-                                          aResourceId, 
+        utilityData.iHandlerProcessId = myProcessUid;
+        TUtilitySDDataPckg pckg( utilityData );
+        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility,
+                                          aResourceId,
                                           pckg ) );
-        
-        // ownership to notifier client                                   
+
+        // ownership to notifier client
         listQuery->SetSecondaryDisplayData( sd );
         }
-    
+
     iStatus = KRequestPending;
     listQuery->ShowListQueryL( listArray, iStatus );
     SetActive();
     iWait.Start();
-    
+
     CleanupStack::PopAndDestroy( 3, listQuery ); //listArray, buffer, listQuery
-    
+
     if ( iStatus.Int() != EAknSoftkeyNo )
         {
         index = iStatus.Int() + 1;
         }
-    
+
     return index;
     }
 
 #else
 
-TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL(
     TInt /*aResourceId*/ )
     {
     return 0;
@@ -311,22 +311,22 @@
 // CDrmUtilityGlobalNoteWrapper::DoShowNoteL
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL( 
-    TInt aResourceId, 
-    const TDesC& aString, 
+TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL(
+    TInt aResourceId,
+    const TDesC& aString,
     TInt aValue )
     {
     TPtr bufPtr( NULL, 0 );
-    TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ? 
+    TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ?
                                                     0 : R_QGN_NOTE_INFO_ANIM );
-    
+
     CAknGlobalConfirmationQuery* globalNote(
                                         CAknGlobalConfirmationQuery::NewLC() );
-         	
-    bufPtr.Set( const_cast <TUint16*>( iTextBuffer.Ptr() ), 
-                                       iTextBuffer.Length(), 
+
+    bufPtr.Set( const_cast <TUint16*>( iTextBuffer.Ptr() ),
+                                       iTextBuffer.Length(),
                                        iTextBuffer.Length() );
-    
+
     AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
 
 
@@ -337,12 +337,12 @@
         TUid myProcessUid( KNullUid );
         RThread().Process( myProcess );
         myProcessUid = myProcess.Identity();
-   
+
         TUtilitySDData utilityData;
         // First field is DrmUtility's Uid
         utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
         // ProcessId which uses DrmUtility
-        utilityData.iHandlerProcessId = myProcessUid; 
+        utilityData.iHandlerProcessId = myProcessUid;
         if ( aString.Compare( KNullDesC ) )
             {
             // If there is filename given, it's always in the PrimaryString
@@ -354,27 +354,27 @@
             utilityData.iNumParam.AppendNum( aValue );
             }
 
-        TUtilitySDDataPckg pckg( utilityData );                   
-        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, 
-                                          aResourceId, 
+        TUtilitySDDataPckg pckg( utilityData );
+        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility,
+                                          aResourceId,
                                           pckg ) );
-        
-        // ownership to notifier client                                   
+
+        // ownership to notifier client
         globalNote->SetSecondaryDisplayData( sd );
         }
 
     iStatus = KRequestPending;
-    globalNote->ShowConfirmationQueryL( iStatus, 
-                                        iTextBuffer, 
+    globalNote->ShowConfirmationQueryL( iStatus,
+                                        iTextBuffer,
                                         iButtonsId,
                                         animation );
-                                         
+
     SetActive();
     iWait.Start();
     CleanupStack::PopAndDestroy( globalNote );
     if ( iStatus.Int() != EAknSoftkeyNo )
         {
-        return iStatus.Int();    
+        return iStatus.Int();
         }
     else
         {
@@ -382,4 +382,4 @@
         }
     }
 
-//  End of File  
+//  End of File
--- a/commondrm/drmutility/src/DrmUtilityInfoNoteWrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/DrmUtilityInfoNoteWrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,18 +17,18 @@
 
 
 // INCLUDE FILES
-#include <stringloader.h>
-#include <aknglobalconfirmationquery.h>
+#include <StringLoader.h>
+#include <AknGlobalConfirmationQuery.h>
 #include <avkon.hrh> // EAknSoftkeyNo
-#include <aknglobalnote.h>
+#include <AknGlobalNote.h>
 
-#include <aknmediatorfacade.h>
+#include <AknMediatorFacade.h>
 #include <featmgr.h>
-#include <aknsddata.h>
+#include <aknSDData.h>
 #include <drmutility.rsg>
 
 #include "drmutilitysecondarydisplay.h"
-#include "drmutilityinfonotewrapper.h"
+#include "DrmUtilityInfoNoteWrapper.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
@@ -40,7 +40,7 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-DRM::CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper() 
+DRM::CDrmUtilityInfoNoteWrapper::CDrmUtilityInfoNoteWrapper()
     : CActive( EPriorityStandard )
     {
     CActiveScheduler::Add( this );
@@ -63,7 +63,7 @@
 //
 DRM::CDrmUtilityInfoNoteWrapper* DRM::CDrmUtilityInfoNoteWrapper::NewLC()
     {
-    DRM::CDrmUtilityInfoNoteWrapper* self( 
+    DRM::CDrmUtilityInfoNoteWrapper* self(
                                 new (ELeave) CDrmUtilityInfoNoteWrapper() );
     CleanupStack::PushL( self );
     self->ConstructL();
@@ -82,7 +82,7 @@
     return self;
     }
 
-    
+
 // Destructor
 DRM::CDrmUtilityInfoNoteWrapper::~CDrmUtilityInfoNoteWrapper()
     {
@@ -95,7 +95,7 @@
 // CDrmUtilityInfoNoteWrapper::ShowNoteL
 // -----------------------------------------------------------------------------
 //
-void DRM::CDrmUtilityInfoNoteWrapper::ShowNoteL( TAknGlobalNoteType aType , 
+void DRM::CDrmUtilityInfoNoteWrapper::ShowNoteL( TAknGlobalNoteType aType ,
                                                  const TDesC& aNoteText,
                                                  TInt aResourceId,
                                                  const TDesC& aString,
@@ -103,20 +103,20 @@
     {
     RProcess myProcess;
     TUid myProcessUid( KNullUid );
-        
+
     // Convert primary display resource ID to Cover Ui
-    // do nothing if not found 
+    // do nothing if not found
     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) &&
          EvaluateCoverResourceId( aResourceId ) )
-        {  
+        {
         RThread().Process( myProcess );
-        myProcessUid = myProcess.Identity();             
-            
+        myProcessUid = myProcess.Identity();
+
         TUtilitySDData utilityData;
         // First field is DrmUtility's Uid
         utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
         // ProcessId which uses DrmUtility
-        utilityData.iHandlerProcessId = myProcessUid; 
+        utilityData.iHandlerProcessId = myProcessUid;
         if ( aNoteText.Compare( KNullDesC ) )
             {
             // If there is filename given, it's always in the PrimaryString
@@ -126,13 +126,13 @@
             {
             // If there is filename given, it's always in the PrimaryString
             utilityData.iStringParam.Append( aValue );
-            }            
+            }
 
-        TUtilitySDDataPckg pckg( utilityData );                   
-        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, 
-                                          aResourceId, 
+        TUtilitySDDataPckg pckg( utilityData );
+        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility,
+                                          aResourceId,
                                           pckg ) );
-        iNote->SetSecondaryDisplayData( sd ); // ownership to notifier client          
+        iNote->SetSecondaryDisplayData( sd ); // ownership to notifier client
         }
 
     iNote->ShowNoteL( iStatus , aType , aNoteText );
@@ -158,10 +158,10 @@
 // ---------------------------------------------------------
 // CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId
 // ---------------------------------------------------------
-//     
-TBool DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( 
+//
+TBool DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId(
     TInt& aResourceId )
-    { 
+    {
     switch ( aResourceId )
         {
         case R_DRMUTILITY_CONFIRMATION_QUERY:
@@ -386,9 +386,9 @@
             }
             break;
         */
-        
-#ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO        
-        
+
+#ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
+
         case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY:
             {
             aResourceId = ECover_prev_audio_get_list_query;
@@ -429,13 +429,13 @@
             aResourceId = ECover_video_prev_play_list;
             }
             break;
-            
+
 #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
-            
+
         default:
             return EFalse; // No proper dialog found, skipping
-        }    
+        }
     return ETrue; // Dialog found
     }
 
-//  End of File  
+//  End of File
--- a/commondrm/drmutility/src/drmautomatedusageerrorhandling.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/drmautomatedusageerrorhandling.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,7 +18,7 @@
 
 
 #include "drmautomatedusageerrorhandling.h"
-#include "drmautomatedusageimpl.h"
+#include "DrmAutomatedUsageImpl.h"
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -46,7 +46,7 @@
 // Two-phased constructor
 // ---------------------------------------------------------------------------
 //
-EXPORT_C DRM::CDrmAutomatedUsageErrorHandling* 
+EXPORT_C DRM::CDrmAutomatedUsageErrorHandling*
 DRM::CDrmAutomatedUsageErrorHandling::NewL(
     DRM::CDrmAutomatedUsageImpl* aImplementation )
     {
@@ -86,15 +86,15 @@
 // RFile based asynchronous method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL( 
+EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL(
     RFile& aFile,
-    ContentAccess::TIntent aIntent, 
-    TInt aError, 
+    ContentAccess::TIntent aIntent,
+    TInt aError,
     DRM::MDrmHandleErrorObserver& aObserver )
     {
-    return iImplementation->HandleErrorAsyncL( aFile, 
-                                               aIntent, 
-                                               aError, 
+    return iImplementation->HandleErrorAsyncL( aFile,
+                                               aIntent,
+                                               aError,
                                                aObserver );
     }
 
@@ -103,10 +103,10 @@
 // RFile based method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL( 
+EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL(
     RFile& aFile,
-    ContentAccess::TIntent aIntent,              
-    TInt aError, 
+    ContentAccess::TIntent aIntent,
+    TInt aError,
     DRM::MDrmHandleErrorObserver* aObserver )
     {
     iImplementation->HandleErrorL( aFile, aIntent, aError, aObserver );
@@ -117,15 +117,15 @@
 // CData based asynchronous method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL( 
+EXPORT_C TInt DRM::CDrmAutomatedUsageErrorHandling::HandleErrorAsyncL(
     ContentAccess::CData& aFile,
     ContentAccess::TIntent aIntent,
-    TInt aError, 
+    TInt aError,
     DRM::MDrmHandleErrorObserver& aObserver )
     {
-    return iImplementation->HandleErrorAsyncL( aFile, 
-                                               aIntent, 
-                                               aError, 
+    return iImplementation->HandleErrorAsyncL( aFile,
+                                               aIntent,
+                                               aError,
                                                aObserver);
     }
 
@@ -134,13 +134,13 @@
 // CData based method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL( 
+EXPORT_C void DRM::CDrmAutomatedUsageErrorHandling::HandleErrorL(
     ContentAccess::CData& aData,
     ContentAccess::TIntent aIntent,
-    TInt aError, 
+    TInt aError,
     DRM::MDrmHandleErrorObserver* aObserver )
     {
-    iImplementation->HandleErrorL( aData, aIntent, aError, aObserver );    
+    iImplementation->HandleErrorL( aData, aIntent, aError, aObserver );
     }
 // End of File
 
--- a/commondrm/drmutility/src/drmuierrorhandling.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/drmuierrorhandling.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,7 +18,7 @@
 
 
 #include "drmuierrorhandling.h"
-#include "drmuihandlingimpl.h"
+#include "DrmUiHandlingImpl.h"
 
 // ---------------------------------------------------------------------------
 // Constructor
@@ -78,33 +78,33 @@
 // RFile based method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL( 
+EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL(
     RFile& aFile,
-    ContentAccess::TIntent aIntent, 
-    TInt aError, 
+    ContentAccess::TIntent aIntent,
+    TInt aError,
     DRM::MDrmHandleErrorObserver& aObserver )
     {
-    TInt operation = iImplementation->HandleErrorAsyncL( aFile, 
-                                                         aIntent, 
-                                                         aError, 
+    TInt operation = iImplementation->HandleErrorAsyncL( aFile,
+                                                         aIntent,
+                                                         aError,
                                                          aObserver);
-    return operation;                                           
+    return operation;
     }
-        
+
 // ---------------------------------------------------------------------------
 // CDrmUiErrorHandling::HandleErrorL
 // RFile based method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL( 
+EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL(
     RFile& aFile,
-    ContentAccess::TIntent aIntent,              
-    TInt aError, 
+    ContentAccess::TIntent aIntent,
+    TInt aError,
     DRM::MDrmHandleErrorObserver* aObserver )
     {
-    iImplementation->HandleErrorL( aFile, 
-                                   aIntent, 
-                                   aError, 
+    iImplementation->HandleErrorL( aFile,
+                                   aIntent,
+                                   aError,
                                    aObserver);
     }
 
@@ -113,34 +113,34 @@
 // ContentAccess::CData based method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL( 
+EXPORT_C TInt DRM::CDrmUiErrorHandling::HandleErrorAsyncL(
     ContentAccess::CData& aFile,
     ContentAccess::TIntent aIntent,
-    TInt aError, 
+    TInt aError,
     DRM::MDrmHandleErrorObserver& aObserver )
     {
-    TInt operation = iImplementation->HandleErrorAsyncL( aFile, 
-                                                         aIntent, 
-                                                         aError, 
+    TInt operation = iImplementation->HandleErrorAsyncL( aFile,
+                                                         aIntent,
+                                                         aError,
                                                          aObserver);
-    return operation;     
+    return operation;
     }
-    
+
 // ---------------------------------------------------------------------------
 // CDrmUiErrorHandling::HandleErrorL
 // ContentAccess::CData based method
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL( 
+EXPORT_C void DRM::CDrmUiErrorHandling::HandleErrorL(
     ContentAccess::CData& aFile,
     ContentAccess::TIntent aIntent,
-    TInt aError, 
+    TInt aError,
     DRM::MDrmHandleErrorObserver* aObserver )
     {
-    iImplementation->HandleErrorL( aFile, 
-                                   aIntent, 
-                                   aError, 
-                                   aObserver);    
+    iImplementation->HandleErrorL( aFile,
+                                   aIntent,
+                                   aError,
+                                   aObserver);
     }
 
 
--- a/commondrm/drmutility/src/drmutilitycommon.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/drmutilitycommon.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,12 +17,12 @@
 
 
 // INCLUDE FILES
-#include <drmpermission.h>
-#include <drmconstraint.h>
+#include <DrmPermission.h>
+#include <DrmConstraint.h>
 
 #include "drmutilitycommon.h"
-#include "drmclockclient.h"
-#include "drmpointerarray.h"
+#include "DRMClockClient.h"
+#include "DRMPointerArray.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
@@ -57,10 +57,10 @@
 EXPORT_C DRM::CDrmUtilityCommon* DRM::CDrmUtilityCommon::NewLC()
     {
     DRM::CDrmUtilityCommon* self( new( ELeave ) CDrmUtilityCommon() );
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
-    
+
     return self;
     }
 
@@ -72,9 +72,9 @@
 EXPORT_C DRM::CDrmUtilityCommon* DRM::CDrmUtilityCommon::NewL()
     {
     DRM::CDrmUtilityCommon* self( NewLC() );
-    
+
     CleanupStack::Pop( self );
-    
+
     return self;
     }
 
@@ -88,8 +88,8 @@
 // CDrmUtilityCommon::GetOmaRightsStatusL
 //
 // -----------------------------------------------------------------------------
-//	
-EXPORT_C DRM::TDrmRightsInfo DRM::CDrmUtilityCommon::GetOmaRightsStatusL( 
+//
+EXPORT_C DRM::TDrmRightsInfo DRM::CDrmUtilityCommon::GetOmaRightsStatusL(
     HBufC8*& aContentUri,
     ContentAccess::TIntent aIntent,
     CDRMConstraint* aConstraint )
@@ -103,30 +103,30 @@
     CDRMConstraint* constraint( NULL );
     CDRMConstraint* toplevel( NULL );
     TUint32 retval( 0 );
-    TInt r( KErrNone );          
-        
+    TInt r( KErrNone );
+
     r = clockClient.Connect();
     CleanupClosePushL( clockClient );
     if ( !r )
         {
-        TInt timeZone( 0 );        
+        TInt timeZone( 0 );
         clockClient.GetSecureTime( drmTime, timeZone, secLevel );
         }
-                                      
+
     uriList = CDRMPointerArray<CDRMPermission>::NewLC();
     uriList->SetAutoCleanup( ETrue );
-    TRAP_IGNORE( iOmaClient.GetDBEntriesL( *aContentUri, *uriList ) );                                  
-                                      
+    TRAP_IGNORE( iOmaClient.GetDBEntriesL( *aContentUri, *uriList ) );
+
     if ( !uriList->Count() )
         {
         CleanupStack::PopAndDestroy( 2, &clockClient ); //clockClient, uriList
         return DRM::EURightsInfoMissing;
         }
-    
+
     individuals = CDRMPointerArray<HBufC8>::NewLC();
     individuals->SetAutoCleanup( ETrue );
-    TRAP_IGNORE( iOmaClient.GetSupportedIndividualsL( *individuals ) );    
-    
+    TRAP_IGNORE( iOmaClient.GetSupportedIndividualsL( *individuals ) );
+
     // Now we have the time, rights and the individual constraints do the
     // checking. The rights are never valid if we get here so we don't have
     // to check for that
@@ -134,12 +134,12 @@
         {
         toplevel = NULL;
         constraint = NULL;
-        
+
         // If the toplevel constraint is defined, get it:
         toplevel = (*uriList)[i]->TopLevelConstraint();
         // If constraint for the intent is defined, get it
         constraint = (*uriList)[i]->ConstraintForIntent( aIntent );
-        
+
         // Top level constraint and constraint for intent, merge them
         if ( toplevel && constraint )
             {
@@ -150,11 +150,11 @@
             {
             }
         // Only top level constraint or no constraints at all, continue
-        else 
+        else
             {
             continue;
             }
-                    
+
         // If the constraint is rejected due to non time reasons or there is no
         // time it can't be future
         constraint->Valid( drmTime, *individuals, retval );
@@ -166,9 +166,9 @@
             {
             continue;
             }
-        
+
         drmTime.HomeTime();
-        
+
         // If the constrain has active start time and it is not valid,
         // it must be future
         if ( constraint->iActiveConstraints & EConstraintStartTime )
@@ -176,11 +176,11 @@
             possiblefuture = ETrue;
             if ( aConstraint )
                 {
-                aConstraint->DuplicateL( *constraint );                       
+                aConstraint->DuplicateL( *constraint );
                 }
             }
-                
-        // If the constrain has active interval and it´s start time is in 
+
+        // If the constrain has active interval and it´s start time is in
         // future, it must be future
         else if ( constraint->iActiveConstraints & EConstraintInterval &&
                   constraint->iIntervalStart > drmTime )
@@ -188,14 +188,14 @@
             possiblefuture = ETrue;
             if ( aConstraint )
                 {
-                aConstraint->DuplicateL( *constraint );                     
+                aConstraint->DuplicateL( *constraint );
                 }
             }
         } // End of for loop
-        
-	CleanupStack::PopAndDestroy( 3, &clockClient ); //individuals, urilist, 
+
+    CleanupStack::PopAndDestroy( 3, &clockClient ); //individuals, urilist,
                                                     //clockClient
-	return possiblefuture ? DRM::EURightsInfoFuture : DRM::EURightsInfoExpired;
-	}
-	
+    return possiblefuture ? DRM::EURightsInfoFuture : DRM::EURightsInfoExpired;
+    }
+
 //  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commondrm/drmutility/src/drmutilityconnection.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,562 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Connection manager for DRM
+ *
+ */
+
+// INCLUDE FILES
+#include <es_sock.h>
+#include <cmconnectionmethod.h>
+#include <cmdestination.h>
+#include <cmconnectionmethoddef.h>
+#include <cmmanager.h>
+#include <extendedconnpref.h>
+#include <cmapplicationsettingsui.h> // CCmApplicationSettingsUi
+#include <es_enum.h>
+#include <cdbcols.h> // IAP, COMMDB_ID
+#include "drmutilityconnection.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "drmutilityconnectionTraces.h"
+#endif
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// -----------------------------------------------------------------------------
+// HasDefaultConnectionL
+// Finds default IAP id
+// @return Etrue: valid AP found
+//         EFalse: valid AP not found
+// @leave system wide error codes
+// -----------------------------------------------------------------------------
+//
+TBool DRM::CDrmUtilityConnection::HasDefaultConnectionL()
+    {
+    TBool hasDefault(EFalse);
+    TCmDefConnValue defConn;
+    RCmManager cmManager;
+    cmManager.OpenLC();
+    cmManager.ReadDefConnL(defConn);
+    if (defConn.iType == ECmDefConnConnectionMethod)
+        {
+        cmManager.GetConnectionMethodInfoIntL(defConn.iId,
+                CMManager::ECmIapId);
+        hasDefault = ETrue;
+        }
+    else if (defConn.iType == ECmDefConnDestination)
+        {
+        RCmDestination dest(cmManager.DestinationL(defConn.iId));
+        CleanupClosePushL(dest);
+
+        if (dest.ConnectionMethodCount() <= 0)
+            {
+            User::Leave(KErrNotFound);
+            }
+
+        RCmConnectionMethod cMeth(dest.ConnectionMethodL(0));
+        CleanupClosePushL(cMeth);
+
+        cMeth.GetIntAttributeL(CMManager::ECmIapId);
+        CleanupStack::PopAndDestroy(&cMeth);
+        CleanupStack::PopAndDestroy(&dest);
+        hasDefault = ETrue;
+        }
+    CleanupStack::PopAndDestroy(&cmManager);
+    return hasDefault;
+    }
+
+// -----------------------------------------------------------------------------
+// CDrmUtilityConnection::HasAccessPointsL
+// -----------------------------------------------------------------------------
+//
+TBool DRM::CDrmUtilityConnection::HasAccessPointsL()
+    {
+    TInt apCount(0);
+    RCmManager cmManager;
+    CleanupClosePushL(cmManager);
+    cmManager.OpenL();
+    RArray<TUint32> aps;
+    CleanupClosePushL(aps);
+    cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue);
+    apCount = aps.Count();
+    CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager
+    return apCount > 0;
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::NewLC
+// ---------------------------------------------------------------------------
+//
+DRM::CDrmUtilityConnection* DRM::CDrmUtilityConnection::NewLC(
+        const TBool aAllowQueries)
+    {
+    CDrmUtilityConnection* conn = new (ELeave) CDrmUtilityConnection(
+            aAllowQueries);
+    CleanupStack::PushL(conn);
+    conn->ConstructL();
+    return conn;
+    }
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::NewL
+// ---------------------------------------------------------------------------
+//
+DRM::CDrmUtilityConnection* DRM::CDrmUtilityConnection::NewL(
+        const TBool aAllowQueries)
+    {
+    CDrmUtilityConnection* conn = CDrmUtilityConnection::NewLC(aAllowQueries);
+    CleanupStack::Pop(conn);
+    return conn;
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::~CDrmUtilityConnection
+// ---------------------------------------------------------------------------
+//
+DRM::CDrmUtilityConnection::~CDrmUtilityConnection()
+    {
+    Cancel();
+    iConnection.Close();
+    iSocketServ.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::ConnectL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::ConnectL(TRequestStatus* aStatus)
+    {
+    TInt error(KErrGeneral);
+    iStatus = KRequestPending;
+
+    if (iState == EInit)
+        {
+
+        // Make this part atomic by pushing closes on the stack.
+        error = iSocketServ.Connect();
+        if (!error)
+            {
+            error = iConnection.Open(iSocketServ);
+            }
+        }
+
+    if (iState == EConnected)
+        {
+        error=iConnection.Stop();
+        //error=iConnection.Stop(RConnection::EStopAuthoritative); //just in case still does not work
+        // if autoriative stop does not work then must do something following follow
+        // TNifProgressBuf iJalla;
+        // loop iConnection.ProgressNotification(iJalla,iStatus,KConnProgressDefault); SetActive
+        // at RunL if (iJalla.iStage < KConnectionDown)
+        // reactiveteWaitClose();
+        //iConnection.ProgressNotification(iJalla,iStatus,(KConnectionDown); (should loop till state KConnectionDown seen)
+        iConnection.Close();
+        iState = EInit;
+        error = KErrNone;
+        error = iConnection.Open(iSocketServ);
+        }
+
+    iParentStatus = aStatus;
+    *iParentStatus = KRequestPending;
+
+    CompleteSelf(error);
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::HasMoreConnectionAttempts
+// ---------------------------------------------------------------------------
+//
+TBool DRM::CDrmUtilityConnection::HasMoreConnectionAttempts()
+    {
+    TBool ret(EFalse);
+    switch (iType)
+        {
+        case EUsingPurposeInternet:
+            if (iAllowQueries)
+                {
+                ret = ETrue;
+                }
+            else
+                {
+                ret = EFalse;
+                }
+            break;
+        case EUsingQuery:
+        case EFail:
+            ret = EFalse;
+            break;
+        default:
+            ret = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::IsConnected
+// ---------------------------------------------------------------------------
+//
+TBool DRM::CDrmUtilityConnection::IsConnected(TUint32& aIap)
+    {
+    TBool ret(EFalse);
+    
+    if (iState == EConnected)
+        {
+        aIap = iIapId;
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::Close
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::Close()
+    {
+    //LOGLIT( "CDrmUtilityConnection::Close" )
+
+    Cancel();
+    iConnection.Close();
+    iSocketServ.Close();
+    iState = EInit;
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection:CDrmUtilityConnection:
+// ---------------------------------------------------------------------------
+//
+DRM::CDrmUtilityConnection::CDrmUtilityConnection(const TBool aAllowQueries) :
+    CActive(CActive::EPriorityStandard), iState(EInit),
+            iType(EAttachExisting), iAllowQueries(aAllowQueries)
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::ConstructL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::DoCancel
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::DoCancel()
+    {
+    iConnection.Close();
+    iSocketServ.Close();
+    CompleteParent(KErrCancel);
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::RunL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::RunL()
+    {
+    TInt error(iStatus.Int());
+    if (iState == EInit)
+        {
+        User::LeaveIfError(error); // Handle errors in RunError().
+        if (iType == EAttachExisting)
+            {
+            AttachExistingConnectionL();
+            }
+        else
+            {
+            iState = EConnecting;
+            error = KErrNotFound;
+            CompleteSelf(error);
+            }
+        }
+    else if (iState == EConnecting)
+        {
+        if (!error)
+            {
+            iState = EConnected;
+            CompleteSelf(error);
+            }
+        else if (error != KErrNotFound)
+            {
+            User::LeaveIfError(error);
+            }
+        else
+            {
+            switch (iType)
+                {
+                case EAttachExisting:
+                    iType = EUsingDefault;
+                    ConnectUsingDefaultL();
+                    break;
+                case EUsingDefault:
+                    iType = EUsingPurposeOperator;
+                    ConnectUsingSnapPurposeL(CMManager::ESnapPurposeOperator);
+                    break;
+                case EUsingPurposeOperator:
+                    iType = EUsingPurposeInternet;
+                    ConnectUsingSnapPurposeL(CMManager::ESnapPurposeInternet);
+                    break;
+                case EUsingPurposeInternet:
+                    iType = EUsingQuery;
+                    if (iAllowQueries)
+                        {
+                        ConnectUsingQueryL();
+                        break;
+                        }
+                case EUsingQuery:
+                    iType = EFail;
+                case EFail:
+                default:
+                    User::Leave(KErrCouldNotConnect);
+                    break;
+                }
+            }
+        }
+    else if (iState == EConnected)
+        {
+        UpdateIapIdL();
+        CompleteParent(iStatus.Int());
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::RunError
+// ---------------------------------------------------------------------------
+//
+TInt DRM::CDrmUtilityConnection::RunError(TInt aError)
+    {
+    //LOGLIT( "CDrmUtilityConnection::RunError" )
+
+    iConnection.Close();
+    iSocketServ.Close();
+
+    CompleteParent(aError);
+    iState = EInit;
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::AttachExistingConnectionL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::AttachExistingConnectionL()
+    {
+    TConnectionInfoBuf connInfo;
+    TUint count(0);
+    TInt error(KErrNotFound);
+    iStatus = KRequestPending;
+
+    User::LeaveIfError(iConnection.EnumerateConnections(count));
+    if (count)
+        {
+        // Select AP with largest index. (Latest created)
+        User::LeaveIfError(iConnection.GetConnectionInfo(count, connInfo));
+        User::LeaveIfError(iConnection.Attach(connInfo,
+                RConnection::EAttachTypeNormal));
+        iState = EConnected;
+        error = KErrNone;
+        }
+    else
+        {
+        iState = EConnecting;
+        }
+    CompleteSelf(error);
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::ConnectUsingDefaultL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::ConnectUsingDefaultL()
+    {
+    // Create overrides
+    TConnPrefList prefList;
+    TExtendedConnPref prefs;
+
+    if (!iAllowQueries)
+        {
+        prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
+        }
+    else
+        {
+        prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnDisableQueries);
+        }
+        
+    //Fetch default connection
+    TBool hasDefault(ETrue);
+    TCmDefConnValue defConn;
+    RCmManager cmManager;
+    cmManager.OpenLC();
+    cmManager.ReadDefConnL(defConn);
+    if (defConn.iType == ECmDefConnConnectionMethod)
+        {
+        prefs.SetIapId(defConn.iId);
+        }
+    else if (defConn.iType == ECmDefConnDestination)
+        {
+        prefs.SetSnapId(defConn.iId);
+        }
+    else
+        {
+        hasDefault = EFalse;
+        }
+    // End of fetch default connection
+    CleanupStack::PopAndDestroy(&cmManager);
+    if (hasDefault)
+        {
+        prefList.AppendL(&prefs);
+
+        // Start an Outgoing Connection with overrides
+        iState = EConnecting;
+        iConnection.Start(prefList, iStatus);
+        SetActive();
+        }
+    else
+        {
+        // No default found --> next iteration needed
+        CompleteSelf(KErrNotFound);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::ConnectUsingSnapOperatorL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::ConnectUsingSnapPurposeL(
+        const TUint32 aPurpose)
+    {
+    // Create overrides
+    TConnPrefList prefList;
+    TExtendedConnPref prefs;
+    prefs.SetSnapPurpose(static_cast<CMManager::TSnapPurpose> (aPurpose));
+    if (aPurpose != CMManager::ESnapPurposeUnknown)
+        {
+        if (!iAllowQueries)
+            {
+            prefs.SetNoteBehaviour(
+                    TExtendedConnPref::ENoteBehaviourConnSilent);
+            }
+        else
+            {
+            prefs.SetNoteBehaviour(
+                    TExtendedConnPref::ENoteBehaviourConnDisableQueries);
+            }
+        }
+    else
+        {
+        prefs.SetConnSelectionDialog(ETrue);
+        prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourDefault);
+        prefs.SetForcedRoaming(EFalse);
+        prefs.SetBearerSet(TExtendedConnPref::EExtendedConnBearerUnknown);
+        }
+    prefList.AppendL(&prefs);
+    iState = EConnecting;
+
+    // Start an Outgoing Connection with overrides
+    iConnection.Start(prefList, iStatus);
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::ConnectUsingQueryL
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::ConnectUsingQueryL()
+    {
+    // Create overrides
+    TConnPrefList prefList;
+    TExtendedConnPref prefs;
+
+    CCmApplicationSettingsUi* ui(CCmApplicationSettingsUi::NewLC());
+    TCmSettingSelection selectedConn;
+
+    TBool selected(ui->RunApplicationSettingsL(selectedConn));
+    CleanupStack::PopAndDestroy(ui);
+    ui=NULL;
+    if (selected)
+        {
+        if (selectedConn.iResult == CMManager::EConnectionMethod)
+            {
+            prefs.SetIapId(selectedConn.iId);
+            }
+        else if (selectedConn.iResult == CMManager::EDestination)
+            {
+            prefs.SetSnapId(selectedConn.iId);
+            }
+        else if (selectedConn.iResult != CMManager::EDefaultConnection)
+            {
+            selected=EFalse;
+            }
+        }
+    if (selected)
+        {
+        if (selectedConn.iResult != CMManager::EDefaultConnection)
+            {
+            prefList.AppendL(&prefs);
+            // For ensuring possibly stale connections get disconnected first;
+            iConnection.Close();
+            iConnection.Open(iSocketServ);
+            
+            iConnection.Start(prefList, iStatus);
+            }
+        else
+            {
+            iConnection.Start(iStatus);
+            }
+        SetActive();
+        }
+    else
+        {
+        CompleteSelf(KErrCancel);
+        }
+    }
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::CompleteSelf
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::CompleteSelf(TInt aError)
+    {
+    TRequestStatus* status(&iStatus);
+    User::RequestComplete(status, aError);
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::CompleteParent
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::CompleteParent(TInt aError)
+    {
+    if (iParentStatus)
+        {
+        User::RequestComplete(iParentStatus, aError);
+        iParentStatus = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// DRM::CDrmUtilityConnection::UpdateIapId
+// ---------------------------------------------------------------------------
+//
+void DRM::CDrmUtilityConnection::UpdateIapIdL()
+    {
+    TBuf<16> query;
+
+    query.Format(_L("%s\\%s"), IAP, COMMDB_ID);
+    User::LeaveIfError(iConnection.GetIntSetting(query, iIapId));
+    
+    }
--- a/commondrm/drmutility/src/drmutilityui.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/drmutilityui.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,25 +20,25 @@
 
 // multiple drive support
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 // notes and queries
 #include <coemain.h>
 #include <bautils.h>
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <stringresourcereader.h>
 #include <aknnotewrappers.h>
-#include <aknglobalnote.h>
-#include <aknquerydialog.h>
+#include <AknGlobalNote.h>
+#include <AknQueryDialog.h>
 #include <aknlistquerydialog.h>
 
 // secondary display support
-#include <aknmediatorfacade.h>
+#include <AknMediatorFacade.h>
 #include <featmgr.h>
-#include <aknsddata.h>
-#include <mediatoreventprovider.h>
-#include <mediatordomainuids.h>
+#include <aknSDData.h>
+#include <MediatorEventProvider.h>
+#include <MediatorDomainUIDs.h>
 
 // caf
 #include <caf/caftypes.h>
@@ -49,20 +49,20 @@
 #include <drmutility.rsg>
 
 // drm
-#include <drmconstraint.h>
-#include <oma2agent.h>
+#include <DrmConstraint.h>
+#include <Oma2Agent.h>
 #include <drmutilitytypes.h>
 
 #include "drmutilityui.h"
 #include "drmutilitysecondarydisplay.h"
-#include "drmutilityglobalnotewrapper.h"
-#include "drmutilityinfonotewrapper.h"
+#include "DrmUtilityGlobalNoteWrapper.h"
+#include "DrmUtilityInfoNoteWrapper.h"
 
 // CONSTANTS
 #ifndef RD_MULTIPLE_DRIVE
 _LIT( KDriveZ, "z:" );
 #else
-_LIT( KRomDriveFormatter, "%c:" );                                      
+_LIT( KRomDriveFormatter, "%c:" );
 #endif
 
 _LIT( KCDrmUtilityResFileName,"drmutility.rsc" );
@@ -91,7 +91,7 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-DRM::CDrmUtilityUI::CDrmUtilityUI( 
+DRM::CDrmUtilityUI::CDrmUtilityUI(
     CCoeEnv* aCoeEnv ) : iCoeEnv( aCoeEnv )
     {
     }
@@ -106,55 +106,55 @@
     if ( !iCoeEnv )
         {
         User::LeaveIfError( iFs.Connect() );
-        User::LeaveIfError( iFs.ShareAuto() );    
+        User::LeaveIfError( iFs.ShareAuto() );
         }
-    
+
     TPtr utilityResourcePtr( NULL, 0 );
     iUtilityResourceFile = HBufC::NewL( KMaxFileName );
     utilityResourcePtr.Set( iUtilityResourceFile->Des() );
-    
+
     TPtr avkonResourcePtr( NULL, 0 );
     iAvkonResourceFile = HBufC::NewL( KMaxFileName );
     avkonResourcePtr.Set( iAvkonResourceFile->Des() );
 
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     utilityResourcePtr.Append( KDriveZ );
     avkonResourcePtr.Append( KDriveZ );
-    
+
 #else //RD_MULTIPLE_DRIVE
 
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
-    
+
     if ( iCoeEnv )
         {
         iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter );
         }
     else
         {
-        iFs.DriveToChar( driveNumber, driveLetter );    
+        iFs.DriveToChar( driveNumber, driveLetter );
         }
-    
+
     utilityResourcePtr.AppendFormat( KRomDriveFormatter, (TUint)driveLetter );
     avkonResourcePtr.AppendFormat( KRomDriveFormatter, (TUint)driveLetter );
-    
+
 #endif
-    
+
     utilityResourcePtr.Append( KDC_RESOURCE_FILES_DIR );
     utilityResourcePtr.Append( KCDrmUtilityResFileName );
-    
+
     avkonResourcePtr.Append( KDC_RESOURCE_FILES_DIR );
     avkonResourcePtr.Append( KAvkonResFileName );
-    
+
     TFileName resourceFile;
     if ( iCoeEnv )
         {
         resourceFile = *iUtilityResourceFile;
         BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile );
         iUtilityResourceFileOffset = iCoeEnv->AddResourceFileL( resourceFile );
-        
+
         resourceFile = *iAvkonResourceFile;
         BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile );
         iAvkonResourceFileOffset = iCoeEnv->AddResourceFileL( resourceFile );
@@ -163,16 +163,16 @@
         {
         resourceFile = *iUtilityResourceFile;
         iUtilityStringResourceReader = CStringResourceReader::NewL( resourceFile, iFs );
-        
+
         resourceFile = *iAvkonResourceFile;
         iAvkonStringResourceReader = CStringResourceReader::NewL( resourceFile, iFs );
         }
 
     FeatureManager::InitializeLibL();
-    
+
     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
         {
-    	iEventProvider = CMediatorEventProvider::NewL();
+        iEventProvider = CMediatorEventProvider::NewL();
         }
     }
 
@@ -182,14 +182,14 @@
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewLC( 
+EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewLC(
     CCoeEnv* aCoeEnv )
     {
     DRM::CDrmUtilityUI* self( new( ELeave ) CDrmUtilityUI( aCoeEnv ) );
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
-    
+
     return self;
     }
 
@@ -198,13 +198,13 @@
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewL( 
+EXPORT_C DRM::CDrmUtilityUI* DRM::CDrmUtilityUI::NewL(
     CCoeEnv* aCoeEnv )
     {
     DRM::CDrmUtilityUI* self( NewLC( aCoeEnv ) );
-    
+
     CleanupStack::Pop( self );
-    
+
     return self;
     }
 
@@ -222,14 +222,14 @@
         delete iAvkonStringResourceReader;
         iFs.Close();
         }
-    
+
     delete iUtilityResourceFile;
     delete iAvkonResourceFile;
     delete iEventProvider;
-    
+
     iNoteList.ResetAndDestroy();
     iNoteList.Close();
-    
+
     FeatureManager::UnInitializeLib();
     }
 
@@ -242,7 +242,7 @@
     TInt aQueryResourceId )
     {
     TInt button( 0 );
-    
+
     if ( iCoeEnv )
         {
         HBufC* msgText( StringLoader::LoadLC( aTextResourceId, iCoeEnv ) );
@@ -253,17 +253,17 @@
         {
         TInt buttonsId(
             aQueryResourceId == R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ?
-                                                R_AVKON_SOFTKEYS_OK_EMPTY__OK : 
+                                                R_AVKON_SOFTKEYS_OK_EMPTY__OK :
                                                 R_AVKON_SOFTKEYS_YES_NO__YES );
-        
+
         DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper(
             DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) );
 
         button = noteWrapper->ShowNoteWithButtonsL( aTextResourceId, buttonsId );
-        
+
         CleanupStack::PopAndDestroy( noteWrapper );
         }
-        
+
     return button;
     }
 
@@ -277,11 +277,11 @@
     const TDesC& aString )
     {
     TInt button( 0 );
-    
+
     if ( iCoeEnv )
         {
-        HBufC* msgText( StringLoader::LoadLC( aTextResourceId, 
-                                              aString, 
+        HBufC* msgText( StringLoader::LoadLC( aTextResourceId,
+                                              aString,
                                               iCoeEnv ) );
         button = DisplayQueryL( *msgText, aQueryResourceId );
         CleanupStack::PopAndDestroy( msgText );
@@ -290,18 +290,18 @@
         {
         TInt buttonsId(
             aQueryResourceId == R_DRMUTILITY_WAITING_RIGHTS_CONFIRMATION_QUERY ?
-                                                R_AVKON_SOFTKEYS_OK_EMPTY__OK : 
+                                                R_AVKON_SOFTKEYS_OK_EMPTY__OK :
                                                 R_AVKON_SOFTKEYS_YES_NO__YES );
-        
+
         DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper(
             DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) );
 
-        button = noteWrapper->ShowNoteWithButtonsL( aTextResourceId, 
-                                                    buttonsId, 
+        button = noteWrapper->ShowNoteWithButtonsL( aTextResourceId,
+                                                    buttonsId,
                                                     aString );
         CleanupStack::PopAndDestroy( noteWrapper );
         }
-        
+
     return button;
     }
 
@@ -309,29 +309,29 @@
 // CDrmUtilityUI::DisplayQueryL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( 
-    TInt aTextResourceId, 
+EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL(
+    TInt aTextResourceId,
     TInt aValue )
     {
     TInt buttonCode( 0 );
-    
+
     if ( iCoeEnv )
         {
         TPtr bufPtr( NULL, 0 );
 
-        HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, 
+        HBufC* stringholder( StringLoader::LoadLC( aTextResourceId,
                                                    aValue,
                                                    iCoeEnv ) );
-        CAknQueryDialog* dlg( 
+        CAknQueryDialog* dlg(
                         CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) );
 
         bufPtr.Set( stringholder->Des() );
         AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
         PrepareSecondaryDisplayL( *dlg, aTextResourceId, KNullDesC, aValue );
 
-        buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, 
+        buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY,
                                      *stringholder );
-        
+
         CancelSecondaryDisplayL( aTextResourceId );
         CleanupStack::PopAndDestroy( stringholder );
         }
@@ -339,9 +339,9 @@
         {
         DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper(
             DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) );
-        
+
         buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aValue );
-        
+
         CleanupStack::PopAndDestroy( noteWrapper );
         }
     return buttonCode;
@@ -351,29 +351,29 @@
 // CDrmUtilityUI::DisplayQueryL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( 
-    TInt aTextResourceId, 
+EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL(
+    TInt aTextResourceId,
     const TDesC& aString )
     {
     TInt buttonCode( 0 );
-    
+
     if ( iCoeEnv )
         {
         TPtr bufPtr( NULL, 0 );
 
-        HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, 
+        HBufC* stringholder( StringLoader::LoadLC( aTextResourceId,
                                                    aString,
                                                    iCoeEnv ) );
-        CAknQueryDialog* dlg(  
+        CAknQueryDialog* dlg(
             CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) );
 
         bufPtr.Set( stringholder->Des() );
         AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
         PrepareSecondaryDisplayL( *dlg, aTextResourceId, aString, -1 );
 
-        buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, 
+        buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY,
                                      *stringholder );
-        
+
         CancelSecondaryDisplayL( aTextResourceId );
         CleanupStack::PopAndDestroy( stringholder );
         }
@@ -381,12 +381,12 @@
         {
         DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper(
             DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) );
-        
+
         buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aString );
-        
+
         CleanupStack::PopAndDestroy( noteWrapper );
         }
-        
+
     return buttonCode;
     }
 
@@ -402,7 +402,7 @@
     TInt aValuePos )
     {
     TInt buttonCode( 0 );
-    
+
     if ( iCoeEnv )
         {
         TPtr bufPtr( NULL, 0 );
@@ -414,36 +414,36 @@
         textBuffer = textBuffer2;
         StringLoader::Format( textBuffer2, textBuffer, aStringPos, aString );
 
-        bufPtr.Set( const_cast <TUint16*>( textBuffer2.Ptr() ), 
+        bufPtr.Set( const_cast <TUint16*>( textBuffer2.Ptr() ),
                                            textBuffer2.Length(),
                                            textBuffer2.Length() );
-                                           
+
         AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
 
         CAknQueryDialog* dlg(
             CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) );
-        
+
         PrepareSecondaryDisplayL( *dlg, aTextResourceId, aString, aValue );
-        
+
         buttonCode =
             dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, textBuffer2 );
-           
+
         CancelSecondaryDisplayL( aTextResourceId );
         }
     else
         {
         DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper(
             DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) );
-        
-        buttonCode = noteWrapper->ShowNoteL( aTextResourceId, 
+
+        buttonCode = noteWrapper->ShowNoteL( aTextResourceId,
                                              aString,
-                                             aValue, 
-                                             aStringPos, 
+                                             aValue,
+                                             aStringPos,
                                              aValuePos );
-        
+
         CleanupStack::PopAndDestroy( noteWrapper );
         }
-        
+
     return buttonCode;
     }
 
@@ -451,52 +451,52 @@
 // CDrmUtilityUI::DisplayQueryL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( 
-    TDesC& aPromptText, 
+EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL(
+    TDesC& aPromptText,
     TInt aQueryResourceId )
     {
-    CAknQueryDialog* dlg( new (ELeave) CAknQueryDialog( 
-                                                aPromptText, 
+    CAknQueryDialog* dlg( new (ELeave) CAknQueryDialog(
+                                                aPromptText,
                                                 CAknQueryDialog::ENoTone ) );
 
     TPtr bufPtr( NULL, 0 );
-    bufPtr.Set( const_cast <TUint16*>( aPromptText.Ptr() ), 
+    bufPtr.Set( const_cast <TUint16*>( aPromptText.Ptr() ),
                                        aPromptText.Length(),
                                        aPromptText.Length() );
-    
+
     AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
 
     PrepareSecondaryDisplayL( *dlg, aQueryResourceId, aPromptText, -1 );
-    
+
     TInt ret( dlg->ExecuteLD( aQueryResourceId ) );
-    
+
     CancelSecondaryDisplayL( aQueryResourceId );
-    
+
     return ret;
     }
 
 // -----------------------------------------------------------------------------
 // CDrmUtilityUI::SetAutomatedQuery
 // -----------------------------------------------------------------------------
-//    
-EXPORT_C TInt DRM::CDrmUtilityUI::SetAutomatedQueryL( 
+//
+EXPORT_C TInt DRM::CDrmUtilityUI::SetAutomatedQueryL(
     CDRMConstraint* aConstraint )
     {
-    __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, 
+    __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage,
                                               KDRMUtilityDebugPanicCode ) );
-                                              
+
     TInt buttonCode( 1 );
-    
-    if ( aConstraint->iActiveConstraints & EConstraintEndTime ) 
+
+    if ( aConstraint->iActiveConstraints & EConstraintEndTime )
         {
         TBuf<KDRMUtilityMaxDateLen> dateFormat;
         TBuf<KDRMUtilityMaxDateLen> endDate;
         TTime endTime( aConstraint->iEndTime );
-        
+
         if ( iCoeEnv )
             {
-            StringLoader::Load( dateFormat, 
-                                R_QTN_DATE_USUAL_WITH_ZERO, 
+            StringLoader::Load( dateFormat,
+                                R_QTN_DATE_USUAL_WITH_ZERO,
                                 iCoeEnv );
             }
         else
@@ -504,7 +504,7 @@
             dateFormat = iAvkonStringResourceReader->ReadResourceString(
                                                 R_QTN_DATE_USUAL_WITH_ZERO );
             }
-        
+
         endTime.FormatL( endDate, dateFormat );
         buttonCode = DisplayQueryL(R_DRM_QUERY_SET_AUTOMATED, endDate );
         }
@@ -514,28 +514,28 @@
                                           R_DRMUTILITY_CONFIRMATION_QUERY );
 
         }
-    return buttonCode;                                          
+    return buttonCode;
     }
 
 // -----------------------------------------------------------------------------
 // CDrmUtilityUI::ShowFutureRightsNoteL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmUtilityUI::ShowFutureRightsNoteL( 
+EXPORT_C void DRM::CDrmUtilityUI::ShowFutureRightsNoteL(
     CDRMConstraint* aConstraint)
     {
-    __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, 
+    __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage,
                                               KDRMUtilityDebugPanicCode ) );
     _LIT( KSpace, " " );
     TTime startTime( Time::NullTTime() );
-    
+
     User::LeaveIfError( GetOmaStartTime( aConstraint, startTime ) );
 
     TBuf<KDRMUtilityMaxDateFormatLen> dateFormat;
     TBuf<KDRMUtilityMaxTimeFormatLen> timeFormat;
     TBuf<KDRMUtilityMaxDateLen + KDRMUtilityMaxTimeLen + 1> startDateBuf;
     TBuf<KDRMUtilityMaxTimeLen> startTimeBuf;
-        
+
     if ( iCoeEnv )
         {
         StringLoader::Load( dateFormat, R_QTN_DATE_USUAL_WITH_ZERO, iCoeEnv );
@@ -543,12 +543,12 @@
         }
     else
         {
-        dateFormat = iAvkonStringResourceReader->ReadResourceString( 
+        dateFormat = iAvkonStringResourceReader->ReadResourceString(
                                             R_QTN_DATE_USUAL_WITH_ZERO );
-        timeFormat = iAvkonStringResourceReader->ReadResourceString( 
+        timeFormat = iAvkonStringResourceReader->ReadResourceString(
                                             R_QTN_TIME_USUAL_WITH_ZERO );
         }
-    
+
     // format date and time
     startTime.FormatL( startDateBuf, dateFormat );
     startTime.FormatL( startTimeBuf, timeFormat );
@@ -571,7 +571,7 @@
         DisplayNoteL( *msgText, aTextResourceId );
         CleanupStack::PopAndDestroy( msgText );
         }
-    
+
     else
         {
         TBuf<KDRMUtilityNoteMaxSize> buffer(
@@ -585,13 +585,13 @@
 // CDrmUtilityUI::DisplayNoteL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( 
-    TInt aTextResourceId, 
+EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL(
+    TInt aTextResourceId,
     const TDesC& aString )
     {
     if ( iCoeEnv )
         {
-        HBufC* msgText( StringLoader::LoadLC( aTextResourceId, 
+        HBufC* msgText( StringLoader::LoadLC( aTextResourceId,
                                               aString,
                                               iCoeEnv ) );
         DisplayNoteL( *msgText, aTextResourceId );
@@ -615,16 +615,16 @@
 // CDrmUtilityUI::DisplayNoteL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( 
-    TInt aTextResourceId, 
+EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL(
+    TInt aTextResourceId,
     TInt aValue )
     {
     if ( iCoeEnv )
         {
-        HBufC* msgText( StringLoader::LoadLC( aTextResourceId, 
+        HBufC* msgText( StringLoader::LoadLC( aTextResourceId,
                                               aValue,
                                               iCoeEnv ) );
-        
+
         DisplayNoteL( *msgText, aTextResourceId, KNullDesC, aValue );
         CleanupStack::PopAndDestroy( msgText );
         }
@@ -645,17 +645,17 @@
 // CDrmUtilityUI::DisplayNoteL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( 
-    TDesC& aPromptText, 
-    TInt aResourceId, 
-    const TDesC& aString, 
+EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL(
+    TDesC& aPromptText,
+    TInt aResourceId,
+    const TDesC& aString,
     TInt aValue )
     {
     TPtr bufPtr( NULL, 0 );
-    bufPtr.Set( const_cast <TUint16*>( aPromptText.Ptr() ), 
-                                       aPromptText.Length(), 
+    bufPtr.Set( const_cast <TUint16*>( aPromptText.Ptr() ),
+                                       aPromptText.Length(),
                                        aPromptText.Length() );
-                                       
+
     AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
 
     if ( iCoeEnv )
@@ -667,16 +667,16 @@
         }
     else
         {
-        DRM::CDrmUtilityInfoNoteWrapper* note( 
+        DRM::CDrmUtilityInfoNoteWrapper* note(
                                 DRM::CDrmUtilityInfoNoteWrapper::NewL() );
-        
+
         //a list for simultanous notes
         User::LeaveIfError( iNoteList.Append( note ) );
-        
+
         note->ShowNoteL( GlobalNoteTypeForResource( aResourceId ),
-                         aPromptText, 
-                         aResourceId, 
-                         aString, 
+                         aPromptText,
+                         aResourceId,
+                         aString,
                          aValue );
         }
     }
@@ -738,7 +738,7 @@
         PrepareSecondaryDisplayL( *dlg, resourceId );
         answer = dlg->ExecuteLD( resourceId );
         CancelSecondaryDisplayL( resourceId );
-        
+
         if ( answer )
             {
             buttonCode = index + 1;
@@ -748,20 +748,20 @@
         {
         DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper(
             DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) );
-            
+
         buttonCode = noteWrapper->ShowPreviewListQueryL( resourceId );
-        
+
         CleanupStack::PopAndDestroy( noteWrapper );
         }
 
     return buttonCode;
     }
-    
+
 #else
 
 EXPORT_C TInt DRM::CDrmUtilityUI::DisplayPopupWindowsForPreviewL(
     ContentAccess::CData& /*aContent*/,
-    TInt /*aPreviewType*/, 
+    TInt /*aPreviewType*/,
     TInt /*aMediaType*/ )
     {
     return 0;
@@ -777,61 +777,61 @@
     TInt aResId )
     {
     CAknResourceNoteDialog* resourceDialog( NULL );
-    
+
     switch ( aResId )
         {
         case R_DRM_ERR_OPENING_FAIL_PERM:
-            
+
             resourceDialog = new ( ELeave ) CAknErrorNote( ETrue );
-            
+
             break;
-        
+
         case R_DRM_WARN_NO_CONN_DEFINED:
         case R_DRM_WARN_INVALID_OR_NO_AP:
-            
+
             resourceDialog = new  ( ELeave ) CAknWarningNote( ETrue );
-            
+
             break;
-        
+
         default:
-            
+
             resourceDialog = new ( ELeave ) CAknInformationNote( ETrue );
-            
+
             break;
         }
-        
+
     return resourceDialog;
     }
 
 // -----------------------------------------------------------------------------
 // CDrmUtilityUI::GlobalNoteTypeForResource
 // -----------------------------------------------------------------------------
-///  
-TAknGlobalNoteType DRM::CDrmUtilityUI::GlobalNoteTypeForResource( 
+///
+TAknGlobalNoteType DRM::CDrmUtilityUI::GlobalNoteTypeForResource(
     TInt aResId )
     {
     TAknGlobalNoteType noteType( EAknGlobalInformationNote );
-    
+
     switch ( aResId )
         {
         case R_DRM_ERR_OPENING_FAIL_PERM:
-            
+
             noteType = EAknGlobalErrorNote;
-            
+
             break;
-        
+
         case R_DRM_WARN_NO_CONN_DEFINED:
         case R_DRM_WARN_INVALID_OR_NO_AP:
-            
+
             noteType = EAknGlobalWarningNote;
-            
+
             break;
-        
+
         default:
-            
+
             break;
         }
-    
+
     return noteType;
     }
 
@@ -839,21 +839,21 @@
 // CDrmUtilityUI::GetOmaStartTime
 // -----------------------------------------------------------------------------
 //
-TInt DRM::CDrmUtilityUI::GetOmaStartTime( 
-    CDRMConstraint* aConstraint, 
+TInt DRM::CDrmUtilityUI::GetOmaStartTime(
+    CDRMConstraint* aConstraint,
     TTime& aStartTime)
     {
-    __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage, 
+    __ASSERT_DEBUG( aConstraint, User::Panic( KDRMUtilityDebugPanicMessage,
                                               KDRMUtilityDebugPanicCode ) );
     TInt err( KErrNone );
-    
+
     // Activated interval is always the same or later than
     // the start time of the start-end
     if ( aConstraint->iActiveConstraints & EConstraintInterval &&
         (aConstraint->iIntervalStart != Time::NullTTime() ) )
         {
         aStartTime = aConstraint->iIntervalStart;
-        }    
+        }
     else if ( aConstraint->iActiveConstraints & EConstraintStartTime )
         {
         aStartTime = aConstraint->iStartTime;
@@ -862,7 +862,7 @@
         {
         err = KErrCANoPermission;
         }
-        
+
     return err;
     }
 
@@ -872,19 +872,19 @@
 //
 #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
 
-TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL( 
+TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL(
     ContentAccess::CData& aContent,
     TInt aPreviewType )
-    {    
+    {
     _LIT( KDRMUtilityMimeTypeVideo, "Video" );
     _LIT( KDRMUtilityMimeTypeRealMedia, "Application/x-pn-realmedia" );
     _LIT( KDRMUtilityMimeTypeVndRealMedia, "Application/vnd.rn-realmedia" );
     TInt mediaType( 0 );
     HBufC* mimeType( HBufC::NewLC( KMaxDataTypeLength ) );
     TPtr mimePtr( mimeType->Des() );
-    
+
     User::LeaveIfError( aContent.GetStringAttribute( ContentAccess::EMimeType, mimePtr ) );
-    
+
     if( mimePtr.FindF( KDRMUtilityMimeTypeVideo ) == KErrNotFound &&
         mimePtr.FindF( KDRMUtilityMimeTypeRealMedia ) == KErrNotFound &&
         mimePtr.FindF( KDRMUtilityMimeTypeVndRealMedia ) == KErrNotFound )
@@ -909,54 +909,54 @@
             mediaType = DRM::EUEmbeddedPreviewActionDefaultVideo;
             }
         }
-    
+
     CleanupStack::PopAndDestroy( mimeType );
     return mediaType;
     }
-    
+
 #else
 
-TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL( 
+TInt DRM::CDrmUtilityUI::EvaluatePreviewMediaTypeL(
     ContentAccess::CData& /*aContent*/,
     TInt /*aPreviewType*/ )
     {
     return 0;
     }
 
-#endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO    
+#endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO
 
 // -----------------------------------------------------------------------------
 // CDrmUtilityUI::PrepareSecondaryDisplayL
 // -----------------------------------------------------------------------------
 //
-void DRM::CDrmUtilityUI::PrepareSecondaryDisplayL( 
-    CEikDialog& aDialog, 
+void DRM::CDrmUtilityUI::PrepareSecondaryDisplayL(
+    CEikDialog& aDialog,
     TInt aResourceId,
-    const TDesC& aString, 
+    const TDesC& aString,
     TInt aValue )
     {
     // Check if we have cover display and shall we display something
     if ( !FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ||
-         !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( 
+         !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId(
                                                                 aResourceId ) )
         {
         return;
         }
-    
+
     RProcess myProcess;
     TUid myProcessUid( KNullUid );
-    
+
     RThread().Process( myProcess );
     myProcessUid = myProcess.Identity();
 
     aDialog.PublishDialogL( aResourceId, KUidCoverUiCategoryDrmUtility );
 
     // fetch akn utility for mediator support
-    CAknMediatorFacade* covercl( AknMediatorFacade( &aDialog ) );    
+    CAknMediatorFacade* covercl( AknMediatorFacade( &aDialog ) );
 
     if ( covercl ) // returns null if cover display is not available
         {
-        // Package dialog data 
+        // Package dialog data
         // <oem/SecondaryDisplay/DrmUtilitySecondaryDisplay.h>
         TUtilitySDData utilityData;
 
@@ -975,10 +975,10 @@
             utilityData.iNumParam.AppendNum( aValue );
             }
         TUtilitySDDataPckg pckg( utilityData );
- 
+
         covercl->BufStream() << pckg;   // Write the package data
         covercl->BufStream().CommitL(); // no more data to send so commit buf
-        }          
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -987,41 +987,41 @@
 //
 void DRM::CDrmUtilityUI::CancelSecondaryDisplayL( TInt aResourceId )
     {
-    
+
     // Check if we have cover display and shall we display something
     if( !FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ||
-        !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( 
+        !DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId(
                                                                 aResourceId ) )
         {
         return;
         }
-        
+
     RProcess myProcess;
     TUid myProcessUid( KNullUid );
-    
+
     RThread().Process( myProcess );
     myProcessUid = myProcess.Identity();
-    
+
     TUtilitySDDataCancel cancelData;
     cancelData.iHandlerProcessId = myProcessUid;
     cancelData.iNoteId = aResourceId;
-    
+
     TPckgBuf<TUtilitySDDataCancel> cancel( cancelData );
-    
-    HBufC8* buf( 
+
+    HBufC8* buf(
         HBufC8::NewLC( sizeof( TUtilitySDDataCancel ) + sizeof( TInt ) ) );
     TPtr8 ptr( buf->Des() );
-    
+
     RDesWriteStream stream( ptr );
     stream << cancel;
     stream.CommitL();
-    
+
     iEventProvider->RaiseEvent( KMediatorSecondaryDisplayDomain,
                                 KUidCoverUiCategoryDrmUtility,
                                 ECover_dialog_cancel,
                                 TVersion( 0, 0, 0 ),
                                 *buf );
-    
+
     stream.Close();
     CleanupStack::PopAndDestroy( buf );
     }
--- a/commondrm/drmutility/src/drmutilitywmdrmutilities.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/drmutilitywmdrmutilities.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,9 +19,9 @@
 #include <e32std.h>
 #include <DRMRights.h>
 
-#include "drmclockclient.h"
+#include "DRMClockClient.h"
 #include "drmutilitywmdrmutilities.h"
-#include "drmrights.h"
+#include "DRMRights.h"
 
 // CONSTANTS
 _LIT( KLicenseType, "licensetype=" );
@@ -63,7 +63,7 @@
     {
     TBool found( EFalse );
     aLex.Mark();
-    
+
     while ( !aLex.Eos() && found == EFalse )
         {
         TChar ch;
@@ -77,7 +77,7 @@
                 aPtr.Set( aLex.MarkedToken() );
                 aLex.Get();
                 }
-            else 
+            else
                 {
                 aPtr.Set( aLex.MarkedToken() );
                 }
@@ -98,134 +98,134 @@
     TTime localTime( Time::NullTTime() );
     TTime universalTime( Time::NullTTime() );
     TTimeIntervalSeconds timeDifference( 0 ); // local time - secure time
-    TInt years, months, days, hours, minutes, secs; 
+    TInt years, months, days, hours, minutes, secs;
     TChar ch;
     TLex lex;
     TTime drmTime;
     TInt timeZone;
-    
+
     DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure;
-    
+
     // The format of the start and end time strings is the following:
     // "starttime=yy-mm-ddThh:mins:ssZ
     // "endtime=yy-mm-ddThh:mins:ssZ
-    // where yy = years, mm = months, dd = days, hh = hours, 
-    // mins = minutes and ss = seconds, "-", "T", ":" and "Z" 
-    // are separators.     
+    // where yy = years, mm = months, dd = days, hh = hours,
+    // mins = minutes and ss = seconds, "-", "T", ":" and "Z"
+    // are separators.
     while ( !aLex.Eos() && ( aLex.Peek() != 0 ) )
         {
         // The next string should be start time, end time or then
         // it does not exist.
         ParseString( '=', aLex, token );
-        
+
         if ( token.CompareF( KStartTime ) == 0 )
             {
             times |= KFoundStartTime;
-            } 
+            }
         else if ( token.CompareF( KEndTime ) == 0 )
             {
             times |= KFoundEndTime;
             }
-        else 
+        else
             {
-            // No start time ("starttime=") or end time ("endtime=")  
-            // string was found -> return   
+            // No start time ("starttime=") or end time ("endtime=")
+            // string was found -> return
             return;
             }
-               
+
         if ( ( times & KFoundStartTime ) || ( times & KFoundEndTime ) )
-            {     
-            // Search for years, months, days, hours, minutes, secs     
+            {
+            // Search for years, months, days, hours, minutes, secs
             if ( ParseString( '-', aLex, token ) )
                 {
                 TLex lexYear( token );
                 User::LeaveIfError( lexYear.Val( years ) );
                 }
-            else 
+            else
                 {
-                User::Leave( KErrNotFound );    
+                User::Leave( KErrNotFound );
                 }
-            
+
             if ( ParseString( '-', aLex, token ) )
                 {
                 TLex lexMonths( token );
                 User::LeaveIfError( lexMonths.Val( months ) );
                 }
-            else 
+            else
                 {
-                User::Leave( KErrNotFound );    
+                User::Leave( KErrNotFound );
                 }
-            
+
             if ( ParseString( 'T', aLex, token ) )
                 {
                 TLex lexDays( token );
                 User::LeaveIfError( lexDays.Val( days ) );
                 }
-            else 
+            else
                 {
-                User::Leave( KErrNotFound );    
+                User::Leave( KErrNotFound );
                 }
-            
+
             if( ParseString( ':', aLex, token ) )
                 {
                 TLex lexHours( token );
                 User::LeaveIfError( lexHours.Val( hours ) );
                 }
-            else 
+            else
                 {
                 User::Leave( KErrNotFound );
                 }
-            
+
             if ( ParseString( ':', aLex, token ) )
                 {
                 TLex lexMinutes( token );
                 User::LeaveIfError( lexMinutes.Val( minutes ) );
                 }
-            else 
+            else
                 {
                 User::Leave( KErrNotFound );
                 }
-            
+
             if( ParseString( 'Z', aLex, token ) )
                 {
                 TLex lexSeconds( token );
                 User::LeaveIfError( lexSeconds.Val( secs ) );
                 }
-            else 
+            else
                 {
                 User::Leave( KErrNotFound );
-                }    
-            
+                }
+
             ParseString( ';', aLex, token );
             token.Set( NULL, 0 );
-            
-            TDateTime date( years, (TMonth)( months - 1 ), days - 1, hours, 
+
+            TDateTime date( years, (TMonth)( months - 1 ), days - 1, hours,
                 minutes, secs, 0 );
             TTime dateTime( date );
-            
-            // Get secure time from DRM clock 
+
+            // Get secure time from DRM clock
             RDRMClockClient client;
-            
+
             User::LeaveIfError( client.Connect() );
             client.GetSecureTime( drmTime, timeZone, secLevel );
             client.Close();
-            
-			localTime.HomeTime();
-			        	
-          	if ( secLevel == DRMClock::KSecure ) 
-          		{
-				// Calculate the difference between local time and secure time
-            	localTime.SecondsFrom( drmTime, timeDifference );
-            	}
-			else 
-				{
-				// Calculate the difference between local and universal time	
-				universalTime.UniversalTime();	
-				localTime.SecondsFrom( universalTime, timeDifference ); 	
-				}
-          	
-			dateTime += timeDifference;
-			               
+
+            localTime.HomeTime();
+
+            if ( secLevel == DRMClock::KSecure )
+                {
+                // Calculate the difference between local time and secure time
+                localTime.SecondsFrom( drmTime, timeDifference );
+                }
+            else
+                {
+                // Calculate the difference between local and universal time
+                universalTime.UniversalTime();
+                localTime.SecondsFrom( universalTime, timeDifference );
+                }
+
+            dateTime += timeDifference;
+
             if ( times & KFoundStartTime )
                 {
                 aStartTime = dateTime;
@@ -248,12 +248,12 @@
     TUint32& aCounts )
     {
     TPtrC16 token( NULL, 0 );
-    TInt counts( 0 ); 
+    TInt counts( 0 );
     TChar ch;
     TLex lex;
-        
+
     ParseString( '=', aLex, token );
-        
+
     if ( token.CompareF( KCountLeft ) == 0 )
         {
         ParseString( ';', aLex, token );
@@ -261,8 +261,8 @@
         User::LeaveIfError( lexCount.Val( counts ) );
         aCounts = counts;
         return ETrue;
-        }    
-    else 
+        }
+    else
         {
         // No counts left ("countleft=") string was found.
         // -> No count information was found, return EFalse
@@ -274,15 +274,15 @@
 // DrmUtilityWmDrmUtilities::ParseWmDrmDurationRightsL
 // ----------------------------------------------------------------------------
 //
-EXPORT_C TBool DrmUtilityWmDrmUtilities::ParseWmDrmDurationRightsL( TLex& aLex, 
+EXPORT_C TBool DrmUtilityWmDrmUtilities::ParseWmDrmDurationRightsL( TLex& aLex,
     TTimeIntervalSeconds& aDuration )
     {
     TPtrC16 token( NULL, 0 );
     TChar ch;
     TInt duration( 0 );
-        
+
     ParseString( '=', aLex, token );
-        
+
     if ( token.CompareF( KDurationLeft ) == 0 )
         {
         ParseString( ';', aLex, token );
@@ -291,12 +291,12 @@
         aDuration = duration;
         return ETrue;
         }
-    else 
+    else
         {
         // No duration left ("durationleft=") string was found.
         // -> No duration information was found, return EFalse
         return EFalse;
-        }         
+        }
     }
 
 // ----------------------------------------------------------------------------
@@ -307,49 +307,49 @@
     ContentAccess::CRightsInfo& aRights,
     CDRMRightsConstraints*& aRightsConstraint )
     {
-    
-    __ASSERT_DEBUG( !aRightsConstraint, 
+
+    __ASSERT_DEBUG( !aRightsConstraint,
                     User::Panic( KWmDrmUtilitiesDebugPanicMessage,
                                  KWmDrmUtilitiesDebugPanicCode ) );
-       
+
     TChar ch;
     TTime startTime( Time::NullTTime() );
     TTime endTime( Time::NullTTime() );
     TTimeIntervalSeconds duration( 0 );
     TUint32 counter( 0 );
-    
+
     TPtrC16 token( NULL, 0 );
-    
+
     // Parse the WM DRM rights string
     TLex lex( aRights.Description() );
-    
-    // First, find the license type format string ("licensetype=") 
+
+    // First, find the license type format string ("licensetype=")
     ParseString( '=', lex, token );
-    
+
     if ( token.CompareF( KLicenseType ) != 0 )
         {
-        // License type format string was not found  
+        // License type format string was not found
         User::Leave( KErrArgument );
         }
- 
-    // Peek for the end of string (eos) in case of (licensetype="") 
+
+    // Peek for the end of string (eos) in case of (licensetype="")
     ch = lex.Peek();
-    if ( ch == 0 ) 
+    if ( ch == 0 )
         {
         return;
         }
-    
+
     // Check the license type
     ParseString( ';', lex, token );
-    
+
     aRightsConstraint = CDRMRightsConstraints::NewL();
     CleanupStack::PushL( aRightsConstraint );
-    
+
     // Check what kind of rights are in question by parsing the string
     // onward. The possible rights are date time (start time and/or end time),
     // count, duration, time count (count and/or date time) and unlimited
     // rights. The substrings for certain rights are further parsed in
-    // specific methods. 
+    // specific methods.
     if ( token.CompareF( KTime ) == 0 )
         {
         ParseWmDrmTimeRightsL( lex, startTime, endTime );
@@ -395,24 +395,24 @@
         }
     else if ( token.CompareF( KUnlimited ) != 0 )
         {
-        // Unknown license type  
+        // Unknown license type
         User::Leave( KErrArgument );
         }
-          
+
     CleanupStack::Pop( aRightsConstraint );
-        
+
     }
 
 // -----------------------------------------------------------------------------
 // DrmUtilityWmDrmUtilities::CheckWmDrmRightsL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( TBool& aUnconstrained, 
+EXPORT_C void DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( TBool& aUnconstrained,
     TTimeIntervalSeconds& aTime,
-    TInt& aCounts,  
+    TInt& aCounts,
     ContentAccess::CRightsInfo& aRights )
     {
-    
+
     TChar ch;
     TPtrC16 token( NULL, 0 );
     TInt constraints( 0 );
@@ -424,34 +424,34 @@
     // End time of rights when duration is taken into account.
     TTime durationEndTime( Time::NullTTime() );
     TTimeIntervalSeconds secondsLeft( 0 ); // seconds to end of time based rights
-    
-    // Parse WM DRM rights string  
+
+    // Parse WM DRM rights string
     TLex lex( aRights.Description() );
-    
-    // First, find the license type format string ("licensetype=") 
+
+    // First, find the license type format string ("licensetype=")
     ParseString( '=', lex, token );
-    
+
     if ( token.CompareF( KLicenseType ) != 0 )
         {
-        // License type format string was not found  
+        // License type format string was not found
         User::Leave( KErrArgument );
         }
-    
-    // Peek for the end of string (Eos) in case of (licensetype="") 
+
+    // Peek for the end of string (Eos) in case of (licensetype="")
     ch = lex.Peek();
-    if ( ch == 0 ) 
+    if ( ch == 0 )
         {
         return;
         }
-    
+
     // Check the license type
     ParseString( ';', lex, token );
-    
+
     // Check what kind of rights are in question by parsing the string
     // onward. The possible rights are date time (start time and/or end time),
     // count, duration, time count (count and/or date time) and unlimited
     // rights. The substrings for certain rights are further parsed in
-    // specific methods. 
+    // specific methods.
     if ( token.CompareF( KTime ) == 0 )
         {
         ParseWmDrmTimeRightsL( lex, startTime, endTime );
@@ -470,7 +470,7 @@
             {
             aCounts = counter;
             constraints |= KWmDrmConstraintCount;
-            }    
+            }
         }
     else if ( token.CompareF( KDuration ) == 0 )
         {
@@ -499,69 +499,69 @@
             {
             constraints |= KWmDrmConstraintEndTime;
             }
-        }        
-    else if ( token.CompareF( KUnlimited ) == 0 ) 
+        }
+    else if ( token.CompareF( KUnlimited ) == 0 )
         {
         aUnconstrained = ETrue;
         return;
         }
-    else 
+    else
         {
         // Unknown license type
         User::Leave( KErrArgument );
         }
-    
+
     // Get current time
     now.HomeTime();
-        
+
     // The rights are not constrained
     if ( !constraints )
         {
         aUnconstrained = ETrue;
         }
-    
+
     if ( constraints & KWmDrmConstraintStartTime )
         {
         // The start time is in the past or the current time
-        if ( ( now >= startTime ) && 
+        if ( ( now >= startTime ) &&
             !( constraints & KWmDrmConstraintEndTime ) &&
             !( constraints & KWmDrmConstraintCount ) )
             {
             aUnconstrained = ETrue;
             }
-        
+
         // This use case is unclear and should be specified later.
         // There are counts for the content, but the start time has
-        // not been reached.    
+        // not been reached.
         if ( ( constraints & KWmDrmConstraintCount ) &&
-            ( now < startTime ) ) 
+            ( now < startTime ) )
             {
             aCounts = 0;
-            }               
+            }
         }
-    
+
     // Find out the amount of time that the rights have left in
     // case the rights have end time constraint.
     if ( constraints & KWmDrmConstraintEndTime )
         {
         error = endTime.SecondsFrom( now, secondsLeft );
-        
+
         // The difference between current time and the end time does not
         // fit to 32-bit number, the start time has been reached and there
         // are no count constraints defined.
-        if ( ( error == KErrOverflow ) && 
-            ( !( constraints & KWmDrmConstraintStartTime ) || 
+        if ( ( error == KErrOverflow ) &&
+            ( !( constraints & KWmDrmConstraintStartTime ) ||
             ( now >= startTime ) ) && !( constraints & KWmDrmConstraintCount ) )
             {
             aUnconstrained = ETrue;
             }
-        
+
         // End time has not been reached and start time has been reached
         if ( ( secondsLeft > (TTimeIntervalSeconds)0 ) && ( now >= startTime ) )
             {
             aTime = secondsLeft;
             }
-       
+
         // This use case is unclear and should be specified later.
         // There are counts for the content, but the end time has
         // been reached.
@@ -571,10 +571,9 @@
             aCounts = 0;
             }
         }
-        
+
     return;
-    
+
     }
-    
+
 // End of File
-    
\ No newline at end of file
--- a/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,8 +19,8 @@
 // INCLUDE FILES
 
 // launching embedded details view
-#include <aknlaunchappservice.h>
-#include <aiwgenericparam.h>
+#include <AknLaunchAppService.h>
+#include <AiwGenericParam.h>
 #include <apgcli.h>
 #include <apgtask.h>
 #include <w32std.h>
@@ -31,15 +31,12 @@
 #include <avkon.hrh>
 
 // access point utils
-#include <centralrepository.h>
+
 #include <cdblen.h>
 #include <cmconnectionmethod.h>
 #include <cmdestination.h>
 #include <cmconnectionmethoddef.h>
 #include <cmmanager.h>
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <browseruisdkcrkeys.h>
-#endif
 
 #include    <wmdrmagent.h> // for WMDRM file details view
 #include    <drmutilitytypes.h>
@@ -52,7 +49,7 @@
 #include    "drmutilityui.h"
 
 #include    "drmagents.h"
-#include    "drmclockclient.h"
+#include    "DRMClockClient.h"
 
 #include    "drmutilityinternaltypes.h"
 #include    "drmutilitywmdrmutilities.h"
@@ -63,12 +60,6 @@
 const TInt KMaxUrlLength( 1024 );
 const TInt KMaxUrlSanityLength( 102400 );
 
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser = {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint = 0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-#endif
-
 #ifdef _DEBUG
 // debug panic
 _LIT( KWmDrmWrapperDebugPanicMessage, "WmDrmWrapperDebugPanic" );
@@ -383,7 +374,7 @@
                 // Check the duration, counts and whether the rights
                 // are unlimited or not
                 case ContentAccess::ERightsStatusValid:
-                    DrmUtilityWmDrmUtilities::CheckWmDrmRightsL( 
+                    DrmUtilityWmDrmUtilities::CheckWmDrmRightsL(
                         aUnconstrained, aTime, aCounts, *aArray[0] );
                     break;
                 }
@@ -672,13 +663,13 @@
                                  KWmDrmWrapperDebugPanicCode ) );
 
     _LIT( KZero, "0" );
-    _LIT( KSpace, " " );
+    _LIT( KMarker, "\x00" );
 
     TPtr ptr( NULL, 0 );
 
     // length of startparam and drm protection type indicator and zero local id
-    // are always 1 and total of 3 spaces are needed
-    TInt length( 1 + aUrl->Length() + 1 + 3 + 1 );
+    // are always 1 and total of 4 markers are needed
+    TInt length( 1 + aUrl->Length() + 1 + 4 + 1 );
 
     aLaunchParam = HBufC::NewLC( length );
     ptr.Set( aLaunchParam->Des() );
@@ -694,14 +685,15 @@
         {
         ptr.AppendNum( EDrmLaunchParamStandAloneUtility );
         }
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     // Default value 0 for localId in case of WM DRM file
     ptr.Append( KZero );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     ptr.Append( *aUrl );
-    ptr.Append( KSpace );
+    ptr.Append( KMarker );
     // WM DRM protection scheme
     ptr.AppendNum( EDrmSchemeWmDrm );
+    ptr.Append( KMarker );
 
     CleanupStack::Pop( aLaunchParam );
     }
@@ -735,7 +727,7 @@
 // CDrmUtilityWMDrmWrapper::GetRFileFromCDataL
 // -----------------------------------------------------------------------------
 //
-void DRM::CDrmUtilityWMDrmWrapper::GetRFileFromCDataL( 
+void DRM::CDrmUtilityWMDrmWrapper::GetRFileFromCDataL(
     ContentAccess::CData& aContent,
     RFile& aFile )
     {
@@ -748,7 +740,7 @@
 // CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL
 // -----------------------------------------------------------------------------
 //
-TBool DRM::CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL( 
+TBool DRM::CDrmUtilityWMDrmWrapper::IsDlaLicenseAcquisitionSilentL(
     RFile& aFile  )
     {
     LoadDlaWrapperL();
@@ -759,7 +751,7 @@
 // CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL
 // -----------------------------------------------------------------------------
 //
-void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL( 
+void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL(
     RFile& aFile )
     {
     TInt iapId( 0 );
@@ -796,56 +788,38 @@
 //
 TInt DRM::CDrmUtilityWMDrmWrapper::DefaultAccessPointL()
     {
-    const TInt KDestinationSelectionMode( 2 );
-    CRepository* repository( NULL );
-    TInt ap( 0 );
-    TInt alwaysAsk( 0 );
+    //Fetch default connection
     TUint32 iapd32( 0 );
-    TInt defaultSnap( 0 );
+    TCmDefConnValue defConn;
+    RCmManager cmManager;
+    cmManager.OpenLC();
+    cmManager.ReadDefConnL(defConn);
+    if (defConn.iType == ECmDefConnConnectionMethod)
+        {
+        iapd32=defConn.iId;
+        }
+    else if (defConn.iType == ECmDefConnDestination)
+        {
+        RCmDestination dest( cmManager.DestinationL( defConn.iId ) );
+        CleanupClosePushL( dest );
 
-    repository = CRepository::NewL( KCRUidBrowser );
-    CleanupStack::PushL( repository );
-    repository->Get( KBrowserDefaultAccessPoint, ap );
-    repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-    repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-    CleanupStack::PopAndDestroy( repository );
-    
-    if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
-        {
-        alwaysAsk = ETrue;
+        if ( dest.ConnectionMethodCount() <= 0 )
+            {
+            User::Leave( KErrNotFound );
+            }
+
+        RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
+        CleanupClosePushL( cMeth );
+
+        iapd32 = cMeth.GetIntAttributeL( CMManager::ECmIapId );
+        CleanupStack::PopAndDestroy( 2, &dest ); //cMeth, dest
         }
     else
         {
-        RCmManager cmManager;
-        cmManager.OpenLC();
-        if ( !alwaysAsk )
-            {
-            iapd32 = 
-                cmManager.GetConnectionMethodInfoIntL( ap, 
-                                                       CMManager::ECmIapId );
-            }
-        else if ( alwaysAsk == KDestinationSelectionMode )
-            {
-            RCmDestination dest( cmManager.DestinationL( defaultSnap ) );
-            CleanupClosePushL( dest );
-
-            if ( dest.ConnectionMethodCount() <= 0 )
-                {
-                User::Leave( KErrNotFound );
-                }
-
-            RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-            CleanupClosePushL( cMeth );
-
-            iapd32 = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-            CleanupStack::PopAndDestroy( 2, &dest ); //cMeth, dest
-            }
-        CleanupStack::PopAndDestroy( &cmManager );
-        }
-    if ( alwaysAsk && alwaysAsk != KDestinationSelectionMode )
-        {
         User::Leave( KErrAccessDenied );
         }
+    CleanupStack::PopAndDestroy(&cmManager);
+    // End of fetch default connection
     return iapd32;
     }
 
--- a/commondrm/drmutility/src/rdrmhelperclient.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/drmutility/src/rdrmhelperclient.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,8 +20,8 @@
 // INCLUDE FILES
 #include <e32std.h>
 #include <e32math.h>
-#include "drmhelpercommon.h"
-#include "drmhelperserver.h"
+#include "DRMHelperCommon.h"
+#include "DRMHelperServer.h"
 #include "rdrmhelperclient.h"
 
 // LOCAL CONSTANTS AND MACROS
@@ -81,7 +81,7 @@
 
     if ( !error )
         {
-        error = CreateSession( KDRMHelperServerName, 
+        error = CreateSession( KDRMHelperServerName,
                                Version(),
                                KDefaultMessageSlots );
         }
@@ -96,7 +96,7 @@
 //
 TVersion RDrmHelperClient::Version() const
     {
-    return ( TVersion( KDRMHSMajorVersionNumber, 
+    return ( TVersion( KDRMHSMajorVersionNumber,
                        KDRMHSMinorVersionNumber,
                        KDRMHSBuildVersionNumber ) );
     }
@@ -115,7 +115,7 @@
     {
     TInt ret( KErrNone );
     TInt drmHsServiceType( 0 );
-    
+
     ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType );
     if ( ret )
         {
@@ -130,10 +130,10 @@
 
     // This call waits for the server to complete the request before
     // proceeding.
-    return SendReceive( ERegister, 
-                        TIpcArgs( aIntent, 
-                                  drmHsServiceType, 
-                                  aAutomatedType, 
+    return SendReceive( ERegister,
+                        TIpcArgs( aIntent,
+                                  drmHsServiceType,
+                                  aAutomatedType,
                                   &descriptor ) );
     }
 
@@ -151,13 +151,13 @@
     {
     TInt ret( KErrNone );
     TInt drmHsServiceType( 0 );
-    
+
     ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType );
     if( ret )
         {
         return ret;
         }
-    
+
     // Create descriptor to enable copying data between
     // client and server. Note: This can be local since
     // this is a synchronous call.
@@ -166,10 +166,10 @@
 
     // This call waits for the server to complete the request before
     // proceeding.
-    ret = SendReceive( ERemove, 
-                       TIpcArgs( aIntent, 
-                                 drmHsServiceType, 
-                                 aAutomatedType, 
+    ret = SendReceive( ERemove,
+                       TIpcArgs( aIntent,
+                                 drmHsServiceType,
+                                 aAutomatedType,
                                  &descriptor ) );
 
     if ( ret == KErrNotFound )
@@ -195,38 +195,38 @@
     TPtrC8 descriptor( aUri );
     TInt ret( KErrNone );
     TInt drmHsServiceType( 0 );
-    
+
     ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType );
     if ( ret )
         {
         return ret;
         }
-    
+
     TBool automated( EFalse );
 
     // This call waits for the server to complete the request before
     // proceeding.
-    ret = SendReceive( ERemove, 
-                       TIpcArgs( aIntent, 
+    ret = SendReceive( ERemove,
+                       TIpcArgs( aIntent,
                                  drmHsServiceType,
-                                 aAutomatedType, 
+                                 aAutomatedType,
                                  &descriptor ) );
-    
-    ret = IsAutomated( aUri, 
-                       aAutomatedType, 
-                       aIntent, 
-                       aServiceType, 
+
+    ret = IsAutomated( aUri,
+                       aAutomatedType,
+                       aIntent,
+                       aServiceType,
                        automated );
-                       
+
     while ( automated )
         {
         // unregister all
-        ret = SendReceive( ERemove, 
-                           TIpcArgs( aIntent, 
-                                     drmHsServiceType, 
-                                     aAutomatedType, 
+        ret = SendReceive( ERemove,
+                           TIpcArgs( aIntent,
+                                     drmHsServiceType,
+                                     aAutomatedType,
                                      &descriptor ) );
-                                     
+
         IsAutomated( aUri, aAutomatedType, aIntent, aServiceType, automated );
         }
 
@@ -260,13 +260,13 @@
     TPtr8 flag( reinterpret_cast< TUint8* >( &aAutomated ), 0, sizeof( TInt ) );
     TInt ret( KErrNone );
     TInt drmHsServiceType( 0 );
-    
+
     ret = AutomatedServiceTypeToHs( aServiceType, drmHsServiceType );
     if ( ret )
         {
         return ret;
         }
-    
+
     TInt type( CDRMHelperServer::EActive );
 
     // Create descriptor to enable copying data between
@@ -278,18 +278,18 @@
     // This call waits for the server to complete the request before
     // proceeding.
     ret = SendReceive( EIsRegistered,
-                       TIpcArgs( aIntent, 
-                                 type, 
-                                 aAutomatedType, 
+                       TIpcArgs( aIntent,
+                                 type,
+                                 aAutomatedType,
                                  &descriptor ) );
     if ( !ret )
         {
         type = CDRMHelperServer::EPassive;
-        
+
         ret = SendReceive( EIsRegistered,
-                           TIpcArgs( aIntent, 
-                                     type, 
-                                     aAutomatedType, 
+                           TIpcArgs( aIntent,
+                                     type,
+                                     aAutomatedType,
                                      &descriptor ) );
         }
     aAutomated = ret ? ETrue : EFalse;
@@ -341,7 +341,7 @@
     {
     TInt result( 0 );
     const TUidType serverUid( KNullUid, KNullUid, KServerUid3 );
-    
+
     RProcess server;
     result = server.Create( KDRMHSServerFileName, _L(""), serverUid );
     if ( result )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commondrm/drmutility/traces/OstTraceDefinitions.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+// #define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- a/commondrm/group/bld.inf	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -39,8 +39,6 @@
 ../rom/DRMEncryptorResources.iby        LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmencryptorresources.iby )
 ../rom/DRMRightsManagerUI.iby           CORE_MW_LAYER_IBY_EXPORT_PATH( drmrightsmanagerui.iby )
 ../rom/DRMRightsManagerUIResources.iby  LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmrightsmanageruiresources.iby )
-../rom/drmsettingsplugin.iby            CORE_MW_LAYER_IBY_EXPORT_PATH( drmsettingsplugin.iby )
-../rom/drmsettingspluginresources.iby   LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmsettingspluginresources.iby )
 ../rom/drmutility.iby                   CORE_MW_LAYER_IBY_EXPORT_PATH( drmutility.iby )
 ../rom/drmutility_resources.iby         LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( drmutility_resources.iby )
 ../rom/drmserviceapiwrapper.iby         CORE_MW_LAYER_IBY_EXPORT_PATH( drmserviceapiwrapper.iby )
@@ -51,17 +49,11 @@
 // DRMEncryptor
 ../drmencryptor/group/DRMEncryptor.mmp
 
-// DRMSettingsPlugin
-../drmsettingsplugin/group/drmsettingsplugin.mmp
-
 // DRMRightsManagerUi
 ../drmrightsmanagerui/group/DRMRightsManager.mmp
 
 // drmutility
-#if (defined RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM)
-PRJ_MMPFILES
 #include "../drmutility/group/bld.inf"
-#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
 
 PRJ_MMPFILES
 #include "../drmserviceapiwrapper/group/bld.inf"
--- a/commondrm/rom/drmsettingsplugin.iby	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  DRMSettingsPlugin ROM resources
-*
-*/
-
-#ifndef DRMSETTINGSPLUGIN_IBY
-#define DRMSETTINGSPLUGIN_IBY
-
-ECOM_PLUGIN( drmsettingsplugin.dll, 102750CC.rsc )
-//data=DATAZ_\BITMAP_DIR\drmsettingsplugin.mif BITMAP_DIR\drmsettingsplugin.mif
-
-data=ZSYSTEM\install\commondrm_stub.SIS             \system\install\commondrm_stub.SIS
-#endif // DRMSETTINGSPLUGIN_IBY
-//  End of File
--- a/commondrm/rom/drmsettingspluginresources.iby	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  DRMSettingsPlugin ROM resources.
-*
-*/
-
-#ifndef DRMSETTINGSPLUGINRESOURCES_IBY
-#define DRMSETTINGSPLUGINRESOURCES_IBY
-
-data=DATAZ_\RESOURCE_FILES_DIR\drmsettingspluginrsc.rsc RESOURCE_FILES_DIR\drmsettingspluginrsc.rsc
-
-#endif // DRMSETTINGSPLUGINRESOURCES_IBY
-//  End of File
--- a/commondrm/rom/drmutility.iby	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/rom/drmutility.iby	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,8 +21,6 @@
 
 #include <data_caging_paths_for_iby.hrh>
 
-#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
-
 file=ABI_DIR\BUILD_DIR\DRMUtility.dll                    SHARED_LIB_DIR\DRMUtility.dll
 
 file=ABI_DIR\BUILD_DIR\drmutilitycommon.dll              SHARED_LIB_DIR\drmutilitycommon.dll
@@ -42,6 +40,4 @@
 file=ABI_DIR\BUILD_DIR\DRMAutomatedUsage.dll             SHARED_LIB_DIR\DRMAutomatedUsage.dll
 file=ABI_DIR\BUILD_DIR\DRMAutomatedUsageImpl.dll         SHARED_LIB_DIR\DRMAutomatedUsageImpl.dll
 
-#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
-
 #endif // DRMUTILITY_IBY
--- a/commondrm/rom/drmutility_resources.iby	Fri Feb 12 14:30:27 2010 +0000
+++ b/commondrm/rom/drmutility_resources.iby	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,11 +21,7 @@
 
 #include <data_caging_paths_for_iby.hrh>
 
-#ifdef RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
-
 data=DATAZ_\RESOURCE_FILES_DIR\DrmUtility.rsc                RESOURCE_FILES_DIR\DrmUtility.rsc
 data=DATAZ_\RESOURCE_FILES_DIR\DrmUtilityDmgrWrapper.rsc        RESOURCE_FILES_DIR\DrmUtilityDmgrWrapper.rsc
 
-#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
-
 #endif // DRMUTILITY_RESOURCES_IBY
--- a/drm_plat/dcf_repository_api/inc/DcfRep.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/drm_plat/dcf_repository_api/inc/DcfRep.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,8 +23,8 @@
 //  INCLUDES
 #include <e32base.h>
 #include <f32file.h>
-#include <D32DBMS.H>
-#include "dcfrepcli.h"
+#include <d32dbms.h>
+#include "DcfRepCli.h"
 // CONSTANTS
 // MACROS
 // DATA TYPES
--- a/drm_plat/drm_common_api/inc/DRMCommon.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/drm_plat/drm_common_api/inc/DRMCommon.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #define DRMCOMMON_H
 
 #include <e32base.h>
-#include <DrmRights.h>
+#include <DRMRights.h>
 #include <caf/caf.h>
 
 const TUint KDrmMaxContentInfoSize = 512;
--- a/drm_plat/drm_rights_api/inc/DcfCommon.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/drm_plat/drm_rights_api/inc/DcfCommon.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,8 +23,8 @@
 //  INCLUDES
 #include <apmstd.h>
 #include <f32file.h>
-#include <oma2agent.h>
-#include <drmtypes.h>
+#include <Oma2Agent.h>
+#include <DRMTypes.h>
 
 using namespace ContentAccess;
 // CONSTANTS
--- a/drm_plat/drm_service_api/inc/drmserviceapi.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/drm_plat/drm_service_api/inc/drmserviceapi.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #define C_CDRMSERVICEAPI_H
 
 #include <e32base.h>
-#include "drmtypes.h"
+#include "DRMTypes.h"
 
 // Forward declarations
 class RDRMClockClient;
--- a/drm_plat/drm_utility_api/group/bld.inf	Fri Feb 12 14:30:27 2010 +0000
+++ b/drm_plat/drm_utility_api/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  File that exports the files belonging to 
+* Description:  File that exports the files belonging to
 :                DRM Utility API
 *
 */
@@ -23,8 +23,6 @@
 DEFAULT
 
 PRJ_EXPORTS
-
-#if (defined RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM)
 // Utility
 ../inc/drmutility.h                  MW_LAYER_PLATFORM_EXPORT_PATH( drmutility.h )
 
@@ -44,5 +42,3 @@
 
 // Types
 ../inc/drmutilitytypes.h             MW_LAYER_PLATFORM_EXPORT_PATH( drmutilitytypes.h )
-
-#endif // RD_DRM_COMMON_INTERFACE_FOR_OMA_AND_WMDRM
--- a/drm_plat/group/bld.inf	Fri Feb 12 14:30:27 2010 +0000
+++ b/drm_plat/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -30,6 +30,7 @@
 #include "../drm_agents_api/group/bld.inf"
 #include "../wmdrm_core_api/group/bld.inf"
 #include "../wmdrm_access_api/group/bld.inf"
+#include "../wmdrm_ota_access_api/group/bld.inf"
 
 #if (defined __WINDOWS_MEDIA_DRM)
 #include "../camese_utility_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drm_plat/wmdrm_ota_access_api/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* File that exports the files belonging to WMDRM Ota API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/wmdrmotaaccess.h     MW_LAYER_PLATFORM_EXPORT_PATH(wmdrmotaaccess.h)
+
+../inc/wmdrmotaaccessecominterface.h \
+    MW_LAYER_PLATFORM_EXPORT_PATH(wmdrmotaaccessecominterface.h)
+
+../inc/wmdrmotaaccessecominterface.inl \
+    MW_LAYER_PLATFORM_EXPORT_PATH(wmdrmotaaccessecominterface.inl)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccess.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  wmdrmotaaccess.h
+*
+*/
+
+#ifndef _WMDRM_OTA_ACCESS_API_H_
+#define _WMDRM_OTA_ACCESS_API_H_
+
+// Forward declarations
+class CWmDrmOtaAccessEcomInterface;
+
+// Class declaration
+/**
+*  Provides access to WM DRM Over-the-Air
+*  Functionality
+*
+*  @code
+*  // Way to use CWmDrmOtaAccess
+*
+*  CWmDrmOtaAccess* access( CWmDrmOtaAccess::NewL() );
+*  delete access;
+*  @endcode
+*
+*/
+NONSHARABLE_CLASS( CWmDrmOtaAccess ) : public CBase
+    {     
+public:
+    /** Constructors */
+    IMPORT_C static CWmDrmOtaAccess* NewL();
+    IMPORT_C static CWmDrmOtaAccess* NewLC();
+
+    /** Destructor */
+    IMPORT_C virtual ~CWmDrmOtaAccess();
+    
+    /**
+    *  GetLicenseChallengeL
+    *  Syncronous method
+    *
+    *  Get the license challenge that can be sent to the server to fetch
+    *  a license
+    *
+    *  @param   aDrmHeader  IN  The drm header
+    *  @param   aChallenge  OUT Resulting Challenge
+    *  @return  None
+    *  @leave   Symbian OS error codes      
+    */
+    IMPORT_C void GetLicenseChallengeL( const TDesC8& aDrmHeader, 
+                                        HBufC8*& aChallenge );
+
+    /**
+    *  GetLicenseChallengeL
+    *  Asyncronous method
+    *
+    *  Get the license challenge that can be sent to the server to fetch
+    *  a license    
+    *
+    *  @param   aDrmHeader  IN  The drm header
+    *  @param   aChallenge  OUT Resulting Challenge
+    *  @param   aStatus     OUT Asyncronous request status
+    *  @return  None
+    *  @leave   Symbian OS error codes      
+    */
+    IMPORT_C void GetLicenseChallengeL( const TDesC8& aDrmHeader, 
+                                        HBufC8*& aChallenge, 
+                                        TRequestStatus& aStatus );
+    
+    /**
+    *  HandleLicenseResponseL
+    *  Syncronous method
+    *
+    *  Handle the response received from the server in correspondence
+    *  to the license challenge
+    *
+    *  @param   aResponse   IN  The license response
+    *  @return  None
+    *  @leave   Symbian OS error codes        
+    */
+    IMPORT_C void HandleLicenseResponseL( const TDesC8& aResponse );
+
+    /**
+    *  GetLicenseChallengeL
+    *  Asyncronous method
+    *
+    *  Handle the response received from the server in correspondence
+    *  to the license challenge
+    *    
+    *  @param   aResponse   IN  The license response
+    *  @param   aStatus     OUT Asyncronous request status    
+    *  @return  None
+    *  @leave   Symbian OS error codes      
+    */
+    IMPORT_C void HandleLicenseResponseL( const TDesC8& aResponse, 
+                                          TRequestStatus& aStatus );
+
+private:
+    /** Default constructor */
+    CWmDrmOtaAccess();
+    /** Second phase constructor */
+    void ConstructL();
+
+    /** Internal interface to the WM DRM system */
+    CWmDrmOtaAccessEcomInterface* iWmDrmOtaAccessEcomInterface;
+
+    };
+#endif // _WMDRM_OTA_ACCESS_API_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  wmdrmotaaccessecominterface.h
+*
+*/
+
+#ifndef _WMDRMOTAACCESSECOMINTERFACE_H_
+#define _WMDRMOTAACCESSECOMINTERFACE_H_
+
+#include <e32base.h>
+
+// Class declaration
+// CWmDrmAccessEcomInterface
+// ecom plugin interface for WM DRM access implementation
+// @see CWmDrmAccess
+NONSHARABLE_CLASS( CWmDrmOtaAccessEcomInterface ) : public CBase
+    {
+public:
+    // Constructors
+    static CWmDrmOtaAccessEcomInterface* NewL();
+    static CWmDrmOtaAccessEcomInterface* NewLC();
+
+    // Destructor
+    virtual ~CWmDrmOtaAccessEcomInterface();
+
+    /**
+    *  GetLicenseChallengeL
+    *  Syncronous method
+    *
+    *  Get the license challenge that can be sent to the server to fetch
+    *  a license
+    *
+    *  @param   aDrmHeader  IN  The drm header
+    *  @param   aChallenge  OUT Resulting Challenge
+    *  @return  None
+    *  @leave   Symbian OS error codes      
+    */
+    virtual void GetLicenseChallengeL( const TDesC8& aDrmHeader, 
+                               HBufC8*& aChallenge ) = 0;
+
+    /**
+    *  GetLicenseChallengeL
+    *  Asyncronous method
+    *
+    *  Get the license challenge that can be sent to the server to fetch
+    *  a license    
+    *
+    *  @param   aDrmHeader  IN  The drm header
+    *  @param   aChallenge  OUT Resulting Challenge
+    *  @param   aStatus     OUT Asyncronous request status
+    *  @return  None
+    *  @leave   Symbian OS error codes      
+    */
+    virtual void GetLicenseChallengeL( const TDesC8& aDrmHeader, 
+                                       HBufC8*& aChallenge, 
+                                       TRequestStatus& aStatus ) = 0;
+    
+    /**
+    *  HandleLicenseResponseL
+    *  Syncronous method
+    *
+    *  Handle the response received from the server in correspondence
+    *  to the license challenge
+    *
+    *  @param   aResponse   IN  The license response
+    *  @return  None
+    *  @leave   Symbian OS error codes        
+    */
+    virtual void HandleLicenseResponseL( const TDesC8& aResponse ) = 0;
+
+    /**
+    *  GetLicenseChallengeL
+    *  Asyncronous method
+    *
+    *  Handle the response received from the server in correspondence
+    *  to the license challenge
+    *    
+    *  @param   aResponse   IN  The license response
+    *  @param   aStatus     OUT Asyncronous request status    
+    *  @return  None
+    *  @leave   Symbian OS error codes      
+    */
+    virtual void HandleLicenseResponseL( const TDesC8& aResponse, 
+                                         TRequestStatus& aStatus ) = 0;
+
+private:
+    // internal variable used on freeing ecom related resources
+    TUid iDtor_ID_Key;
+    };
+
+#include "wmdrmotaaccessecominterface.inl"
+#endif _WMDRMOTAACCESSECOMINTERFACE_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drm_plat/wmdrm_ota_access_api/inc/wmdrmotaaccessecominterface.inl	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  wmdrmotaaccessecominterface.inl
+*
+*/
+
+#include <ecom/ecom.h> // for interface
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccessEcomInterface::NewL
+// ---------------------------------------------------------------------------
+//
+CWmDrmOtaAccessEcomInterface* CWmDrmOtaAccessEcomInterface::NewL()
+    {
+    const TUid KWmdrmOtaAccessEcomInterfaceUid =
+        {
+        0x2002E67D
+        };
+    TAny* theImplementation( NULL );
+
+    TEComResolverParams resolveParams;
+    resolveParams.SetWildcardMatch( ETrue );
+
+    theImplementation = REComSession::CreateImplementationL(
+        KWmdrmOtaAccessEcomInterfaceUid,
+        _FOFF( CWmDrmOtaAccessEcomInterface, iDtor_ID_Key ),
+        resolveParams );
+
+    return reinterpret_cast<CWmDrmOtaAccessEcomInterface*>( theImplementation );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccessEcomInterface::NewLC
+// ---------------------------------------------------------------------------
+//
+CWmDrmOtaAccessEcomInterface* CWmDrmOtaAccessEcomInterface::NewLC()
+    {
+    CWmDrmOtaAccessEcomInterface* self( CWmDrmOtaAccessEcomInterface::NewL() );
+
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccessEcomInterface::~CWmDrmOtaAccessEcomInterface
+// ---------------------------------------------------------------------------
+//
+CWmDrmOtaAccessEcomInterface::~CWmDrmOtaAccessEcomInterface()
+    {
+    REComSession::DestroyedImplementation( iDtor_ID_Key );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drm_plat/wmdrm_ota_access_api/wmdrm_ota_access_api.metaxml	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<api id="49fc416669cd9affd6778815e848f92b" dataversion="2.0">
+  <name>WMDRM Ota Access API</name>
+  <description>Platform API to access WMDRM Ota Interface</description>
+  <type>c++</type>
+  <collection>wmdrm</collection>
+  <libs>
+    <lib name="wmdrmotaaccess.lib"/>
+  </libs>
+  <release category="platform" sinceversion="5.0"/>
+  <attributes>
+    <htmldocprovided>no</htmldocprovided>
+    <adaptation>no</adaptation>
+  </attributes>
+</api>
--- a/inc/DRMClockClient.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/inc/DRMClockClient.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,8 +22,7 @@
 
 //  INCLUDES
 #include <e32std.h>
-#include <DrmTypes.h>
-//#include "DRMClock.h"
+#include <DRMTypes.h>
 
 // CONSTANTS
 // MACROS
@@ -48,79 +47,79 @@
          * C++ default constructor.
          */
         IMPORT_C RDRMClockClient();
-        
-        /** 
+
+        /**
          * Destructor.
          */
         IMPORT_C virtual ~RDRMClockClient();
-        
-        /** 
+
+        /**
          * This method opens the connection between the client and the server.
          * @since 2.5
          * @return Error code. KErrNone if the operation is successful.
          */
         IMPORT_C TInt Connect();
-        
+
         /**
          * This function closes the connection between the client and the server.
          * It is safe to call this method even if connection is not established.
          * @since S60Rel2.5
-         */ 
+         */
         IMPORT_C void Close();
-        
+
     public: // New functions
-        
+
         /**
          * Get the secure time.
          * @since 2.6
-         * @param aTime           Output parameter containing the 
+         * @param aTime           Output parameter containing the
          *                        secure time in UTC.
          * @param aTimeZone       Time zone information including summer/winter time
          *                        in +/- 15 minutes
          * @param aSecurityLevel  Output parameter Securiry level.
          * @return Symbian OS error code if any.
          */
-        IMPORT_C TInt GetSecureTime( TTime& aTime, 
+        IMPORT_C TInt GetSecureTime( TTime& aTime,
                             TInt& aTimeZone,
                             DRMClock::ESecurityLevel& aSecurityLevel ) const;
-                            
+
         /**
          * Update the secure time.
          * @since 2.6
-         * @param aTime           Input parameter containing the 
+         * @param aTime           Input parameter containing the
          *                        secure time in UTC.
          * @param aTimeZone       Time zone information including summer/winter time
-         *                        in +/- 15 minutes         
+         *                        in +/- 15 minutes
          * @return Symbian OS error code if any.
          */
         IMPORT_C TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone );
-                            
-        
+
+
     public: // Functions from base classes
-        
+
     protected:  // New functions
-        
+
     protected:  // Functions from base classes
-        
+
     private:
         // Prohibit copy constructor if not deriving from CBase.
         RDRMClockClient( const RDRMClockClient& );
         // Prohibit assigment operator if not deriving from CBase.
         RDRMClockClient& operator=( const RDRMClockClient& );
-        
+
     public:     // Data
-        
+
     protected:  // Data
-        
+
     private:    // Data
-        
+
     public:     // Friend classes
-        
+
     protected:  // Friend classes
-        
+
     private:    // Friend classes
     };
-    
-#endif      // RDRMCLOCKCLIENT_H   
+
+#endif      // RDRMCLOCKCLIENT_H
 
 // End of File
--- a/inc/DRMEventTimeChange.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/inc/DRMEventTimeChange.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,8 +22,8 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <DrmTypes.h>
-#include <DRMEvent.h>   
+#include <DRMTypes.h>
+#include <DRMEvent.h>
 
 // CONSTANTS
 
@@ -45,7 +45,7 @@
 *  @since S60Rel2.8
 */
 
-class CDRMEventTimeChange : public MDRMEvent, public CBase 
+class CDRMEventTimeChange : public MDRMEvent, public CBase
 {
 public: // Constructors and destructor
 
@@ -72,10 +72,10 @@
     * @since S60Rel3.0
     */
     IMPORT_C static CDRMEventTimeChange* NewL();
-    
+
     /**
     * Destructor
-    */   
+    */
     IMPORT_C virtual ~CDRMEventTimeChange();
 
 public: // new functions
@@ -96,7 +96,7 @@
     /**
     * GetOldTime
     *
-    * Returns what the time was before the time changed 
+    * Returns what the time was before the time changed
     *
     * @since S60Rel2.8
     */
@@ -117,7 +117,7 @@
     /**
     * GetNewTime
     *
-    * Returns what the time is after the time changed 
+    * Returns what the time is after the time changed
     *
     * @since S60Rel2.8
     */
@@ -161,7 +161,7 @@
     /**
     * GetNewTimeZone
     *
-    * Returns what the timezone is after the time changed 
+    * Returns what the timezone is after the time changed
     *
     * @since S60Rel2.8
     */
@@ -204,7 +204,7 @@
     /**
     * GetNewSecurityLevel
     *
-    * Returns what the security level is after the time changed 
+    * Returns what the security level is after the time changed
     *
     * @since S60Rel2.8
     */
@@ -235,7 +235,7 @@
 
     /**
     * WriteInt64L
-    * 
+    *
     * Writes the 64 bit integer to the stream
     *
     * @since    3.0
@@ -248,7 +248,7 @@
 
     /**
     * ReadInt64L
-    * 
+    *
     * Reads the 64 bit integer from the stream
     *
     * @since    3.0
@@ -257,10 +257,10 @@
     * @return   The function leaves with Symbian OS error code if an
     *           error occurs
     */
-    void ReadInt64L( TInt64& aRead, RReadStream& aStream ); 
+    void ReadInt64L( TInt64& aRead, RReadStream& aStream );
 
 private:
-    
+
     /**
     * C++ default constructor.
     */
@@ -270,7 +270,7 @@
     * First Phase constructor
     */
     void ConstructL();
-   
+
     // Prohibit copy constructor
     CDRMEventTimeChange( const CDRMEventTimeChange& );
 
@@ -282,21 +282,21 @@
 
     // The new time after the change
     TTime iNewTime;
-    
+
     // The old timezone before the change
     TInt iOldTimeZone;
-    
+
     // The new timezone after the change
     TInt iNewTimeZone;
-    
+
     // The old security level before the change
     DRMClock::ESecurityLevel iOldSecurityLevel;
-    
+
     // The new security level after the change
     DRMClock::ESecurityLevel iNewSecurityLevel;
-    
+
 };
 
 #endif      // CDRMEVENTTIMECHANGE_H
-            
+
 // End of File
--- a/inc/DrmKeyStorage.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/inc/DrmKeyStorage.h	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -25,7 +25,12 @@
 // CLASS DECLARATION
 
 /**
-*  CDrmKeyStorage: Contains key storage for OMA DRM 2.0
+*  CDrmKeyStorage: Contains key storage for OMA DRM 2.x
+*
+*  Generally the methods to the class require that a root certificate is selected.
+*  A specific root certificate can be selected or the default root can be selected.
+*  Operations needing the PKI keys should fail if the key has not been selected.
+*  Suggested error code: KErrNotReady
 *
 *  @lib    -
 *  @since  3.0
@@ -38,53 +43,231 @@
     
 public: // New functions
 
+    /**
+    *  Destructor
+    */
+
     virtual ~MDrmKeyStorage() = 0;
     
+    /**
+    * ModulusSize
+    *
+    * Return the modulus size of the selected certificates private key.
+    *
+    * @return   Modulus size of the PKI key 
+    */
+    
     virtual TInt ModulusSize() = 0;
-
+    
+    /**
+    * SelectTrustedRootL
+    *
+    * Selects the trusted root certificate to be used for operation occurring after
+    * this call
+    *
+    * @param    aRootKeyHash      Hash of the root key to be used.
+    * @leave    Symbian OS error codes
+    */
+    
     virtual void SelectTrustedRootL(
         const TDesC8& aRootKeyHash) = 0;
-        
+
+    /**
+    * SelectedRootIsCmla
+    *
+    * Checks if the selected root is a CMLA root
+    *
+    * @return   ETrue if the selected root is a CMLA root
+    *           EFalse if the root does not exist or is not a CMLA root
+    */
+            
     virtual TBool SelectedRootIsCmla() = 0;
-        
+
+    /**
+    * SelectDefaultRootL
+    *
+    * Selects the default root certificate of the device/keystorage implementation
+    *
+    * @leave    Symbian OS error code if the root can't be selected for some reason
+    */
+            
     virtual void SelectDefaultRootL() = 0;
-        
+
+    /**
+    * GetTrustedRootsL
+    *
+    * Get a list of unique identifiers for the trusted roots of the
+    * device / keystorage implementation. Generally PKI public key hash values.
+    *
+    * @param    aRootList     A pointer array of trusted root certificate hash values
+    *                         or other unique identifiers for the certificates
+    * @leave    Symbian OS error codes
+    */
+            
     virtual void GetTrustedRootsL(
         RPointerArray<HBufC8>& aRootList) = 0;
-        
+
+    /**
+    * GetCertificateChainL
+    *
+    * Get the certificate chain of the selected certificate
+    *
+    * @param    aRootList     A pointer array of certificate hash values
+    *                         or other unique identifiers for the certificates
+    *                         in the certificate chain
+    * @leave    Symbian OS error codes
+    */
+            
     virtual void GetCertificateChainL(
         RPointerArray<HBufC8>& aCertChain) = 0;
+    
+    /**
+    * RsaSignL
+    *
+    * Create an RSA signature of the buffer given
+    *
+    * @param    aInput         A descriptor containing the data to be signed
+    * @return   Signed buffer. Caller is responsible for freeing it.
+    * @leave    Symbian OS error codes
+    */
         
     virtual HBufC8* RsaSignL(
         const TDesC8& aInput) = 0;
-    
+
+    /**
+    * RsaDecryptL
+    *
+    * Decrypt the RSA encrypted buffer
+    *
+    * @param    aInput         A descriptor containing the data to be decrypted
+    * @return   Decrypted buffer. Caller is responsible for freeing it.
+    * @leave    Symbian OS error codes
+    */
+        
     virtual HBufC8* RsaDecryptL(
         const TDesC8& aInput) = 0;
-        
+
+    /**
+    * ImportDataL
+    *
+    * Allows the importing of PKI keys into the system
+    * Should import: Private Key, Public Certificate and all
+    * signing certificates for the certificate chain all the way to the root.
+    *
+    * Mostly usable for debugging purposes. Should be used with caution.
+    *
+    * @param    aPrivateKey           Private key of the imported PKI key.
+    * @param    aCertificateChain     Public Certificate and signing certificates
+    * @leave    Symbian OS error codes
+    */
+            
     virtual void ImportDataL(
         const TDesC8& aPrivateKey,
         const RArray<TPtrC8>& aCertificateChain) = 0;
-        
+
+    /**
+    * GetDeviceSpecificKeyL
+    *
+    * Get the device specific key/identifier that has a length of
+    * KDeviceSpecificKeyLength. Must return the same value every time.
+    * This method must not require the root to be selected.
+    *
+    * Does not require the selection of 
+    *
+    * @param    aKey      Buffer to fit the bytes of a device specific
+    *                     unique key / identifier. Must return the same
+    *                     value every time
+    * @leave    Symbian OS error codes
+    */
+            
     virtual void GetDeviceSpecificKeyL(
         TBuf8<KDeviceSpecificKeyLength>& aKey) = 0;
+    
+    /**
+    * GetRdbSerialNumberL
+    *
+    * This method fetches a unique serial number for the OMA DRM rights database
+    * currently in use. Does not have to be unique per device, but should return
+    * the same value while the current database is in use.
+    * Should create a new serial number if one does not exists.
+    *
+    * @param    aSerialNumber      Serial number for the OMA DRM
+    *                              rights database
+    * @leave    Symbian OS error codes
+    */
         
     virtual void GetRdbSerialNumberL(
     	TBuf8<KRdbSerialNumberLength>& aSerialNumber) = 0;
-    	
+
+    /**
+    * GenerateNewRdbSerialNumberL(
+    *
+    * This method creates a new unique serial number for the OMA DRM rights database. 
+    * Length of the serial number is defined by KRdbSerialNumberLength constant.
+    * Should be random and must be persisted until a new serial number is generated by
+    * a new call to this method.
+    *
+    * Recommend storing the serial number into the file system or other secure location.
+    * For example under the rightsserver.exe private directory.    
+    *
+    * @leave    Symbian OS error codes
+    */
+        	
    	virtual void GenerateNewRdbSerialNumberL() = 0;
-   	
+
+    /**
+    * UdtEncryptL
+    *
+    * Encrypt the User Data Transfer data. Usable only in the user data transfer use case.
+    * Uses it's own User Data Transfer PKI key.
+    *
+    * @param    aInput      Input buffer to be encrypted
+    * @return   Buffer encrypted with the User Data Transfer specific PKI key.
+    * @leave    Symbian OS error codes
+    */
+       	
    	virtual HBufC8* UdtEncryptL(
    	    const TDesC8& aInput) = 0;
-   	    
+   	
+    /**
+    * GetRootCertificatesL
+    *
+    * Get a list of all the root certificates of the device.
+    * Returns actual binary format (.der) certificates.
+    *
+    * @param    aRootCerts     Param description
+    * @return   Return value descriptions
+    * @leave    Symbian OS error codes
+    */
+       	    
    	virtual void GetRootCertificatesL(
         RPointerArray<HBufC8>& aRootCerts) = 0; 
 
+    /**
+    * RandomDataGetL
+    *
+    * Get random data into the beginning of the aData buffer.
+    *
+    * @param    aData      A return buffer that has enough space for the aLength amount of data.
+    * @param    aLength    Amount of random data requested
+    * @leave    Symbian OS error codes
+    */
+    
     virtual void RandomDataGetL( 
         TDes8& aData, 
         const TInt aLength ) = 0; 
 
     };
     
+/**
+* DrmKeyStorageNewL
+*
+* @return   Pointer to an object which implements the MDrmKeyStorage
+*           interface. Underlying implementation tells which
+*           keystorage to load if there are emulator/hw specific ones
+* @leave    Symbian OS error codes
+*/    
+    
 IMPORT_C MDrmKeyStorage* DrmKeyStorageNewL();
 
 #endif      // DRMKEYSTORAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/DrmUtilityDmgrWrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef CDRMUTILITYDMGRWRAPPER_H
+#define CDRMUTILITYDMGRWRAPPER_H
+
+#include <f32file.h> // RFs
+#include <DownloadMgrClient.h>
+#include <RoapObserver.h> // Roap::MRoapObserver
+#include <AknProgressDialog.h> // MAknProgressDialogCallback CAknProgressDialog
+
+
+namespace Roap
+    {
+    class CRoapEng;
+    }
+
+namespace DRM
+    {
+    class CDrmUtilityConnection;
+    }
+class CDRMRights;
+class CEikProgressInfo;
+
+
+/**
+* Environment gate function
+*
+* @since S60 v5.0
+* @return pointer to DMgr handler
+*/
+IMPORT_C TAny* GateFunctionDMgr();
+
+class MDrmUtilityDmgrWrapper
+    {
+
+public:
+    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0;
+
+    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl,
+        CCoeEnv& aCoeEnv ) = 0;
+
+    virtual HBufC8* GetErrorUrlL() = 0;
+
+    };
+
+/**
+*  Class for downloading ROAP triggers
+*
+*  @lib DrmUtilityDmgrWrapper
+*  @since S60 v5.0
+*/
+class CDrmUtilityDmgrWrapper :
+    public CActive,
+    public MHttpDownloadMgrObserver,
+    public Roap::MRoapObserver,
+    public MDrmUtilityDmgrWrapper,
+    public MProgressDialogCallback
+    {
+private:
+
+    enum TDownloadState
+        {
+        EInit,
+        EGetMeteringTrigger,
+        ESaveMeteringTrigger,
+        EMeteringReportSubmit,
+        EGetPrUrlTrigger,
+        ESavePrUrlTrigger,
+        EPrRoapRequest,
+        EComplete
+        };
+public:
+
+    static CDrmUtilityDmgrWrapper* NewL();
+
+    static CDrmUtilityDmgrWrapper* NewLC();
+
+    virtual ~CDrmUtilityDmgrWrapper();
+
+    /**
+    * Download a ROAP trigger from URL and handle it
+    *
+    * @param aUrl  URL of ROAP trigger
+    */
+    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
+
+    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl,
+        CCoeEnv& aCoeEnv );
+
+    HBufC8* GetErrorUrlL();
+
+
+    // from base class MHttpDownloadMgrObserver
+
+    /**
+    * From MHttpDownloadMgrObserver.
+    * Handle download manager events
+    *
+    * @param aDownload the download
+    * @param aEvent the event
+    */
+    void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
+
+// From Roap::MRoapObserver
+    /**
+    * ConnectionConfL
+    * @return ETrue: the network can be establish
+    *         EFalse: the ROAP transaction is canceled
+    *
+    * @leave  System wide error code */
+    TBool ConnectionConfL();
+
+    /**
+    * ContactRiConfL
+    * @return ETrue: the user consent is achieved
+    *         EFalse: the user consent is not achieved
+    *
+    * @leave  System wide error code */
+    TBool ContactRiConfL();
+
+    /**
+    * TransIdConfL
+    * @return ETrue: the user consent is achieved
+    *         EFalse: the user consent is not achieved
+    *
+    * @leave  System wide error code */
+
+    TBool TransIdConfL();
+
+    /**
+    * RightsObjectDetailsL
+    *
+    * The function is called after successful completion of RO acquisition
+    * protocol. The passes information about stored rights objects to the
+    * observer.
+    *
+    * @since  3.0
+    * @param aRightsList: A list of pointers to rights objects.
+    *                     Contents of aRightsList are owend by ROAP engine
+    *
+    * @leave  System wide error code */
+    void RightsObjectDetailsL( const RPointerArray<CDRMRights>& aRightsList );
+
+    /**
+    * ContentDownloadInfoL
+    *
+    * The function is called when the ROAP engine notices that it is about to
+    * receive a multipart content as a ROAP response. The method must return via
+    * out-parameter the path to a temp folder where the content is saved during
+    * download. The name that is used as filename when saving the content to
+    * the appropriate palce and the maximum size of the content (a safety upper limit)
+    * must also be provided via out-parameters.
+    *
+    * @since 3.0
+    * @param aTempFolder: (out-param) The path of the temp folder, or KNullDesC
+    * @param aContentName: (out-param) The name of the content, or KNullDesC (defaut name is used)
+    * @param aMaxSize: (out-param) The maximum size of the content, or -1 if not known
+    *
+    * @leave System wide error code */
+
+    void ContentDownloadInfoL( TPath& aTempFolder,
+            TFileName& aContentName,
+            TInt& aMaxSize );
+
+    /**
+    * ContentDetailsL
+    *
+    * The function is called when the ROAP engine has received a DCF content (together
+    * with a ROAP response) The ROAP engine saves the DCF to the appropriate location
+    * and gives out the information about the saved DCF file by calling this method
+    *
+    * @since 3.0
+    * @param aPath: The path andf the filename of the saved DCF file
+    * @param aType: The plain MIME type of the saved DCF file
+    * @param aAppUid: The handler app UID of the saved DCF file
+    *
+    * @leave System wide error code */
+
+    void ContentDetailsL( const TDesC& aPath,
+            const TDesC8& aType,
+            const TUid& aAppUid );
+
+    /**
+    * RoapProgressInfoL
+    *
+    * The function provides progress information about ROAP processing to the
+    * observer
+    *
+    * @since  3.0
+    * @param aProgressInfo: An integer value representing the state of
+    *                       ROAP processing, counting in bytes
+    *
+    * @leave  System wide error code */
+
+    void RoapProgressInfoL( const TInt aProgressInfo );
+
+    /**
+    * ErrorUrlL
+    *
+    * The function is called in ROAP error case and it provides an error URL
+    * for the caller. The calling entity should send an HTTP GET request to
+    * the URL which should then return an HTML page.
+    *
+    * @since  3.0
+    * @param aErrorUrl: The error URL
+    *
+    *
+    * @leave  System wide error code */
+
+    void ErrorUrlL( const TDesC8& aErrorUrl );
+
+    /**
+    * PostResponseUrlL
+    *
+    * The function is called if handled ROAP metering report response
+    * contains PostResponseURL extension. The calling entity should send
+    * an HTTP GET request to the URL, which should return ROAP trigger,
+    * download descriptor or multipart message containing both
+    * download descriptor and ROAP trigger.
+    *
+    * @since  3.2
+    * @param aPostResponseUrl: The URL to be fetched
+    *                          after handling ROAP metering response
+    *                          with PostResponseURL extension.
+    *
+    *
+    * @leave  System wide error code */
+    void PostResponseUrlL( const TDesC8& aPostResponseUrl );
+
+public: // Call back methods of MAknProgressDialogCallback
+
+    /**
+    * ProgressDialog call back method.
+    * Get's called when a dialog is dismissed.
+    *
+    * @param aButtonId ID of the button pressed
+    */
+    void DialogDismissedL( TInt aButtonId );
+
+protected:
+    //from Cactive
+    virtual void DoCancel();
+
+    virtual void RunL();
+
+    virtual TInt RunError( TInt aError );
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CDrmUtilityDmgrWrapper();
+
+    void ConstructL();
+
+    /**
+    * Set the browser default access point to be used
+    */
+
+
+    void ShowProgressNoteL( );
+
+    void RemoveProgressNoteL( );
+
+    void DoConnectL( TDownloadState aNextState );
+
+    void DoDownloadRoapTriggerL( TDownloadState aNextState );
+
+    void DoSaveRoapTriggerL( TDownloadState aNextState );
+
+    void DoHandleRoapTriggerL( TDownloadState aNextState );
+
+    void CompleteToState( TDownloadState aNextState, TInt aError );
+
+private: // data
+
+    /**
+    * Download manager session
+    */
+    RHttpDownloadMgr iDlMgr;
+
+    /**
+    * Used to make downloads synchronous
+    */
+    CActiveSchedulerWait iWait;
+
+    /**
+    * to store information on download
+    */
+    TBool iDownloadSuccess;
+    TBool iConnectionError;
+
+    /**
+    * trigger URL
+    */
+    HBufC8* iTriggerUrl;
+
+    /**
+    * trigger buffer
+    */
+    HBufC8* iTriggerBuf;
+
+    TBool iDialogDismissed;
+
+    /**
+    * Progess note dialog and progress info
+    */
+    CAknProgressDialog* iProgressNoteDialog;        // owned
+    CEikProgressInfo* iProgressInfo;                // not owned
+    TInt iCurrentProgressValue;                     // owned
+    TInt iProgressIncrement;                        // owned
+
+    /**
+    * Control environment
+    */
+    CCoeEnv* iCoeEnv;
+
+    /**
+    * Is CoeEnv given
+    */
+    TBool iUseCoeEnv;
+
+    /**
+    * Error url for ROAP temporary error
+    */
+    HBufC8* iErrorUrl;
+
+    /**
+    * Post response url for ROAP prUrl
+    */
+    HBufC8* iPostResponseUrl;
+
+    /**
+    * IAP (from ROAP or from UI)
+    */
+    TUint32 iIapId;
+
+    TDownloadState iState;
+
+    Roap::CRoapEng* iRoapEng;
+
+    RFs iFs;
+
+    HBufC* iFileName;
+
+    DRM::CDrmUtilityConnection* iConnection;
+    };
+
+#endif // CDRMUTILITYDMGRWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/buffercontainers.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CBase derived container classes for easening
+*               dynamic memory allocation of TBuf<n> type variables
+*               (TName etc.)
+*/
+#ifndef   BUFFERCONTAINERS_H
+#define   BUFFERCONTAINERS_H
+
+#include <e32std.h>
+namespace DRM
+{
+template <typename T>
+NONSHARABLE_CLASS( CBufferContainer ): public CBase
+    {
+    // Note, this class is not intendend to be part of any API
+    public:
+        inline static CBufferContainer<T>* NewL();
+        inline static CBufferContainer<T>* NewLC();
+
+        inline virtual ~CBufferContainer();
+    private:
+        inline CBufferContainer();
+
+        //data
+    public:
+        // Contained TBuf member
+        T iBuffer;
+    };
+
+//Containers for some TBuf based types defined at e32cmn.h
+typedef CBufferContainer<TName> CNameContainer;
+typedef CBufferContainer<TFullName> CFullNameContainer;
+typedef CBufferContainer<TExitCategoryName> CExitCategoryNameContainer;
+typedef CBufferContainer<TFileName> CFileNameContainer;
+typedef CBufferContainer<TPath> CPathContainer;
+typedef CBufferContainer<TVersionName> CVersionNameContainer;
+typedef CBufferContainer<TUidName> CUidNameContainer;
+}
+
+#include "buffercontainers.inl"
+#endif // BUFFERCONTAINERS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/buffercontainers.inl	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+#ifndef   BUFFERCONTAINERS_INL
+#define   BUFFERCONTAINERS_INL
+
+// ---------------------------------------------------------------------------
+// DRM::CBufferContainer::NewL
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+inline DRM::CBufferContainer<T>* DRM::CBufferContainer<T>::NewL()
+{
+    CBufferContainer<T>* self( CBufferContainer<T>::NewLC() );
+    CleanupStack::Pop( self );
+    return self;
+}
+
+// ---------------------------------------------------------------------------
+// DRM::CBufferContainer::NewLC
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+inline DRM::CBufferContainer<T>* DRM::CBufferContainer<T>::NewLC()
+{
+    CBufferContainer<T>* self( new (ELeave) CBufferContainer<T>() );
+    CleanupStack::PushL( self );
+    return self;
+}
+
+// ---------------------------------------------------------------------------
+// DRM::CBufferContainer::CBufferContainer
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+inline DRM::CBufferContainer<T>::CBufferContainer()
+{}
+
+// ---------------------------------------------------------------------------
+// DRM::CBufferContainer::~CBufferContainer
+// ---------------------------------------------------------------------------
+//
+template <typename T>
+inline DRM::CBufferContainer<T>::~CBufferContainer()
+{}
+
+
+#endif // BUFFERCONTAINERS_INL
--- a/inc/drmserviceapiwrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/inc/drmserviceapiwrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,7 +20,7 @@
 #define CDRMSERVICEAPIWRAPPER_H
 
 #include <e32base.h>
-#include "drmtypes.h"
+#include "DRMTypes.h"
 
 /**
  * Environment gate function
@@ -37,28 +37,28 @@
      * Get the secure time
      *
      * @since   S60 v3.2
-     * @param   aTime           Output parameter containing the 
+     * @param   aTime           Output parameter containing the
      *                          secure time in UTC.
      * @param   aTimeZone       Time zone information including summer/winter time
      *                          in +/- 15 minutes
      * @param   aSecurityLevel  Output parameter Securiry level.
      * @return  Symbian OS error code if any.
      */
-    virtual TInt GetSecureTime( TTime& aTime, 
+    virtual TInt GetSecureTime( TTime& aTime,
                                 TInt& aTimeZone,
                                 DRMClock::ESecurityLevel& aSecurityLevel ) const = 0;
-                        
+
     /**
      * Update the secure time
      *
      * Requires DRM Capability
      *
      * @since   S60 v3.2
-     * @param   aTime           Input parameter containing the 
+     * @param   aTime           Input parameter containing the
      *                          secure time in UTC.
-     * @param   aTimeZone       Time zone information including 
+     * @param   aTimeZone       Time zone information including
      *                          summer/winter time
-     *                          in +/- 15 minutes         
+     *                          in +/- 15 minutes
      * @return  Symbian OS error code if any.
      */
     virtual TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone ) = 0;
@@ -89,13 +89,13 @@
     };
 
 
-namespace DRM 
+namespace DRM
     {
 
 // forward declaration
-class CDrmServiceApi;    
-    
-    
+class CDrmServiceApi;
+
+
 /**
  *  Class for connecting to the WmDrmServer
  *
@@ -118,28 +118,28 @@
      * Get the secure time
      *
      * @since   S60 v3.2
-     * @param   aTime           Output parameter containing the 
+     * @param   aTime           Output parameter containing the
      *                          secure time in UTC.
      * @param   aTimeZone       Time zone information including summer/winter time
      *                          in +/- 15 minutes
      * @param   aSecurityLevel  Output parameter Securiry level.
      * @return  Symbian OS error code if any.
      */
-    virtual TInt GetSecureTime( TTime& aTime, 
+    virtual TInt GetSecureTime( TTime& aTime,
                                 TInt& aTimeZone,
                                 DRMClock::ESecurityLevel& aSecurityLevel ) const;
-                        
+
     /**
      * Update the secure time
      *
      * Requires DRM Capability
      *
      * @since   S60 v3.2
-     * @param   aTime           Input parameter containing the 
+     * @param   aTime           Input parameter containing the
      *                          secure time in UTC.
-     * @param   aTimeZone       Time zone information including 
+     * @param   aTimeZone       Time zone information including
      *                          summer/winter time
-     *                          in +/- 15 minutes         
+     *                          in +/- 15 minutes
      * @return  Symbian OS error code if any.
      */
     virtual TInt UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone );
@@ -167,7 +167,7 @@
      * @leave Symbian OS error code
      */
     virtual void SignL( const TDesC8& aHash, HBufC8*& aSignature );
-    
+
 protected:
 
 private:
@@ -186,9 +186,9 @@
      * Download manager session
      */
     CDrmServiceApi* iServiceApi;
-    
+
     };
-    
+
     } // namespace DRM
-    
+
 #endif // CDRMSERVICEAPIWRAPPER_H
--- a/layers.sysdef.xml	Fri Feb 12 14:30:27 2010 +0000
+++ b/layers.sysdef.xml	Wed Jun 23 17:42:58 2010 +0100
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
   <!ENTITY layer_real_source_path "sf/mw/drm" >
 ]>
 
-<SystemDefinition name="drm" schema="1.4.0">
+<SystemDefinition name="drm" schema="1.5.1">
   <systemModel>
     <layer name="mw_layer">
       <module name="drm">
--- a/omadrm/drmengine/agentv2/inc/DcfCache.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/DcfCache.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #define DCFCACHE_H
 
 //  INCLUDES
-#include <dcfcommon.h>
+#include <DcfCommon.h>
 #include <mode.h>
 #include <symmetric.h>
 #include <rijndael.h>
--- a/omadrm/drmengine/agentv2/inc/Oma2AgentAttributes.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/Oma2AgentAttributes.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,10 +22,10 @@
 
 #include <caf/caftypes.h>
 #include <caf/virtualpathptr.h>
-#include <caf/AttributeSet.h>
-#include <caf/StringAttributeSet.h>
+#include <caf/attributeset.h>
+#include <caf/stringattributeset.h>
 #include "Oma2Agent.h"
-#include "Oma2Dcf.h"
+#include "oma2dcf.h"
 
 using namespace ContentAccess;
 
@@ -38,32 +38,32 @@
 */
 
 class TOma2AgentAttributes
-	{
+    {
 public:
-	static TInt GetAttribute(
-	    CDcfCommon& aDcfFile,
-	    TInt aAttribute, 
-	    const TVirtualPathPtr& aVirtualPath,
-	    RDRMRightsClient* aRightsClient = NULL);
-	    
-	static TInt GetAttributeSet(
-	    CDcfCommon& aDcfFile,
-	    RAttributeSet& aAttributeSet,
-	    const TVirtualPathPtr& aVirtualPath,
-	    RDRMRightsClient* aRightsClient = NULL);
-	    
-	static TInt GetStringAttribute(
-	    CDcfCommon& aDcfFile,
-	    TInt aAttribute,
-	    TDes& aValue,
-	    const TVirtualPathPtr& aVirtualPath,
-	    RDRMRightsClient* aRightsClient = NULL);
-	    
-	static TInt GetStringAttributeSet(
-	    CDcfCommon& aDcfFile,
-	    RStringAttributeSet& aStringAttributeSet,
-	    const TVirtualPathPtr& aVirtualPath,
-	    RDRMRightsClient* aRightsClient = NULL);
-	};
+    static TInt GetAttribute(
+        CDcfCommon& aDcfFile,
+        TInt aAttribute,
+        const TVirtualPathPtr& aVirtualPath,
+        RDRMRightsClient* aRightsClient = NULL);
+
+    static TInt GetAttributeSet(
+        CDcfCommon& aDcfFile,
+        RAttributeSet& aAttributeSet,
+        const TVirtualPathPtr& aVirtualPath,
+        RDRMRightsClient* aRightsClient = NULL);
+
+    static TInt GetStringAttribute(
+        CDcfCommon& aDcfFile,
+        TInt aAttribute,
+        TDes& aValue,
+        const TVirtualPathPtr& aVirtualPath,
+        RDRMRightsClient* aRightsClient = NULL);
+
+    static TInt GetStringAttributeSet(
+        CDcfCommon& aDcfFile,
+        RStringAttributeSet& aStringAttributeSet,
+        const TVirtualPathPtr& aVirtualPath,
+        RDRMRightsClient* aRightsClient = NULL);
+    };
 
 #endif // __Oma2AGENTATTRIBUTES_H__
--- a/omadrm/drmengine/agentv2/inc/Oma2AgentContent.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/Oma2AgentContent.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,10 +22,11 @@
 //  INCLUDES
 #include <f32file.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/agentinterface.h>
-#include <dcfcommon.h>
-#include <drmnotifier.h>
-#include <drmrightsclient.h>
+#include <DcfCommon.h>
+#include <DRMNotifier.h>
+#include <DRMRightsClient.h>
 
 // FORWARD DECLARATIONS
 class CAESDecryptor;
@@ -43,117 +44,117 @@
 class COma2AgentContent : public CAgentContent, public MDRMEventObserver
 {
 public:
-	static COma2AgentContent* NewL(
-	    const TDesC& aUri, 
-	    TContentShareMode aShareMode);
-	    
-	static COma2AgentContent* NewLC(
-	    const TDesC& aUri, 
-	    TContentShareMode aShareMode);
-		
-	static COma2AgentContent* NewL(
-	    RFile& aFile);
-	
-	static COma2AgentContent* NewLC(
-	    RFile& aFile);
+    static COma2AgentContent* NewL(
+        const TDesC& aUri,
+        TContentShareMode aShareMode);
+
+    static COma2AgentContent* NewLC(
+        const TDesC& aUri,
+        TContentShareMode aShareMode);
+
+    static COma2AgentContent* NewL(
+        RFile& aFile);
+
+    static COma2AgentContent* NewLC(
+        RFile& aFile);
 
     void EmbedDomainRoL();
-    
-	virtual ~COma2AgentContent();
+
+    virtual ~COma2AgentContent();
+
+public:
+    // From CAgentContent
+    virtual TInt OpenContainer(
+        const TDesC& aUniqueId);
+
+    virtual TInt CloseContainer();
+
+    virtual void GetEmbeddedObjectsL(
+        RStreamablePtrArray<CEmbeddedObject>& aArray);
+
+    virtual void GetEmbeddedObjectsL(
+        RStreamablePtrArray<CEmbeddedObject>& aArray,
+        TEmbeddedType aType);
+
+    virtual TInt Search(
+        RStreamablePtrArray<CEmbeddedObject>& aArray,
+        const TDesC8& aMimeType,
+        TBool aRecursive);
+
+    virtual TInt GetAttribute(
+        TInt aAttribute,
+        TInt& aValue,
+        const TDesC& aUniqueId);
+
+    virtual TInt GetAttributeSet(
+        RAttributeSet& aAttributeSet,
+        const TDesC& aUniqueId);
+
+    virtual TInt GetStringAttribute(
+        TInt aAttribute,
+        TDes& aValue,
+        const TDesC& aUniqueId);
 
-public: 
-	// From CAgentContent
-	virtual TInt OpenContainer(
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt CloseContainer();
-	
-	virtual void GetEmbeddedObjectsL(
-	    RStreamablePtrArray<CEmbeddedObject>& aArray);
-	    
-	virtual void GetEmbeddedObjectsL(
-	    RStreamablePtrArray<CEmbeddedObject>& aArray,
-	    TEmbeddedType aType);
-	    
-	virtual TInt Search(
-	    RStreamablePtrArray<CEmbeddedObject>& aArray,
-	    const TDesC8& aMimeType,
-	    TBool aRecursive);
-	    
-	virtual TInt GetAttribute(
-	    TInt aAttribute, 
-	    TInt& aValue, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt GetAttributeSet(
-	    RAttributeSet& aAttributeSet, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt GetStringAttribute(
-	    TInt aAttribute, 
-	    TDes& aValue, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt GetStringAttributeSet(
-	    RStringAttributeSet& aStringAttributeSet, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt AgentSpecificCommand(
-	    TInt aCommand, 
-	    const TDesC8& aInputBuffer, 
-	    TDes8& aOutputBuffer);
-	    
-	virtual void AgentSpecificCommand(
-	    TInt aCommand, 
-	    const TDesC8& aInputBuffer, 
-	    TDes8& aOutputBuffer, 
-	    TRequestStatus& aStatus);
-	    
-	virtual void NotifyStatusChange(
-	    TEventMask aMask, 
-	    TRequestStatus& aStatus, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt CancelNotifyStatusChange(
-	    TRequestStatus& aStatus, 
-	    const TDesC& aUniqueId);
-	    
-	virtual void RequestRights(
-	    TRequestStatus& aStatus, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt CancelRequestRights(
-	    TRequestStatus& aStatus, 
-	    const TDesC& aUniqueId);
-	    
-	virtual void DisplayInfoL(
-	    TDisplayInfo aInfo, 
-	    const TDesC& aUniqueId);
-	    
-	virtual TInt SetProperty(
-	    TAgentProperty aProperty, 
-	    TInt aValue);
+    virtual TInt GetStringAttributeSet(
+        RStringAttributeSet& aStringAttributeSet,
+        const TDesC& aUniqueId);
+
+    virtual TInt AgentSpecificCommand(
+        TInt aCommand,
+        const TDesC8& aInputBuffer,
+        TDes8& aOutputBuffer);
+
+    virtual void AgentSpecificCommand(
+        TInt aCommand,
+        const TDesC8& aInputBuffer,
+        TDes8& aOutputBuffer,
+        TRequestStatus& aStatus);
+
+    virtual void NotifyStatusChange(
+        TEventMask aMask,
+        TRequestStatus& aStatus,
+        const TDesC& aUniqueId);
+
+    virtual TInt CancelNotifyStatusChange(
+        TRequestStatus& aStatus,
+        const TDesC& aUniqueId);
+
+    virtual void RequestRights(
+        TRequestStatus& aStatus,
+        const TDesC& aUniqueId);
+
+    virtual TInt CancelRequestRights(
+        TRequestStatus& aStatus,
+        const TDesC& aUniqueId);
+
+    virtual void DisplayInfoL(
+        TDisplayInfo aInfo,
+        const TDesC& aUniqueId);
+
+    virtual TInt SetProperty(
+        TAgentProperty aProperty,
+        TInt aValue);
 
 public: // From MDRMEventObserver
     virtual void HandleEventL(
         MDRMEvent* aEvent);
-   
+
 private:
-	COma2AgentContent();
+    COma2AgentContent();
 
-	void NotifyStatusChangeL(
-	    TEventMask aMask, 
-	    TRequestStatus& aStatus, 
-	    const TDesC& aUniqueId);
+    void NotifyStatusChangeL(
+        TEventMask aMask,
+        TRequestStatus& aStatus,
+        const TDesC& aUniqueId);
 
-	
-	void ConstructL(
-	    const TDesC& aUri, 
-	    TContentShareMode aShareMode);
-	    
-	void ConstructL(
-	    RFile& aFile);
-		
+
+    void ConstructL(
+        const TDesC& aUri,
+        TContentShareMode aShareMode);
+
+    void ConstructL(
+        RFile& aFile);
+
     protected:  // Data
         CDcfCommon* iDcf;
         RFs iFs;
@@ -161,29 +162,29 @@
         TInt iFilePosition;
         TInt iDataPosition;
         HBufC* iUri;
-        
+
         // Content ID of the currently open container,
         // NULL for the outermost file
         HBufC* iCurrentContainer;
-        
+
         // Request status for change notifications
         TRequestStatus* iStatus;
-        
+
         // Notifier for change notifications
         CDRMNotifier* iNotifier;
-        
+
         // Watched events
         TEventMask iWatchedEvents;
-        
+
         // Watched content ID
         HBufC8* iWatchedId;
-        
+
         // Rights client
         RDRMRightsClient iRdb;
     };
 
 }
 
-#endif      // OMA2AGENTCONTENT_H   
-            
+#endif      // OMA2AGENTCONTENT_H
+
 // End of File
--- a/omadrm/drmengine/agentv2/inc/Oma2AgentData.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/Oma2AgentData.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,12 +23,13 @@
 //  INCLUDES
 #include <f32file.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/agentinterface.h>
-#include <dcfcommon.h>
-#include <drmrightsclient.h>
+#include <DcfCommon.h>
+#include <DRMRightsClient.h>
 
 //this header can be removed when ASYNC_READ flag is removed
-#include "dcfcache.h"
+#include "DcfCache.h"
 
 // FORWARD DECLARATIONS
 
--- a/omadrm/drmengine/agentv2/inc/Oma2AgentFactory.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/Oma2AgentFactory.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,11 +22,11 @@
 
 //  INCLUDES
 #include <caf/agentfactory.h>
-#include "oma2agentcontent.h"
-#include "oma2agentdata.h"
-#include "oma2agentmanager.h"
-#include "oma2agentrightsmanager.h"
-#include "oma2agentimportfile.h"
+#include "Oma2AgentContent.h"
+#include "Oma2AgentData.h"
+#include "Oma2AgentManager.h"
+#include "Oma2AgentRightsManager.h"
+#include "Oma2AgentImportFile.h"
 
 // CONSTANTS
 //const ?type ?constant_var = ?constant;
@@ -60,19 +60,19 @@
 class COma2AgentFactory : public CAgentFactory
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static COma2AgentFactory* NewL();
-        
+
         /**
         * Destructor.
         */
         virtual ~COma2AgentFactory();
 
     public: // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -89,17 +89,17 @@
         * @param ?arg1 ?description
         * @return ?description
         */
-		CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode);	
-		CAgentContent* CreateContentBrowserL(RFile& aFile);
-		CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode);
-		CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId);
-		CAgentManager*  CreateManagerL();
-		CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName);
-		CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray);
-		CAgentRightsManager* CreateRightsManagerL();	
+        CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode);
+        CAgentContent* CreateContentBrowserL(RFile& aFile);
+        CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode);
+        CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId);
+        CAgentManager*  CreateManagerL();
+        CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName);
+        CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray);
+        CAgentRightsManager* CreateRightsManagerL();
 
     protected:  // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -109,7 +109,7 @@
         //?type ?member_function( ?type ?arg1 );
 
     protected:  // Functions from base classes
-        
+
         /**
         * From ?base_class ?member_description
         */
@@ -135,7 +135,7 @@
     public:     // Data
         // ?one_line_short_description_of_data
         //?data_declaration;
-    
+
     protected:  // Data
         // ?one_line_short_description_of_data
         //?data_declaration;
@@ -143,7 +143,7 @@
     private:    // Data
         // ?one_line_short_description_of_data
         //?data_declaration;
-         
+
         // Reserved pointer for future extension
         //TAny* iReserved;
 
@@ -158,6 +158,6 @@
 
 }
 
-#endif      // OMA2AGENTFACTORY_H   
-            
+#endif      // OMA2AGENTFACTORY_H
+
 // End of File
--- a/omadrm/drmengine/agentv2/inc/Oma2AgentImportFile.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/Oma2AgentImportFile.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 
 #include <s32file.h>
 #include <caf/agentinterface.h>
-#include <oma2agent.h>
+#include <Oma2Agent.h>
 
 using namespace ContentAccess;
 
@@ -47,11 +47,11 @@
         const CMetaDataArray& aMetaDataArray,
         const TDesC& aOutputDirectory,
         const TDesC& aSuggestedFileName);
-        
+
     static COma2AgentImportFile* NewL(
         const TDesC8& aMimeType,
         const CMetaDataArray& aMetaDataArray);
-        
+
     virtual ~COma2AgentImportFile();
 
 public:
@@ -59,59 +59,59 @@
     // From CAgentImportFile
     virtual TInt WriteData(
         const TDesC8& aData);
-        
+
     virtual void WriteData(
         const TDesC8& aData,
         TRequestStatus& aStatus);
-        
+
     virtual TInt WriteDataComplete();
-    
+
     virtual void WriteDataComplete(
         TRequestStatus& aStatus);
-        
+
     virtual TInt OutputFileCountL() const;
-    
+
     virtual CSupplierOutputFile& OutputFileL(
         TInt aIndex);
-        
+
     virtual TImportStatus GetImportStatus() const;
-    
+
     virtual TInt GetSuggestedOutputFileExtension(
         TDes& aFileExtension);
-        
+
     virtual TInt GetSuggestedOutputFileName(
         TDes& aFileName);
-        
+
     virtual TInt ContinueWithNewOutputFile(
-        RFile& aFile, 
+        RFile& aFile,
         const TDesC& aFileName);
-        
+
     virtual void ContinueWithNewOutputFile(
-        RFile& aFile, 
-        const TDesC& aFileName, 
+        RFile& aFile,
+        const TDesC& aFileName,
         TRequestStatus& aStatus);
-        
+
     virtual void NewMimePartL(
-        const TDesC8& aMimeType, 
+        const TDesC8& aMimeType,
         const CMetaDataArray& aImportMetaData);
-        
+
     virtual void EndMimePartL();
 
 private:
 
     COma2AgentImportFile(
         TBool aAgentCreatesOutputFiles);
-        
+
     void ConstructL(
-        const TDesC8& aMimeType, 
-        const CMetaDataArray& aMetaDataArray, 
-        const TDesC& aOutputDirectory, 
+        const TDesC8& aMimeType,
+        const CMetaDataArray& aMetaDataArray,
+        const TDesC& aOutputDirectory,
         const TDesC& aSuggestedFileName);
-        
+
     TInt OpenOutputFile();
-    
+
     void WriteDataL(const TDesC8& aData);
-    
+
 private:
 
     TImportType iImportType;
@@ -130,5 +130,5 @@
     CDRMRights* iDcfRights;
     HBufC8* iDcfMimeType;
     };
-    
+
 #endif // __OMA2AGENTIMPORTFILE_H__
--- a/omadrm/drmengine/agentv2/inc/Oma2AgentManager.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/inc/Oma2AgentManager.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,8 +22,9 @@
 
 //  INCLUDES
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/agentinterface.h>
-#include <drmnotifier.h>
+#include <DRMNotifier.h>
 
 class CFileMan;
 
@@ -35,20 +36,20 @@
 class COma2AgentManager : public CAgentManager, public MDRMEventObserver
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static COma2AgentManager* NewL();
         static COma2AgentManager* NewLC();
-        
+
         /**
         * Destructor.
         */
         ~COma2AgentManager();
 
     public: // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -66,48 +67,48 @@
         * @return ?description
         */
 
-		// From CAgentManagerBase
-		TInt DeleteFile(const TDesC &aFileName);
-		TInt CopyFile(const TDesC& aSource, const TDesC& aDestination);
-		TInt CopyFile(RFile& aSource, const TDesC& aDestination);		
-		TInt RenameFile(const TDesC& aSource, const TDesC& aDestination);
-		TInt MkDir(const TDesC& aPath);
-		TInt MkDirAll(const TDesC& aPath);
-		TInt RmDir(const TDesC& aPath);
-		TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList) const;
-		TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList,CDir*& aDirList) const;
-		TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey, CDir*& aFileList) const;
-		TInt GetAttribute(TInt aAttribute, TInt& aValue, const TVirtualPathPtr& aVirtualPath);
-		TInt GetAttributeSet(RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath);
-		TInt GetStringAttributeSet(RStringAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath);
-		TInt GetStringAttribute(TInt aAttribute, TDes& aValue, const TVirtualPathPtr& aVirtualPath);
-		void NotifyStatusChange(const TDesC& aURI, TEventMask aMask, TRequestStatus& aStatus);
-		TInt CancelNotifyStatusChange(const TDesC& aURI, TRequestStatus& aStatus);
-		TInt SetProperty(TAgentProperty aProperty, TInt aValue);
-		void DisplayInfoL(TDisplayInfo aInfo, const TVirtualPathPtr& aVirtualPath);
-		
-		// From CAgentManager
-		TBool IsRecognizedL(const TDesC& aURI, TContentShareMode aShareMode) const;
-		TBool IsRecognizedL(RFile& aFile) const;
-		TBool RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const;
-		TInt AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer);
-		void AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer, TRequestStatus& aStatus);
+        // From CAgentManagerBase
+        TInt DeleteFile(const TDesC &aFileName);
+        TInt CopyFile(const TDesC& aSource, const TDesC& aDestination);
+        TInt CopyFile(RFile& aSource, const TDesC& aDestination);
+        TInt RenameFile(const TDesC& aSource, const TDesC& aDestination);
+        TInt MkDir(const TDesC& aPath);
+        TInt MkDirAll(const TDesC& aPath);
+        TInt RmDir(const TDesC& aPath);
+        TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList) const;
+        TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey, CDir*& anEntryList,CDir*& aDirList) const;
+        TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey, CDir*& aFileList) const;
+        TInt GetAttribute(TInt aAttribute, TInt& aValue, const TVirtualPathPtr& aVirtualPath);
+        TInt GetAttributeSet(RAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath);
+        TInt GetStringAttributeSet(RStringAttributeSet& aAttributeSet, const TVirtualPathPtr& aVirtualPath);
+        TInt GetStringAttribute(TInt aAttribute, TDes& aValue, const TVirtualPathPtr& aVirtualPath);
+        void NotifyStatusChange(const TDesC& aURI, TEventMask aMask, TRequestStatus& aStatus);
+        TInt CancelNotifyStatusChange(const TDesC& aURI, TRequestStatus& aStatus);
+        TInt SetProperty(TAgentProperty aProperty, TInt aValue);
+        void DisplayInfoL(TDisplayInfo aInfo, const TVirtualPathPtr& aVirtualPath);
+
+        // From CAgentManager
+        TBool IsRecognizedL(const TDesC& aURI, TContentShareMode aShareMode) const;
+        TBool IsRecognizedL(RFile& aFile) const;
+        TBool RecognizeFileL(const TDesC& aFileName, const TDesC8& aBuffer, TDes8& aFileMimeType, TDes8& aContentMimeType) const;
+        TInt AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer);
+        void AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer, TRequestStatus& aStatus);
         void PrepareHTTPRequestHeaders(RStringPool& aStringPool, RHTTPHeaders& aRequestHeaders) const;
-		void DisplayManagementInfoL();
-		
+        void DisplayManagementInfoL();
+
 public: // From MDRMEventObserver
         virtual void HandleEventL(
             MDRMEvent* aEvent);
-   
-	private:
-		RFs iFs;
-        
+
+    private:
+        RFs iFs;
+
         // File manager
         CFileMan* iFileManager;
-        
+
         // Oma based extensions
         HBufC8* iOmaBasedMimeType;
-                
+
     private:
 
         /**
@@ -119,27 +120,27 @@
         * By default Symbian 2nd phase constructor is private.
         */
         void ConstructL();
-        
+
         void FetchOmaBasedInfoL();
         void PrepareHTTPRequestHeadersL(RStringPool& aStringPool, RHTTPHeaders& aRequestHeaders) const;
-        
+
 
     protected:  // Data
         // Request status for change notifications
         TRequestStatus* iStatus;
-        
+
         // Notifier for change notifications
         CDRMNotifier* iNotifier;
-        
+
         // Watched events
         TEventMask iWatchedEvents;
-        
+
         // Watched content ID
         HBufC8* iWatchedId;
     };
 
 }
 
-#endif      // OMA2AGENTMANAGER_H   
-            
+#endif      // OMA2AGENTMANAGER_H
+
 // End of File
--- a/omadrm/drmengine/agentv2/src/DcfCache.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/DcfCache.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 #include <rijndael.h>
 #include "DcfCache.h"
 #include "DcfCommon.h"
-#include "DrmRightsClient.h"
+#include "DRMRightsClient.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
 
--- a/omadrm/drmengine/agentv2/src/Oma2Agent.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2Agent.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,29 +19,29 @@
 // INCLUDE FILES
 #include <ecom/ecom.h>
 #include <ecom/implementationproxy.h>
-#include "oma2agentfactory.h"
+#include "Oma2AgentFactory.h"
 
 // EXTERNAL DATA STRUCTURES
 //extern  ?external_data;
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 //extern ?external_function( ?arg_type,?arg_type );
 
 // CONSTANTS
 
 /** Implementation table is required by ECom. Allows alternative
-	New methods to be specified.
+    New methods to be specified.
 */
 
 const TImplementationProxy ImplementationTable[] =
-	{
+    {
 #ifdef __EABI__
-		IMPLEMENTATION_PROXY_ENTRY(0x101F6DB4,
+        IMPLEMENTATION_PROXY_ENTRY(0x101F6DB4,
             ContentAccess::COma2AgentFactory::NewL)
 #else
-		{ {0x101F6DB4}, ContentAccess::COma2AgentFactory::NewL}
+        { {0x101F6DB4}, ContentAccess::COma2AgentFactory::NewL}
 #endif
-	}; 
+    };
 
 
 // MACROS
@@ -69,10 +69,10 @@
 // -----------------------------------------------------------------------------
 //
 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-	{
-	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-	return ImplementationTable;
-	}
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
 
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,18 +22,19 @@
 #include <charconv.h>
 
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/attributeset.h>
 #include <caf/stringattributeset.h>
 #include <caf/virtualpath.h>
 #include <caf/caferr.h>
 #include <utf.h>
 #include <drmagents.h>
-#include "oma2agent.h"
-#include "oma2agentattributes.h"
-#include "oma1dcf.h"
+#include "Oma2Agent.h"
+#include "Oma2AgentAttributes.h"
+#include "Oma1Dcf.h"
 #include "oma2dcf.h"
-#include "drmrightsclient.h"
-#include "DrmProtectedRoParser.h"
+#include "DRMRightsClient.h"
+#include "DRMProtectedRoParser.h"
 
 using namespace ContentAccess;
 
@@ -71,6 +72,20 @@
 const TInt KMaxAlbumTrack = 3;
 const TInt KMaxRecordingYear = 6;
 
+const TInt KAllowAllDefined =  
+    DRM::EDrmAllowAudioAnalog |
+    DRM::EDrmAllowAudioFmTransmitter |
+    DRM::EDrmAllowAudioBluetooth |
+    DRM::EDrmAllowAudioUplink |
+    DRM::EDrmAllowVideoAnalog |
+    DRM::EDrmAllowVideoMacroVision |
+    DRM::EDrmAllowAudioUsb |   
+    DRM::EDrmAllowAudioHdmiHdcpRequired |
+    DRM::EDrmAllowAudioHdmi |
+    DRM::EDrmAllowVideoHDMI  |
+    DRM::EDrmAllowVideoHdmiHdcpRequested |
+    DRM::EDrmAllowVideoHdmiHdcpRequired;
+
 // ============================= LOCAL FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -450,7 +465,18 @@
                     }
                 break;
             case DRM::EDrmAllowedOutputs:
-                value = DRM::EDrmAllowAudioAnalog | DRM::EDrmAllowAudioBluetooth | DRM::EDrmAllowVideoMacroVision | DRM::EDrmAllowAudioFmTransmitter;
+                if( dcf2 )
+                    {
+                    value = DRM::EDrmAllowAudioAnalog | 
+                            DRM::EDrmAllowAudioBluetooth | 
+                            DRM::EDrmAllowVideoMacroVision | 
+                            DRM::EDrmAllowAudioFmTransmitter | 
+                            DRM::EDrmAllowAudioUsb;
+                    }
+                else
+                    {
+                    value = KAllowAllDefined;
+                    }
                 break;
             default:
                 value = KErrCANotSupported;
@@ -682,7 +708,18 @@
                      }
                 break;
             case DRM::EDrmAllowedOutputs:
-                value = DRM::EDrmAllowAudioAnalog | DRM::EDrmAllowAudioBluetooth | DRM::EDrmAllowVideoMacroVision;
+                if( dcf2 )
+                    {
+                    value = DRM::EDrmAllowAudioAnalog | 
+                            DRM::EDrmAllowAudioBluetooth | 
+                            DRM::EDrmAllowVideoMacroVision | 
+                            DRM::EDrmAllowAudioFmTransmitter | 
+                            DRM::EDrmAllowAudioUsb;
+                    }
+                else
+                    {
+                    value = KAllowAllDefined;
+                    }
                 break;
             case ERightsNone:
                 if (aRightsClient == NULL)
@@ -816,6 +853,7 @@
     RDRMRightsClient* aRightsClient)
     {
     TInt err = KErrCANotSupported;
+    TInt ret = KErrNone;
     HBufC* b = NULL;
     COma1Dcf* dcf1 = NULL;
     COma2Dcf* dcf2 = NULL;
--- a/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentContent.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,23 +19,24 @@
 
 // INCLUDE FILES
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/bitset.h>
 #include <caf/attribute.h>
 #include <e32test.h>
 #include <utf.h>
 
 
-#include <schemehandler.h>
+#include <SchemeHandler.h>
 
 
-#include "oma2agentcontent.h"
-#include "oma2agentattributes.h"
-#include "oma1dcf.h"
+#include "Oma2AgentContent.h"
+#include "Oma2AgentAttributes.h"
+#include "Oma1Dcf.h"
 #include "oma2dcf.h"
 #include "symmetric.h"
-#include "DrmRights.h"
+#include "DRMRights.h"
 #include "Oma2DcfPartInfo.h"
-#include "DrmProtectedRoParser.h"
+#include "DRMProtectedRoParser.h"
 
 using namespace ContentAccess;
 
@@ -544,9 +545,8 @@
 
 // -----------------------------------------------------------------------------
 // COma2AgentContent::NotifyStatusChange
+// -----------------------------------------------------------------------------
 //
-// -----------------------------------------------------------------------------
-// 
 void COma2AgentContent::NotifyStatusChange(
     TEventMask aEventMask,
     TRequestStatus& aStatus,
--- a/omadrm/drmengine/agentv2/src/Oma2AgentData.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentData.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,18 +17,19 @@
 
 // INCLUDE FILES
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/bitset.h>
 #include <caf/attribute.h>
 #include <e32test.h>
-#include "drmcommon.h"
-#include "oma2agentdata.h"
-#include "oma2agentattributes.h"
-#include "oma1dcf.h"
+#include "DRMCommon.h"
+#include "Oma2AgentData.h"
+#include "Oma2AgentAttributes.h"
+#include "Oma1Dcf.h"
 #include "oma2dcf.h"
 #include "symmetric.h"
-#include "drmrightsclient.h"
-#include "drmprotectedroparser.h"
-#include "dcfcache.h"
+#include "DRMRightsClient.h"
+#include "DRMProtectedRoParser.h"
+#include "DcfCache.h"
 #include "cleanupresetanddestroy.h"
 
 using namespace ContentAccess;
--- a/omadrm/drmengine/agentv2/src/Oma2AgentFactory.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentFactory.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,14 +19,15 @@
 
 // INCLUDE FILES
 #include <caf/caf.h>
-#include "oma2agentfactory.h"
+#include <caf/cafplatform.h>
+#include "Oma2AgentFactory.h"
 
 using namespace ContentAccess;
 
 // EXTERNAL DATA STRUCTURES
 //extern  ?external_data;
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 //extern ?external_function( ?arg_type,?arg_type );
 
 // CONSTANTS
@@ -101,7 +102,7 @@
 COma2AgentFactory* COma2AgentFactory::NewL()
     {
     COma2AgentFactory* self = new( ELeave ) COma2AgentFactory;
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -109,7 +110,7 @@
     return self;
     }
 
-    
+
 // Destructor
 COma2AgentFactory::~COma2AgentFactory()
     {
@@ -123,42 +124,42 @@
 // -----------------------------------------------------------------------------
 //
 CAgentContent* COma2AgentFactory::CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode)
-	{
-	return COma2AgentContent::NewL(aURI, aShareMode);
-	}
+    {
+    return COma2AgentContent::NewL(aURI, aShareMode);
+    }
 
 CAgentContent* COma2AgentFactory::CreateContentBrowserL(RFile& aFile)
-	{
-	return COma2AgentContent::NewL(aFile);
-	}
+    {
+    return COma2AgentContent::NewL(aFile);
+    }
 
 CAgentData* COma2AgentFactory::CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)
-	{
-	return COma2AgentData::NewL(aVirtualPath, aShareMode);
-	}
+    {
+    return COma2AgentData::NewL(aVirtualPath, aShareMode);
+    }
 
 CAgentData* COma2AgentFactory::CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId)
-	{
-	return COma2AgentData::NewL(aFile, aUniqueId);
-	}
+    {
+    return COma2AgentData::NewL(aFile, aUniqueId);
+    }
 
 CAgentManager*  COma2AgentFactory::CreateManagerL()
-	{
-	return COma2AgentManager::NewL();
-	}
+    {
+    return COma2AgentManager::NewL();
+    }
 
 CAgentImportFile* COma2AgentFactory::CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName)
-	{
-	return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray, aOutputDirectory, aSuggestedFileName);
-	}
+    {
+    return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray, aOutputDirectory, aSuggestedFileName);
+    }
 
 CAgentImportFile* COma2AgentFactory::CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray)
-	{
-	return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray);
-	}
+    {
+    return COma2AgentImportFile::NewL(aMimeType, aMetaDataArray);
+    }
 
 CAgentRightsManager* COma2AgentFactory::CreateRightsManagerL()
-	{
-	return COma2AgentRightsManager::NewL();
-	}
+    {
+    return COma2AgentRightsManager::NewL();
+    }
 
--- a/omadrm/drmengine/agentv2/src/Oma2AgentImportFile.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentImportFile.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,16 +21,17 @@
 #include <s32mem.h>
 #include <f32file.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <caf/caferr.h>
-#include <caf/SupplierOutputFile.h>
+#include <caf/supplieroutputfile.h>
 #include "Oma2Agent.h"
-#include "Oma2AgentImportfile.h"
+#include "Oma2AgentImportFile.h"
 #include "DcfCommon.h"
-#include "DrmRights.h"
-#include "DrmMessageParser.h"
+#include "DRMRights.h"
+#include "DRMMessageParser.h"
 #include "Oma1DcfCreator.h"
 #include "DrmRightsParser.h"
-#include "DrmProtectedRoParser.h"
+#include "DRMProtectedRoParser.h"
 
 using namespace ContentAccess;
 
@@ -59,7 +60,7 @@
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 COma2AgentImportFile* COma2AgentImportFile::NewL(
@@ -67,34 +68,34 @@
     const CMetaDataArray& aMetaDataArray,
     const TDesC& aOutputDirectory,
     const TDesC& aSuggestedFileName)
-	{
-	COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse);
-	CleanupStack::PushL(self);
-	self->ConstructL(aMimeType, aMetaDataArray, aOutputDirectory,
-	    aSuggestedFileName);
-	CleanupStack::Pop(self);
-	return self;
-	}
+    {
+    COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse);
+    CleanupStack::PushL(self);
+    self->ConstructL(aMimeType, aMetaDataArray, aOutputDirectory,
+        aSuggestedFileName);
+    CleanupStack::Pop(self);
+    return self;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 COma2AgentImportFile* COma2AgentImportFile::NewL(
     const TDesC8& aMimeType,
     const CMetaDataArray& aMetaDataArray)
-	{
-	COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse);
-	CleanupStack::PushL(self);
-	self->ConstructL(aMimeType, aMetaDataArray, KNullDesC(), KNullDesC());
-	CleanupStack::Pop(self);
-	return self;
-	}
-	
+    {
+    COma2AgentImportFile* self=new(ELeave) COma2AgentImportFile(EFalse);
+    CleanupStack::PushL(self);
+    self->ConstructL(aMimeType, aMetaDataArray, KNullDesC(), KNullDesC());
+    CleanupStack::Pop(self);
+    return self;
+    }
+
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 COma2AgentImportFile::COma2AgentImportFile(
@@ -108,38 +109,38 @@
     iDcfCreator(NULL),
     iDcfRights(NULL),
     iDcfMimeType(NULL)
-	{
-	iImportStatus = EInProgress;
-	}
+    {
+    iImportStatus = EInProgress;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 COma2AgentImportFile::~COma2AgentImportFile()
-	{
-	if (iFileOpen)
-		{
-		iFile.Close();
-		iFileOpen = EFalse;
-		}
-	iFs.Close();
-	delete iOutputDirectory;
-	delete iSuggestedFileName;
+    {
+    if (iFileOpen)
+        {
+        iFile.Close();
+        iFileOpen = EFalse;
+        }
+    iFs.Close();
+    delete iOutputDirectory;
+    delete iSuggestedFileName;
     delete iOutputFileName;
-	delete iLastWriteData;
-	iOutputFiles.ResetAndDestroy();
-	iOutputFiles.Close();
-	delete iMessageParser;
-	delete iDcfCreator;
-	delete iDcfRights;
-	delete iDcfMimeType;
-	}
-  
+    delete iLastWriteData;
+    iOutputFiles.ResetAndDestroy();
+    iOutputFiles.Close();
+    delete iMessageParser;
+    delete iDcfCreator;
+    delete iDcfRights;
+    delete iDcfMimeType;
+    }
+
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::ConstructL(
@@ -147,129 +148,129 @@
     const CMetaDataArray& aMetaDataArray,
     const TDesC& aOutputDirectory,
     const TDesC& aSuggestedFileName)
-	{
-	RMemReadStream rights;
-	
-	if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0 ||
-	    aMimeType.CompareF(KOmaImportContentType) == 0)
-	    {
-	    if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0)
-	        {
+    {
+    RMemReadStream rights;
+
+    if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0 ||
+        aMimeType.CompareF(KOmaImportContentType) == 0)
+        {
+        if (aMimeType.CompareF(KOma1DrmMessageContentType) == 0)
+            {
             iMessageParser = CDRMMessageParser::NewL();
-	        iImportType = EOma1DrmMessage;
-	        }
-	    else
-	        {
-	        iDcfCreator = COma1DcfCreator::NewL();
-    	    iImportType = EPlainContent;
+            iImportType = EOma1DrmMessage;
+            }
+        else
+            {
+            iDcfCreator = COma1DcfCreator::NewL();
+            iImportType = EPlainContent;
             const TDesC8& mimeDes = aMetaDataArray.SearchL(
                 KOmaImportMimeTypeField);
             if (mimeDes.Length() == 0)
                 {
                 User::Leave(KErrArgument);
                 }
-    	    iDcfMimeType = mimeDes.AllocL();
-    	    const TDesC8& rightsDes = aMetaDataArray.SearchL(
-    	        KOmaImportRightsField);
+            iDcfMimeType = mimeDes.AllocL();
+            const TDesC8& rightsDes = aMetaDataArray.SearchL(
+                KOmaImportRightsField);
             if (rightsDes.Length() > 0)
-    	        {
-    	        rights.Open(rightsDes.Ptr(), rightsDes.Length());
-    	        CleanupClosePushL(rights);
-        	    iDcfRights = CDRMRights::NewL();
-    	        iDcfRights->InternalizeL(rights);
-    	        CleanupStack::PopAndDestroy(); // rights
-    	        }
-	        }
-    	iOutputDirectory = aOutputDirectory.AllocL();
-    	iSuggestedFileName = aSuggestedFileName.AllocL();
-    	iOutputFileName = HBufC::NewL(iOutputDirectory->Des().Length() +
+                {
+                rights.Open(rightsDes.Ptr(), rightsDes.Length());
+                CleanupClosePushL(rights);
+                iDcfRights = CDRMRights::NewL();
+                iDcfRights->InternalizeL(rights);
+                CleanupStack::PopAndDestroy(); // rights
+                }
+            }
+        iOutputDirectory = aOutputDirectory.AllocL();
+        iSuggestedFileName = aSuggestedFileName.AllocL();
+        iOutputFileName = HBufC::NewL(iOutputDirectory->Des().Length() +
             iSuggestedFileName->Des().Length());
-	    iAgentCreatesOutputFiles = ETrue;
-	    }
+        iAgentCreatesOutputFiles = ETrue;
+        }
     else if (aMimeType.CompareF(KOma1XmlRoContentType) == 0)
-	    {
-	    iImportType = EOma1XmlRo;
-	    }
+        {
+        iImportType = EOma1XmlRo;
+        }
     else if (aMimeType.CompareF(KOma1WbxmlRoContentType) == 0)
-	    {
-	    iImportType = EOma1WbxmlRo;
-	    }
+        {
+        iImportType = EOma1WbxmlRo;
+        }
     else if (aMimeType.CompareF(KOma2RoContentType) == 0)
-	    {
-	    iImportType = EOma2Ro;
-	    }
+        {
+        iImportType = EOma2Ro;
+        }
     else
         {
-		User::Leave(KErrCANotSupported);
-		}
-	User::LeaveIfError(iFs.Connect());
-    User::LeaveIfError(iFs.ShareAuto());	
-	}
+        User::Leave(KErrCANotSupported);
+        }
+    User::LeaveIfError(iFs.Connect());
+    User::LeaveIfError(iFs.ShareAuto());
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::OpenOutputFile()
-	{
-	TInt r = KErrNone;
-	TPtr fileNamePtr = iOutputFileName->Des();
-	
-	fileNamePtr.Copy(*iOutputDirectory);
-	fileNamePtr.Append(*iSuggestedFileName);
+    {
+    TInt r = KErrNone;
+    TPtr fileNamePtr = iOutputFileName->Des();
+
+    fileNamePtr.Copy(*iOutputDirectory);
+    fileNamePtr.Append(*iSuggestedFileName);
 
-	r = iFile.Create(iFs, fileNamePtr, EFileShareAny  | EFileStream |
-	    EFileWrite);
-	if (r == KErrNone)
-		{
-		iFileOpen = ETrue;
-		if (iImportType == EOma1DrmMessage)
-		    {
-		    TRAP(r, iMessageParser->InitializeMessageParserL(iFile));
-		    }
-		else
-		    {
-		    TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType,
-		        iDcfRights));
-		    }
-		}
+    r = iFile.Create(iFs, fileNamePtr, EFileShareAny  | EFileStream |
+        EFileWrite);
+    if (r == KErrNone)
+        {
+        iFileOpen = ETrue;
+        if (iImportType == EOma1DrmMessage)
+            {
+            TRAP(r, iMessageParser->InitializeMessageParserL(iFile));
+            }
+        else
+            {
+            TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType,
+                iDcfRights));
+            }
+        }
     else
         {
         r = KErrCANewFileHandleRequired;
         }
     return r;
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::WriteDataL(const TDesC8& aData)
     {
-	CDrmRightsParser* oma1Parser = NULL;
-	CDrmProtectedRoParser* oma2Parser = NULL;
-	RPointerArray<CDRMRights> rights;
+    CDrmRightsParser* oma1Parser = NULL;
+    CDrmProtectedRoParser* oma2Parser = NULL;
+    RPointerArray<CDRMRights> rights;
     TCleanupItem listCleanup(PointerArrayResetDestroyAndClose<CDRMRights>,
         &rights);
-	TInt r;
-	
+    TInt r;
+
     switch (iImportType)
         {
         case EOma1DrmMessage:
-        	if (!iFileOpen)
-        		{
-        		r = OpenOutputFile();
-        		if (r == KErrNone)
-        		    {
+            if (!iFileOpen)
+                {
+                r = OpenOutputFile();
+                if (r == KErrNone)
+                    {
                     iMessageParser->ProcessMessageDataL(aData);
-        		    }
-        		else
-        		    {
+                    }
+                else
+                    {
                     iLastWriteData = aData.AllocL();
                     User::Leave(r);
-        		    }
+                    }
                 }
             else
                 {
@@ -277,18 +278,18 @@
                 }
             break;
         case EPlainContent:
-        	if (!iFileOpen)
-        		{
-        		r = OpenOutputFile();
-        		if (r == KErrNone)
-        		    {
+            if (!iFileOpen)
+                {
+                r = OpenOutputFile();
+                if (r == KErrNone)
+                    {
                     iDcfCreator->EncryptUpdateL(aData);
-        		    }
-        		else
-        		    {
+                    }
+                else
+                    {
                     iLastWriteData = aData.AllocL();
                     User::Leave(r);
-        		    }
+                    }
                 }
             else
                 {
@@ -314,231 +315,231 @@
             break;
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::WriteData(const TDesC8& aData)
-	{
-	TInt r = KErrNone;
-	TRAP(r, WriteDataL(aData));
-	return r;
-	}
+    {
+    TInt r = KErrNone;
+    TRAP(r, WriteDataL(aData));
+    return r;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::WriteDataComplete()
-	{
-	TInt r = KErrNone;
-	CSupplierOutputFile *temp = NULL;
-	TPtrC8 type(NULL, 0);
-	
-	if (iFileOpen)
-		{
-		if (iImportType == EOma1DrmMessage)
-		    {
-		    TRAP(r, iMessageParser->FinalizeMessageParserL());
-		    }
-		else
-		    {
-		    TRAP(r, iDcfCreator->EncryptFinalizeL());
-		    }
-		iFile.Close();
-		iFileOpen = EFalse;
-		}
-	if( r ) 
-	    {
-		  return r;
+    {
+    TInt r = KErrNone;
+    CSupplierOutputFile *temp = NULL;
+    TPtrC8 type(NULL, 0);
+
+    if (iFileOpen)
+        {
+        if (iImportType == EOma1DrmMessage)
+            {
+            TRAP(r, iMessageParser->FinalizeMessageParserL());
+            }
+        else
+            {
+            TRAP(r, iDcfCreator->EncryptFinalizeL());
+            }
+        iFile.Close();
+        iFileOpen = EFalse;
+        }
+    if( r )
+        {
+          return r;
       }
-	if (iOutputFileName)
-		{
-		switch (iImportType)
-		    {
-		    case EPlainContent:
+    if (iOutputFileName)
+        {
+        switch (iImportType)
+            {
+            case EPlainContent:
             case EOma1DrmMessage:
                 type.Set(KOma1DcfContentType());
                 break;
             default:
                 return KErrGeneral;;
-		    }
-		TRAP(r, temp = CSupplierOutputFile::NewL(iOutputFileName->Des(),
-		    EContent, type));
-		if (r == KErrNone)
-			{
-			r = iOutputFiles.Append(temp);
-			if (r != KErrNone)
-				{
-				delete temp;
-				}
-			}
-		}
-	return r;
-	}
-		
+            }
+        TRAP(r, temp = CSupplierOutputFile::NewL(iOutputFileName->Des(),
+            EContent, type));
+        if (r == KErrNone)
+            {
+            r = iOutputFiles.Append(temp);
+            if (r != KErrNone)
+                {
+                delete temp;
+                }
+            }
+        }
+    return r;
+    }
+
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::WriteData(
     const TDesC8& aData,
     TRequestStatus &aStatus)
-	{
-	TRequestStatus *ptr = &aStatus;
-	TInt r = WriteData(aData);
-	User::RequestComplete(ptr,r);
-	}
+    {
+    TRequestStatus *ptr = &aStatus;
+    TInt r = WriteData(aData);
+    User::RequestComplete(ptr,r);
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::WriteDataComplete(
     TRequestStatus &aStatus)
-	{
-	TRequestStatus *ptr = &aStatus;
-	TInt r = WriteDataComplete();
-	User::RequestComplete(ptr,r);
-	}
-	
+    {
+    TRequestStatus *ptr = &aStatus;
+    TInt r = WriteDataComplete();
+    User::RequestComplete(ptr,r);
+    }
+
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::OutputFileCountL() const
-	{
-	return iOutputFiles.Count();
-	}
+    {
+    return iOutputFiles.Count();
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 CSupplierOutputFile& COma2AgentImportFile::OutputFileL(
     TInt aIndex)
-	{
-	return *iOutputFiles[aIndex];
-	}
+    {
+    return *iOutputFiles[aIndex];
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TImportStatus COma2AgentImportFile::GetImportStatus() const
-	{
-	return iImportStatus;
-	}	
+    {
+    return iImportStatus;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::GetSuggestedOutputFileExtension(
     TDes& aFileExtension)
-	{
-	aFileExtension.Copy(_L(".dcf"));
-	return KErrNone;
-	}
+    {
+    aFileExtension.Copy(_L(".dcf"));
+    return KErrNone;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::GetSuggestedOutputFileName(
     TDes& aFileName)
-	{
-	aFileName.Append(_L(".dcf"));
-	return KErrNone;
-	}
+    {
+    aFileName.Append(_L(".dcf"));
+    return KErrNone;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma2AgentImportFile::ContinueWithNewOutputFile(
     RFile& aFile,
     const TDesC& aFileName)
-	{
-	RFile file;
-	TInt r = KErrNone;
+    {
+    RFile file;
+    TInt r = KErrNone;
 
-	if (iOutputFileName != NULL)
-	    {
-	    delete iOutputFileName;
-	    iOutputFileName = NULL;
-	    }
-	TRAP(r, iOutputFileName = aFileName.AllocL());
-	if (r == KErrNone)
-	    {
-	    file.Duplicate(aFile);
+    if (iOutputFileName != NULL)
+        {
+        delete iOutputFileName;
+        iOutputFileName = NULL;
+        }
+    TRAP(r, iOutputFileName = aFileName.AllocL());
+    if (r == KErrNone)
+        {
+        file.Duplicate(aFile);
         iFile.Attach(file);
         iFileOpen = ETrue;
-		if (iImportType == EOma1DrmMessage)
-		    {
-		    TRAP(r, iMessageParser->InitializeMessageParserL(iFile));
-		    }
-		else
-		    {
-		    TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType,
-		        iDcfRights));
-		    }
+        if (iImportType == EOma1DrmMessage)
+            {
+            TRAP(r, iMessageParser->InitializeMessageParserL(iFile));
+            }
+        else
+            {
+            TRAP(r, iDcfCreator->EncryptInitializeL(iFile, *iDcfMimeType,
+                iDcfRights));
+            }
         if (r == KErrNone)
             {
             r = WriteData(*iLastWriteData);
             }
         delete iLastWriteData;
         iLastWriteData = NULL;
-	    }
-	return r;
-	}
+        }
+    return r;
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::ContinueWithNewOutputFile(
     RFile& aFile,
     const TDesC& aFileName,
     TRequestStatus& aStatus)
-	{
-	TRequestStatus *ptr = &aStatus;
-	TInt r = ContinueWithNewOutputFile(aFile, aFileName);
-	User::RequestComplete(ptr,r);
-	}
+    {
+    TRequestStatus *ptr = &aStatus;
+    TInt r = ContinueWithNewOutputFile(aFile, aFileName);
+    User::RequestComplete(ptr,r);
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::NewMimePartL(
     const TDesC8& /*aMimeType*/,
     const CMetaDataArray& /*aImportMetaData*/)
-	{
-	User::Leave(KErrCANotSupported);
-	}
+    {
+    User::Leave(KErrCANotSupported);
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentImportFile::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma2AgentImportFile::EndMimePartL()
-	{
-	User::Leave(KErrCANotSupported);
-	}
+    {
+    User::Leave(KErrCANotSupported);
+    }
 
 // End of file
--- a/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentManager.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,6 +18,7 @@
 
 // INCLUDE FILES
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <http.h>
 #include <http/rhttpheaders.h>
 #include <stringpool.h>
@@ -32,13 +33,13 @@
 #include <sysutil.h>
 #include <centralrepository.h>
 
-#include "oma2agentmanager.h"
-#include "oma2agentattributes.h"
-#include "oma1dcf.h"
+#include "Oma2AgentManager.h"
+#include "Oma2AgentAttributes.h"
+#include "Oma1Dcf.h"
 #include "oma2dcf.h"
-#include "drmrightsclient.h"
+#include "DRMRightsClient.h"
 
-#include "drmutilityinternalcrkeys.h"      // Cenrep extension for OmaBased
+#include "DrmUtilityInternalcrkeys.h"      // Cenrep extension for OmaBased
 
 using namespace ContentAccess;
 
@@ -117,9 +118,9 @@
     User::LeaveIfError(iFs.Connect());
     User::LeaveIfError(iFs.ShareAuto());
     iFileManager = CFileMan::NewL(iFs);
-    
+
     TInt err( KErrNone );
-                
+
     TRAP(err, FetchOmaBasedInfoL() );
     if( err)
         {
@@ -129,7 +130,7 @@
             }
         iOmaBasedMimeType = NULL;
         }
-    
+
     }
 
 // -----------------------------------------------------------------------------
@@ -141,26 +142,26 @@
     TInt err = KErrNone;
     CRepository* repository( NULL );
     RBuf bOmaBasedMimeType;
-    
+
     CleanupClosePushL(bOmaBasedMimeType);
     bOmaBasedMimeType.CreateL( KCenRepDataLength );
- 
+
     TRAP( err, repository = CRepository::NewL( KCRUidOmaBased ) );
     if ( !err )
         {
         CleanupStack::PushL( repository );
-        
+
         err = repository->Get( KOmaBasedMimeType, bOmaBasedMimeType );
         if( !err )
             {
-            iOmaBasedMimeType = CnvUtfConverter::ConvertFromUnicodeToUtf8L( bOmaBasedMimeType ); 
+            iOmaBasedMimeType = CnvUtfConverter::ConvertFromUnicodeToUtf8L( bOmaBasedMimeType );
             }
         CleanupStack::PopAndDestroy( repository );
         }
-    
+
     CleanupStack::PopAndDestroy();
-    
-    User::LeaveIfError( err );    
+
+    User::LeaveIfError( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -197,7 +198,7 @@
         delete iNotifier;
         }
     delete iWatchedId;
-    
+
     delete iOmaBasedMimeType;
     }
 
@@ -227,34 +228,34 @@
     TInt err = KErrNone;
     TBool retval = KErrNone;
 
-    
+
     // Check the destination drive letter
-    result = iFs.CharToDrive(drive,driveNumber);      
-    
+    result = iFs.CharToDrive(drive,driveNumber);
+
     if( result )
         {
         return result;
         }
-    
-    // open the file to read the size    
+
+    // open the file to read the size
     result = file.Open(iFs, aSource, EFileShareReadersOrWriters|EFileRead);
-                
-    if( result )
-        {
-        return result;
-        }       
-    
-    // read the size
-    result = file.Size( size );
-    
-    // close the file
-    file.Close();
-    
+
     if( result )
         {
         return result;
         }
-    
+
+    // read the size
+    result = file.Size( size );
+
+    // close the file
+    file.Close();
+
+    if( result )
+        {
+        return result;
+        }
+
     // check that the drive has enough space for the copy operation
 
     TRAP( err, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs,
@@ -263,21 +264,21 @@
     if( retval )
         {
         return KErrDiskFull;
-        }        	
-    	
-        
+        }
+
+
     return iFileManager->Copy( aSource, aDestination);
     }
 
 
 // -----------------------------------------------------------------------------
 // CWmDrmAgentManager::CopyFile
-// 
+//
 // -----------------------------------------------------------------------------
 //
-TInt COma2AgentManager::CopyFile(RFile& aSource, 
+TInt COma2AgentManager::CopyFile(RFile& aSource,
     const TDesC& aDestination)
-	{
+    {
     TInt driveNumber = 0;
     TChar drive( aDestination[0] );
     TInt size = 0;
@@ -288,32 +289,32 @@
     TInt err = KErrNone;
     TBool retval = KErrNone;
 
-    
+
     // Same file, do not even try to copy
-    // And since they are the same don't return an error  
+    // And since they are the same don't return an error
     aSource.FullName( fileName );
-    
+
     if( !aDestination.CompareF( fileName ) )
         {
         return KErrNone;
         }
-    
+
     // Check the destination drive letter
-    result = iFs.CharToDrive(drive,driveNumber);      
-    
+    result = iFs.CharToDrive(drive,driveNumber);
+
     if( result )
         {
         return result;
         }
-                
+
     // read the size
     result = aSource.Size( size );
-    
+
     if( result )
         {
         return result;
         }
-    
+
     // check that the drive has enough space for the copy operation
 
     TRAP( err, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs,
@@ -323,21 +324,21 @@
 
         {
         return KErrDiskFull;
-        }  
+        }
 
     // Perform the copy:
-    
+
     // Rewind just in case:
     size = 0;
     result = aSource.Seek(ESeekStart, size);
-    
+
     if( !result )
         {
-        result = iFileManager->Copy(aSource, aDestination);        
+        result = iFileManager->Copy(aSource, aDestination);
         }
-            	
+
     return result;
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // COma2AgentManager::RenameFile
@@ -355,39 +356,39 @@
     TInt err = KErrNone;
     TBool retval = KErrNone;
 
-    
+
     TInt result( iFileManager->Rename(aSource, aDestination) );
     // If the files are on a different drive, Rename will fail
     // Therefore we simulate the Move by doing a Copy, followed by Delete
     if ( result != KErrNone )
         {
         // Check the destination drive letter
-        result = iFs.CharToDrive(drive,driveNumber);      
-     
+        result = iFs.CharToDrive(drive,driveNumber);
+
         if( result )
             {
             return result;
             }
-        
-        // open the file to read the size    
+
+        // open the file to read the size
         result = file.Open(iFs, aSource, EFileShareReadersOrWriters|EFileRead);
-                    
-        if( result )
-            {
-            return result;
-            }       
-        
-        // read the size
-        result = file.Size( size );
-        
-        // close the file
-        file.Close();
-        
+
         if( result )
             {
             return result;
             }
-        
+
+        // read the size
+        result = file.Size( size );
+
+        // close the file
+        file.Close();
+
+        if( result )
+            {
+            return result;
+            }
+
         // check that the drive has enough space for the copy operation
 
         TRAP( err, retval = SysUtil::DiskSpaceBelowCriticalLevelL( &iFs,
@@ -397,9 +398,9 @@
 
             {
             return KErrDiskFull;
-            }        	
-        	
-        	
+            }
+
+
         result = iFileManager->Copy(aSource,aDestination);
         if (result == KErrNone)
             {
@@ -609,7 +610,7 @@
         {
         iStatus = &aStatus;
         iWatchedEvents = aEventMask;
-        TRAP_IGNORE( iWatchedId = dcf->iContentID->AllocL() ); 
+        TRAP_IGNORE( iWatchedId = dcf->iContentID->AllocL() );
         TRAP(r, iNotifier->RegisterEventObserverL(*this, KEventAddRemove, *iWatchedId));
         TRAP(r, iNotifier->RegisterEventObserverL(*this, KEventModify, *iWatchedId));
         *iStatus = KRequestPending;
@@ -760,9 +761,9 @@
                     aContentMimeType.Copy(*dcf->iMimeType);
                     r = ETrue; // file was recognized as OMA1 DCF
                     }
-                CleanupStack::PopAndDestroy();    
+                CleanupStack::PopAndDestroy();
                 }
-                
+
             }
 #ifdef __DRM_OMA2
         }
--- a/omadrm/drmengine/agentv2/src/Oma2AgentRightsManager.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentRightsManager.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,12 +19,13 @@
 
 // INCLUDE FILES
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <utf.h>
-#include "drmrights.h"
-#include "oma2agentrightsmanager.h"
-#include "drmrightsclient.h"
-#include "dcfrep.h"
-#include "dcfentry.h"
+#include "DRMRights.h"
+#include "Oma2AgentRightsManager.h"
+#include "DRMRightsClient.h"
+#include "DcfRep.h"
+#include "DcfEntry.h"
 
 using namespace ContentAccess;
 
@@ -39,7 +40,7 @@
     User::LeaveIfError(client.Connect());
     CleanupClosePushL(client);
     User::LeaveIfError(fs.Connect());
-    User::LeaveIfError(fs.ShareAuto());    
+    User::LeaveIfError(fs.ShareAuto());
     CleanupClosePushL(fs);
     dcf = CDcfCommon::NewL(aVirtualPath.URI(), &fs);
     CleanupStack::PushL(dcf);
@@ -50,7 +51,7 @@
 
 void DoDeleteAllRightsObjects( const TVirtualPathPtr& aVirtualPath )
     {
-    TRAP_IGNORE( DoDeleteAllRightsObjectsL( aVirtualPath ) );    
+    TRAP_IGNORE( DoDeleteAllRightsObjectsL( aVirtualPath ) );
     }
 
 void DoDeleteRightsObjectL(
@@ -83,11 +84,11 @@
         }
     CleanupStack::PopAndDestroy(2); // contentId, client
     }
-    
+
 void DoDeleteRightsObject(
     const CRightsInfo& aRightsInfo)
     {
-    TRAP_IGNORE( DoDeleteRightsObjectL( aRightsInfo ) );    
+    TRAP_IGNORE( DoDeleteRightsObjectL( aRightsInfo ) );
     }
 
 
@@ -105,7 +106,7 @@
     {
     TBool r = EFalse;
     CDRMConstraint* constraint;
-    
+
     constraint = aPermission->ConstraintForIntent(aIntent);
     if (constraint != NULL && !constraint->Expired(aTime))
         {
@@ -119,13 +120,13 @@
     {
     TRightsStatus r = ERightsStatusNone;
     TTime time;
-    
+
     time.HomeTime();
     if ((!(aPermission->iAvailableRights & ERightsTopLevel) ||
         !aPermission->iTopLevel->Expired(time))
-        
+
         &&
-        
+
         (IsValid(aPermission, EPlay, time) ||
         IsValid(aPermission, EView, time) ||
         IsValid(aPermission, EPrint, time) ||
@@ -144,7 +145,7 @@
     TPtr ptr(NULL, 0);
     HBufC* id = NULL;
     CRightsInfo* r = NULL;
-    
+
     id = HBufC::NewLC(aContentId.Length() + 20);
     ptr.Set(id->Des());
     ptr.Copy(aContentId);
@@ -193,7 +194,7 @@
 COma2AgentRightsManager* COma2AgentRightsManager::NewL()
     {
     COma2AgentRightsManager* self = new( ELeave ) COma2AgentRightsManager;
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -201,7 +202,7 @@
     return self;
     }
 
-    
+
 // Destructor
 COma2AgentRightsManager::~COma2AgentRightsManager()
     {
@@ -240,12 +241,12 @@
             {
             aArray.AppendL(ConvertToRightsInfoL(permissions[i], *idList[j]));
             }
-        
+
         CleanupStack::PopAndDestroy(1); // permCleanup
         }
     CleanupStack::PopAndDestroy(2); // idCleanup, client
     }
-    
+
 void COma2AgentRightsManager::ListRightsL(
     RStreamablePtrArray<CRightsInfo>& aArray,
     const TDesC& aUri) const
@@ -253,9 +254,9 @@
     TVirtualPathPtr ptr(aUri, KDefaultContentObject);
     ListRightsL(aArray, ptr);
     }
-    
+
 void COma2AgentRightsManager::ListRightsL(
-    RStreamablePtrArray<CRightsInfo>& aArray, 
+    RStreamablePtrArray<CRightsInfo>& aArray,
     TVirtualPathPtr& aVirtualPath) const
     {
     RPointerArray<CDRMPermission> permissions;
@@ -272,7 +273,7 @@
     User::LeaveIfError(client.Connect());
     CleanupClosePushL(client);
     User::LeaveIfError(fs.Connect());
-    User::LeaveIfError(fs.ShareAuto());    
+    User::LeaveIfError(fs.ShareAuto());
     CleanupClosePushL(fs);
     dcf = CDcfCommon::NewL(aVirtualPath.URI(), &fs);
     if (dcf == NULL)
@@ -281,7 +282,7 @@
         }
     CleanupStack::PushL(dcf);
     User::LeaveIfError(dcf->OpenPart(aVirtualPath.UniqueId()));
-    
+
     TRAP(error, permission = client.GetActiveRightsL(EUnknown, *dcf->iContentID, reason));
     if (permission != NULL)
         {
@@ -289,7 +290,7 @@
         aArray.AppendL(ConvertToRightsInfoL(permission, *dcf->iContentID));
         CleanupStack::PopAndDestroy(); // permission
         }
-    
+
     TRAP(error, client.GetDBEntriesL(*dcf->iContentID, permissions));
     CleanupStack::PushL(listCleanup);
 
@@ -297,10 +298,10 @@
         {
         aArray.AppendL(ConvertToRightsInfoL(permissions[i], *dcf->iContentID));
         }
-    
+
     CleanupStack::PopAndDestroy(4); // listCleanup, dcf, fs, client
     }
-    
+
 void COma2AgentRightsManager::ListContentL(
     RStreamablePtrArray<CVirtualPath>& aArray,
     CRightsInfo& aRightsInfo) const
@@ -323,7 +324,7 @@
         aRightsInfo.UniqueId().Left(n));
     CleanupStack::PushL(contentId);
     rep = CDcfRep::NewL();
-    CleanupStack::PushL(rep);    
+    CleanupStack::PushL(rep);
     rep->OrderListL();
     entry = rep->NextL();
     while (entry != NULL)
@@ -335,10 +336,10 @@
         CleanupStack::PopAndDestroy(); // entry
         entry = rep->NextL();
         }
-    
+
     CleanupStack::PopAndDestroy(3); // rep, contentId, client
     }
-    
+
 MAgentRightsBase* COma2AgentRightsManager::GetRightsDataL(
     const CRightsInfo& aRightsInfo) const
     {
@@ -378,26 +379,26 @@
         }
     CleanupStack::Pop(); // rights
     CleanupStack::PopAndDestroy(2); // contentId, client
-    
+
     return rights;
     }
-    
+
 TInt COma2AgentRightsManager::DeleteRightsObject(
     const CRightsInfo& aRightsInfo)
     {
     TInt error = KErrNone;
-		TRAP( error, DoDeleteRightsObject(aRightsInfo));
-		return error;
+        TRAP( error, DoDeleteRightsObject(aRightsInfo));
+        return error;
     }
-    
+
 TInt COma2AgentRightsManager::DeleteAllRightsObjects(
     const TVirtualPathPtr& aVirtualPath)
     {
     TInt error = KErrNone;
-		TRAP( error, DoDeleteAllRightsObjectsL(aVirtualPath));
-		return error;
+        TRAP( error, DoDeleteAllRightsObjectsL(aVirtualPath));
+        return error;
     }
-    
+
 TInt COma2AgentRightsManager::SetProperty(
     TAgentProperty /*aProperty*/,
     TInt /*aValue*/)
--- a/omadrm/drmengine/dcf/src/DcfCommon.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcf/src/DcfCommon.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,13 +22,13 @@
 #include <f32file.h>
 #include "DcfCommon.h"
 #include "Oma1Dcf.h"
-#include "Oma2Dcf.h"
+#include "oma2dcf.h"
 
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
 // CDcfCommon::CDcfCommon
-// 
+//
 // -----------------------------------------------------------------------------
 //
 CDcfCommon::CDcfCommon():
@@ -46,7 +46,7 @@
 
 // -----------------------------------------------------------------------------
 // CDcfCommon::ConstructL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CDcfCommon::ConstructL(
@@ -58,7 +58,7 @@
 
 // -----------------------------------------------------------------------------
 // CDcfCommon::NewL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C CDcfCommon* CDcfCommon::NewL(
@@ -84,7 +84,7 @@
 
 // -----------------------------------------------------------------------------
 // CDcfCommon::NewL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C CDcfCommon* CDcfCommon::NewL(
@@ -95,7 +95,7 @@
     RFile file;
     TInt r = KErrNone;
     CDcfCommon* self = NULL;
-    
+
     if (aFs == NULL)
         {
         fs = new RFs();
@@ -103,28 +103,28 @@
         CleanupStack::PushL(fs);
         User::LeaveIfError(fs->Connect());
         }
-    else 
+    else
         {
         fs = aFs;
         }
-    
-	r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareReadersOrWriters );
+
+    r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareReadersOrWriters );
     if( r == KErrInUse )
         {
-    	r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareAny);        
+        r = file.Open(*fs, aFileName, EFileStream | EFileRead | EFileShareAny);
 
-	    if (r == KErrInUse)
-	        {
-    	    r = file.Open(*fs, aFileName, EFileStream | EFileRead |
-    	        EFileShareReadersOnly);
-	        }
+        if (r == KErrInUse)
+            {
+            r = file.Open(*fs, aFileName, EFileStream | EFileRead |
+                EFileShareReadersOnly);
+            }
         }
-	if(r == KErrNone)
-	    {
-	    CleanupClosePushL(file);
-	    self = NewL(file);
-	    CleanupStack::PopAndDestroy();
-	    }
+    if(r == KErrNone)
+        {
+        CleanupClosePushL(file);
+        self = NewL(file);
+        CleanupStack::PopAndDestroy();
+        }
 
     if (aFs == NULL)
         {
@@ -136,7 +136,7 @@
 
 // -----------------------------------------------------------------------------
 // CDcfCommon::NewL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C CDcfCommon::~CDcfCommon()
@@ -156,19 +156,19 @@
 
 // -----------------------------------------------------------------------------
 // CDcfCommon::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt CDcfCommon::CheckUniqueId(const TDesC& aUniqueId)
-	{
-	if (aUniqueId.Compare(KDefaultContentObject) == 0)
-	    {
-	    return 0;
-	    }
-	else
-	    {
-	    return KErrNotFound;
-	    }
-	}
+    {
+    if (aUniqueId.Compare(KDefaultContentObject) == 0)
+        {
+        return 0;
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+    }
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/dcf/src/Oma1Dcf.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcf/src/Oma1Dcf.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,11 +21,10 @@
 #include <e32base.h>
 #include <f32file.h>
 #include <utf.h>
-#include <WSPDecoder.h>
+#include <wspdecoder.h>
 #include "Oma1Dcf.h"
 #include "DRMRightsClient.h"
 #include <centralrepository.h>
-#include <UTF.h>
 
 #include "DrmUtilityInternalcrkeys.h"      // Cenrep extension for OmaBased
 
@@ -87,8 +86,8 @@
     HBufC8* mimetype = NULL;
 
     CleanupClosePushL(bOmaBasedMimeType);
-    bOmaBasedMimeType.CreateL( KCenRepDataLength );    
-    
+    bOmaBasedMimeType.CreateL( KCenRepDataLength );
+
     repository = CRepository::NewL( KCRUidOmaBased );
 
     CleanupStack::PushL( repository );
@@ -96,11 +95,11 @@
     User::LeaveIfError(repository->Get( KOmaBasedMimeType, bOmaBasedMimeType ));
     mimetype = CnvUtfConverter::ConvertFromUnicodeToUtf8L( bOmaBasedMimeType );
     CleanupStack::PopAndDestroy( repository );
-    
+
     CleanupStack::PopAndDestroy();
-    
+
     return mimetype;
-    
+
     }
 
 // -----------------------------------------------------------------------------
@@ -111,7 +110,7 @@
 EXPORT_C COma1Dcf* COma1Dcf::NewL(const RFile& aFile)
     {
     COma1Dcf* self = new(ELeave) COma1Dcf;
-    
+
     CleanupStack::PushL(self);
     self->ConstructL(aFile);
     CleanupStack::Pop();
@@ -121,13 +120,13 @@
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C COma1Dcf* COma1Dcf::NewL(const TDesC8& aMemoryBlock)
     {
     COma1Dcf* self = new(ELeave) COma1Dcf;
-    
+
     CleanupStack::PushL(self);
     self->ConstructL(aMemoryBlock);
     CleanupStack::Pop();
@@ -137,7 +136,7 @@
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C COma1Dcf::~COma1Dcf()
@@ -147,7 +146,7 @@
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma1Dcf::ReadHeaderL(const TDesC8& aMemoryBlock)
@@ -159,29 +158,29 @@
     TBuf8<10> lengthFields;
     TUint32 length;
     TPtr8 ptr(NULL,0,0);
-    
+
     if (aMemoryBlock.Length()<3)
         {
         User::Leave(KErrArgument);
         }
-        
+
     iVersion = aMemoryBlock[0];
-    
+
     if (iVersion!=1)
         {
         // for OMA Version 1, DCF version must be 1
         User::Leave(KErrArgument);
         }
-        
+
     mimeLength = aMemoryBlock[1];
     cidLength = aMemoryBlock[2];
-    
+
     if (mimeLength + cidLength + 3 + 5 + 5 > aMemoryBlock.Length())
         {
         User::Leave(KErrArgument);
         }
 
-    
+
     if (mimeLength!=0)
         {
         iMimeType = aMemoryBlock.Mid(3, mimeLength).AllocL();
@@ -196,22 +195,22 @@
         {
         User::Leave(KErrArgument);
         }
-    
-    
+
+
     if (cidLength!=0)
         {
         iContentID = aMemoryBlock.Mid(3 + mimeLength, cidLength).AllocL();
         }
     else
         {
-        User::Leave(KErrArgument);    
+        User::Leave(KErrArgument);
         }
 
 
     lengthFields.Copy(aMemoryBlock.Mid(3 + mimeLength + cidLength, 10));
     TWspPrimitiveDecoder decoder(lengthFields);
     fieldLength = decoder.UintVar(length);
-    if( fieldLength < 0 ) 
+    if( fieldLength < 0 )
         {
         User::Leave(KErrArgument);
         }
@@ -221,7 +220,7 @@
         {
         User::Leave(KErrArgument);
         }
-    
+
     iDataLength = length;
     iOffset = 3 + mimeLength + cidLength + fieldLength + iHeaderLength;
     if (iDataLength == 0)
@@ -244,13 +243,13 @@
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::ReadHeaderValuesL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma1Dcf::ReadHeaderValuesL(void)
     {
     TPtrC8 ptr(NULL, 0);
-    
+
     if (GetHeaderL(KRightsIssuer, ptr) == KErrNone)
         {
         if( iRightsIssuerURL )
@@ -262,11 +261,11 @@
         }
     if (GetHeaderL(KContentName, ptr) == KErrNone)
         {
-        if( iTitle ) 
+        if( iTitle )
             {
             delete iTitle;
             iTitle = NULL;
-            }        
+            }
         iTitle = ptr.AllocL();
         }
     if (GetHeaderL(KContentDescription, ptr) == KErrNone)
@@ -275,7 +274,7 @@
             {
             delete iDescription;
             iDescription = NULL;
-            }          
+            }
         iDescription = ptr.AllocL();
         }
     if (GetHeaderL(KIconURI, ptr) == KErrNone)
@@ -284,14 +283,14 @@
             {
             delete iIconUri;
             iIconUri = NULL;
-            }         
+            }
         iIconUri = ptr.AllocL();
         }
     }
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma1Dcf::ReadHeaderL(void)
@@ -351,7 +350,7 @@
     User::LeaveIfNull(iContentID);
     p.Set(iContentID->Des());
     iFile.Read(p, cidLength);
-    
+
     pos = 0;
     iFile.Seek(ESeekCurrent, pos);
     iFile.Read(lengthFields);
@@ -367,7 +366,7 @@
         {
         User::Leave(KErrArgument);
         }
-    
+
     iDataLength = length;
     iOffset = pos + fieldLength + iHeaderLength;
     if (iDataLength == 0)
@@ -390,7 +389,7 @@
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TBool COma1Dcf::IsValidDcf(const TDesC8& aDcfFragment)
@@ -419,15 +418,15 @@
                 {
                 r = ETrue;
                 // Check for specific mimetype
-                
+
                 TRAP( error, omaBasedBuf = FetchOmaBasedInfoL() );
-                
+
                 if( !error )
                     {
-                    mimeType.Set(aDcfFragment.Mid(3, 
+                    mimeType.Set(aDcfFragment.Mid(3,
                             omaBasedBuf->Length()));
-                    
-                
+
+
                     if (mimeType.CompareF( *omaBasedBuf ) == 0)
                         {
                         r = EFalse;
@@ -442,63 +441,63 @@
 
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma1Dcf::CheckUniqueId(const TDesC& aUniqueId)
-	{
-	TInt r = CDcfCommon::CheckUniqueId(aUniqueId);
-	
-	if (r == KErrNotFound)
-	    {
-	    HBufC8* id = NULL;
-    	TRAPD(err, id = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aUniqueId));
-    	if (err == KErrNone)
-    	    {
-    	    if (iContentID->Compare(*id) == 0)
-    		    {
-    		    r = 0;
-    		    }
+    {
+    TInt r = CDcfCommon::CheckUniqueId(aUniqueId);
+
+    if (r == KErrNotFound)
+        {
+        HBufC8* id = NULL;
+        TRAPD(err, id = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aUniqueId));
+        if (err == KErrNone)
+            {
+            if (iContentID->Compare(*id) == 0)
+                {
+                r = 0;
+                }
             }
         else
             {
             r = err;
             }
-    	delete id;
-    	}
-	return r;
-	}
-	
+        delete id;
+        }
+    return r;
+    }
+
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma1Dcf::OpenPart(const TDesC& aUniqueId)
-	{
-	return OpenPart(CheckUniqueId(aUniqueId));
-	}
-	
+    {
+    return OpenPart(CheckUniqueId(aUniqueId));
+    }
+
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt COma1Dcf::OpenPart(TInt aPart)
-	{
-	if (aPart == 0)
-		{
-		return KErrNone;
-		}
-	else
-		{
-		return KErrNotFound;
-		}
-	}
-	
+    {
+    if (aPart == 0)
+        {
+        return KErrNone;
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+    }
+
 // -----------------------------------------------------------------------------
 // COma1Dcf::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void COma1Dcf::GetPartIdsL(RPointerArray<HBufC8>& aPartList)
@@ -506,10 +505,10 @@
     aPartList.ResetAndDestroy();
     aPartList.AppendL(iContentID->Des().AllocL());
     }
-	
+
 // -----------------------------------------------------------------------------
 // COma1Dcf::GetHeaderL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt COma1Dcf::GetHeaderL(
@@ -519,22 +518,22 @@
     TInt i;
     TInt j;
     TPtrC8 ptr( iHeaders->Des() );
-    
+
     // Add Room for CRLF and Semicolon:
-    HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 );  
-    TPtr8 searchBuf( const_cast<TUint8*>(buffer->Ptr()), 0, buffer->Des().MaxSize() );  
+    HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 );
+    TPtr8 searchBuf( const_cast<TUint8*>(buffer->Ptr()), 0, buffer->Des().MaxSize() );
 
     searchBuf.Copy(aHeaderName);
     searchBuf.Append(KColon);
-    
-    // First see if the     
+
+    // First see if the
     i = ptr.Find(searchBuf);
     if( i < 0 )
         {
         CleanupStack::PopAndDestroy(); // buffer
-        return KErrNotFound; 
+        return KErrNotFound;
         }
-        
+
    if( i > 0 )
         {
         // if it's not the first one, use the search buffer:
@@ -542,29 +541,29 @@
         searchBuf.Copy(KEndLine);
         searchBuf.Append(aHeaderName);
         searchBuf.Append(KColon);
-    
-        // First see if the     
+
+        // First see if the
         i = ptr.Find(searchBuf);
         if ( i < 0 )
             {
-            CleanupStack::PopAndDestroy(); // buffer            
+            CleanupStack::PopAndDestroy(); // buffer
             return KErrNotFound;
-            }        
+            }
         }
-    // Move search buffer    
-    i += searchBuf.Length();  
-    
+    // Move search buffer
+    i += searchBuf.Length();
+
     j = ptr.Mid(i).Find(KEndLine);
     if( j < 0 )
         {
-        CleanupStack::PopAndDestroy(); // buffer        
+        CleanupStack::PopAndDestroy(); // buffer
         return KErrNotFound;
         }
-        
-    aHeaderValue.Set( ptr.Mid(i, j) );  
-    
+
+    aHeaderValue.Set( ptr.Mid(i, j) );
+
     CleanupStack::PopAndDestroy(); // buffer
     return KErrNone;
     }
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/dcf/src/Oma2Dcf.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcf/src/Oma2Dcf.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -24,8 +24,9 @@
 #include <f32file.h>
 #include <utf.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include "Oma2Agent.h"
-#include "Oma2Dcf.h"
+#include "oma2dcf.h"
 #include "Oma2DcfPartInfo.h"
 
 // LOCAL CONSTANTS AND MACROS
--- a/omadrm/drmengine/dcf/src/Oma2DcfPartInfo.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcf/src/Oma2DcfPartInfo.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,14 +22,15 @@
 #include <f32file.h>
 #include <utf.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include "Oma2Agent.h"
-#include "Oma2Dcf.h"
+#include "oma2dcf.h"
 #include "Oma2DcfPartInfo.h"
 
 // EXTERNAL DATA STRUCTURES
 //extern  ?external_data;
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 //extern ?external_function( ?arg_type,?arg_type);
 
 // CONSTANTS
@@ -93,7 +94,7 @@
 
 // -----------------------------------------------------------------------------
 // COma2Dcf::NewL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 COma2DcfPartInfo* COma2DcfPartInfo::NewL()
@@ -111,4 +112,4 @@
     }
 
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/dcfrepository/client/src/DcfRep.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcfrepository/client/src/DcfRep.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -25,7 +25,7 @@
 #include    <DRMRightsClient.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 // EXTERNAL DATA STRUCTURES
--- a/omadrm/drmengine/dcfrepository/server/inc/DcfRepSrv.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcfrepository/server/inc/DcfRepSrv.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #define CDCFREPSRV_H
 
 //  INCLUDES
-#include    <D32DBMS.H>
+#include    <d32dbms.h>
 #include <e32base.h>
 #include "Pair.h"
 #include "procwatcher.h"
@@ -40,7 +40,7 @@
     EStateIdle = 0,
     EStateSetTtid,
     EStateFullScan,
-    EStateScan   
+    EStateScan
     };
 // FUNCTION PROTOTYPES
 // FORWARD DECLARATIONS
@@ -52,25 +52,25 @@
 *  Server implementation.
 *  DCF Repository
 *
-*  @lib 
-*  @since Series 60 3.0 
+*  @lib
+*  @since Series 60 3.0
 */
 class CDcfRepSrv : public CServer2, public MWatcherObserver
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static CDcfRepSrv* NewLC();
-        
+
         /**
         * Destructor.
         */
         virtual ~CDcfRepSrv();
 
     public: // New functions
-        
+
         /**
         * Startup starts the actual server after initializing
         * the cleanup stack and active scheduler.
@@ -84,9 +84,9 @@
         * @since Series 60 3.0
         * @param aFile file name
         * @KErrNotSupported if file is not protected file
-        */        
+        */
         void AddFileL( const TDesC& aFile );
-        
+
         /**
         * ProcessFile
         * @since Series 60 3.0
@@ -102,89 +102,89 @@
         * @return state of the server
         */
         TInt State() const;
-        
+
         /**
         * SetState
         * @since Series 60 3.0
         * @param aMode server state
-        * @return 
+        * @return
         */
         void SetState(TServerState aMode);
-        
+
         /**
         * CompleteScanning
         * @since Series 60 3.0
         * @param aRet return code
         */
-        void CompleteScanning(TInt err);  
-        
-        
+        void CompleteScanning(TInt err);
+
+
         /**
         * SetMessage
         * @since Series 60 3.0
         * @param aMessage Message from client
         */
-        RMessage2* SetMessageL(const RMessage2& aMessage);  
-        
+        RMessage2* SetMessageL(const RMessage2& aMessage);
+
         /**
         * Scan
         * @since Series 60 3.0
         * @return error code
-        */            
+        */
         TInt Scan();
- 
+
         /**
         * SetCidList
         * @since Series 60 3.0
         * @param aList content ID list
         */
         void SetCidList(RPointerArray<HBufC8>*& aList);
-        
-        
+
+
         /**
         * SetPairList
         * @since Series 60 3.0
         * @param aList list of pairs for content ID and transaction ID
         */
         void SetPairList(RPointerArray<CPair>*& aList);
-        
+
         /**
         * Stop watching the Rights Server
         * @since Series 60 3.1
         */
         void StopWatchingL();
-        
+
         /**
         * RemoveMessageL
         * Called by destructor of the session class
         */
         void RemoveMessageL( const RMessage2* aMessage );
-    
-            
+
+
     public: // Functions from base classes
-        
+
         //class MWatcherObserver
-        
-        /** 
+
+        /**
          * Called when the peer process died
          *
          * @since S60 3.0
          * @param aObject Changed object
          */
         void WatchedObjectChangedL( const TDesC& aObject );
-        
+
     protected:  // New functions
-        
+
     protected:  // Functions from base classes
-        
+
         // Class CServer
-        /** 
+        /**
         * NewSessionL
         * @since S60Rel3.0
         */
         CSession2* NewSessionL( const TVersion& aVersion,
                                        const RMessage2& aMessage ) const;
-        
+
 
     private:
 
@@ -200,86 +200,86 @@
 
         /**
         * StartupL called by StartUp
-        * @since S60 Rel 3.0 
+        * @since S60 Rel 3.0
         */
         static void StartupL();
 
         /**
         * PanicServer will panic with panic code
-        * @since S60 Rel 3.0 
+        * @since S60 Rel 3.0
         */
         static void PanicServer(TDcfRepSrvPanic aPanic);
-        
+
         /**
         * CleanScanInternal will clean list for Scan
-        * @since S60 Rel 3.0 
-        */        
+        * @since S60 Rel 3.0
+        */
         void CleanScanInternal();
 
         /**
         * CleanDatabase will close database connection
-        * @since S60 Rel 3.0 
-        */        
+        * @since S60 Rel 3.0
+        */
         void CleanDatabase();
 
         /**
         * OpenDatabaseL will open database connection
-        * @since S60 Rel 3.0 
-        */          
+        * @since S60 Rel 3.0
+        */
         void OpenDatabaseL();
 
         /**
         * CleanTableL will clean all items in the table
-        * @since S60 Rel 3.0 
-        */           
+        * @since S60 Rel 3.0
+        */
         void CleanTableL();
 
         /**
         * AddDomainRoL will add domain RO into file if there is any.
-        * @since S60 Rel 3.0 
-        */         
+        * @since S60 Rel 3.0
+        */
         void AddDomainRoL( const TDesC& aFile );
 
         /**
         * CheckFileL will check the file type: dcf1,dcf2,plain
-        * @since S60 Rel 3.0 
-        */             
+        * @since S60 Rel 3.0
+        */
         void CheckFileL(const TDesC& aFile , TInt& aType);
 
         /**
         * StoreFileL will store file info
-        * @since S60 Rel 3.0 
-        */          
+        * @since S60 Rel 3.0
+        */
         void StoreFileL(const TDesC& aFile , TInt aType);
-        
+
         /**
         * UpdateDatabaseL will store info into database
-        * @since S60 Rel 3.0 
-        */         
+        * @since S60 Rel 3.0
+        */
         void UpdateDatabaseL(
-            const TDesC& aFile, 
-            TInt aPos, 
+            const TDesC& aFile,
+            TInt aPos,
             const TDesC& aCid ,
-            const TDesC& aGroupId ,  
+            const TDesC& aGroupId ,
             const TDesC& aTtid);
 
         /**
         * ResetTtidL will write new ttid into file
-        * @since S60 Rel 3.0 
+        * @since S60 Rel 3.0
         */
         void ResetTtidL(
-            const TDesC& aFile, 
+            const TDesC& aFile,
             const TDesC8& aTtid
             );
 
         /**
         * ResetTtidL will write new ttid into file
-        * @since S60 Rel 3.0 
+        * @since S60 Rel 3.0
         */
         void ResetTtidL(
-            COma2Dcf* aDcf, 
+            COma2Dcf* aDcf,
             const TDesC8& aTtid
-            );        
+            );
         // Prohibit copy constructor if not deriving from CBase.
         CDcfRepSrv( const CDcfRepSrv& );
         // Prohibit assigment operator if not deriving from CBase.
@@ -299,7 +299,7 @@
         TInt iState;
         CProcWatcher* iProcWatcher;
         TBool iArmed;
-        
+
         // Reserved pointer for future extension
         TAny* iReserved;
 
@@ -309,6 +309,6 @@
 
     };
 
-#endif      // CDCFREPSRV_H   
-            
+#endif      // CDCFREPSRV_H
+
 // End of File
--- a/omadrm/drmengine/dcfrepository/server/inc/drmlog.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcfrepository/server/inc/drmlog.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 
 //  INCLUDES
 #if (defined _DEBUG || defined _LOGGING)
-#include <E32SVR.H>
+#include <e32svr.h>
 #include <flogger.h>
 
 // CONSTANTS
@@ -35,18 +35,18 @@
 #define DRMLOG( a ) \
     RFileLogger::Write(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a); \
     RDebug::Print( a );
-    
+
 #define DRMLOG2( a, b ) \
     RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b); \
     RDebug::Print( a, b );
-     
+
 #define DRMLOGHEX( a ) \
     RFileLogger::HexDump(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, _S(""), _S(""), (a).Ptr(), (a).Size());
 
 #else
 
-#define DRMLOG( a ) 
-#define DRMLOG2( a, b ) 
+#define DRMLOG( a )
+#define DRMLOG2( a, b )
 #define DRMLOGHEX( a )
 
 #endif // _DEBUG
@@ -56,8 +56,8 @@
 // FORWARD DECLARATIONS
 // CLASS DECLARATION
 
-#endif      // DRMLOG_H   
-            
+#endif      // DRMLOG_H
+
 // End of File
 
 
--- a/omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcfrepository/server/src/DcfRepSrv.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -28,13 +28,13 @@
 #include    <caf/data.h>
 #include    <caf/content.h>
 #include    <Oma2Agent.h> // oma2agent
-#include    "Oma2Dcf.h"
+#include    "oma2dcf.h"
 #include    "Oma1Dcf.h"
 #include    "drmlog.h"
 #include <starterclient.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include    <DriveInfo.h>
+#include    <driveinfo.h>
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -205,7 +205,7 @@
 #endif
     {
 #ifdef _DRM_TESTING
-    TRAP_IGNORE( WriteL(_L8("DataFile")) ); 
+    TRAP_IGNORE( WriteL(_L8("DataFile")) );
 #endif
 
     TParse p;
--- a/omadrm/drmengine/dcfrepository/server/src/FileScan.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dcfrepository/server/src/FileScan.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,22 +17,22 @@
 
 
 // INCLUDE FILES
-#include	<e32std.h>
-#include	<e32base.h>
-#include	<f32file.h>
-#include    <drmcommon.h>
+#include    <e32std.h>
+#include    <e32base.h>
+#include    <f32file.h>
+#include    <DRMCommon.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include    <DriveInfo.h>
+#include    <driveinfo.h>
 #endif
 
 #include    "DcfRepSrv.h"
 #include    "SearchLeaf.h"
-#include	"FileScan.h"
+#include    "FileScan.h"
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -69,7 +69,7 @@
  #ifndef RD_MULTIPLE_DRIVE
 LOCAL_C TBool IgnoreDir( TFileName& aDir )
     {
-    if ( !aDir.CompareF( KIgnoreDir1 ) || 
+    if ( !aDir.CompareF( KIgnoreDir1 ) ||
          !aDir.CompareF( KIgnoreDir2 ) )
         {
         return ETrue;
@@ -82,15 +82,15 @@
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	aFs.DriveToChar( driveNumber, driveLetter );
-	
-	TFileName ignore1;
-	TFileName ignore2;
-	
-	ignore1.Format( KIgnoreDir1, (TUint)driveLetter );
+    aFs.DriveToChar( driveNumber, driveLetter );
+
+    TFileName ignore1;
+    TFileName ignore2;
+
+    ignore1.Format( KIgnoreDir1, (TUint)driveLetter );
     ignore2.Format( KIgnoreDir2, (TUint)driveLetter );
-    
-    if ( !aDir.CompareF( ignore1 ) || 
+
+    if ( !aDir.CompareF( ignore1 ) ||
          !aDir.CompareF( ignore2 ) )
         {
         return ETrue;
@@ -98,7 +98,7 @@
     return EFalse;
     }
 #endif
-    
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -107,10 +107,10 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CFileScan::CFileScan( RFs& aFs ) : 
+CFileScan::CFileScan( RFs& aFs ) :
 CActive( CActive::EPriorityStandard ),iServer(NULL),iFs(&aFs),iCurrentLeaf(NULL)
-	{
-	CleanInternal();
+    {
+    CleanInternal();
     }
 
 // -----------------------------------------------------------------------------
@@ -120,17 +120,17 @@
 //
 void CFileScan::ConstructL()
     {
-	TInt err = 0;
-	if ( !iFs )
-		{
-		err = KErrArgument;
-		}
-	else
-		{
-		err = KErrNone;
-		}
-	User::LeaveIfError( err );
-	}
+    TInt err = 0;
+    if ( !iFs )
+        {
+        err = KErrArgument;
+        }
+    else
+        {
+        err = KErrNone;
+        }
+    User::LeaveIfError( err );
+    }
 
 // -----------------------------------------------------------------------------
 // CFileScan::NewL
@@ -139,20 +139,20 @@
 //
 CFileScan* CFileScan::NewL( RFs& aFs )
     {
-    CFileScan* self = new( ELeave ) CFileScan( aFs ); 
-	CleanupStack::PushL( self );
+    CFileScan* self = new( ELeave ) CFileScan( aFs );
+    CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop(self);
     return self;
     }
 
-    
+
 // Destructor
 CFileScan::~CFileScan()
     {
-	CleanInternal();
-	iServer = NULL;
-	iFs = NULL;
+    CleanInternal();
+    iServer = NULL;
+    iFs = NULL;
     }
 
 
@@ -164,28 +164,28 @@
 // -----------------------------------------------------------------------------
 //
 void CFileScan::DoCancel()
-	{
-	CleanInternal();
-	}
+    {
+    CleanInternal();
+    }
 
 
 // -----------------------------------------------------------------------------
 // CFileScan::IsProtected
-// Function returns whether the specific file is protected or not 
+// Function returns whether the specific file is protected or not
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CFileScan::IsProtected( const TDesC& aFileName , TBool& aIsDCF )
-	{
-	TInt err = KErrNone;
-	aIsDCF = EFalse;
-	err = iServer->ProcessFile( aFileName , aIsDCF );
-	if ( err && err != KErrNoMemory )
-		{
-		err = KErrNone;
-		}
-	return err;
-	}
+    {
+    TInt err = KErrNone;
+    aIsDCF = EFalse;
+    err = iServer->ProcessFile( aFileName , aIsDCF );
+    if ( err && err != KErrNoMemory )
+        {
+        err = KErrNone;
+        }
+    return err;
+    }
 
 
 // -----------------------------------------------------------------------------
@@ -195,62 +195,62 @@
 // -----------------------------------------------------------------------------
 //
 void CFileScan::RunL()
-	{
-	TInt err = KErrNone;
-	if ( iSearching && iServer->State()!=EStateIdle )
-		{
-		err = SearchNext();
-		if ( err == KErrCancel )
-			{
-			err = KErrNone;
-			}
-		if ( !err )
-			{
-			SetActive();			
-			TRequestStatus* status = &iStatus;
-			User::RequestComplete( status , err );			
-			}
-		}
-	else 
-		{
-		CleanInternal();
-		iServer->CompleteScanning(err);
-		Deque();
-		}
-	if ( err )
-		{
-		CleanInternal();
-		iServer->CompleteScanning(err);
-		Deque();
-		}
-	}
+    {
+    TInt err = KErrNone;
+    if ( iSearching && iServer->State()!=EStateIdle )
+        {
+        err = SearchNext();
+        if ( err == KErrCancel )
+            {
+            err = KErrNone;
+            }
+        if ( !err )
+            {
+            SetActive();
+            TRequestStatus* status = &iStatus;
+            User::RequestComplete( status , err );
+            }
+        }
+    else
+        {
+        CleanInternal();
+        iServer->CompleteScanning(err);
+        Deque();
+        }
+    if ( err )
+        {
+        CleanInternal();
+        iServer->CompleteScanning(err);
+        Deque();
+        }
+    }
 
 
 
 // -----------------------------------------------------------------------------
 // CFileScan::SearchContent
-// Function starts the active objects to search protected file through whole file system 
+// Function starts the active objects to search protected file through whole file system
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CFileScan::SearchContent( CDcfRepSrv* aServer )
-	{
+    {
     TInt err = KErrNone;
-	
-	iServer = aServer;
-	CActiveScheduler::Add( this );
-	
-	iSearching = ETrue;
-	err = SearchNext();
-	if ( err )
-		{
-		return err;
-		}
-	SetActive();
-	TRequestStatus* status = &iStatus;
-	User::RequestComplete( status , KErrNone );
-	return err;
-	}
+
+    iServer = aServer;
+    CActiveScheduler::Add( this );
+
+    iSearching = ETrue;
+    err = SearchNext();
+    if ( err )
+        {
+        return err;
+        }
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status , KErrNone );
+    return err;
+    }
 
 // -----------------------------------------------------------------------------
 // CFileScan::SearchDrive
@@ -259,16 +259,16 @@
 // -----------------------------------------------------------------------------
 //
 TInt CFileScan::SearchDrive()
-	{
-	_LIT( KDrive, "%c:");
-	TDriveList drivelist;
-	TChar driveLetter;
-	TInt driveNumber = EDriveA - 1;
-	TInt err = KErrNone;
+    {
+    _LIT( KDrive, "%c:");
+    TDriveList drivelist;
+    TChar driveLetter;
+    TInt driveNumber = EDriveA - 1;
+    TInt err = KErrNone;
 
 #ifdef RD_MULTIPLE_DRIVE
-	
-	TInt ramDrive( -1 );
+
+    TInt ramDrive( -1 );
     TInt romDrive( -1 );
 
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, ramDrive );
@@ -276,44 +276,44 @@
 
 #endif
 
-	err = iFs->DriveList( drivelist ); 
+    err = iFs->DriveList( drivelist );
 
-	if ( iLastPosition != KNullDesC )
-		{
-		driveLetter = iLastPosition[0];
-		err = iFs->CharToDrive( driveLetter, driveNumber );
-		}
-	
-	driveNumber++;
-	
+    if ( iLastPosition != KNullDesC )
+        {
+        driveLetter = iLastPosition[0];
+        err = iFs->CharToDrive( driveLetter, driveNumber );
+        }
+
+    driveNumber++;
+
     for ( ; driveNumber < KMaxDrives ; driveNumber++ )
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-	    
-	    if ( driveNumber == EDriveD || driveNumber == EDriveZ )
-		    {
-		    }
-	    		
+
+        if ( driveNumber == EDriveD || driveNumber == EDriveZ )
+            {
+            }
+
 #else // RD_MULTIPLE_DRIVE
 
-		if ( driveNumber == ramDrive || driveNumber == romDrive )
-		    {
-			}
+        if ( driveNumber == ramDrive || driveNumber == romDrive )
+            {
+            }
 
 #endif
-		
-		else if ( drivelist[driveNumber] ) 
-				{
-				err = iFs->DriveToChar( driveNumber, driveLetter );
-				iLastPosition.Format( KDrive, (TUint)driveLetter );
-				iDeeper = ETrue;
-				return err;
-				}
+
+        else if ( drivelist[driveNumber] )
+                {
+                err = iFs->DriveToChar( driveNumber, driveLetter );
+                iLastPosition.Format( KDrive, (TUint)driveLetter );
+                iDeeper = ETrue;
+                return err;
+                }
         }
-	CleanInternal();
-	return err;
-	}
+    CleanInternal();
+    return err;
+    }
 
 
 
@@ -324,46 +324,46 @@
 // -----------------------------------------------------------------------------
 //
 TInt CFileScan::SearchFolder( CDir*& aFolderList )
-	{
-	TInt err = KErrNone;
-	TRAP( err , iCurrentLeaf->SetLeafL( aFolderList ) );
-	return err;
-	}
+    {
+    TInt err = KErrNone;
+    TRAP( err , iCurrentLeaf->SetLeafL( aFolderList ) );
+    return err;
+    }
 
 // -----------------------------------------------------------------------------
 // CFileScan::SearchFile
-// This function searches for the DCF files under specific folder 
+// This function searches for the DCF files under specific folder
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
 TInt CFileScan::SearchFile( CDir*& aFileList )
-	{
-	TInt err = KErrNone;
-	TInt i = 0;
-	TBool isDCF;
-	_LIT ( KFullFileName , "%S\\%S");
-	TFileName fileName;
+    {
+    TInt err = KErrNone;
+    TInt i = 0;
+    TBool isDCF;
+    _LIT ( KFullFileName , "%S\\%S");
+    TFileName fileName;
 
-	for ( ; i < aFileList->Count() && !err ; i++ )
-		{
-		if (!( *aFileList )[i].IsDir())
-		    {
-    		TPtrC extension = (*aFileList)[i].iName.Right( 4 );
-    		if( !extension.CompareF( KWma ) || 
-    		    !extension.CompareF( KWmv ) ||
-    		    !extension.CompareF( KAsf ) )
-    		    {
-    		    
-    		    }
-    		else
-    		    {
-    		    fileName.Format( KFullFileName , &iLastPosition , &( *aFileList )[i].iName );
-    		    err = IsProtected( fileName , isDCF );
-		        }
-    		}
-		}
-	return err;
-	}
+    for ( ; i < aFileList->Count() && !err ; i++ )
+        {
+        if (!( *aFileList )[i].IsDir())
+            {
+            TPtrC extension = (*aFileList)[i].iName.Right( 4 );
+            if( !extension.CompareF( KWma ) ||
+                !extension.CompareF( KWmv ) ||
+                !extension.CompareF( KAsf ) )
+                {
+
+                }
+            else
+                {
+                fileName.Format( KFullFileName , &iLastPosition , &( *aFileList )[i].iName );
+                err = IsProtected( fileName , isDCF );
+                }
+            }
+        }
+    return err;
+    }
 
 // -----------------------------------------------------------------------------
 // CFileScan::SearchNext
@@ -372,155 +372,155 @@
 // -----------------------------------------------------------------------------
 //
 TInt CFileScan::SearchNext()
-	{
-	TInt err = KErrNone;
+    {
+    TInt err = KErrNone;
 
-	err = CheckDrive();
-	if ( !err && iSearching )
-		{
-		if ( iDeeper )
-			{
-			err = CheckFolder();
-			}
-		if ( !err && iSearching )
-			{
-			err = ToNextLeaf();
-			}
-		}
-	return err;
-	}
+    err = CheckDrive();
+    if ( !err && iSearching )
+        {
+        if ( iDeeper )
+            {
+            err = CheckFolder();
+            }
+        if ( !err && iSearching )
+            {
+            err = ToNextLeaf();
+            }
+        }
+    return err;
+    }
 
 TInt CFileScan::CheckDrive()
-	{
-	// check if current drive is end of searching
-	TInt err = KErrNone;
+    {
+    // check if current drive is end of searching
+    TInt err = KErrNone;
 
-	if( !iCurrentLeaf )
-		{
-		err = SearchDrive();
-		if ( err || !iSearching )
-			{
-			return err;
-			}
-		CSearchLeaf* root = NULL;
-		TRAP( err , iCurrentLeaf = CSearchLeaf::NewL( root , iLastPosition ) );
-		}	
-	return err;
-	}
+    if( !iCurrentLeaf )
+        {
+        err = SearchDrive();
+        if ( err || !iSearching )
+            {
+            return err;
+            }
+        CSearchLeaf* root = NULL;
+        TRAP( err , iCurrentLeaf = CSearchLeaf::NewL( root , iLastPosition ) );
+        }
+    return err;
+    }
 
-TInt CFileScan::CheckFolder()	
-	{
-	// check current folder
-	_LIT ( KSearchDir , "%S\\*");
+TInt CFileScan::CheckFolder()
+    {
+    // check current folder
+    _LIT ( KSearchDir , "%S\\*");
 
-	TInt err = KErrNone;
-	CDir* fileList = NULL;
-	CDir* dirList = NULL;
-	TFileName temp;
-    
+    TInt err = KErrNone;
+    CDir* fileList = NULL;
+    CDir* dirList = NULL;
+    TFileName temp;
+
 #ifndef RD_MULTIPLE_DRIVE
     if ( IgnoreDir( iLastPosition ) )
 #else // RD_MULTIPLE_DRIVE
-    if ( IgnoreDir( *iFs, iLastPosition ) )    
+    if ( IgnoreDir( *iFs, iLastPosition ) )
 #endif
         {
         return err;
         }
-    
+
     if( iLastPosition.Length() + KSearchDir().Length() < iLastPosition.MaxLength() )
         {
-	    temp.Format( KSearchDir , &iLastPosition );
-	    err = iFs->GetDir( temp  
-		    , KEntryAttMaskSupported
-		    , ESortByName 
-		    , fileList , dirList );
-	
-	    if ( !err )
-		    {
-		    err = SearchFolder( dirList );
-		    if ( !err )
-			    {
-			    err = SearchFile( fileList );
-			    }
-		    }
-	    delete fileList;
-	    fileList = NULL;
-	    delete dirList;
-	    dirList = NULL;        
+        temp.Format( KSearchDir , &iLastPosition );
+        err = iFs->GetDir( temp
+            , KEntryAttMaskSupported
+            , ESortByName
+            , fileList , dirList );
+
+        if ( !err )
+            {
+            err = SearchFolder( dirList );
+            if ( !err )
+                {
+                err = SearchFile( fileList );
+                }
+            }
+        delete fileList;
+        fileList = NULL;
+        delete dirList;
+        dirList = NULL;
         }
-	return err;
-	}
+    return err;
+    }
 
 TInt CFileScan::ToNextLeaf()
-	{
-	_LIT ( KChildDir , "%S\\%S");
-	TInt err = KErrNone;
-	TFileName file;
-	CSearchLeaf* temp = NULL;
+    {
+    _LIT ( KChildDir , "%S\\%S");
+    TInt err = KErrNone;
+    TFileName file;
+    CSearchLeaf* temp = NULL;
 
-	file.Format( iLastPosition );
+    file.Format( iLastPosition );
 
-	if ( iCurrentLeaf->LeafList().Count() > 0 )
-		{
-		iDeeper = ETrue;
-		iCurrentLeaf = iCurrentLeaf->LeafList()[0];
-		iLastPosition.Format( KChildDir , &file , &iCurrentLeaf->FolderName() );
-		}
-	else
-		{
-		iDeeper = EFalse;
-		temp = iCurrentLeaf;
-		iCurrentLeaf = iCurrentLeaf->Root();
-		if ( iCurrentLeaf )
-			{
-			iCurrentLeaf->RemoveLeaf( temp );			
-			}
-		delete temp;
-		temp = NULL;
-		err = UpFolder();
-		}
-	return err;
-	}
+    if ( iCurrentLeaf->LeafList().Count() > 0 )
+        {
+        iDeeper = ETrue;
+        iCurrentLeaf = iCurrentLeaf->LeafList()[0];
+        iLastPosition.Format( KChildDir , &file , &iCurrentLeaf->FolderName() );
+        }
+    else
+        {
+        iDeeper = EFalse;
+        temp = iCurrentLeaf;
+        iCurrentLeaf = iCurrentLeaf->Root();
+        if ( iCurrentLeaf )
+            {
+            iCurrentLeaf->RemoveLeaf( temp );
+            }
+        delete temp;
+        temp = NULL;
+        err = UpFolder();
+        }
+    return err;
+    }
 
 TInt CFileScan::UpFolder()
-	{
-	TInt err = KErrNone;
-	TParse file;
-	if ( iLastPosition.Length()<3 )
-		{
-		return err;
-		}
-	err = file.Set( iLastPosition , NULL , NULL );
-	iLastPosition.Format( file.DriveAndPath() );
-	iLastPosition.SetLength( iLastPosition.Length() - 1 );
-	return err;
-	}
+    {
+    TInt err = KErrNone;
+    TParse file;
+    if ( iLastPosition.Length()<3 )
+        {
+        return err;
+        }
+    err = file.Set( iLastPosition , NULL , NULL );
+    iLastPosition.Format( file.DriveAndPath() );
+    iLastPosition.SetLength( iLastPosition.Length() - 1 );
+    return err;
+    }
 
 
 void CFileScan::CleanInternal()
-	{
-	CSearchLeaf* root = iCurrentLeaf;
-	iLastPosition = KNullDesC;
-	iSearching = EFalse;
-	root = GetRootLeaf();
-	delete root;
-	root = NULL;
-	iCurrentLeaf = NULL;
-	iDeeper = ETrue;
-	}
+    {
+    CSearchLeaf* root = iCurrentLeaf;
+    iLastPosition = KNullDesC;
+    iSearching = EFalse;
+    root = GetRootLeaf();
+    delete root;
+    root = NULL;
+    iCurrentLeaf = NULL;
+    iDeeper = ETrue;
+    }
 
 CSearchLeaf* CFileScan::GetRootLeaf()
-	{
-	CSearchLeaf* root = iCurrentLeaf;
-	if ( iCurrentLeaf )
-		{
-		while ( root->Root() )
-			{
-			root = root->Root();
-			}	
-		}
-	return root;
-	}
+    {
+    CSearchLeaf* root = iCurrentLeaf;
+    if ( iCurrentLeaf )
+        {
+        while ( root->Root() )
+            {
+            root = root->Root();
+            }
+        }
+    return root;
+    }
 
 // End of File
 
--- a/omadrm/drmengine/dm/src/DRMMessageParser.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dm/src/DRMMessageParser.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -26,20 +26,20 @@
 #include <wspencoder.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
-#include "DrmRights.h"
+#include "DRMRights.h"
 #include "Oma1DcfCreator.h"
 #include "b64.h"
 #include "DRMMessageParser.h"
-#include "DRMRightsParser.h"
+#include "DrmRightsParser.h"
 #include "DRMRightsClient.h"
 #include "DrmKeyStorage.h"
 
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 // MACROS
 // LOCAL CONSTANTS AND MACROS
@@ -54,7 +54,7 @@
 
 _LIT8( KFLSuffix, "@localhost");
 LOCAL_C const TUint8 KCDContentIDLength = 25; // 4 + 11 + 10
-LOCAL_C const TUint8 KCDPlainIDLength = 11; 
+LOCAL_C const TUint8 KCDPlainIDLength = 11;
 
 LOCAL_C const TInt KInputBufferSize = 2048;
 LOCAL_C const TInt KBoundaryMarkLength = 2;
@@ -108,7 +108,7 @@
     RFs aFs;
     TFileName aName;
     };
-    
+
 // LOCAL FUNCTION PROTOTYPES
 LOCAL_C void DoResetAndDestroy( TAny* aPtr );
 LOCAL_C void DoResetAndDestroy2( TAny* aPtr );
@@ -126,14 +126,14 @@
 void DoResetAndDestroy( TAny* aPtr )
     {
     __ASSERT_DEBUG( aPtr, User::Invariant() );
-    
+
     reinterpret_cast< RPointerArray< CDRMRights >* >( aPtr )->ResetAndDestroy();
     }
 
 void DoResetAndDestroy2( TAny* aPtr )
     {
     __ASSERT_DEBUG( aPtr, User::Invariant() );
-    
+
     reinterpret_cast< RPointerArray< CDRMPermission >* >( aPtr )->ResetAndDestroy();
     }
 // -----------------------------------------------------------------------------
@@ -153,28 +153,28 @@
     {
     CDRMAsset* asset( NULL );
     CDRMRights* rights( NULL );
-    
+
     aRights = NULL;
-    
+
     rights = CDRMRights::NewL();
     CleanupStack::PushL( rights );
-    
+
     asset = CDRMAsset::NewL();
     CleanupStack::PushL( asset );
-    
+
     asset->iUid = aURI.AllocL();
-    
+
     if ( aPermission.iParentUID )
         {
         asset->iParentRights = aPermission.iParentUID->AllocL();
         }
-    
+
     rights->SetPermissionL( aPermission );
     rights->SetAssetL( *asset );
-    
+
     CleanupStack::PopAndDestroy(); // asset
     CleanupStack::Pop(), // rights
-    
+
     aRights = rights;
     }
 
@@ -187,11 +187,11 @@
 EXPORT_C CDRMMessageParser* CDRMMessageParser::NewL( void )
     {
     CDRMMessageParser* self = new( ELeave ) CDRMMessageParser();
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
-    
+
     return self;
     }
 
@@ -219,23 +219,23 @@
     {
     TInt error = KErrNone;
     TRAP( error, FinalizeMessageParserL() );
-    
+
     Reset();
-    
+
     User::Free( const_cast< TUint8* >( iInputBuffer.Ptr() ) );
     }
 
 // -----------------------------------------------------------------------------
 // CDRMMessageParser::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C void CDRMMessageParser::InitializeMessageParserL( RWriteStream& aStream )
     {
     Reset();
-    
+
     iDcfCreator = COma1DcfCreator::NewL();
-    
+
     iOutputStream = aStream;
     }
 
@@ -250,8 +250,8 @@
     *   - a boundary string is located and extracted
     *   - MIME header is read, and based on content-type field the internal
     *     state is set to either EReadingRightsPart or EReadingContentPart.
-    *   - after processing the MIME part, internal state is updated again to 
-    *     EReadingHeaderPart if there are several MIME parts in the DRM 
+    *   - after processing the MIME part, internal state is updated again to
+    *     EReadingHeaderPart if there are several MIME parts in the DRM
     *     message.
     *   - data is consumed from iInputData in each phase.
     *   - after everything is done, internal state is set to EAllDone.
@@ -260,14 +260,14 @@
         {
         User::Leave( KErrNotReady );
         }
-    
+
     if ( iState & EAllDone )
         {
         return;
         }
-    
+
     iInputData.Set( aMessageData );
-    
+
     while( iInputData.Length() )
         {
         if ( iState & EReadingHeaderPart )
@@ -302,7 +302,7 @@
 EXPORT_C void CDRMMessageParser::FinalizeMessageParserL()
     {
     TInt error( KErrNone );
-    
+
     if ( iState & EEncryptStreamOk )
         {
         if ( iInputBuffer.Length() )
@@ -312,15 +312,15 @@
             DeletePermission();
             error = KDRMMessageMalformed;
             }
-            
+
         ClearBit( EEncryptStreamOk );
         iDcfCreator->EncryptFinalizeL();
-        
+
         iOutputStream.CommitL();
         }
 
     Reset();
-    
+
     User::LeaveIfError( error );
     }
 
@@ -332,9 +332,9 @@
 void CDRMMessageParser::ConstructL()
     {
     // Make some extra room for crazy b64decode().
-    iInputBuffer.Set( reinterpret_cast< TUint8* >( 
-                        User::AllocL( KInputBufferSize + 2 ) ), 
-                      0, 
+    iInputBuffer.Set( reinterpret_cast< TUint8* >(
+                        User::AllocL( KInputBufferSize + 2 ) ),
+                      0,
                       KInputBufferSize );
     }
 
@@ -351,30 +351,30 @@
    TPtrC8 res( NULL, 0 );
     TBool cont( ETrue );
     TInt remainder( 0 );
-    
-    // Loop until 
+
+    // Loop until
     // - PrepareContentDataL leaves
     // - boundary end marker is found
     // - iInputBuffer is not updated anymore.
-    for ( PrepareContentDataL(); 
-          iInputBuffer.Length() && 
-              ( remainder != iInputBuffer.Length() ) && 
+    for ( PrepareContentDataL();
+          iInputBuffer.Length() &&
+              ( remainder != iInputBuffer.Length() ) &&
               cont;
           PrepareContentDataL() )
         {
         TInt pos = iInputBuffer.Find( *iBoundary );
-        
+
         if ( pos >= 0 )
             {
-            if ( pos < KBoundaryMarkLength + 1 ) 
+            if ( pos < KBoundaryMarkLength + 1 )
                 {
                 SetBrokenStateL( KDRMMessageMalformed );
                 }
-            
+
             res.Set( iInputBuffer.Left( pos - KBoundaryMarkLength ) );
-            
+
             StripEndLineL( res );
-            
+
             cont = EFalse;
             }
         else
@@ -383,33 +383,33 @@
             // there may be only a part of boundary string in this buffer
             // and the rest is got from the next input descriptor.
             remainder = iBoundary->Length() + KBoundaryMarkLength + 1;
-            
+
             if ( iInputBuffer.Length() <= remainder )
                 {
                 return;
                 }
-            
-            res.Set( iInputBuffer.Left( iInputBuffer.Length() - 
+
+            res.Set( iInputBuffer.Left( iInputBuffer.Length() -
                                         remainder ) );
             }
-        
+
         if ( iState & EBase64 )
             {
             iUsedFromInput = HandleBase64DataL( res );
             }
-        
+
         else
             {
             iUsedFromInput = res.Length();
             }
-        
+
         ProcessContentDataL( res );
-        
+
         CompressInputBuffer();
 
-        remainder = iInputBuffer.Length(); 
+        remainder = iInputBuffer.Length();
         }
-    
+
     if ( !cont )
         {
         // Discard all the remaining data.
@@ -431,34 +431,34 @@
 void CDRMMessageParser::HandleRightsDataL()
     {
     TPtrC8 res( NULL, 0 );
-    
+
     do
         {
         res.Set( GetLineL() );
-        
+
         TInt pos = res.Find( *iBoundary );
-        
+
         if ( pos >= KBoundaryMarkLength )
             {
             if ( res.Left( KBoundaryMarkLength ) == KBoundaryMark )
                 {
-                // Allow empty RO here. If it is not allowed by 
+                // Allow empty RO here. If it is not allowed by
                 // HandleRightsMessagePart(), an error is thrown.
                 TBool last = EFalse;
-                
+
                 // Returns always true.
                 IsBoundary( res, last );
-                
+
                 if ( last )
                     {
                     TInt error( KErrNone );
                     RPointerArray< CDRMRights > rights;
-                    TPtrC8 ptr( iInputBuffer.Ptr(),         
+                    TPtrC8 ptr( iInputBuffer.Ptr(),
                                 pos - KBoundaryMarkLength );
-                    
+
                     error = ProcessRightsObject(ptr, rights);
                     rights.ResetAndDestroy();
-                    
+
                     if ( !error )
                         {
                         SetBit( EAllDone );
@@ -470,25 +470,25 @@
                     }
                 else
                     {
-                    // Save the RO since the CID needs to be either changed 
+                    // Save the RO since the CID needs to be either changed
                     // or created.
-                    iRightsData = iInputBuffer.Left( iUsedFromInput - 
+                    iRightsData = iInputBuffer.Left( iUsedFromInput -
                                                      res.Length() ).AllocL();
                     }
-                
+
                 CompressInputBuffer();
-                
+
                 ClearBit( EReadingRightsPart );
                 ClearBit( EGotContentType );
                 ClearBit( EGotContentEncoding );
 
                 SetBit( EGotRightsPart );
                 SetBit( EReadingHeaderPart );
-                
+
                 res.Set( NULL, 0 );
 #ifndef __DRM_FULL
                 User::Leave(KErrNotSupported);
-#endif                
+#endif
                 }
             else
                 {
@@ -514,31 +514,31 @@
 void CDRMMessageParser::FindBoundaryL()
     {
     TPtrC8 line( NULL, 0 );
-    
+
     FOREVER
         {
         line.Set( GetLineL() );
-        
+
         if ( line.Length() > KBoundaryMarkLength )
             {
             TInt size = 0;
-            
+
             if ( line.Left( KBoundaryMarkLength ) == KBoundaryMark )
                 {
                 size = line.Length() - KBoundaryMarkLength - 1;
-                
+
                 if ( line[ line.Length() - 2 ] == '\r' )
                     {
                     --size;
                     }
-                
+
                 iBoundary = line.Mid( KBoundaryMarkLength, size ).AllocL();
-                
+
                 SetBit( EGotBoundary );
                 SetBit( EReadingHeaderPart );
-                
+
                 CompressInputBuffer();
-                
+
                 return;
                 }
             }
@@ -549,7 +549,7 @@
                 return;
                 }
             }
-        
+
         // Something else, not interested.
         CompressInputBuffer();
         }
@@ -558,8 +558,8 @@
 // ----------------------------------------------------------------------------
 // CDRMMessageParser::ReadHeaderL
 // The boundary is read and the following part is (should be) either a RO part
-// or content part. The data is kept in iInputBuffer until the whole header 
-// part of the MIME header part is received. After plain "\r\n" line is 
+// or content part. The data is kept in iInputBuffer until the whole header
+// part of the MIME header part is received. After plain "\r\n" line is
 // received and content-type is defined, iState is updated.
 // ----------------------------------------------------------------------------
 //
@@ -567,16 +567,16 @@
     {
     TPtrC8 line( NULL, 0 );
     TPtrC8 ptr( NULL, 0 );
-    
+
     FOREVER
         {
         ///////////////////////////////////////////////////////////////////
         // Process the MIME header line-by-line. Process the lines if they
-        // contain some information that is found useful. Update the 
+        // contain some information that is found useful. Update the
         // internal state according to findings.
         ///////////////////////////////////////////////////////////////////
         line.Set( GetLineL() );
-        
+
         if ( line.Length() )
             {
             if ( line == KEndLine || line == KNewLine )
@@ -586,18 +586,18 @@
                 ///////////////////////////////////////////////
                 if ( iState & EGotContentType )
                     {
-                    // Sanity check: Either EReadingRightsPart or 
+                    // Sanity check: Either EReadingRightsPart or
                     // EReadingContentPart must defined.
                     __ASSERT_DEBUG( ( iState & EReadingRightsPart ) ||
-                        ( iState & EReadingContentPart ), 
+                        ( iState & EReadingContentPart ),
                         User::Invariant() );
-                    
+
                     ClearBit( EReadingHeaderPart );
-                    
+
                     CompressInputBuffer();
-                    
+
                     // Check which part was read.
-                    // If content part is being processed, some checkings 
+                    // If content part is being processed, some checkings
                     // need to be made.
                     if ( iState & EReadingContentPart )
                         {
@@ -608,53 +608,53 @@
                                 // CD DCF.
                                 SetBrokenStateL( KErrCANotSupported );
                                 }
-                            
+
                             InitDCFBufferL();
 
                             SetBit( EDCFFile );
                             }
                         else
                             {
-                            // Non-DCF FL content or normal CD content. 
+                            // Non-DCF FL content or normal CD content.
                             // Create or modify the CID, save the RO.
                             HandleFlContentL();
-                            
+
                              iDcfCreator->EncryptInitializeL(
                                 iOutputStream,
                                 *iContentType,
                                 iRightsObject );
                             SetBit( EEncryptStreamOk );
-                            
-                            // The RO handle iRightsObject is kept in order 
-                            // to delete the rights in case of content 
-                            // encryption error. In that case, this will 
+
+                            // The RO handle iRightsObject is kept in order
+                            // to delete the rights in case of content
+                            // encryption error. In that case, this will
                             // generate unnecessary "RO Added / RO Deleted"
                             // notifications, but so what. "More correct"
-                            // way of doing would be modifying 
-                            // EncryptInitialize not to 
+                            // way of doing would be modifying
+                            // EncryptInitialize not to
                             // save the RO, but then the key would have to
                             // be given to it by other means. Since we are
-                            // not their "friend" class, we cannot access 
+                            // not their "friend" class, we cannot access
                             // their members, and making them to ask our
                             // members when doing EncryptInitialize/Finalize
                             // might cause some problems perhaps.
                             }
-                        
+
                         delete iContentType;
                         iContentType = NULL;
                         }
-                    
+
                     return;
                     }
-                
+
                 // Empty MIME header.
                 SetBrokenStateL( KDRMMessageMalformed );
                 }
-            
+
             ///////////////////////////////////
             // Check the line for content-type.
             ///////////////////////////////////
-            if ( line.Length() > KContentType().Length()  &&  
+            if ( line.Length() > KContentType().Length()  &&
                 !( line.Left( KContentType().Length() ).CompareF( KContentType ) ) )
                 {
                 if ( iState & EGotContentType )
@@ -662,11 +662,11 @@
                     // Content-type given twice.
                     SetBrokenStateL( KDRMMessageMalformed );
                     }
-                
+
                 ptr.Set( HeaderValueL( line ) );
-                
+
                 SetBit( EGotContentType );
-                
+
                 // Which part this is: rights or the actual content?
                 if ( ( ptr.CompareF( KDRMXMLRightsType ) == 0 ) ||
                     ( ptr.CompareF( KDRMWBXMLRightsType ) == 0 ) )
@@ -676,7 +676,7 @@
                         // Rights are given twice.
                         SetBrokenStateL( KDRMMessageMalformed );
                         }
-                    
+
                     SetBit( EReadingRightsPart );
                     }
                 else
@@ -685,9 +685,9 @@
                         {
                         SetBrokenStateL( KDRMMessageMalformed );
                         }
-                    
+
                     SetBit( EReadingContentPart );
-                    
+
                     // Content-type is saved for future use.
                     iContentType = ptr.AllocL();
                     }
@@ -706,12 +706,12 @@
                         // Double line.
                         SetBrokenStateL( KDRMMessageMalformed );
                         }
-                    
+
                     ptr.Set( HeaderValueL( line ) );
-                    
+
                     SetBit( EGotContentEncoding );
 
-                    // Throw an error if content-transfer-encoding 
+                    // Throw an error if content-transfer-encoding
                     // is something we don't support.
                     if ( ptr.CompareF( KEncoding8bit ) &&
                         ptr.CompareF( KEncoding7bit) &&
@@ -721,7 +721,7 @@
                             {
                             SetBrokenStateL( KErrCANotSupported );
                             }
-                        
+
                         // So it has to be Base64.
                         SetBit( EBase64 );
                         }
@@ -732,20 +732,20 @@
                     // Check the line for end boundary marker.
                     //////////////////////////////////////////
                     TBool final( EFalse );
-                    
+
                     if ( IsBoundary( line, final ) )
                         {
                         SetBrokenStateL( KDRMMessageMalformed );
                         }
-                    
-                    // Else: some X-field, parameter or something else. 
+
+                    // Else: some X-field, parameter or something else.
                     // The line is ignored.
                     }
                 }
-            
+
             CompressInputBuffer();
             }
-            
+
         else
             {
             // No line available yet.
@@ -763,32 +763,32 @@
     {
     TInt pos = 0;
     TPtrC8 res( NULL, 0 );
-    
+
     if ( iInputBuffer.Length() > iUsedFromInput )
         {
         pos = iInputBuffer.Mid( iUsedFromInput ).Find( KNewLine );
-        
+
         if ( pos >= 0 )
             {
             res.Set( iInputBuffer.Mid( iUsedFromInput, pos - iUsedFromInput + 1 ) );
             iUsedFromInput = pos + 1;
             }
         }
-    
+
     if ( res.Length() == 0 )
         {
         if ( iInputData.Length() )
             {
             pos = iInputData.Find( KNewLine );
-            
+
             if ( pos < 0 )
                 {
-                if ( iInputBuffer.MaxSize() - iInputBuffer.Length() < 
+                if ( iInputBuffer.MaxSize() - iInputBuffer.Length() <
                     iInputData.Length() )
                     {
                     SetBrokenStateL( KDRMMessageMalformed );
                     }
-                
+
                 iInputBuffer.Append( iInputData );
                 iInputData.Set( NULL, 0 );
                 }
@@ -799,16 +799,16 @@
                     {
                     SetBrokenStateL( KDRMMessageMalformed );
                     }
-                
+
                 iInputBuffer.Append( iInputData.Left( pos + 1 ) );
                 res.Set( iInputBuffer.Mid( iUsedFromInput ) );
                 iUsedFromInput = iInputBuffer.Length();
-                
+
                 iInputData.Set( iInputData.Mid( pos + 1 ) );
                 }
             }
         }
-    
+
     return res;
     }
 
@@ -821,23 +821,23 @@
     {
     TInt pos( 0 );
     TPtrC8 res( NULL, 0 );
-    
+
     pos = aLine.Find( KColon );
-    
+
     if ( pos <= 0 )
         {
         SetBrokenStateL( KDRMMessageMalformed );
         }
-    
+
     pos += 1;
-    
-    while ( pos < aLine.Length() && 
+
+    while ( pos < aLine.Length() &&
             TChar( aLine[ pos ] ).IsSpace() )
         {
         ++pos;
         }
 
-    // Don't overindex.   
+    // Don't overindex.
     if ( pos == aLine.Length() )
         {
         // Full of whitespaces.
@@ -847,27 +847,27 @@
     // Drop possible parameters.
     res.Set( aLine.Mid( pos ) );
     pos = res.Find( KSemiColon );
-    
+
     if ( pos >= 0 )
         {
         res.Set( res.Left( pos ) );
         }
-    
+
     pos = res.Length();
-    
+
     if ( !pos )
         {
         // Just parameters, no actual value.
         SetBrokenStateL( KDRMMessageMalformed );
         }
 
-    // This can't underflow, since otherwise there would be only 
+    // This can't underflow, since otherwise there would be only
     // semicolon & parameters (checked earlier).
     while( TChar( res[ pos - 1 ] ).IsSpace() )
         {
         --pos;
         }
-    
+
     return res.Left( pos );
     }
 
@@ -881,11 +881,11 @@
     if ( iUsedFromInput )
         {
         const TInt size = iInputBuffer.Length() - iUsedFromInput;
-        
+
         Mem::Copy( const_cast< TUint8* >( iInputBuffer.Ptr() ),
             iInputBuffer.Ptr() + iUsedFromInput,
             size );
-        
+
         iInputBuffer.SetLength( size );
         iUsedFromInput = 0;
         }
@@ -904,20 +904,20 @@
             {
             SetBrokenStateL( KDRMMessageMalformed );
             }
-        
-        const TInt size = Min( iInputBuffer.MaxSize() - iInputBuffer.Length(), 
+
+        const TInt size = Min( iInputBuffer.MaxSize() - iInputBuffer.Length(),
                                iInputData.Length() );
-        
+
         iInputBuffer.Append( iInputData.Left( size ) );
-        
+
         iInputData.Set( iInputData.Mid( size ) );
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMMessageParser::HandleBase64DataL
 // Decode base64 encoded data from and to aData descriptor.
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt CDRMMessageParser::HandleBase64DataL( TPtrC8& aData )
@@ -938,19 +938,19 @@
                 }
             }
         }
-    
+
     if ( consumed != aData.Ptr() )
         {
-        User::LeaveIfError( b64decode( const_cast< TUint8* >( aData.Ptr() ), 
+        User::LeaveIfError( b64decode( const_cast< TUint8* >( aData.Ptr() ),
                                        consumed - aData.Ptr() + 1,
-                                       const_cast< TUint8* >( aData.Ptr() ), 
+                                       const_cast< TUint8* >( aData.Ptr() ),
                                        &temp1 ) );
-        
+
         aData.Set( aData.Ptr(), temp1 );
 
         temp1 = consumed - aData.Ptr() + 1;
         }
-        
+
     else
         {
         aData.Set( aData.Ptr(), 0 );
@@ -970,17 +970,17 @@
 void CDRMMessageParser::StripEndLineL( TPtrC8& aBuf )
     {
     TInt newSize( aBuf.Length() );
-    
+
     if ( aBuf.Right( 1 ) == KNewLine )
         {
         --newSize;
-        
-        if ( ( aBuf.Length() > 1 ) && 
+
+        if ( ( aBuf.Length() > 1 ) &&
             ( aBuf.Right( 2 ) == KEndLine ) )
             {
             --newSize;
             }
-        
+
         aBuf.Set( aBuf.Left( newSize ) );
         }
     else
@@ -995,28 +995,28 @@
 // the end boundary.
 // -----------------------------------------------------------------------------
 //
-TBool CDRMMessageParser::IsBoundary( const TDesC8& aLine, TBool& aLast ) const 
+TBool CDRMMessageParser::IsBoundary( const TDesC8& aLine, TBool& aLast ) const
     {
     TBool res = EFalse;
-    
+
     __ASSERT_DEBUG( iBoundary, User::Invariant() );
-    
+
     if ( iState & EGotBoundary )
         {
         if ( aLine.Length() > KBoundaryMarkLength + iBoundary->Length() )
             {
             TPtrC8 tmp( NULL, 0 );
-            
+
             if ( ( aLine.Left( KBoundaryMarkLength ) == KBoundaryMark ) &&
                 ( aLine.Mid( KBoundaryMarkLength, iBoundary->Length() ).
                 Compare( *iBoundary ) == 0 ) )
                 {
                 res = ETrue;
-                
-                tmp.Set( aLine.Right( aLine.Length() - 
-                    KBoundaryMarkLength - 
+
+                tmp.Set( aLine.Right( aLine.Length() -
+                    KBoundaryMarkLength -
                     iBoundary->Length() ) );
-                
+
                 if ( ( tmp.Length() >= KBoundaryMarkLength ) &&
                     ( tmp.Left( KBoundaryMarkLength ) == KBoundaryMark ) )
                     {
@@ -1025,7 +1025,7 @@
                 }
             }
         }
-    
+
     return res;
     }
 
@@ -1037,23 +1037,23 @@
 void CDRMMessageParser::HandleFlContentL()
     {
     __ASSERT_DEBUG( !( iState & EDCFFile ), User::Invariant() );
-    
+
     if ( iRightsData )
         {
         HBufC8* cid( NULL );
         HBufC8* buf( NULL );
-        
+
         // RO was found from DRM message.
         CreateCDCIDL( cid );
         CleanupStack::PushL( cid );
-      
+
         buf = iRightsData;
         CleanupStack::PushL( buf );
         iRightsData = NULL;
-        
-        ProcessRightsDataL( *cid, 
+
+        ProcessRightsDataL( *cid,
                             *buf );
-        
+
         CleanupStack::PopAndDestroy(); // buf
         CleanupStack::PopAndDestroy(); // cid
         }
@@ -1069,19 +1069,19 @@
 
 // -----------------------------------------------------------------------------
 // CDRMMessageParser::ProcessRightsData
-// Process DRM message -style rights object and fetch it to iRightsObject if 
+// Process DRM message -style rights object and fetch it to iRightsObject if
 // necessary.
 // -----------------------------------------------------------------------------
 //
-void CDRMMessageParser::ProcessRightsDataL( 
+void CDRMMessageParser::ProcessRightsDataL(
                             const TDesC8& aCID,
                             const TDesC8& aData )
     {
     __ASSERT_DEBUG( !iRightsObject, User::Invariant() );
-    
+
     TInt start = aData.Find(KRightsStartTag);
     TInt end = aData.LocateReverse('>');
-    
+
     if ( start >= 0 && end > start )
         {
         TDRMUniqueID localID( 0 );
@@ -1092,39 +1092,39 @@
         TBuf8< KDCFKeySize > key;
         key.SetLength(KDCFKeySize);
         RPointerArray< CDRMRights > rights;
-        
+
         TCleanupItem cleanup( DoResetAndDestroy, &rights );
         CleanupStack::PushL( cleanup );
-        
+
         User::LeaveIfError( client.Connect() );
         CleanupClosePushL( client );
-        
+
         parser = CDrmRightsParser::NewL();
         CleanupStack::PushL( parser );
-        
+
         parser->ParseL( ptr, rights );
-        
+
         if (rights.Count()==0)
-        	{
-        	User::Leave(KErrCorrupt);
-        	}
-        
+            {
+            User::Leave(KErrCorrupt);
+            }
+
         client.GetRandomDataL(key);
 
         User::LeaveIfError( client.AddRecord(
-                            key, 
-                            rights[0]->GetPermission(), 
-                            aCID, 
+                            key,
+                            rights[0]->GetPermission(),
+                            aCID,
                             localID) );
-        
+
         iRightsObject = CDRMRights::NewL();
-        
+
         asset = CDRMAsset::NewLC();
         asset->iUid = aCID.AllocL();
-        
+
         iRightsObject->SetAssetL(*asset);
         iRightsObject->SetPermissionL(rights[0]->GetPermission());
-        
+
         CleanupStack::PopAndDestroy( 4 ); // asset, parser, client, rights
         }
     else
@@ -1135,7 +1135,7 @@
 
 // -----------------------------------------------------------------------------
 // CDRMMessageParser::ProcessContentDataL
-// Handle DCF file's CID manipulation in "DCF in DRM message" case. 
+// Handle DCF file's CID manipulation in "DCF in DRM message" case.
 // Send the data to EncryptUpdateL if encryption is needed.
 // -----------------------------------------------------------------------------
 //
@@ -1165,9 +1165,9 @@
 TBool CDRMMessageParser::ValidB64CharL( const TUint8 aChar )
     {
     // Allowed characters are '0'...'9', 'A'...'Z', 'a'...'z', '+', '/', '='
-    if ( ( aChar >= 48 && aChar <= 57 ) || 
+    if ( ( aChar >= 48 && aChar <= 57 ) ||
          ( aChar >= 65 && aChar <= 90 ) ||
-         ( aChar >= 97 && aChar <= 122 ) || 
+         ( aChar >= 97 && aChar <= 122 ) ||
          ( aChar == 43 ) ||
          ( aChar == 47 ) ||
          ( aChar == 61 ) )
@@ -1177,7 +1177,7 @@
 
     if ( ( aChar != 0x0D ) && ( aChar != 0x0A ) )
         {
-        SetBrokenStateL( KDRMMessageMalformed );        
+        SetBrokenStateL( KDRMMessageMalformed );
         }
 
     return EFalse;
@@ -1185,29 +1185,29 @@
 
 // -----------------------------------------------------------------------------
 // DRMCommon::ProcessMessage
-// 
+//
 // -----------------------------------------------------------------------------
 EXPORT_C TInt CDRMMessageParser::ProcessMessage(
     HBufC8*& aDRMMessage)
     {
     TInt error( KErrNone );
     TRAP( error, DoProcessMessageL( aDRMMessage ) );
-    
+
     return error;
     }
-    
+
 // -----------------------------------------------------------------------------
 // DRMCommon::ProcessRightsObject
 // Processes a rights objects and saves it in the rights database.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt CDRMMessageParser::ProcessRightsObject(
-    const TDesC8& aRightsObject, 
+    const TDesC8& aRightsObject,
     RPointerArray<CDRMRights>& aRightsDetail)
     {
     TInt error( KErrNone );
     TRAP( error, DoProcessRightsObjectL( aRightsObject,
                                          aRightsDetail ) );
-                                         
+
     return error;
     }
 
@@ -1215,7 +1215,7 @@
     {
     iState |= aBit;
     }
-    
+
 void CDRMMessageParser::ClearBit( TUint32 aBit )
     {
     iState &= ~aBit;
@@ -1225,24 +1225,24 @@
     {
     delete iDCFBuffer;
     iDCFBuffer = NULL;
-    
+
     delete iDcfCreator;
     iDcfCreator = NULL;
-    
+
     delete iRightsData;
     iRightsData = NULL;
-    
+
     delete iRightsObject;
     iRightsObject = NULL;
-    
+
     delete iBoundary;
     iBoundary = NULL;
-    
+
     delete iContentType;
     iContentType = NULL;
-    
+
     iInputBuffer.SetLength( 0 );
-    
+
     iState = ESearchingBoundary;
     iDCFHeaderSize[ 0 ] = KMaxTUint32;
     iDCFHeaderSize[ 1 ] = KMaxTUint32;
@@ -1254,63 +1254,63 @@
     RFileWriteStream output;
     RFile file;
     TInt size( 0 );
-    
+
     User::LeaveIfError( fileData.aFs.Connect() );
     CleanupClosePushL( fileData.aFs );
 
     TCleanupItem cleanup( DoDeleteFile, &fileData );
     CleanupStack::PushL( cleanup );
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
-    User::LeaveIfError( output.Temp( fileData.aFs, 
-                                     KTempPath, 
-                                     fileData.aName, 
+    User::LeaveIfError( output.Temp( fileData.aFs,
+                                     KTempPath,
+                                     fileData.aName,
                                      EFileWrite ) );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	fileData.aFs.DriveToChar( driveNumber, driveLetter );
-    
-	TFileName tempPath;
-	tempPath.Format( KTempPath, (TUint)driveLetter );
+    fileData.aFs.DriveToChar( driveNumber, driveLetter );
+
+    TFileName tempPath;
+    tempPath.Format( KTempPath, (TUint)driveLetter );
 
-    User::LeaveIfError( output.Temp( fileData.aFs, 
-                                   tempPath, 
-                                   fileData.aName, 
+    User::LeaveIfError( output.Temp( fileData.aFs,
+                                   tempPath,
+                                   fileData.aName,
                                    EFileWrite ) );
-    
+
 #endif
-    
+
     CleanupClosePushL( output );
-    
+
     InitializeMessageParserL( output );
     ProcessMessageDataL( *aDRMMessage );
     FinalizeMessageParserL();
-    
+
     CleanupStack::PopAndDestroy(); // output
-    
+
     User::LeaveIfError( file.Open( fileData.aFs, fileData.aName, EFileRead ) );
     CleanupClosePushL( file );
-    
+
     User::LeaveIfError( file.Size( size ) );
-    
+
     if ( size > aDRMMessage->Des().MaxSize() )
         {
         HBufC8* tmp( NULL );
-        
-        delete aDRMMessage; 
+
+        delete aDRMMessage;
         aDRMMessage = NULL;
-        
+
         tmp = HBufC8::NewLC( size );
         TPtr8 data( tmp->Des() );
-        
+
         User::LeaveIfError( file.Read( data ) );
         CleanupStack::Pop(); // tmp
-        
+
         aDRMMessage = tmp;
         }
     else
@@ -1318,22 +1318,22 @@
         TPtr8 data( aDRMMessage->Des() );
         User::LeaveIfError( file.Read( data ) );
         }
-    
+
     CleanupStack::PopAndDestroy( 3 ); // file, cleanup, fileData.aFs
     }
 
-void CDRMMessageParser::DoProcessRightsObjectL( 
-    const TDesC8& aRightsObject, 
+void CDRMMessageParser::DoProcessRightsObjectL(
+    const TDesC8& aRightsObject,
     RPointerArray<CDRMRights>& aRightsDetail )
     {
     CDrmRightsParser* parser = NULL;
     TInt start;
     TInt end;
     TPtrC8 ptr(0, 0);
-    
+
     start = aRightsObject.Find(KRightsStartTag);
     end = aRightsObject.LocateReverse('>');
-    
+
     TCleanupItem cleanup( DoResetAndDestroy, &aRightsDetail );
     CleanupStack::PushL( cleanup );
 
@@ -1342,16 +1342,16 @@
         // xml
         parser = CDrmRightsParser::NewL();
         CleanupStack::PushL(parser);
-        
-        ptr.Set(&aRightsObject[start], end - start + 1);    
-        
+
+        ptr.Set(&aRightsObject[start], end - start + 1);
+
         parser->ParseAndStoreL(ptr, aRightsDetail);
-        
+
         if (aRightsDetail.Count() == 0)
             {
             User::Leave( KErrArgument );
             }
-        
+
         CleanupStack::PopAndDestroy(); // parser
         }
     else if (start == KErrNotFound )
@@ -1359,23 +1359,23 @@
         // wbxml
         parser = CDrmRightsParser::NewL(CDrmRightsParser::EWbxmlParser);
         CleanupStack::PushL(parser);
-        
+
         parser->ParseAndStoreL(aRightsObject, aRightsDetail);
         if (aRightsDetail.Count() == 0)
             {
             User::Leave( KErrArgument );
             }
-        
+
         CleanupStack::PopAndDestroy(); // parser
         }
     else
         {
         User::Leave( KErrArgument );
         }
-    
+
     CleanupStack::Pop(); // cleanup
     }
-    
+
 void CDRMMessageParser::DeletePermission()
     {
     if ( iRightsObject )
@@ -1383,28 +1383,28 @@
         if ( !( iState & EFLContent ) )
             {
             HBufC8* URI = NULL;
-            
+
             if ( !( iRightsObject->GetContentURI( URI ) ) )
                 {
                 __ASSERT_DEBUG( URI, User::Invariant() );
-                
+
                 RDRMRightsClient client;
-                
+
                 TInt error = client.Connect();
-                
+
                 if ( !error )
                     {
                     // Don't care if it fails.
                     client.DeleteDbEntry( *URI, iRightsObject->GetLocalID() );
-                    
+
                     client.Close();
                     }
-                
+
                 delete URI;
                 URI = NULL;
                 }
             }
-        
+
         delete iRightsObject;
         iRightsObject = NULL;
         }
@@ -1414,7 +1414,7 @@
     {
     SetBit( EBroken );
     DeletePermission();
-    
+
     User::Leave( aError );
     }
 
@@ -1442,7 +1442,7 @@
     CleanupStack::PopAndDestroy();
 
     des = KFLPrefix;
-    
+
     for (TInt i = 0; i < KCDPlainIDLength; i++)
         {
         des.AppendNumFixedWidth( id[i], EDecimal, 1 );
@@ -1450,28 +1450,28 @@
 
     des.Append( KFLSuffix );
     }
-    
+
 TInt CDRMMessageParser::RetrieveFlRights()
     {
     __ASSERT_DEBUG( !iRightsObject, User::Invariant() );
-    
+
     RDRMRightsClient client;
     TInt error( client.Connect() );
-    
+
     if ( !error )
         {
         TRAP( error, EnsureFLRightsExistL( client, &iRightsObject ) );
-                
+
         client.Close();
         }
-        
+
     return error;
     }
 
 void CDRMMessageParser::ProcessDCFDataL( TPtrC8& aDCFData )
     {
     TBool doCommit( EFalse );
-    
+
     // Loop until all available data is either cached or processed.
     // What happens is
     // - modify Content-URI
@@ -1485,52 +1485,52 @@
             // Modify ContentURI.
             //////////////////////////////////////////////////////////////////
             FillDCFBufferL( aDCFData );
-        
+
             if ( iDCFBuffer->Length() > 3 )
                 {
                 TInt pos = 0;
                 TUint8* data = const_cast< TUint8* > ( iDCFBuffer->Ptr() );
-                
+
                 if ( data[ 0 ] != 1 )
                     {
                     SetBrokenStateL( KDRMMessageMalformed );
                     }
-                
-                // Cache the data until 
-                // - version, 
-                // - ContentTypeLen, 
-                // - ContentURILen, 
-                // - ContentType and 
-                // - ContentURI 
+
+                // Cache the data until
+                // - version,
+                // - ContentTypeLen,
+                // - ContentURILen,
+                // - ContentType and
+                // - ContentURI
                 // have been received.
                 pos = data[ 1 ] + 3;
                 if ( iDCFBuffer->Length() < pos + data[ 2 ] )
                     {
                     return;
                     }
-                
+
                 // Sanity check. URI has to be more than four ("cid:") octets.
                 if ( data[ 2 ] < 5 )
                     {
                     SetBrokenStateL( KDRMMessageMalformed );
                     }
-                
-                if ( Mem::CompareF( &data[ pos ], 
+
+                if ( Mem::CompareF( &data[ pos ],
                                     KCIDStringLength,
-                                    KCIDString().Ptr(), 
+                                    KCIDString().Ptr(),
                                     KCIDStringLength ) == 0 )
                     {
                     // The data length doesn't change, so Mem::Copy() is safe.
-                    Mem::Copy( &data[ pos ], 
-                               KFLPrefix().Ptr(), 
+                    Mem::Copy( &data[ pos ],
+                               KFLPrefix().Ptr(),
                                KFLKPrefixLength );
-                    
+
                     iOutputStream.WriteL( iDCFBuffer->Left( pos + data[ 2 ] ) );
-                    
+
                     doCommit = ETrue;
 
                     CompressDCFBuffer( pos + data[ 2 ] );
-                    
+
                     SetBit( EDCFURIModified );
                     }
                 else
@@ -1553,52 +1553,52 @@
             if ( !( iState & EDCFHeadersModified ) )
                 {
                 FillDCFBufferL( aDCFData );
-                
+
                 // Figure out how much data there is in the header part and/or
                 // in the data part.
                 if ( ( iDCFHeaderSize[ 0 ] == KMaxTUint32 ) &&
                      ( iDCFHeaderSize[ 1 ] == KMaxTUint32 ) )
                     {
                     TUint8 used( 0 );
-                    
+
                     // uintvar has 1...5 octets and we need two uintvars before
-                    // anything can be done. Still, there has to be at least 
+                    // anything can be done. Still, there has to be at least
                     // 12 octets of data in total to make the DCF legal. But here
                     // we just check the two uintvars.
                     if ( iDCFBuffer->Length() < 10 )
                         {
                         // Not enough data yet.
-                        // No need to flush aDCFData at this point, since it 
+                        // No need to flush aDCFData at this point, since it
                         // simply cannot contain anything at this point.
                         __ASSERT_DEBUG( !aDCFData.Length(), User::Invariant() );
                         break;
                         }
-                    
+
                     // Read header field length & data length.
                     for ( TUint8 count = 0; count < 2; ++count )
                         {
                         TInt size( 0 );
-                        
-                        TWspPrimitiveDecoder decoder( 
+
+                        TWspPrimitiveDecoder decoder(
                                 iDCFBuffer->Mid( used ) );
                         size = decoder.UintVar( iDCFHeaderSize[ count ] );
-                        
+
                         // Sanity check.
                         if ( size < 1 || iDCFHeaderSize[ count ] >= KMaxTInt )
                             {
                             SetBrokenStateL( KDRMMessageMalformed );
                             }
-                        
+
                         used += size;
                         }
-                    
+
                     CompressDCFBuffer( used );
                     }
                 else
                     {
                     // We know the original header size now.
                     // Wait until the whole header is read.
-                    if ( static_cast< TUint32 >( iDCFBuffer->Length() ) < 
+                    if ( static_cast< TUint32 >( iDCFBuffer->Length() ) <
                          iDCFHeaderSize[ 0 ] )
                         {
                         if ( !aDCFData.Length() )
@@ -1613,78 +1613,78 @@
                         TUint length( 0 );
                         HBufC8* newHeader = NULL;
 
-                        if ( FindDCFHeader( KRightsIssuer, 
-                                            offset, 
+                        if ( FindDCFHeader( KRightsIssuer,
+                                            offset,
                                             length ) )
                             {
                             // The header field exists.
                             TInt pos( 0 );
-                            TPtr8 trim( const_cast< TUint8* >( 
+                            TPtr8 trim( const_cast< TUint8* >(
                                             iDCFBuffer->Ptr() ) + offset,
-                                            length, 
+                                            length,
                                             length );
 
                             iDCFHeaderSize[ 0 ] -= length; // remove old data.
-                            
-                            // No colon, no header value. 
+
+                            // No colon, no header value.
                             pos = trim.Find( KColon );
                             if ( pos > 0 )
                                 {
-                                trim.Set( const_cast< TUint8* >( trim.Ptr() ) + pos + 1, 
+                                trim.Set( const_cast< TUint8* >( trim.Ptr() ) + pos + 1,
                                           trim.Length() - pos - 1,
                                           trim.Length() - pos - 1 );
 
                                 // Skip whitespaces
                                 trim.TrimLeft();
                                 trim.TrimRight();
-                                
+
                                 if ( trim.Length() )
                                     {
                                     // Something to process
                                     newHeader = EncryptDCFFieldLC( trim );
-                                    
+
                                     iDCFHeaderSize[ 0 ] += KRightsIssuer().Length();
                                     iDCFHeaderSize[ 0 ] += newHeader->Length();
                                     iDCFHeaderSize[ 0 ] += 3; // ":" and CRLF
                                     }
                                 }
                             }
-                        
+
                         // Write the uintvars to output.
                         for ( TUint8 loop = 0; loop < 2; ++loop )
                             {
                             TWspPrimitiveEncoder encoder;
                             HBufC8* var( encoder.UintVarL( iDCFHeaderSize[ loop ] ) );
-                            
+
                             CleanupStack::PushL( var );
-                            
+
                             iOutputStream.WriteL( *var );
-                            
+
                             CleanupStack::PopAndDestroy(); // var
                             }
-                        
+
                         // Dump the header data to output stream.
                         iOutputStream.WriteL( iDCFBuffer->Left( offset ) );
-                        
+
                         if ( newHeader )
                             {
                             iOutputStream.WriteL( KRightsIssuer );
                             iOutputStream.WriteL( KColon );
                             iOutputStream.WriteL( *newHeader );
-                            
+
                             CleanupStack::PopAndDestroy(); // newHeader
                             newHeader = NULL;
-                            
+
                             iOutputStream.WriteL( KEndLine );
                             }
 
-                        iOutputStream.WriteL( 
-                            iDCFBuffer->Right( iDCFBuffer->Length() - 
-                                                offset - 
+                        iOutputStream.WriteL(
+                            iDCFBuffer->Right( iDCFBuffer->Length() -
+                                                offset -
                                                 length ) );
-                        
+
                         doCommit = ETrue;
-                        
+
                         CompressDCFBuffer( iDCFBuffer->Length() );
                         SetBit( EDCFHeadersModified );
                         }
@@ -1696,9 +1696,9 @@
                 __ASSERT_DEBUG( !( iDCFBuffer->Length() ), User::Invariant() );
 
                 iOutputStream.WriteL( aDCFData );
-                
+
                 aDCFData.Set( NULL, 0 );
-                
+
                 doCommit = ETrue;
                 }
             }
@@ -1718,7 +1718,7 @@
 
         if ( iDCFBuffer->Length() == iDCFBuffer->Des().MaxSize() )
             {
-            HBufC8* ptr = iDCFBuffer->ReAlloc( iDCFBuffer->Length() + 
+            HBufC8* ptr = iDCFBuffer->ReAlloc( iDCFBuffer->Length() +
                             KDefaultInputBufferSize );
 
             if ( !ptr )
@@ -1728,16 +1728,16 @@
 
             iDCFBuffer = ptr;
             }
-        
-        size = Min( iDCFBuffer->Des().MaxSize() - iDCFBuffer->Length(), 
+
+        size = Min( iDCFBuffer->Des().MaxSize() - iDCFBuffer->Length(),
                     aData.Length() );
-        
+
         iDCFBuffer->Des().Append( aData.Left( size ) );
-        
+
         aData.Set( aData.Right( aData.Length() - size ) );
         }
     }
-    
+
 void CDRMMessageParser::CompressDCFBuffer( const TInt aHowMuch )
     {
     __ASSERT_DEBUG( aHowMuch <= iDCFBuffer->Des().MaxSize(), User::Invariant() );
@@ -1748,7 +1748,7 @@
                                         TUint& aOffset,
                                         TUint& aLength )
     {
-    TPtrC8 des( const_cast< TUint8* >( iDCFBuffer->Ptr() ),  
+    TPtrC8 des( const_cast< TUint8* >( iDCFBuffer->Ptr() ),
                 Min( iDCFBuffer->Length(), iDCFHeaderSize[ 0 ] ) );
 
     aOffset = 0;
@@ -1770,43 +1770,43 @@
             {
             pos += KEndLineLength;
             }
-            
-        if ( ( pos < aString.Length() ) || 
+
+        if ( ( pos < aString.Length() ) ||
              ( des.Left( aString.Length() ).CompareF( aString ) != 0 ) )
              {
             // Skip the line, since this can't be the one we're looking for.
-            des.Set( des.Right( des.Length() - 
+            des.Set( des.Right( des.Length() -
                                 pos ) );
             }
         else
             {
             aOffset = des.Ptr() - iDCFBuffer->Ptr();
             aLength = pos;
-            
+
             return ETrue;
             }
         }
-    
+
     // Never reached.
     return EFalse;
     }
-    
-void CDRMMessageParser::EnsureFLRightsExistL( 
-    RDRMRightsClient& aClient, 
+
+void CDRMMessageParser::EnsureFLRightsExistL(
+    RDRMRightsClient& aClient,
     CDRMRights** aOutput )
     {
     HBufC8* cid( NULL );
     CDRMRights* perm( NULL );
     RPointerArray< CDRMPermission > rights( 1 );
-    
+
     TCleanupItem cleanup( DoResetAndDestroy2, &rights );
     CleanupStack::PushL( cleanup );
-    
+
     User::LeaveIfError( aClient.ForwardLockURI( cid ) );
     CleanupStack::PushL( cid );
-    
+
     TRAPD( error, aClient.GetDBEntriesL( *cid, rights ) );
-    
+
     if ( !error )
         {
         ConvertPermissionL( perm, *( rights[ 0 ] ), *cid );
@@ -1816,28 +1816,28 @@
         {
         HBufC8* fl( NULL );
         RPointerArray< CDRMRights > rightslist( 1 );
-        
+
         TCleanupItem cleanup2( DoResetAndDestroy, &rightslist );
         CleanupStack::PushL( cleanup2 );
-        
+
         fl = HBufC8::NewLC( KFLROSize + cid->Length() );
-        
+
         *fl = KROPart1;
         fl->Des().Append( *cid );
         fl->Des().Append( KROPart2 );
-            
+
         User::LeaveIfError( ProcessRightsObject( *fl, rightslist ) );
-    
+
         CleanupStack::PopAndDestroy(); // fl
 
         perm = rightslist[ 0 ];
         rightslist.Remove( 0 );
-        
+
         CleanupStack::PopAndDestroy(); // cleanup2
-        
+
         error = KErrNone;
         }
-        
+
     CleanupStack::PopAndDestroy(); // cid
 
     if ( !error )
@@ -1852,7 +1852,7 @@
             delete perm; perm = NULL;
             }
         }
-        
+
     CleanupStack::PopAndDestroy(); // cleanup
     }
 
@@ -1861,23 +1861,23 @@
     {
     HBufC8* res = NULL;
     RDRMRightsClient client;
-    
+
     User::LeaveIfError( client.Connect() );
     CleanupClosePushL( client );
 
     // Make sure FL rights exists.
     EnsureFLRightsExistL( client, NULL );
 
-    User::LeaveIfError( 
+    User::LeaveIfError(
         client.EncodeRightsIssuerField( aOldHeader, res ) );
-    
+
     CleanupStack::PopAndDestroy(); // client
 
     CleanupStack::PushL( res );
 
     return res;
     }
-    
+
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
 //  End of File
--- a/omadrm/drmengine/dm/src/Oma1DcfCreator.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dm/src/Oma1DcfCreator.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -30,19 +30,19 @@
 #include <symmetric.h>
 #include "Oma1DcfCreator.h"
 #include "DRMRightsClient.h"
-#include "DRMPermission.h"
-#include "DRMConstraint.h"
+#include "DrmPermission.h"
+#include "DrmConstraint.h"
 #include "DRMCommon.h"
 #include "DrmKeyStorage.h"
 
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
-static const TInt KMaxEncryptionSize = 2048;    
+static const TInt KMaxEncryptionSize = 2048;
 
 // MACROS
 
@@ -64,7 +64,7 @@
     {
     iEncryptionStream = NULL;
     iEncryptionBuffer = NULL;
-    } 
+    }
 
 // -----------------------------------------------------------------------------
 // COma1DcfCreator::ConstructL
@@ -83,13 +83,13 @@
 EXPORT_C COma1DcfCreator* COma1DcfCreator::NewL()
     {
     COma1DcfCreator* self = new COma1DcfCreator();
-    
+
     User::LeaveIfNull(self);
-    
+
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop();
-    
+
     return self;
     }
 
@@ -105,11 +105,11 @@
 
 // -----------------------------------------------------------------------------
 // COma1DcfCreator::
-// 
+//
 // -----------------------------------------------------------------------------
 EXPORT_C void COma1DcfCreator::EncryptInitializeL(
     RWriteStream& anOutput,
-    const TDesC8& aMIMEType, 
+    const TDesC8& aMIMEType,
     CDRMRights* aRightsObject)
     {
     const TUint KVersion = 1;
@@ -130,7 +130,7 @@
         if (err == KErrCANoRights)
             {
             key.SetLength(KDCFKeySize);
-            iRdb.GetRandomDataL(key);    
+            iRdb.GetRandomDataL(key);
             User::LeaveIfError(iRdb.AddRecord(key, aRightsObject->GetPermission(),
                 uri, id));
             User::LeaveIfError(iRdb.InitializeKey(uri));
@@ -181,9 +181,9 @@
     anOutput.CommitL();
     iBytesWritten += 3 + aMIMEType.Size() + 2 + KLDFHeader().Size() +
         iIv.Size();
-    
+
     CleanupStack::PopAndDestroy(); // rights
-    } 
+    }
 
 // -----------------------------------------------------------------------------
 // COma1DcfCreator::EncryptUpdateL
@@ -196,7 +196,7 @@
     TInt size;
     TPtr8 ptr(iEncryptionBuffer->Des());
     TPtrC8 data;
-    
+
     data.Set(aMessageData);
     if (iRemainder.Size() > 0 && iRemainder.Size() + data.Size() >= KDCFKeySize)
         {
@@ -210,7 +210,7 @@
         data.Set(data.Right(data.Size() - n));
         iRemainder.SetLength(0);
         }
-    
+
     size = data.Size();
     for (i = 0; size > KDCFKeySize; i += KMaxEncryptionSize)
         {
@@ -233,7 +233,7 @@
 EXPORT_C void COma1DcfCreator::EncryptFinalizeL()
     {
     TPtr8 ptr(iEncryptionBuffer->Des());
-    
+
     ptr.Copy(iRemainder);
     iRdb.Encrypt(iIv, ptr, ETrue);
     iEncryptionStream->WriteL(ptr);
@@ -249,8 +249,8 @@
 // content with the DCF.
 // -----------------------------------------------------------------------------
 EXPORT_C void COma1DcfCreator::EncryptContentL(
-    HBufC8*& aContent, 
-    const TDesC8& aMIMEType, 
+    HBufC8*& aContent,
+    const TDesC8& aMIMEType,
     CDRMRights* aRightsObject)
     {
     RMemWriteStream output;
@@ -259,7 +259,7 @@
 
     size = aContent->Length() +
         aMIMEType.Length() +
-        KLDContentURI().Length() + 
+        KLDContentURI().Length() +
         KLDFHeader().Length() + 256;
     buffer = User::Alloc(size);
     User::LeaveIfNull(buffer);
@@ -282,18 +282,18 @@
 // Turn a plain content file into a DCF.
 // -----------------------------------------------------------------------------
 EXPORT_C void COma1DcfCreator::EncryptFileL(
-    const TDesC& aFileName, 
-    const TDesC& aDCFFileName, 
-    const TDesC8& aMIMEType, 
+    const TDesC& aFileName,
+    const TDesC& aDCFFileName,
+    const TDesC8& aMIMEType,
     CDRMRights* aRightsObject)
     {
-    TInt r = KErrNone;    
+    TInt r = KErrNone;
     RFs fs;
     RFile input;
     RFileWriteStream output;
     HBufC8* buf = HBufC8::NewLC(8000);
     TPtr8 buffer(const_cast<TUint8*>(buf->Ptr()),0,8000);
-   
+
 
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
@@ -302,26 +302,26 @@
     if(r == KErrInUse)
         {
         r = input.Open(fs, aFileName, EFileRead | EFileShareAny);
-                                                      
+
         if(r == KErrInUse)
             {
-            User::LeaveIfError(input.Open(fs, aFileName, EFileRead | 
+            User::LeaveIfError(input.Open(fs, aFileName, EFileRead |
                                                          EFileShareReadersOnly));
-            r = KErrNone;                                             
+            r = KErrNone;
             }
         }
-        
-    User::LeaveIfError( r );        
-    
+
+    User::LeaveIfError( r );
+
     CleanupClosePushL(input);
-    
+
     User::LeaveIfError(output.Replace(fs, aDCFFileName, EFileWrite));
-    CleanupClosePushL(output);    
-    
-   
+    CleanupClosePushL(output);
+
+
     EncryptInitializeL(output, aMIMEType, aRightsObject);
 
-    
+
     do
         {
         input.Read(buffer, buffer.MaxSize());
@@ -333,7 +333,7 @@
             }
         }
     while (buffer.Size() > 0);
- 
+
     EncryptFinalizeL();
 
     CleanupStack::PopAndDestroy(4); // output, input, fs, buf
@@ -344,9 +344,9 @@
 // Encrypt plain content to a DCF and stores it in a file.
 // -----------------------------------------------------------------------------
 EXPORT_C void COma1DcfCreator::EncryptContentToFileL(
-    const TDesC8& aContent, 
-    const TDesC& aFileName, 
-    const TDesC8& aMIMEType, 
+    const TDesC8& aContent,
+    const TDesC& aFileName,
+    const TDesC8& aMIMEType,
     CDRMRights* aRightsObject)
     {
     RFs fs;
--- a/omadrm/drmengine/dm/src/b64.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/dm/src/b64.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,7 +17,7 @@
 
 
 #include <e32base.h>
-#include "base64.h"
+#include "Base64.h"
 
 /*  6    LOCAL DEFINITIONS */
 
@@ -25,19 +25,19 @@
 
 /*  6.2    Local constants */
 
-LOCAL_C const TUint8 pBase64[] = 
-	{                   
-	0x3e, 0x7f, 0x7f, 0x7f, 0x3f, 0x34, 0x35, 0x36,
-	0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x7f,
-	0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x01,
-	0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
-	0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
-	0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
-	0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x1a, 0x1b,
-	0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
-	0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
-	0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33
-	};
+LOCAL_C const TUint8 pBase64[] =
+    {
+    0x3e, 0x7f, 0x7f, 0x7f, 0x3f, 0x34, 0x35, 0x36,
+    0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x7f,
+    0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x01,
+    0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
+    0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
+    0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+    0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x1a, 0x1b,
+    0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
+    0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+    0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33
+    };
 
 /*  6.3    Local macros */
 #define b64blocks(l) (((l) + 2) / 3 * 4)
@@ -59,7 +59,7 @@
 
 /* Functional description
  *
- * This function does base64 decoding. As the outputted buffer is always 33% shorter than 
+ * This function does base64 decoding. As the outputted buffer is always 33% shorter than
  * the input buffer, the caller may want to reallocate the buffer after calling this function.
  *
  * Parameters
@@ -84,145 +84,145 @@
  *
  * Return values
  *
- *	byte 0 if OK else > 0
+ *  byte 0 if OK else > 0
  */
 
 /* ---------------------------------------------------------------------- */
 
 TInt b64decode(TUint8 *source, TUint32 length, TUint8 *destination, TUint32 *destination_length)
-	{
-	/* Data structures */
+    {
+    /* Data structures */
+
+    /*  Code  */
 
-	/*  Code  */
-    
-	TUint8   *buf/*, *pbuf*/;     /* Decoding buffer pointers. */
-	register TUint32 x = 0;          /* General purpose integers. */
-	TUint32 buf_index = 0;  /* current index in destination buffer */
+    TUint8   *buf/*, *pbuf*/;     /* Decoding buffer pointers. */
+    register TUint32 x = 0;          /* General purpose integers. */
+    TUint32 buf_index = 0;  /* current index in destination buffer */
+
 
-	
-	/* buffer to avoid allocating wholly new buffer for output */
-	TUint8 localBuffer[4] = {0,0,0,0}; 
-	TUint8* pLocalBufferOutPointer = 0;
-	
-	register TUint32 i = 0;
-	TUint32 num;
+    /* buffer to avoid allocating wholly new buffer for output */
+    TUint8 localBuffer[4] = {0,0,0,0};
+    TUint8* pLocalBufferOutPointer = 0;
+
+    register TUint32 i = 0;
+    TUint32 num;
 
     TUint8   c = 0;          /* Character to decode. */
     TUint8 localBufferIndex = 0;
 
-    /*	int32 buf_length = 0; */ /* new length of destination buf */
-	const TUint8 pad = 0x3d; /* '=' */
+    /*  int32 buf_length = 0; */ /* new length of destination buf */
+    const TUint8 pad = 0x3d; /* '=' */
 
-	if(!source || length == 0 || !destination || !destination_length)
-		{
-		return KErrArgument;
-		}
+    if(!source || length == 0 || !destination || !destination_length)
+        {
+        return KErrArgument;
+        }
 
-	/* Collating sequence independant "===". */
+    /* Collating sequence independant "===". */
 
-	/* Calculate the amount of '=' in the end of the source */
-	for(x=0, buf=source + (length-1); *buf == pad; buf --)
-		{
-		x++;
-		}
+    /* Calculate the amount of '=' in the end of the source */
+    for(x=0, buf=source + (length-1); *buf == pad; buf --)
+        {
+        x++;
+        }
 
-	/* max allow 3 "===" in the end of content */
-	if (x > 3)
-		{                                       
-		return KErrArgument;
-		}
+    /* max allow 3 "===" in the end of content */
+    if (x > 3)
+        {
+        return KErrArgument;
+        }
 
-	/* Save the encoded string pointer. */
-	// pbuf = destination; 
+    /* Save the encoded string pointer. */
+    // pbuf = destination;
 
-	/* save address for first output block */
-	pLocalBufferOutPointer = destination;
-	x = 0; /* Initialize index. */
+    /* save address for first output block */
+    pLocalBufferOutPointer = destination;
+    x = 0; /* Initialize index. */
 
-	localBufferIndex = 0;
+    localBufferIndex = 0;
 
 
-	Mem::Copy(localBuffer, source, 4);
+    Mem::Copy(localBuffer, source, 4);
 
-	for (i = length; i != 0; i-- ) /* Decode every byte of the base 64 string */
-		{
-		/* c = *pbuf++; */
-		c = localBuffer[localBufferIndex++];
+    for (i = length; i != 0; i-- ) /* Decode every byte of the base 64 string */
+        {
+        /* c = *pbuf++; */
+        c = localBuffer[localBufferIndex++];
+
+        if(localBufferIndex == 4)
+            {
+            localBufferIndex = 0;
+
+            source = source + 4;
 
-		if(localBufferIndex == 4)
-			{
-			localBufferIndex = 0;
-			
-			source = source + 4;
+            /* INPUT: copy next input block to local buffer */
+            num = i > 4 ? 4 : i - 1;
+            if(num > 0)
+                {
+                Mem::Copy(localBuffer, source, num);
+                }
+            }
 
-			/* INPUT: copy next input block to local buffer */
-			num = i > 4 ? 4 : i - 1;
-			if(num > 0)
-				{
-				Mem::Copy(localBuffer, source, num);
-				}
-			}
+        /* Ignore "=". */
+        if  (c == pad)
+            {
+            break; /* this must be the end of the buffer, or else ve have a invalid character */
+            }
+
+        if  (c == '\n' || c == '\r' || c == '\t') /* ignore linefeed tab and cr */
+            {
+            continue;
+            }
 
-		/* Ignore "=". */
-		if  (c == pad)
-			{
-			break; /* this must be the end of the buffer, or else ve have a invalid character */
-			}
-		
-		if  (c == '\n' || c == '\r' || c == '\t') /* ignore linefeed tab and cr */
-			{
-			continue;
-			}
-		
-		/* Valid Base64 Index? */
-		if (!b64valid(&c))
-			{
-			/* b64free(buf); */
-			return KErrArgument;
-			}
-        
-		/* Decode 4 byte words into 3 byte octets.*/
-		switch(x % 4)
-			{
-			case 0: /* Byte 0 of word.*/
-				pLocalBufferOutPointer[buf_index] = (TInt8)(c << 2);
-				break;                          
-			case 1: /* Byte 1 of word. */
-				pLocalBufferOutPointer[buf_index] |= c >> 4;
-				buf_index ++;
-				pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x0f) << 4 );
-				break;
-			case 2: /* Byte 2 of word. */
-				pLocalBufferOutPointer[buf_index] |= c >> 2;
-				buf_index ++;
-				pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x03) << 6 );
-				break;
-			case 3: /* Byte 3 of word. */
-				pLocalBufferOutPointer[buf_index] |= c;
-				buf_index ++;
-				break;
-			default: /* useless, just to depress warnings */
-				break;
-			}
-		
-		x++; /* Increment word byte. */
-		
+        /* Valid Base64 Index? */
+        if (!b64valid(&c))
+            {
+            /* b64free(buf); */
+            return KErrArgument;
+            }
 
-		} /* while */
+        /* Decode 4 byte words into 3 byte octets.*/
+        switch(x % 4)
+            {
+            case 0: /* Byte 0 of word.*/
+                pLocalBufferOutPointer[buf_index] = (TInt8)(c << 2);
+                break;
+            case 1: /* Byte 1 of word. */
+                pLocalBufferOutPointer[buf_index] |= c >> 4;
+                buf_index ++;
+                pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x0f) << 4 );
+                break;
+            case 2: /* Byte 2 of word. */
+                pLocalBufferOutPointer[buf_index] |= c >> 2;
+                buf_index ++;
+                pLocalBufferOutPointer[buf_index] = (TInt8)( (c & 0x03) << 6 );
+                break;
+            case 3: /* Byte 3 of word. */
+                pLocalBufferOutPointer[buf_index] |= c;
+                buf_index ++;
+                break;
+            default: /* useless, just to depress warnings */
+                break;
+            }
+
+        x++; /* Increment word byte. */
 
 
-	/* make sure that there is zero at the end of the buffer
-	   though buf[buf_index] shoule be zero after decoding
-	*/
+        } /* while */
+
+
+    /* make sure that there is zero at the end of the buffer
+       though buf[buf_index] shoule be zero after decoding
+    */
+
 
-	
-	/* pbuf[buf_index+1] = 0; */
+    /* pbuf[buf_index+1] = 0; */
 
-	/*buf[buf_index+1]=0*/
-	/* don't return the size of the buffer (buf_length), but the data size we put in (buf_index)*/
-	*destination_length = buf_index; 
-	return KErrNone;
-	}
+    /*buf[buf_index+1]=0*/
+    /* don't return the size of the buffer (buf_length), but the data size we put in (buf_index)*/
+    *destination_length = buf_index;
+    return KErrNone;
+    }
 
 /*  7.3 */
 
@@ -239,30 +239,30 @@
  *
  * Return values
  *
- *	TRUE if character is valid else FALSE.
+ *  TRUE if character is valid else FALSE.
  */
 
 /* ---------------------------------------------------------------------- */
 
 LOCAL_C TInt b64valid(TUint8 *c)
-	{
-	/* Data structures */
+    {
+    /* Data structures */
 
-	/*  Code  */
+    /*  Code  */
 
-	/* If not within the range of the table, return false. */
-	if ((*c < 0x2b) || (*c > 0x7a))
-		{
-		return 0;
-		}
-	/* If it falls within one of the gaps, return false. */
-	if ((*c = pBase64[*c - 0x2b]) == 0x7f)
-		{
-		return 0;
-		}
-	
-	return 1; /* Otherwise, return true. */
-	}
+    /* If not within the range of the table, return false. */
+    if ((*c < 0x2b) || (*c > 0x7a))
+        {
+        return 0;
+        }
+    /* If it falls within one of the gaps, return false. */
+    if ((*c = pBase64[*c - 0x2b]) == 0x7f)
+        {
+        return 0;
+        }
+
+    return 1; /* Otherwise, return true. */
+    }
 
 /*  7.4 */
 
@@ -278,29 +278,29 @@
  *
  * Return values
  *
- *	pointer to buffer
+ *  pointer to buffer
  */
 
 /* ---------------------------------------------------------------------- */
 #ifdef BUILD_BASE64_ENCODE
 
 LOCAL TUint8 *b64buffer(TUint32 length)
-	{
-	/* Data structures */
+    {
+    /* Data structures */
 
-	/*  Code  */
+    /*  Code  */
+
+    TUint8 *buf; /* buffer pointers. */
 
-	TUint8 *buf; /* buffer pointers. */
-	
-	if  (!length) /* dont allow buf size  0 */
-		{
-		return  NULL;
-		}
-	
-	buf = (TUint8 *) DRM_BLOCK_ALLOC(length); 
-	
-	return buf; /* Return the pointer or null. */
-	}
+    if  (!length) /* dont allow buf size  0 */
+        {
+        return  NULL;
+        }
+
+    buf = (TUint8 *) DRM_BLOCK_ALLOC(length);
+
+    return buf; /* Return the pointer or null. */
+    }
 #endif /* #ifdef BUILD_BASE64_ENCODE */
 
 /* End of File */
--- a/omadrm/drmengine/drmbackup/src/DRMBackup.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmbackup/src/DRMBackup.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,14 +22,14 @@
 #include <sysutil.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DRMBackup.h"
-#include "DRMLog.h"
+#include "drmlog.h"
 #include "RoapStorageClient.h"
-#include "DRMRightsDB.h"
-#include "drmbackupinterface.h"
+#include "drmrightsdb.h"
+#include "DRMBackupInterface.h"
 /*
 #include "flogger.h"
 
@@ -40,7 +40,7 @@
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 const TInt KDoBackup        =   0x00000001;
@@ -74,7 +74,7 @@
 LOCAL_C void CleanupData( TAny* aPtr )
     {
     CDRMBackup* backup = reinterpret_cast<CDRMBackup*>( aPtr );
-    
+
     backup->PerformCleanup();
     }
 
@@ -88,16 +88,16 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CDRMBackup::CDRMBackup( CDRMRightsDB* aRightsDatabase, 
+CDRMBackup::CDRMBackup( CDRMRightsDB* aRightsDatabase,
                         RFs& aFileServer ) :
-    iFileServer( aFileServer ),                        
+    iFileServer( aFileServer ),
     iDRMRightsDB( aRightsDatabase ),
     iRightsFileSize( 0 ),
     iContextFileSize( 0 ),
     iPosition( 0 ),
     iReadData( 0 ),
     iStatus( 0 )
-    {      
+    {
     };
 
 // -----------------------------------------------------------------------------
@@ -108,44 +108,44 @@
 void CDRMBackup::ConstructL()
     {
     TInt error = KErrNone;
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     // Create the backup directory if needed
     error = iFileServer.MkDirAll( KBackupDirectory );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	iFileServer.DriveToChar( driveNumber, driveLetter );
-    
-	TFileName backupDir;
-	backupDir.Format( KBackupDir, (TUint)driveLetter );
-    
+    iFileServer.DriveToChar( driveNumber, driveLetter );
+
+    TFileName backupDir;
+    backupDir.Format( KBackupDir, (TUint)driveLetter );
+
     // Create the backup directory if needed
     error = iFileServer.MkDirAll( backupDir );
-    
+
 #endif
-    
+
     if( error != KErrAlreadyExists )
         {
         User::LeaveIfError( error );
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     iRightsFileName.Copy( KBackupDirectory );
-    
+
 #else //RD_MULTIPLE_DRIVE
 
     iRightsFileName.Copy( backupDir );
-    
+
 #endif
-    
+
     iRightsFileName.Append( KRightsDbBackupFile );
-    iSizeBuffer.SetLength( 4 );    
+    iSizeBuffer.SetLength( 4 );
     };
 
 // -----------------------------------------------------------------------------
@@ -153,14 +153,14 @@
 // Two-phased constructor
 // -----------------------------------------------------------------------------
 //
-CDRMBackup* CDRMBackup::NewLC( CDRMRightsDB* aRightsDatabase, 
+CDRMBackup* CDRMBackup::NewLC( CDRMRightsDB* aRightsDatabase,
                                RFs& aFileServer )
     {
-    CDRMBackup* self = new(ELeave) CDRMBackup( aRightsDatabase, 
+    CDRMBackup* self = new(ELeave) CDRMBackup( aRightsDatabase,
                                                aFileServer );
     CleanupStack::PushL( self );
     self->ConstructL();
-    
+
     return self;
     };
 
@@ -169,21 +169,21 @@
 // Two-phased constructor
 // -----------------------------------------------------------------------------
 //
-CDRMBackup* CDRMBackup::NewL( CDRMRightsDB* aRightsDatabase, 
+CDRMBackup* CDRMBackup::NewL( CDRMRightsDB* aRightsDatabase,
                               RFs& aFileServer )
     {
-    CDRMBackup* self = NewLC( aRightsDatabase, 
+    CDRMBackup* self = NewLC( aRightsDatabase,
                               aFileServer );
     CleanupStack::Pop();
 
     return self;
     };
-  
+
 // ---------------------------------------------------------
 // CDRMBackup::~CDRMBackup
 // Destructor
 // ---------------------------------------------------------
-//  
+//
 CDRMBackup::~CDRMBackup()
     {
     };
@@ -192,70 +192,70 @@
 // ---------------------------------------------------------
 // CDRMBackup::AllSnapshotsSuppliedL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::AllSnapshotsSuppliedL()
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("AllSnapshotsSuppliedL\n\r"));      
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("AllSnapshotsSuppliedL\n\r"));
     return;
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::ReceiveSnapshotDataL
 // ---------------------------------------------------------
-// 
-void CDRMBackup::ReceiveSnapshotDataL(TDriveNumber /* aDrive */, 
-                                      TDesC8& /* aBuffer */, 
+//
+void CDRMBackup::ReceiveSnapshotDataL(TDriveNumber /* aDrive */,
+                                      TDesC8& /* aBuffer */,
                                       TBool /* aLastSection */)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RecieveSnapshotdataL\n\r"));   
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RecieveSnapshotdataL\n\r"));
     User::Leave( KErrNotSupported );
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::GetExpectedDataSize
 // ---------------------------------------------------------
-// 
+//
 TUint CDRMBackup::GetExpectedDataSize(TDriveNumber /* aDrive */)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetExpectedDataSize\n\r"));       
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetExpectedDataSize\n\r"));
     return 0;
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::GetSnapshotDataL
 // ---------------------------------------------------------
-// 
-void CDRMBackup::GetSnapshotDataL(TDriveNumber /* aDrive */, 
-                                  TPtr8& /* aBuffer */, 
+//
+void CDRMBackup::GetSnapshotDataL(TDriveNumber /* aDrive */,
+                                  TPtr8& /* aBuffer */,
                                   TBool& /* aFinished */)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetSnapShopDataL\n\r"));       
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetSnapShopDataL\n\r"));
     User::Leave( KErrNotSupported );
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::InitialiseGetBackupDataL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::InitialiseGetBackupDataL(TDriveNumber aDrive)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init backup data\n\r"));    
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init backup data\n\r"));
     // Clean up existing data:
     PerformCleanup();
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     // Only do a backup when backing up drive C
     if( aDrive == EDriveC )
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	
-	// Only do a backup when backing up system drive
+
+    // Only do a backup when backing up system drive
     if( aDrive == driveNumber )
-    
+
 #endif
         {
         iStatus |= KDoBackup;
@@ -265,20 +265,20 @@
         iStatus &= ~KDoBackup;
         return;
         }
-    
-    // Add the cleanup item to the cleanup stack    
+
+    // Add the cleanup item to the cleanup stack
     TCleanupItem resetAndDestroy( CleanupData, reinterpret_cast<TAny*>(this) );
     CleanupStack::PushL( resetAndDestroy );
-    
+
     // This function needs to write the two files required to be backed up.
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create rights file\n\r"));     
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create rights file\n\r"));
     // create the rights database backup file
     CreateRightsBackupFileL();
-    
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create context file\n\r"));     
+
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Init: create context file\n\r"));
     // create the context database backup file
     CreateContextBackupFileL();
-    
+
     // If everything went properly, pop
     CleanupStack::Pop();
     };
@@ -286,110 +286,110 @@
 // ---------------------------------------------------------
 // CDRMBackup::GetBackupDataSectionL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL\n\r"));       
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL\n\r"));
     TInt seekAmount = 0;
-    
+
     // if we are not supposed to do anything, just return
     if( !(iStatus & KDoBackup ) )
         {
-        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL: no Do Backup\n\r"));          
+        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL: no Do Backup\n\r"));
         aFinished = ETrue;
         return;
         }
-    
+
     // Make sure that the buffer is empty and starts from the beginning
     aBuffer.SetLength(0);
-        
-     // Add the cleanup item to the cleanup stack    
+
+     // Add the cleanup item to the cleanup stack
     TCleanupItem resetAndDestroy( CleanupData, reinterpret_cast<TAny*>(this) );
     CleanupStack::PushL( resetAndDestroy );
-       
+
     if( iPosition < iRightsFileSize )
-        {        
-        // Find the right position    
+        {
+        // Find the right position
         iRightsBackupFile.Seek( ESeekStart,iPosition );
 
         // Read data
         User::LeaveIfError( iRightsBackupFile.Read( aBuffer ) );
-        
+
         iPosition += aBuffer.Length();
-        
+
         if( iPosition == iRightsFileSize )
             {
             aFinished = ETrue;
             }
         else
-            {                
-            aFinished = EFalse;         
-            }        
-            
+            {
+            aFinished = EFalse;
+            }
+
         }
     else if( iPosition < iRightsFileSize + iContextFileSize )
-        {   
+        {
         // Find the right position
-        seekAmount = iPosition-iRightsFileSize;  
+        seekAmount = iPosition-iRightsFileSize;
         iContextBackupFile.Seek( ESeekStart, seekAmount );
-        
+
         // Read data
         User::LeaveIfError( iContextBackupFile.Read( aBuffer ) );
-        
+
         iPosition += aBuffer.Length();
-        
+
         if( iPosition-iRightsFileSize == iContextFileSize )
             {
             aFinished = ETrue;
             }
         else
-            {                
-            aFinished = EFalse;         
+            {
+            aFinished = EFalse;
             }
         }
     else
         {
-        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Error\n\r"));         
+        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Error\n\r"));
         User::Leave( KErrGeneral );
         }
-    
-    // if we are finished, we can clean up the stuff otherwise not     
+
+    // if we are finished, we can clean up the stuff otherwise not
     if( aFinished )
         {
-        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Finished\n\r"));        
-        CleanupStack::PopAndDestroy();           
+        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Finished\n\r"));
+        CleanupStack::PopAndDestroy();
         }
     else
         {
-        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Continues\n\r"));        
-        CleanupStack::Pop();   
-        }              
+        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("GetBackupDataSectionL - Continues\n\r"));
+        CleanupStack::Pop();
+        }
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::InitialiseRestoreBaseDataL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::InitialiseRestoreBaseDataL(TDriveNumber aDrive)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("InitializeRestoreBaseDataL\n\r")); 
-        
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("InitializeRestoreBaseDataL\n\r"));
+
     // Clean up existing data:
     PerformCleanup();
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     // Only do a restore when restoring drive C
     if( aDrive == EDriveC )
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	
+
     // Only do a restore when restoring drive C
     if( aDrive == driveNumber )
-    
+
 #endif
         {
         iStatus |= KDoBackup;
@@ -404,25 +404,25 @@
 // CDRMBackup::RestoreBaseDataSectionL
 // Create the files where the restore is performed from
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL\n\r")); 
-        
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL\n\r"));
+
     TInt seekAmount = 0;
     Roap::RRoapStorageClient client;
     TFileName tempFileName;
     TPtrC8 buffer( aBuffer );
-        
+
     if( !(iStatus & KDoBackup ) )
         {
         return;
         }
-        
-     // Add the cleanup item to the cleanup stack    
+
+     // Add the cleanup item to the cleanup stack
     TCleanupItem resetAndDestroy( CleanupData, reinterpret_cast<TAny*>(this) );
-    CleanupStack::PushL( resetAndDestroy );        
-        
+    CleanupStack::PushL( resetAndDestroy );
+
     // Read the size of the first file, even if it comes in one byte chunks
     if( iPosition == 0 && iReadData < 4 && !( iStatus & KRightsSizeRead ) )
         {
@@ -434,12 +434,12 @@
             CleanupClosePushL( stream );
             iRightsFileSize = stream.ReadInt32L();
             CleanupStack::PopAndDestroy();
-            
+
             // Remove the 'used' data from the beginning of the data block
             buffer.Set( buffer.Mid( 4-iReadData ) );
-            
+
             iStatus |= KRightsSizeRead;
-             
+
             iReadData = 0;
             }
         else
@@ -448,17 +448,17 @@
                 {
                 CleanupStack::PopAndDestroy();
                 return;
-                }               
+                }
             // copy the data to the temp buffer
             Mem::Copy( const_cast<TUint8*>( iSizeBuffer.Ptr() ) + iReadData,
                        buffer.Ptr(), buffer.Length() );
             iReadData += buffer.Length();
-            CleanupStack::Pop();          
-            return;           
+            CleanupStack::Pop();
+            return;
             }
         }
-    
-    // Read the size of the 2nd file when it's needed:    
+
+    // Read the size of the 2nd file when it's needed:
     if( iPosition == iRightsFileSize && iReadData < 4 && !(iStatus & KContextSizeRead) )
         {
         if( iReadData + buffer.Length() >= 4 )
@@ -469,10 +469,10 @@
             CleanupClosePushL( stream );
             iContextFileSize = stream.ReadInt32L();
             CleanupStack::PopAndDestroy();
-            
+
             // Remove the 'used' data from the beginning of the data block
             buffer.Set( buffer.Mid( 4-iReadData ) );
-            
+
             iStatus |= KContextSizeRead;
             iReadData = 0;
 
@@ -481,88 +481,88 @@
             {
             if( aFinished )
                 {
-                // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : buggy file(1)\n\r"));                
+                // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : buggy file(1)\n\r"));
                 CleanupStack::PopAndDestroy();
                 return;
-                }             
+                }
             // copy the data to the temp buffer
             Mem::Copy( const_cast<TUint8*>( iSizeBuffer.Ptr()) + iReadData,
                        buffer.Ptr(), buffer.Length() );
             iReadData += buffer.Length();
-            CleanupStack::Pop();           
-            return;           
-            }       
+            CleanupStack::Pop();
+            return;
+            }
         }
-        
+
     // Restore the two files:
     // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : before restore\n\r"));
-        
+
     if( iPosition < iRightsFileSize )
         {
         // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : restore starts\n\r"));
         if( !( iStatus & KRightsFileOpen ) )
             {
-            // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : replace the file\n\r"));            
+            // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : replace the file\n\r"));
             User::LeaveIfError( iRightsBackupFile.Replace( iFileServer,
                                                            iRightsFileName,
                                                            EFileRead|EFileWrite ) );
             iStatus |= KRightsFileOpen;
-            // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write startn\r"));                                            
+            // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write startn\r"));
             iRightsBackupFile.Write( iSizeBuffer, 4 );
-            // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write end\n\r"));            
+            // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : write end\n\r"));
             iPosition += 4;
             }
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : before seek\n\r"));            
-        // Find the right position    
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : before seek\n\r"));
+        // Find the right position
         User::LeaveIfError( iRightsBackupFile.Seek( ESeekStart,iPosition ) );
-        
-        
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after seek\n\r"));        
+
+
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after seek\n\r"));
         // Read data
         User::LeaveIfError( iRightsBackupFile.Write( buffer ) );
-        
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after write\n\r"));        
+
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : after write\n\r"));
         iPosition += buffer.Length();
         }
     else if( iPosition < iRightsFileSize + iContextFileSize )
         {
-               
+
         // Open the file if it's not open
         if( !( iStatus & KContextFileOpen ) )
             {
             User::LeaveIfError( iContextBackupFile.Replace( iFileServer,
-                                                            iContextFileName, 
+                                                            iContextFileName,
                                                             EFileRead|EFileWrite ) );
-            iStatus |= KContextFileOpen;                                                             
+            iStatus |= KContextFileOpen;
             iContextBackupFile.Write( iSizeBuffer, 4 );
             iPosition += 4;
             }
-            
+
         // Find the right position
-        seekAmount = iPosition-iRightsFileSize;  
+        seekAmount = iPosition-iRightsFileSize;
         iContextBackupFile.Seek( ESeekStart, seekAmount );
-        
+
         // Read data
         User::LeaveIfError( iContextBackupFile.Write( buffer ) );
-        
+
         iPosition += buffer.Length();
         }
     else
         {
-        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : error\n\r"));        
+        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreBaseDataSectionL : error\n\r"));
         User::Leave( KErrGeneral );
         }
-  
-    CleanupStack::Pop();         
+
+    CleanupStack::Pop();
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::InitialiseRestoreIncrementDataL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("init incremental restore\n\r"));        
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("init incremental restore\n\r"));
     User::Leave( KErrNotSupported );
     };
 
@@ -572,7 +572,7 @@
 //
 void CDRMBackup::RestoreIncrementDataSectionL(TDesC8& /* aBuffer */, TBool /* aFinished */)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("restore incremenetal\n\r"));        
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("restore incremenetal\n\r"));
     User::Leave( KErrNotSupported );
     };
 
@@ -580,64 +580,64 @@
 // CDRMBackup::RestoreComplete
 // This function performs the actual restoring
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::RestoreComplete(TDriveNumber aDrive)
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete\n\r"));     
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete\n\r"));
     TInt error = KErrNone;
     TBool doUdt = EFalse;
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     // Only do a backup when backing up drive C
     if( aDrive != EDriveC )
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	
+
     // Only do a backup when backing up drive C
     if( aDrive != driveNumber )
-    
+
 #endif
         {
-        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete : not Drive C\n\r"));         
+        // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("RestoreComplete : not Drive C\n\r"));
         return;
         }
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformRightsMergeL\n\r")); 
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformRightsMergeL\n\r"));
+
 
-    
 
-    // Merge the rights    
+    // Merge the rights
     TRAP( error, PerformRightsMergeL() );
     if( error )
         {
         if( error == KErrPermissionDenied )
             {
-            doUdt = ETrue;                 
+            doUdt = ETrue;
             }
         // Log some error
         error = KErrNone;
         }
-    
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformContextMergeL\n\r"));     
+
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("PerformContextMergeL\n\r"));
 
     // Merge the Contexts
     TRAP( error, PerformContextMergeL() );
     if( error )
         {
         // Log some error
-        error = KErrNone;        
+        error = KErrNone;
         }
-        
-    PerformCleanup( doUdt );                
+
+    PerformCleanup( doUdt );
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::TerminateMultiStageOperation
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::TerminateMultiStageOperation()
     {
     PerformCleanup();
@@ -646,35 +646,35 @@
 // ---------------------------------------------------------
 // CDRMBackup::GetDataChecksum
 // ---------------------------------------------------------
-// 
+//
 TUint CDRMBackup::GetDataChecksum(TDriveNumber /* aDrive */)
     {
     return 0;
     };
-       
+
 // ---------------------------------------------------------
 // CDRMBackup::CreateRightsBackupFileL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::CreateRightsBackupFileL()
     {
-    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Create backup file\n\r"));    
-     
+    // RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Create backup file\n\r"));
+
     // Open the file and get the filename
     User::LeaveIfError( iRightsBackupFile.Replace( iFileServer,
                                                    iRightsFileName,
-                                                   EFileRead|EFileWrite ) );                                        
-    iStatus |= KRightsFileOpen; 
-                                                        
+                                                   EFileRead|EFileWrite ) );
+    iStatus |= KRightsFileOpen;
+
     iDRMRightsDB->BackupContentToFileL( iRightsBackupFile, KNullDesC8 );
-    
+
     User::LeaveIfError( iRightsBackupFile.Size( iRightsFileSize ) );
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::CreateContextBackupFileL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::CreateContextBackupFileL()
     {
     //Roap::RRoapStorageClient client;
@@ -682,88 +682,88 @@
     // Open the file and get the filename
 /*    User::LeaveIfError( iContextBackupFile.Replace( iFileServer,
                                                     iContextFileName,
-                                                    EFileRead|EFileWrite ) );  
+                                                    EFileRead|EFileWrite ) );
 
     iStatus |= KContextFileOpen;
-*/        
-    // Connect to the roap storage server                               
+*/
+    // Connect to the roap storage server
     //User::LeaveIfError( client.Connect() );
     //CleanupClosePushL( client );
-    
+
     //client.BackupContentToFileL( iContextBackupFile, KNullDesC8 );
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::PerformRightsMergeL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::PerformRightsMergeL()
     {
     if( iStatus & KRightsFileOpen )
         {
-        iDRMRightsDB->RestoreContentFromFileL( iRightsBackupFile, KNullDesC8, 
+        iDRMRightsDB->RestoreContentFromFileL( iRightsBackupFile, KNullDesC8,
                                                KDRMNormalBackup );
         }
-    else 
+    else
         {
-        User::Leave(KErrNotReady);    
+        User::Leave(KErrNotReady);
         }
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::PerformContextMergeL
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::PerformContextMergeL()
     {
     //Roap::RRoapStorageClient client;
-                                      
-    // Connect to the roap storage server 
+
+    // Connect to the roap storage server
     //User::LeaveIfError( client.Connect() );
     //CleanupClosePushL( client );
 
     //client.RestoreContentFromFileL( iContextBackupFile, KNullDesC8 );
-    
+
     //CleanupStack::PopAndDestroy();// client
     };
 
 // ---------------------------------------------------------
 // CDRMBackup::PerformCleanup
 // ---------------------------------------------------------
-// 
+//
 void CDRMBackup::PerformCleanup( TBool aUdt )
     {
     iRightsFileSize = 0;
     iContextFileSize = 0;
-    
-    if( iStatus & KRightsFileOpen ) 
+
+    if( iStatus & KRightsFileOpen )
         {
-        if( !aUdt ) 
+        if( !aUdt )
             {
-            iRightsBackupFile.SetSize(0);                
+            iRightsBackupFile.SetSize(0);
             }
 
         iRightsBackupFile.Close();
-        
+
         if( !aUdt )
             {
-            iFileServer.Delete( iRightsFileName );                 
+            iFileServer.Delete( iRightsFileName );
             }
         }
-        
-    if( iStatus & KContextFileOpen ) 
+
+    if( iStatus & KContextFileOpen )
         {
         if( !aUdt )
             {
-            iContextBackupFile.SetSize(0);                
+            iContextBackupFile.SetSize(0);
             }
 
-        iContextBackupFile.Close();   
-             
+        iContextBackupFile.Close();
+
         if( !aUdt )
             {
-            iFileServer.Delete( iContextFileName );                          
-            } 
+            iFileServer.Delete( iContextFileName );
+            }
         }
 
     iPosition = 0;
--- a/omadrm/drmengine/drmclock/Inc/DRMClock.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmclock/Inc/DRMClock.h	Wed Jun 23 17:42:58 2010 +0100
@@ -26,7 +26,7 @@
 #include <e32def.h>		// Type definitions
 #include <bacntf.h>
 #include <etelmm.h>
-#include <DrmTypes.h>
+#include <DRMTypes.h>
 #include <e32property.h>
 
 // CONSTANTS
@@ -40,6 +40,7 @@
 // FORWARD DECLARATIONS
 class CDRMNitzObserver;
 class CDRMNotifier;
+class CGPSWatcher;
 
 // CLASS DECLARATION
 
@@ -52,6 +53,14 @@
 NONSHARABLE_CLASS( CDRMClock )
     {
     public:
+        // Notifications:        
+        enum 
+            {
+            ENotifyNone = 0,    
+            ENotifyGPSTimeReceived = 1    
+            };    
+    
+    public:
 
         /**
         * NewLC
@@ -106,6 +115,18 @@
         */
         void ResetSecureTimeL( const TTime& aSecureTime, const TInt& aTimeZone );
         
+        
+        /**
+        * Notify
+        *
+        * Notifies about an event to the DRM Clock
+        *
+        * @since 9.2
+        * @param Message The notification event   
+        *
+        */
+        void Notify( TInt aMessage );
+        
     protected:    
     private:
         /**
@@ -140,6 +161,9 @@
         RTelServer iEtelServer;
         RMobilePhone iPhone;
         CDRMNitzObserver* iObserver;
+        
+        // GPS watcher component, updates DRM time from GPS if available
+        CGPSWatcher* iGpsWatcher;
     };
 #endif      // DRMCLOCK_H   
             
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadrm/drmengine/drmclock/Inc/GPSTimeUpdater.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,58 @@
+
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the GPS Watcher
+*
+*/
+
+
+#ifndef GPSTIMEUPDATER_H_
+#define GPSTIMEUPDATER_H_
+
+#include <lbs.h>
+#include <lbssatellite.h>
+
+class CDRMClock;
+
+class CGPSTimeUpdater : public CActive
+	{
+public:
+	~CGPSTimeUpdater();
+	static CGPSTimeUpdater* New( const TPositionModuleId& aModuleId,
+	                             CDRMClock* aClock );
+	
+	inline const TPositionModuleId& ModuleId() { return iModuleId; }
+	
+	inline const TBool TimeReceived() { return iTimeReceived; }
+	
+private:
+	CGPSTimeUpdater( const TPositionModuleId& aModuleId, 
+	                 CDRMClock* aClock );
+	void ConstructL();
+	
+	void RunL();
+	void DoCancel();
+	TInt RunError( TInt aError );
+	
+private:
+	RPositionServer iPosServer;
+	RPositioner iPositioner;
+	TPositionModuleId iModuleId;
+	
+	TPositionSatelliteInfo iSatelliteInfo;
+	CDRMClock* iClock;
+	TBool iTimeReceived;
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadrm/drmengine/drmclock/Inc/GPSWatcher.h	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,72 @@
+
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the GPS Watcher
+*
+*/
+
+
+#ifndef GPSWATCHER_H_
+#define GPSWATCHER_H_
+
+#include <lbs.h>
+#include <epos_intgpshwstatus.h>
+
+class CGPSTimeUpdater;
+class CDRMClock;
+
+
+class CGPSWatcher : public CTimer, public MPosIntGpsHwStatusObserver
+	{
+public:
+	~CGPSWatcher();
+	static CGPSWatcher* NewL( CDRMClock* aClock );
+
+public: // from MPosIntGpsHwStatusObserver
+	/**
+	 * Notify observer of a GPS hardware status event
+	 * @param aStatus The GPS hardware status.
+	 * @param aError KErrNone if successful. Other possible error values defined by RProperty::Get()
+	 */
+    void OnStatusUpdateEvent(CPosIntGpsHwStatus::TIntGpsHwStatus aStatus, TInt aError);
+
+private:
+	CGPSWatcher( CDRMClock* aClock );
+	void ConstructL();
+	
+	void CheckSatellites();
+	TInt CheckModules();
+	void RunL();
+	void DoCancel();
+	TInt RunError( TInt aError );
+	
+private:
+	// owned:
+	RPointerArray<CGPSTimeUpdater> iTimeUpdaters;
+	
+	// not owned:
+	CDRMClock* iClock;
+	
+	// GPS status information:
+	CPosIntGpsHwStatus* iStatusUpdater;
+	
+	// status received from GPS:
+	CPosIntGpsHwStatus::TIntGpsHwStatus iGpsStatus;
+	
+	// List of active satellite modules:   
+	RPointerArray<TPositionModuleInfo> iActiveSatelliteModules;   
+	 
+	};
+
+#endif /* GPSWATCHER_H_ */
--- a/omadrm/drmengine/drmclock/Src/DRMClock.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmclock/Src/DRMClock.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #include <mmtsy_names.h>
 
 #include "DRMClock.h"
-#include "DRMLog.h"
+#include "drmlog.h"
 #include "DRMEventTimeChange.h"
 #include "wmdrmfileserverclient.h"
 
@@ -32,10 +32,11 @@
 #include <e32keys.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DRMNitzObserver.h"
+#include "GPSWatcher.h"
 
 // EXTERNAL DATA STRUCTURES
 
@@ -85,6 +86,7 @@
 void CDRMClock::ConstructL()
     {
     DRMLOG( _L( "DRM Clock Starting: " ) );
+    TInt error = KErrNone;
 
     // Create a notifier instance
     iNotifier = CDRMNotifier::NewL();
@@ -95,9 +97,11 @@
     iObserver = CDRMNitzObserver::NewL( iPhone, const_cast<CDRMClock*>(this));
 
     iObserver->Start();
+    
+    TRAP( error, iGpsWatcher = CGPSWatcher::NewL( const_cast<CDRMClock*>(this) ));
+    DRMLOG2( _L("DRMClock: GPS watcher started: %d"), error );    
 #endif
 
-
     DRMLOG( _L( "DRM Clock started" ) );		    
     };
 
@@ -158,6 +162,13 @@
         delete iObserver;
         iObserver = 0;
         }  
+        
+    if( iGpsWatcher )
+        {
+        iGpsWatcher->Cancel();
+        delete iGpsWatcher;
+        iGpsWatcher = 0;
+        }   
 #endif // __WINS__        
     };
 
@@ -189,7 +200,7 @@
         
         aTime.UniversalTime();
 
-        aSecurityLevel = DRMClock::KInsecure;
+        aSecurityLevel = DRMClock::KInsecure; 
        
         DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Insecure" ) );        
         }
@@ -308,6 +319,31 @@
     DRMLOG( _L( "CDRMClock::ResetSecureTimeL ok" ) );
     };
 
+// ---------------------------------------------------------
+// CDRMClock::Notify
+// Notify DRM clock about an event
+// ---------------------------------------------------------
+//
+void CDRMClock::Notify( TInt aNotify )
+    {
+    switch( aNotify )
+        {
+        case ENotifyGPSTimeReceived:
+            // GPS time received, listen again after the next boot, destroy GPS watcher:
+            DRMLOG(_L("Notify: ENotifyGPSTimeReceived, Deleting GPS watcher"));
+            delete iGpsWatcher;
+            iGpsWatcher = NULL;
+            DRMLOG(_L("Notify: GPS Watcher deleted"));
+            break;    
+        case ENotifyNone:
+        default:
+            break;  // Do nothing    
+        }    
+    }
+
+
+
+
 
 // ---------------------------------------------------------
 // CDRMClock::ConnectToPhoneL(const TDateTime& aDateTime)
--- a/omadrm/drmengine/drmclock/Src/DRMClockClient.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Client side class implementation
-*
-*/
-
-
-// INCLUDE FILES
-#include "DRMClockClient.h"
-#include "DRMClientServer.h"
-
-#include "DRMLog.h"
-
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
-
-// CONSTANTS
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-// To initialize C/S parameters.
-#define PARAMS TAny* params[ KMaxMessageArguments ]; \
-for ( TUint8 i = 0; i < KMaxMessageArguments; ++i ) { params[ i ] = NULL; }
-#define CLEARPARAM Mem::FillZ( params, \
-KMaxMessageArguments * sizeof( TAny* ) );
-
-// Maximum number of message slots that we use
-const TInt KMaxMessageSlots = 3;
-
-
-// MODULE DATA STRUCTURES
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// RDRMClockClient::RDRMClockClient
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RDRMClockClient::RDRMClockClient()
-    {
-    }
-    
-// -----------------------------------------------------------------------------
-// RDRMClockClient::~RDRMClockClient
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RDRMClockClient::~RDRMClockClient()
-    {
-    }    
-
-// -----------------------------------------------------------------------------
-// RDRMClockClient::Connect
-// Opens connection to the server.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMClockClient::Connect()
-    {
-    TInt ret = KErrNone;
-    
-    DRMLOG( _L( "RDRMClockClient::Connect" ) );
-
-    const TVersion requiredVersion( 
-        DRMClock::KServerMajorVersion,
-        DRMClock::KServerMinorVersion,
-        DRMClock::KServerBuildVersion );
-    
-    DRMLOG( _L("RDRMClockClient: Create a new session" ) );
-    ret = CreateSession( DRMClock::KDRMServerName,
-                         requiredVersion, 
-                         KMaxMessageSlots );
-
-    DRMLOG2( _L( "Result: %d") , ret );
-    
-    return ret;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMClockClient::Close
-// Closes the connection to the server.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void RDRMClockClient::Close() 
-    {
-    DRMLOG( _L( "RDRMClockClient::Close" ) );
-
-    RHandleBase::Close();
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMClockClient::GetSecureTime
-// Gets the secure time from the DRMClockServer
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMClockClient::GetSecureTime( TTime& aTime, TInt& aTimeZone,
-                                     DRMClock::ESecurityLevel& aSecurityLevel )
-    {
-    TPckg<TTime> package(aTime);
-    TPckg<TInt> package2(aTimeZone);
-    TPckg<DRMClock::ESecurityLevel> package3(aSecurityLevel);
-                    
-    DRMLOG( _L( "RDRMClockClient::GetSecureTime" ) );
-    TInt error = KErrNone;
-    
-    // For C/S communications.
-    PARAMS;
-    
-    // Set the parameters.
-    params[ 0 ] = reinterpret_cast< TAny* >( &package );
-    params[ 1 ] = reinterpret_cast< TAny* >( &package2 );
-    params[ 2 ] = reinterpret_cast< TAny* >( &package3 );
-    
-    // Send the message.
-    error = SendReceive( DRMClock::EGetDRMTime, params );
-    
-    // Reset
-    CLEARPARAM;
-    
-    DRMLOG2( _L( "RDRMClockClient::GetSecureTime: %d" ), error );
-
-    return error;
-    }
-
-
-// -----------------------------------------------------------------------------
-// RDRMClockClient::UpdateSecureTime
-// Updates the secure time on the DRMClockServer
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMClockClient::UpdateSecureTime( const TTime& aTime, const TInt& aTimeZone )
-    {
-    TInt error = KErrNone;
-    TPckg<TTime> package(aTime);
-    TPckg<TInt> package2(aTimeZone);
-    
-    DRMLOG( _L( "RDRMClockClient::UpdateSecureTime" ) );
-    
-    // For C/S communications.
-    PARAMS;
-    
-    params[ 0 ] = reinterpret_cast< TAny* >( &package );
-    params[ 1 ] = reinterpret_cast< TAny* >( &package2 );
-    
-    error = SendReceive( DRMClock::EUpdateDRMTime, params );
-    
-    CLEARPARAM;
-    
-    DRMLOG2( _L( "RDRMClockClient::UpdateSecureTime: " ), error );
-
-    // All done.
-    return error;
-    }
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-//  End of File  
--- a/omadrm/drmengine/drmclock/Src/DRMClockClient2.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmclock/Src/DRMClockClient2.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,14 +18,14 @@
 
 // INCLUDE FILES
 #include "DRMClockClient.h"
-#include "DRMclockClientServer.h"
+#include "drmclockclientserver.h"
 #include "DRMTypes.h"
 
-#include "DRMLog.h"
+#include "drmlog.h"
 
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 // MACROS
@@ -57,7 +57,7 @@
 EXPORT_C RDRMClockClient::RDRMClockClient()
     {
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMClockClient::~RDRMClockClient
 // Destructor.
@@ -65,7 +65,7 @@
 //
 EXPORT_C RDRMClockClient::~RDRMClockClient()
     {
-    }    
+    }
 
 // -----------------------------------------------------------------------------
 // RDRMClockClient::Connect
@@ -75,23 +75,23 @@
 EXPORT_C TInt RDRMClockClient::Connect()
     {
     TInt ret = KErrNone;
-#ifdef __DRM_CLOCK    
+#ifdef __DRM_CLOCK
     DRMLOG( _L( "RDRMClockClient::Connect" ) );
 
-    const TVersion requiredVersion( 
+    const TVersion requiredVersion(
         DRMClock::KServerMajorVersion,
         DRMClock::KServerMinorVersion,
         DRMClock::KServerBuildVersion );
-    
+
     DRMLOG( _L("RDRMClockClient: Create a new session" ) );
     ret = CreateSession( DRMClock::KServerName,
-                         requiredVersion, 
+                         requiredVersion,
                          KMaxMessageSlots );
     DRMLOG2( _L( "Result: %d") , ret );
 #else
     DRMLOG( _L( "RDRMClockClient: No Session Created, DRMClock is off") );
 #endif // __DRM_CLOCK
-    
+
     return ret;
     }
 
@@ -100,7 +100,7 @@
 // Closes the connection to the server.
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void RDRMClockClient::Close() 
+EXPORT_C void RDRMClockClient::Close()
     {
     DRMLOG( _L( "RDRMClockClient::Close" ) );
 
@@ -115,38 +115,38 @@
 EXPORT_C TInt RDRMClockClient::GetSecureTime( TTime& aTime, TInt& aTimeZone,
                                      DRMClock::ESecurityLevel& aSecurityLevel ) const
     {
-#ifdef __DRM_CLOCK    	
+#ifdef __DRM_CLOCK
     TPckg<TTime> package(aTime);
     TPckg<TInt> package2(aTimeZone);
     TPckg<DRMClock::ESecurityLevel> package3(aSecurityLevel);
-                
+
     DRMLOG( _L( "RDRMClockClient::GetSecureTime" ) );
     TInt error = KErrNone;
-    
+
     // Send the message.
     error = SendReceive( DRMClock::EGetDRMTime, TIpcArgs( &package, &package2, &package3 ) );
-    
+
     DRMLOG2( _L( "RDRMClockClient::GetSecureTime: %d" ), error );
     return error;
 #else
     DRMLOG( _L( "RDRMClockClient::GetSecureTime, UI Time is returned, DRMClock is off" ) );
-	  TTime currentLocal;
+      TTime currentLocal;
     TInt64 result = 0;
-    	  
-	  // aTime:
-	  aTime.UniversalTime();
-	  currentLocal.HomeTime();
-    
+
+      // aTime:
+      aTime.UniversalTime();
+      currentLocal.HomeTime();
+
     result = currentLocal.Int64() - aTime.Int64();
     result /= KMinuteInMicroseconds;
     result /= KTimeZoneIncrement;
-    
+
     // aTimeZone:
     aTimeZone = I64INT(result);
 
-	  // aSecurityLevel:
-	  aSecurityLevel = DRMClock::KSecure;
-	  return KErrNone;
+      // aSecurityLevel:
+      aSecurityLevel = DRMClock::KSecure;
+      return KErrNone;
 #endif // __DRM_CLOCK
     }
 
@@ -162,11 +162,11 @@
 #ifdef __DRM_CLOCK
     TPckg<TTime> package(aTime);
     TPckg<TInt> package2(aTimeZone);
-    
+
     DRMLOG( _L( "RDRMClockClient::UpdateSecureTime" ) );
-        
+
     error = SendReceive( DRMClock::EUpdateDRMTime, TIpcArgs( &package, &package2 ) );
-    
+
     DRMLOG2( _L( "RDRMClockClient::UpdateSecureTime: " ), error );
 #else
     DRMLOG( _L("RDRMClockClient::UpdateSecureTime, Did nothing DRMClock is off") );
@@ -177,4 +177,4 @@
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/drmclock/Src/DRMClockSession.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmclock/Src/DRMClockSession.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,11 +19,11 @@
 // INCLUDE FILES
 #include <s32file.h>
 #include <f32file.h>
-#include "drmcommon.h"
+#include "DRMCommon.h"
 #include "DRMClockSession.h"
 #include "drmclockclientserver.h"
 #include "DRMClockServer.h"
-#include <DrmTypes.h>
+#include <DRMTypes.h>
 
 #include <e32test.h>
 
@@ -33,7 +33,7 @@
 using namespace DRMClock;
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 
 
@@ -58,7 +58,7 @@
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-CDRMClockSession* CDRMClockSession::NewL( CDRMClock* aClock) 
+CDRMClockSession* CDRMClockSession::NewL( CDRMClock* aClock)
     {
     CDRMClockSession* self = new( ELeave ) CDRMClockSession( aClock );
     CleanupStack::PushL( self );
@@ -88,9 +88,9 @@
     {
     DRMLOG(  _L( "CDRMClockSession::ServiceL called" ) );
     // Trap possible errors...
-    
+
     TRAPD( error, DispatchL( aMessage ) );
-    
+
     if ( error )
         {
         DRMLOG2(  _L( "CDRMClockSession::DispatcL threw an exception %d" ), error );
@@ -108,13 +108,13 @@
 // Default constructor.
 // -----------------------------------------------------------------------------
 //
-CDRMClockSession::CDRMClockSession( CDRMClock* aClock ) : 
+CDRMClockSession::CDRMClockSession( CDRMClock* aClock ) :
     // Base class' constructor is called first.
     iDRMClock( aClock )
     {
     // Nothing.
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMClockSession::ConstructL
 // Second phase constructor. Initializes the log tool in DRM internal testing.
@@ -126,11 +126,11 @@
 
 // -----------------------------------------------------------------------------
 // CDRMClockSession::DispatchL
-// Checks which command the user requested, and forwards the request to 
+// Checks which command the user requested, and forwards the request to
 // appropriate private method. This helps to keep the code more readable.
 // -----------------------------------------------------------------------------
 //
-void CDRMClockSession::DispatchL( const RMessage2& aMessage ) 
+void CDRMClockSession::DispatchL( const RMessage2& aMessage )
     {
     switch ( aMessage.Function() )
         {
@@ -156,13 +156,13 @@
     TTime drmTime;
     TInt timeZone;
     DRMClock::ESecurityLevel level;
-    
+
     iDRMClock->GetSecureTime( drmTime, timeZone, level );
 
     TPckg<TTime> package(drmTime);
-    TPckg<TInt> package2(timeZone);    
+    TPckg<TInt> package2(timeZone);
     TPckg<DRMClock::ESecurityLevel> package3(level);
-    
+
     IPCWRITE0L( package );
     IPCWRITE1L( package2 );
     IPCWRITE2L( package3 );
@@ -178,19 +178,19 @@
     {
     DRMLOG(  _L( "CDRMClockSession::UpdateDRMTimeL" ) );
     TInt error = KErrNone;
-    TTime drmTime;    
+    TTime drmTime;
     TInt timeZone;
     TPckg<TTime> package( drmTime );
     TPckg<TInt> package2( timeZone );
     TInt r = KErrAccessDenied;
-    
+
     // Add a check for the vendor id
-	_LIT_SECURITY_POLICY_V0(vidCheck, VID_DEFAULT); // Check Default VID    
-	_LIT_SECURITY_POLICY_C1(drmCheck, ECapabilityDRM);
+    _LIT_SECURITY_POLICY_V0(vidCheck, VID_DEFAULT); // Check Default VID
+    _LIT_SECURITY_POLICY_C1(drmCheck, ECapabilityDRM);
     RThread client;
-    
-    aMessage.ClientL( client );    
-    
+
+    aMessage.ClientL( client );
+
     if( vidCheck.CheckPolicy( client ) || drmCheck().CheckPolicy(client) )
         {
         r = KErrNone;
@@ -198,7 +198,7 @@
 
     client.Close();
     User::LeaveIfError( r );
-    
+
     IPCREAD0L( package );
     IPCREAD1L( package2 );
 
--- a/omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,11 +20,11 @@
 // INCLUDE FILES
 #include "DRMNitzObserver.h"
 #include "DRMClock.h"
-#include "DRMLog.h"
+#include "drmlog.h"
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 const TInt KTimeZoneValidBit(0x3F);     // Time zone difference
@@ -50,47 +50,47 @@
 // CDRMNitzObserver::CDRMNitzObserver
 // Default Constructor
 // ---------------------------------------------------------
-//  
+//
 CDRMNitzObserver::CDRMNitzObserver( RMobilePhone& aMobilePhone, CDRMClock* aDRMClock) :
     CActive(EPriorityNormal) ,iDRMClock( aDRMClock ), iMobilePhone( &aMobilePhone ),
     iError( KErrNone )
-    {    
+    {
     }
 
 // ---------------------------------------------------------
 // CDRMNitzObserver::~CDRMNitzObserver
 // Destructor
 // ---------------------------------------------------------
-//        
+//
 CDRMNitzObserver::~CDRMNitzObserver()
     {
-    Cancel();	
-    };      
-      
-      
+    Cancel();
+    };
+
+
 // ---------------------------------------------------------
 // CDRMNitzObserver::ConstructL
 // Two-phase Constructor
 // ---------------------------------------------------------
-//   
+//
 void CDRMNitzObserver::ConstructL()
     {
     DRMLOG( _L("ConstructL "));
-    
+
     // Get the NITZ info on the creation, might not be available yet
     iError = iMobilePhone->GetNITZInfo(iNitzInfo);
-    
-    
+
+
     DRMLOG2( _L("ConstructL: Error = %d"), iError );
-    
+
     }
- 
+
 
 // ---------------------------------------------------------
 // CDRMNitzObserver::NewL
 // Two-phase constructor
 // ---------------------------------------------------------
-//  
+//
 CDRMNitzObserver* CDRMNitzObserver::NewL( RMobilePhone& aMobilePhone,
                                          CDRMClock* aDRMClock)
     {
@@ -100,21 +100,21 @@
     CleanupStack::Pop();
     return self;
     }
- 
+
 // ---------------------------------------------------------
 // CDRMNitzObserver::Start
 // Adds the active object into the ActiveScheduler
 // and sets the object active, makes sure RunL is called
 // atleast once
 // ---------------------------------------------------------
-//        
-void CDRMNitzObserver::Start() 
+//
+void CDRMNitzObserver::Start()
     {
     TRequestStatus* status = 0;
-    
-    DRMLOG2( _L("iError == %d "), iError );  
- 
-    if( iError == KErrNotSupported ) 
+
+    DRMLOG2( _L("iError == %d "), iError );
+
+    if( iError == KErrNotSupported )
         {
         // NITZ never supported, kill the observer
         if( IsAdded() )
@@ -123,64 +123,64 @@
             return;
             }
         return;
-        }     
-    
-    if( !IsAdded() ) 
+        }
+
+    if( !IsAdded() )
         {
-        CActiveScheduler::Add(this);        
+        CActiveScheduler::Add(this);
         }
-    if ( !IsActive() ) 
+    if ( !IsActive() )
         {
-        SetActive();        
+        SetActive();
         }
     status = &iStatus;
     User::RequestComplete(status,KErrNone);
     }
-    
-    
-// Ignore the error:    
+
+
+// Ignore the error:
 TInt CDRMNitzObserver::RunError( TInt /*aError*/ )
     {
     SetActive();
     return KErrNone;
     }
-    
-    
+
+
 // ---------------------------------------------------------
 // CDRMNitzObserver::RunL
 // Active object RunL
 // ---------------------------------------------------------
-//  
+//
 void CDRMNitzObserver::RunL()
     {
     TTime timeData;
     TInt timeZone( 0 );
-    
+
     // Check if the nitz has changed and is available, if so call update
     // otherwise just wait
-    
-    DRMLOG( _L("ObserverRunL Called\n\r ") ); 
+
+    DRMLOG( _L("ObserverRunL Called\n\r ") );
 
     iStatus = KRequestPending;
-    
+
     iMobilePhone->NotifyNITZInfoChange(iStatus, iNitzInfo);
-    
-    DRMLOG( _L("NotifyNITZInfoChange:"));             
+
+    DRMLOG( _L("NotifyNITZInfoChange:"));
     if( GetNitzTime( timeData, timeZone ) )
         {
-        DRMLOG( _L("Resetting secure time from NITZ observer:"));          
+        DRMLOG( _L("Resetting secure time from NITZ observer:"));
         TRAPD(error, iDRMClock->ResetSecureTimeL( timeData, timeZone ) );
         if( error )
             {
-            DRMLOG( _L("Resetting secure time from NITZ observer returned an error."));   
+            DRMLOG( _L("Resetting secure time from NITZ observer returned an error."));
             }
-        DRMLOG( _L("Resetting secure time from NITZ observer successful."));     
-          
+        DRMLOG( _L("Resetting secure time from NITZ observer successful."));
+
         if( error != KErrArgument )
             {
             if( error )
                 {
-                DRMLOG( _L("ObserverRunL Called error \n\r ") );                
+                DRMLOG( _L("ObserverRunL Called error \n\r ") );
                 }
             User::LeaveIfError( error );
             }
@@ -194,7 +194,7 @@
 // CDRMNitzObserver::DoCancel
 // Cancels the active object
 // ---------------------------------------------------------
-//        
+//
 void CDRMNitzObserver::DoCancel()
     {
     // cancel the notify change
@@ -227,8 +227,8 @@
 TBool CDRMNitzObserver::GetNitzTime(TTime& aNitzTime, TInt& aTimeZone)
     {
     TInt32 nitzCaps(iNitzInfo.iNitzFieldsUsed);
-    
-    if (nitzCaps & RMobilePhone::KCapsTimezoneAvailable)    
+
+    if (nitzCaps & RMobilePhone::KCapsTimezoneAvailable)
         {
         TInt timezone(iNitzInfo.iTimeZone & KTimeZoneValidBit);
 
@@ -237,30 +237,30 @@
             // Changes sign
             timezone = - timezone;
             }
-        
+
         // TimeZone info
         aTimeZone = timezone;
         }
-    
-    if (nitzCaps & RMobilePhone::KCapsTimeAvailable)  
+
+    if (nitzCaps & RMobilePhone::KCapsTimeAvailable)
         {
         TDateTime dateTime;
         TInt fourDigitYear(iNitzInfo.Year());
 
         //Check if our TSY returns 2 digits in stead of 4 digits for the year value
-        if (fourDigitYear <= KMaximumTwoDigitValue)        // The maximum year value in UI applications is 2060 
-		    {
+        if (fourDigitYear <= KMaximumTwoDigitValue)        // The maximum year value in UI applications is 2060
+            {
            //The year received from TSY is 2 digits we make it 4 digits
-            fourDigitYear = fourDigitYear + KNitzYearOffset;  // 2000   
-		    }
+            fourDigitYear = fourDigitYear + KNitzYearOffset;  // 2000
+            }
 
         dateTime.Set(fourDigitYear,
-		            TMonth(iNitzInfo.Month()),
-					iNitzInfo.Day(),
-					iNitzInfo.Hour(),
-					iNitzInfo.Minute(),
-					iNitzInfo.Second(),
-					iNitzInfo.MicroSecond());
+                    TMonth(iNitzInfo.Month()),
+                    iNitzInfo.Day(),
+                    iNitzInfo.Hour(),
+                    iNitzInfo.Minute(),
+                    iNitzInfo.Second(),
+                    iNitzInfo.MicroSecond());
 
         DRMLOG2( _L( "CDRMNitzObserver::GetNitzTime: DateTime: %d" ), fourDigitYear );
         DRMLOG2( _L( ":%d" ), iNitzInfo.Month() );
@@ -273,11 +273,11 @@
             {
             return EFalse;
             }
-        // Transfer the time into a TTime object, UTC    
+        // Transfer the time into a TTime object, UTC
         aNitzTime = dateTime;
         return ETrue;
         }
-    
+
     return EFalse;
-           
+
     };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadrm/drmengine/drmclock/Src/GPSTimeUpdater.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,180 @@
+
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the GPS time updater
+*
+*/
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32debug.h>
+#include "GPSTimeUpdater.h"
+#include "DRMClock.h"
+#include "drmlog.h"
+
+
+_LIT(KDRMClockServerName, "DRMClockServer");
+
+const TInt KGPSUpdateInterval   = 1000000;  // One second
+const TInt KGPSUpdateAge        = 500000;   // Half a second
+const TInt KGPSUpdateTimeOut    = 30000000; // Thirty seconds
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::CGPSTimeUpdater
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//   
+CGPSTimeUpdater::CGPSTimeUpdater( const TPositionModuleId& aModuleId,
+                                  CDRMClock* aClock ) : 
+	CActive(EPriorityHigh),
+	iModuleId(aModuleId),
+	iClock( aClock ),
+	iTimeReceived( EFalse )
+	{
+	CActiveScheduler::Add(this);
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::~CGPSTimeUpdater
+// C++ destructor
+// -----------------------------------------------------------------------------
+// 
+CGPSTimeUpdater::~CGPSTimeUpdater()
+	{
+	DRMLOG(_L("CGPSTimeUpdater::~CGPSTimeUpdater"));
+	Cancel();
+	
+	iPositioner.Close();
+	iPosServer.Close();
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::New
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CGPSTimeUpdater* CGPSTimeUpdater::New( const TPositionModuleId& aModuleId,
+                                       CDRMClock* aClock )
+	{
+	CGPSTimeUpdater* self = new CGPSTimeUpdater(aModuleId, aClock);
+	if(self)
+		{
+		TRAPD(err, self->ConstructL());
+		if(err!=KErrNone)
+			{
+			delete self;
+			self = 0;
+			}
+		}
+	return self;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CGPSTimeUpdater::ConstructL()
+	{
+	DRMLOG(_L("CGPSTimeUpdater::ConstructL >>"));
+	
+	User::LeaveIfError( iPosServer.Connect() );
+	
+	// Open positioner
+	User::LeaveIfError(iPositioner.Open(iPosServer, iModuleId));
+	User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService,
+	                   CRequestor::EFormatApplication, 
+	                   KDRMClockServerName));
+	
+	// Set update options
+	TPositionUpdateOptions updateOptions;
+	updateOptions.SetAcceptPartialUpdates(ETrue);
+	updateOptions.SetMaxUpdateAge(KGPSUpdateAge);
+	updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(KGPSUpdateInterval));
+	updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(KGPSUpdateTimeOut));
+	User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions));
+	
+	// Request position update
+	iPositioner.NotifyPositionUpdate(iSatelliteInfo, iStatus);
+	SetActive();
+	
+	DRMLOG(_L("CGPSTimeUpdater::ConstructL <<"));
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::RunL
+// Inherited from CActive
+// -----------------------------------------------------------------------------
+//
+void CGPSTimeUpdater::RunL()
+	{
+	DRMLOG(_L("CGPSTimeUpdater::RunL >>"));
+	
+	DRMLOG2(_L("CGPSTimeUpdater::RunL: iStatus=%d"), iStatus.Int());
+	
+	// We got some kind of an update:
+	if( iStatus == KErrNone || 
+	    iStatus == KPositionPartialUpdate )
+		{
+		DRMLOG(_L("CGPSTimeUpdater::RunL: position updated!"));
+		
+		DRMLOG2(_L("CGPSTimeUpdater::RunL: satellites used = %d"), iSatelliteInfo.NumSatellitesUsed());
+		TTime satelliteTime = iSatelliteInfo.SatelliteTime();
+		
+		TDateTime dt = satelliteTime.DateTime();
+		DRMLOG7(_L("CGPSTimeUpdater::RunL: satellite time = %02d-%02d-%04d, %02d:%02d:%02d"), dt.Day(), dt.Month(), dt.Year(), dt.Hour(), dt.Minute(), dt.Second());
+		    
+	    // If the time has not been received yet this function will leave and we re-issue the request from run error:    
+		iClock->ResetSecureTimeL( satelliteTime, 0 );    
+		
+		// Mark time as received
+		iTimeReceived = ETrue;
+		}
+
+    // We only try once, if it fails it fails and we will try again when it is activated the next time.
+	iPositioner.Close();
+        
+	DRMLOG(_L("CGPSTimeUpdater::RunL <<"));
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::DoCancel
+// Inherited from CActive
+// -----------------------------------------------------------------------------
+//	
+void CGPSTimeUpdater::DoCancel()
+	{
+	iPositioner.CancelRequest(EPositionerNotifyPositionUpdate);
+	}
+
+
+// -----------------------------------------------------------------------------
+// CGPSTimeUpdater::RunError
+// Inherited from CActive
+// -----------------------------------------------------------------------------
+//	
+TInt CGPSTimeUpdater::RunError( TInt /*aError*/ )
+    {
+    // Time received was invalid, wait for more updates
+    iPositioner.NotifyPositionUpdate(iSatelliteInfo, iStatus);
+    SetActive();
+	
+    // ignore errors    
+    return KErrNone;    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadrm/drmengine/drmclock/Src/GPSWatcher.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the GPS Watcher
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <e32svr.h>
+
+#include "GPSWatcher.h"
+#include "GPSTimeUpdater.h"
+#include "DRMClock.h"
+#include "drmlog.h"
+
+// Wait time in microseconds: wait 5 minutes
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::CGPSWatcher
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//   
+CGPSWatcher::CGPSWatcher( CDRMClock* aClock ) :
+	CTimer(EPriorityHigh),
+	iClock( aClock ),
+	iStatusUpdater( NULL ),
+	iGpsStatus( CPosIntGpsHwStatus::EStatusUnknown )
+	{
+	CActiveScheduler::Add(this);
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::~CGPSWatcher
+// C++ destructor
+// -----------------------------------------------------------------------------
+// 
+CGPSWatcher::~CGPSWatcher()
+	{
+	Cancel();
+
+    iTimeUpdaters.ResetAndDestroy();
+	iActiveSatelliteModules.ResetAndDestroy();
+    
+    delete iStatusUpdater;
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::NewL
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+//
+CGPSWatcher* CGPSWatcher::NewL( CDRMClock* aClock )
+	{
+	CGPSWatcher* self = new (ELeave) CGPSWatcher( aClock );
+	
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CGPSWatcher::ConstructL()
+	{
+    TRequestStatus* status = &iStatus;    	    
+	CTimer::ConstructL();
+
+    // Create the status updater
+    iStatusUpdater = CPosIntGpsHwStatus::NewL(*this);
+        
+    // Get the status manually, if we can, it's ok if we cant
+    TRAP_IGNORE( iStatusUpdater->GetStatusL( iGpsStatus ) );
+    
+    if( !IsActive() )
+        {
+        SetActive();    
+        }
+        
+    User::RequestComplete(status, KErrNone);   
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::OnStatusUpdateEvent
+// Inherited from MPosIntGpsHwStatusObserver
+// -----------------------------------------------------------------------------
+//
+void CGPSWatcher::OnStatusUpdateEvent(CPosIntGpsHwStatus::TIntGpsHwStatus aStatus, TInt aError)
+    {
+    TRequestStatus* status = &iStatus;    
+    
+    // store the status from the Gps:
+    iGpsStatus = aStatus;
+        
+    User::RequestComplete(status, aError);
+
+    if( !IsActive() )
+        {        
+        SetActive();
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::RunL
+// Inherited from CActive
+// -----------------------------------------------------------------------------
+//
+void CGPSWatcher::RunL()
+	{
+    TInt error = KErrNone;
+    
+	// If there are errors just leave and stop watching:    
+	DRMLOG2(_L("CGPSWatcher::RunL: status: '%d'"), iStatus.Int());   
+
+    switch( iGpsStatus )
+        {
+        // GPS HW is used and is receiving location fixes.
+        case CPosIntGpsHwStatus::EStatusOn:
+            DRMLOG(_L("CGPSWatcher::RunL: CPosIntGpsHwStatus::EStatusOn: Checking modules"));
+            // No active modules, check again:
+            if( !iActiveSatelliteModules.Count() )
+                {
+                DRMLOG(_L("CGPSWatcher::RunL: CPosIntGpsHwStatus::EStatusOn: No active modules in list Checking modules"));    
+                error = CheckModules();    
+                }
+            
+            // if we have some or found some check the satellites for updates:    
+            if( !error && iActiveSatelliteModules.Count() )
+                {
+                DRMLOG2(_L("CGPSWatcher::RunL: CPosIntGpsHwStatus::EStatusOn: Active modules available (%d), check satellites"), iActiveSatelliteModules.Count());                     
+                // Get the time update:
+                CheckSatellites();   
+                }
+            else
+                {
+                DRMLOG2(_L("CGPSWatcher::RunL: CPosIntGpsHwStatus::EStatusOn: Still no active modules in list or error (%d) occurred"), error);                     
+                }        
+            break;  
+        // GPS HW is used and is searching for location.
+        case CPosIntGpsHwStatus::EStatusActive:
+            // Get a list of active GPS modules:
+            DRMLOG(_L("CGPSWatcher::RunL: CPosIntGpsHwStatus::EStatusActive: Checking modules"));
+            
+            // return value not important:
+            CheckModules();
+            break;
+        case CPosIntGpsHwStatus::EStatusUnknown:
+        case CPosIntGpsHwStatus::EStatusOff:
+            // Clear the list of modules:
+            DRMLOG2(_L("CGPSWatcher::RunL: CPosIntGpsHwStatus::EStatusUnknown,Off or default: (%d) Checking modules"), iGpsStatus);            
+            iActiveSatelliteModules.ResetAndDestroy();  
+            iTimeUpdaters.ResetAndDestroy();         
+        default:
+            // Do nothing    
+            break;   
+        }		
+	}
+
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::DoCancel
+// Inherited from CActive
+// -----------------------------------------------------------------------------
+//
+void CGPSWatcher::DoCancel()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::RunError
+// Inherited from CActive
+// -----------------------------------------------------------------------------
+//
+TInt CGPSWatcher::RunError( TInt /*aError*/ )
+    {
+    // ignore errors    
+    return KErrNone;    
+    }
+	
+// -----------------------------------------------------------------------------
+// CGPSWatcher::CheckModules
+// Check what modules are present and act accordingly
+// -----------------------------------------------------------------------------
+//
+TInt CGPSWatcher::CheckModules()
+	{
+	TUint numModules = 0;
+	TPositionModuleInfo* moduleInfo = NULL;
+	TInt error = KErrNone;
+	RPositionServer posServer;
+	
+	// Destroy the old list:
+	iActiveSatelliteModules.ResetAndDestroy();
+		    
+	// open connection to the positioning server:	    
+    error = posServer.Connect();		    
+	if( error )
+	    {
+	    return error;    
+	    }	    
+		    
+    error = posServer.GetNumModules( numModules );		    
+		    
+	if(error || !numModules)
+	    {
+        DRMLOG2(_L("CheckModules: modules available (%d)"), numModules);	  
+        DRMLOG2(_L("CheckModules: error code (%d)"), error);	          
+      
+		return KErrNotFound;
+        }
+        
+	for( TUint i = 0; i < numModules; i++)
+		{
+		if(!moduleInfo)
+			{
+			moduleInfo = new TPositionModuleInfo;
+            if( !moduleInfo )
+                {
+                // in practice OOM situation
+                posServer.Close();    
+                return KErrNoMemory;    
+                }
+			}
+		
+		// Get module info from the server
+		if(posServer.GetModuleInfoByIndex(i, *moduleInfo) != KErrNone)
+		    {
+			continue;
+            }
+
+        DRMLOG(_L("CheckModules: Checking for internal & satellite capable"));	
+                        
+		// Check if the module is internal and satellite capable		
+		if(! (moduleInfo->DeviceLocation() & TPositionModuleInfo::EDeviceInternal) ||
+		   ! (moduleInfo->Capabilities() & TPositionModuleInfo::ECapabilitySatellite) )
+			{
+			// Not internal or satellite capable
+			continue;
+			}
+		
+		// Get module status and check if the module is actually active:
+
+
+        DRMLOG(_L("CheckModules: Checking module status"));	
+        		
+		TPositionModuleStatus moduleStatus;
+		
+		if(posServer.GetModuleStatus(moduleStatus, moduleInfo->ModuleId()) != KErrNone)
+		    {
+			continue;
+		    }
+
+		// Check if the module is active or ready as all might not use the active state:
+		if(!(moduleStatus.DeviceStatus() == TPositionModuleStatus::EDeviceActive ||
+		     moduleStatus.DeviceStatus() == TPositionModuleStatus::EDeviceReady) ) 
+		    {
+			continue;
+		    }
+
+
+        DRMLOG(_L("CheckModules: Module is ready or active"));	
+			
+		// Active internal satellite device, try to append in the array
+		if(iActiveSatelliteModules.Append(moduleInfo) == KErrNone)
+		    {
+		    // Set this to 0 so that on the next round a new one will be created
+		    // old one will be in the list:   
+            DRMLOG2(_L("CheckModules: Appended modules to list available (%d) active now available"), iActiveSatelliteModules.Count());		     
+			moduleInfo = 0;
+		    }
+		}
+	
+	// There is a module created which was not added, delete it.	
+	if( moduleInfo )
+	    {
+	    delete moduleInfo;
+	    moduleInfo = NULL;    
+	    }	
+	
+	// close connection to the positioning server:    
+	posServer.Close();
+	return KErrNone;
+	}
+
+
+// -----------------------------------------------------------------------------
+// CGPSWatcher::CheckSatellites()
+// Check what modules are present and act accordingly
+// -----------------------------------------------------------------------------
+//
+void CGPSWatcher::CheckSatellites()
+    {
+    CGPSTimeUpdater* updater = NULL;
+        
+    iTimeUpdaters.ResetAndDestroy();
+        
+    // Start as many updaters as needed:    
+    for( TInt i = 0; i < iActiveSatelliteModules.Count(); i++ )
+        {
+        updater = CGPSTimeUpdater::New( iActiveSatelliteModules[i]->ModuleId(), iClock );
+        if( updater )
+            {
+            if( iTimeUpdaters.Append(updater) ) 
+                {
+                delete updater;
+                updater = NULL;    
+                }
+            }
+        }    
+    }
+    
+// End of File
--- a/omadrm/drmengine/drmserviceapi/src/drmserviceapi.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/drmserviceapi/src/drmserviceapi.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,8 +19,8 @@
 
 #include <drmserviceapi.h>
 
-#include "roapstorageclient.h"
-#include "drmclockclient.h"
+#include "RoapStorageClient.h"
+#include "DRMClockClient.h"
 
 
 // ======== LOCAL FUNCTIONS ========
@@ -65,7 +65,7 @@
         delete iClockClient;
         iClockClient = NULL;
         }
-    
+
     // Roap storage client
     if( iRoapStorageClient )
         {
@@ -79,14 +79,14 @@
 // CDrmServiceApi::GetSecureTime
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TInt DRM::CDrmServiceApi::GetSecureTime( 
-    TTime& aTime, 
+EXPORT_C TInt DRM::CDrmServiceApi::GetSecureTime(
+    TTime& aTime,
     TInt& aTimeZone,
     DRMClock::ESecurityLevel& aSecurityLevel ) const
     {
-    return iClockClient->GetSecureTime( aTime, aTimeZone, aSecurityLevel);    
+    return iClockClient->GetSecureTime( aTime, aTimeZone, aSecurityLevel);
     };
-                        
+
 // ---------------------------------------------------------------------------
 // CDrmServiceApi::UpdateSecureTime
 // ---------------------------------------------------------------------------
@@ -132,10 +132,10 @@
     {
     // Create an instance of the clock client
     iClockClient = new (ELeave) RDRMClockClient;
-    
+
     // Connect to the server
     User::LeaveIfError( iClockClient->Connect() );
-    
+
     // Create and instance of the roap storage client
     iRoapStorageClient = new (ELeave) Roap::RRoapStorageClient;
 
--- a/omadrm/drmengine/group/CryptoPrep.flm	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/group/CryptoPrep.flm	Wed Jun 23 17:42:58 2010 +0100
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of the License "Eclipse Public License v1.0"
@@ -13,14 +13,21 @@
 # Description: DRM Crypto Library build configuration
 #
 
-TMPROOT:=$(subst \,/,$(EPOCROOT))
-EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
+# Bug 2707 - cryptoprep.flm changes the value of EPOCROOT
+#
+# TMPROOT:=$(subst \,/,$(EPOCROOT))
+# EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
 
 CREATABLEPATH:=$(EXTENSION_ROOT)/../drmengine/drmcrypto/build
 CLEANTARGETS:=$(CREATABLEPATH)/cmlacrypto.cpp $(CREATABLEPATH)/omacrypto.cpp
 
 crypto_files:=$(wildcard $(EXTENSION_ROOT)/../drmengine/drmcrypto/CMLA/*.cpp)
 
+
+GUARD:=done_$(call sanitise,$(CLEANTARGETS))
+ifeq ($($(GUARD)),)
+$(GUARD):=1
+
 BITMAP :: $(CREATABLEPATH)
 
 ifeq ($(crypto_files),)
@@ -29,6 +36,8 @@
 	$(GNUCP) $(CREATABLEPATH)/../CMLA/CmlaCrypto.cpp $(CREATABLEPATH)/cmlacrypto.cpp
 endif
 	$(GNUCP) $(CREATABLEPATH)/../src/OmaCrypto.cpp $(CREATABLEPATH)/omacrypto.cpp
+	$(GNUCHMOD) u+w $(CREATABLEPATH)/cmlacrypto.cpp
+	$(GNUCHMOD) u+w $(CREATABLEPATH)/omacrypto.cpp
 
 # Create dirs
 $(call makepath,$(CREATABLEPATH))
@@ -36,3 +45,11 @@
 ## Clean up
 $(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS)))
 
+## What
+$(eval $(call whatmacro,$(CLEANTARGETS)))
+
+
+else
+$(info <debug>$(PLATFORM) $(CFG), up-to-date $(CLEANTARGETS)</debug>)
+
+endif
--- a/omadrm/drmengine/group/DrmCrypto.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/group/DrmCrypto.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -40,9 +40,11 @@
 SOURCE          drmaescrypto.cpp
 
 SOURCEPATH      ../drmcrypto/build
-SOURCE          omacrypto.cpp
 SOURCE          cmlacrypto.cpp
 
+SOURCEPATH      ../drmcrypto/src
+SOURCE          OmaCrypto.cpp
+
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
 LIBRARY         asn1.lib
--- a/omadrm/drmengine/group/ROAPHandler.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/group/ROAPHandler.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -113,8 +113,9 @@
 LIBRARY     DcfRep.lib
 LIBRARY     caf.lib                     // Embedding domain ROs
 LIBRARY     cafutils.lib                // Embedding domain ROs
-LIBRARY     centralrepository.lib       // Browser default AP
+LIBRARY     centralrepository.lib       // CRepository
 LIBRARY     cmmanager.lib
+LIBRARY     extendedconnpref.lib netmeta.lib // TExtendedConnPref
 
 LIBRARY     SysUtil.lib
 LIBRARY     HttpFilterCommon.lib
--- a/omadrm/drmengine/group/RightsServer.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/group/RightsServer.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 TARGETTYPE      EXE
 
 UID             0x1000008d 0x101F51F2
-CAPABILITY      CAP_SERVER DRM CommDD ProtServ PowerMgmt
+CAPABILITY      CAP_SERVER DRM CommDD ProtServ PowerMgmt Location
 VENDORID        VID_DEFAULT
 
 // Default system include paths for middleware layer modules.
@@ -103,6 +103,9 @@
 SOURCE          DRMClockSession.cpp
 
 SOURCE          DRMNitzObserver.cpp
+SOURCE          GPSWatcher.cpp
+SOURCE          GPSTimeUpdater.cpp
+
 #else
 #ifdef __DRM_OMA2
 SOURCEPATH      ../DRMClock/src
@@ -144,6 +147,8 @@
 LIBRARY         flogger.lib
 LIBRARY         featmgr.lib                 // Feature Manager
 LIBRARY         wmdrmfileserverclient.lib
+LIBRARY         lbs.lib                     // GPS libraries
+LIBRARY         eposindicator.lib           // GPS positioner indicator lib
 #ifdef RD_DRM_METERING
 LIBRARY         random.lib
 #endif
--- a/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/keystorage/src/DrmStdKeyStorage.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -27,7 +27,7 @@
 #include <mmtsy_names.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DrmKeyStorage.h"
@@ -50,7 +50,7 @@
         buffer.Ptr(), buffer.Length());
 #else
 #define LOG(string)
-#define LOGHEX(buffer)       
+#define LOGHEX(buffer)
 #endif
 
 #pragma message("Compiling DRM Std KeyStorage..")
@@ -100,17 +100,17 @@
 LOCAL_C void WriteFileL(RFs& aFs, const TDesC& aName, const TDesC8& aData)
     {
     RFile file;
-    
+
     User::LeaveIfError(file.Replace(aFs, aName, EFileWrite));
     User::LeaveIfError(file.Write(aData));
     file.Close();
     }
-    
+
 LOCAL_C void ReadFileL(RFs& aFs, const TDesC& aName, HBufC8*& aContent)
-    {   
+    {
     RFile file;
     TInt size = 0;
-    
+
     User::LeaveIfError(file.Open(aFs, aName, EFileRead));
     CleanupClosePushL(file);
     User::LeaveIfError(file.Size(size));
@@ -150,7 +150,7 @@
     {
     RInteger r;
     TInt i;
-    
+
     r = RInteger::NewL(0);
     for (i = 0; i < aOctetStream.Length(); i++)
         {
@@ -172,7 +172,7 @@
 
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage* CDrmStdKeyStorage::NewL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C CDrmStdKeyStorage* CDrmStdKeyStorage::NewL(RLibrary aLibrary)
@@ -186,9 +186,9 @@
 
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::CDrmStdKeyStorage
-// 
+//
 // -----------------------------------------------------------------------------
-//    
+//
 CDrmStdKeyStorage::CDrmStdKeyStorage(RLibrary aLibrary):
     iFileMan(NULL),
     iRootSelected(EFalse),
@@ -200,18 +200,18 @@
 
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::ConstructL
-// 
+//
 // -----------------------------------------------------------------------------
-//   
+//
 void CDrmStdKeyStorage::ConstructL()
     {
-   
+
     LOG(_L("CDrmStdKeyStorage::ConstructL ->"));
     User::LeaveIfError(iFs.Connect());
     iFileMan = CFileMan::NewL(iFs);
 
-#ifdef __DRM_OMA2 
-	SelectDefaultRootL();
+#ifdef __DRM_OMA2
+    TRAP_IGNORE( SelectDefaultRootL() ); // Allow startup anyway.
 #endif
 
     iDeviceSpecificKey.Copy(KDefaultKey);
@@ -221,7 +221,7 @@
 
 // -----------------------------------------------------------------------------
 // MDrmKeyStorage::~MDrmKeyStorage
-// 
+//
 // -----------------------------------------------------------------------------
 //
 
@@ -230,7 +230,7 @@
     }
 // -----------------------------------------------------------------------------
 // DrmStdKeyStorage::~CDrmStdKeyStorage
-// 
+//
 // -----------------------------------------------------------------------------
 //
 
@@ -247,10 +247,10 @@
 
 // -----------------------------------------------------------------------------
 // DrmStdKeyStorage::ModulusSize
-// 
+//
 // -----------------------------------------------------------------------------
 //
-    
+
 TInt CDrmStdKeyStorage::ModulusSize()
     {
     LOG(_L("CDrmStdKeyStorage::ModulusSize ->"));
@@ -265,7 +265,7 @@
 
 // -----------------------------------------------------------------------------
 // DrmStdKeyStorage::SelectTrustedRootL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CDrmStdKeyStorage::SelectTrustedRootL(
@@ -274,30 +274,30 @@
     TFileName fileName;
     TEntry entry;
     TInt i;
-    
+
     LOG(_L("CDrmStdKeyStorage::SelectTrustedRootL ->"));
     LOG(aRootKeyHash);
     if (aRootKeyHash.Length() != 0)
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-        
+
         fileName.Copy(KKeyStoragePath);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
         TFileName tempPath;
         TInt driveNumber( -1 );
         TChar driveLetter;
         DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-    	iFs.DriveToChar( driveNumber, driveLetter );
-    
-    	tempPath.Format( KKeyStoragePath, (TUint)driveLetter );
-        
+        iFs.DriveToChar( driveNumber, driveLetter );
+
+        tempPath.Format( KKeyStoragePath, (TUint)driveLetter );
+
         fileName.Copy(tempPath);
-    
+
 #endif
-        
+
         for (i = 0; i < SHA1_HASH; i++)
             {
             fileName.AppendNumFixedWidth(aRootKeyHash[i], EHex, 2);
@@ -305,22 +305,22 @@
         fileName.Append('\\');
         if (iFs.Entry(fileName, entry) != KErrNone)
             {
-            
+
 #ifndef RD_MULTIPLE_DRIVE
-            
+
             fileName.Copy(KRomKeyStoragePath);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
             DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
-    	    iFs.DriveToChar( driveNumber, driveLetter );
-    	    
-    	    tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter );
-            
+            iFs.DriveToChar( driveNumber, driveLetter );
+
+            tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter );
+
             fileName.Copy(tempPath);
-    
+
 #endif
-            
+
             for (i = 0; i < SHA1_HASH; i++)
                 {
                 fileName.AppendNumFixedWidth(aRootKeyHash[i], EHex, 2);
@@ -332,7 +332,7 @@
         User::LeaveIfError(iFs.SetSessionPath(fileName));
         InitializeKeyL();
         CheckRootForCmlaL();
-        iRootSelected = ETrue;  
+        iRootSelected = ETrue;
         }
     else
         {
@@ -340,10 +340,10 @@
         }
     LOG(_L("CDrmStdKeyStorage::SelectTrustedRootL <-"));
     }
-    
+
 // -----------------------------------------------------------------------------
 // DrmStdKeyStorage::SelectDefaultRootL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CDrmStdKeyStorage::SelectDefaultRootL()
@@ -351,44 +351,44 @@
     CDir* dir = NULL;
     TFileName dirName;
     TBool found = EFalse;
-    
+
     LOG(_L("CDrmStdKeyStorage::SelectDefaultRootL ->"));
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     if (iFs.GetDir(KKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName tempPath;
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     tempPath.Format( KKeyStoragePath, (TUint)driveLetter );
-    
+
     if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #endif
-    
+
         {
         __UHEAP_MARK;
         LOG(_L("  Checking keys on C:"));
         CleanupStack::PushL(dir);
         if (dir->Count() >= 1)
             {
-            
+
 #ifndef RD_MULTIPLE_DRIVE
-            
+
             dirName.Copy(KKeyStoragePath);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
             dirName.Copy(tempPath);
-    
+
 #endif
-            
+
             dirName.Append((*dir)[0].iName);
             dirName.Append('\\');
             User::LeaveIfError(iFs.SetSessionPath(dirName));
@@ -397,39 +397,39 @@
         CleanupStack::PopAndDestroy(dir);
         __UHEAP_MARKEND;
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
     if (!found && iFs.GetDir(KRomKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter );
-    
+
     if (!found && iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #endif
         {
-    	LOG(_L("  Checking keys on Z:"));
+        LOG(_L("  Checking keys on Z:"));
         CleanupStack::PushL(dir);
         if (dir->Count() < 1)
             {
             User::Leave(KErrGeneral);
             }
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-        
+
         dirName.Copy(KRomKeyStoragePath);
-        
+
 #else //RD_MULTIPLE_DRIVE
-    
+
         dirName.Copy(tempPath);
-        
+
 #endif
-        
+
         dirName.Append((*dir)[0].iName);
         dirName.Append('\\');
         User::LeaveIfError(iFs.SetSessionPath(dirName));
@@ -438,14 +438,14 @@
         }
     if (!found)
         {
-        User::Leave(KErrGeneral); 
+        User::Leave(KErrGeneral);
         }
     InitializeKeyL();
     CheckRootForCmlaL();
     iRootSelected = ETrue;
     LOG(_L("CDrmStdKeyStorage::SelectDefaultRootL <-"));
     }
-    
+
 TBool CDrmStdKeyStorage::SelectedRootIsCmla()
     {
     return iRootIsCmla;
@@ -453,10 +453,10 @@
 
 // -----------------------------------------------------------------------------
 // DrmStdKeyStorage::GetTrustedRootsL
-// 
+//
 // -----------------------------------------------------------------------------
 //
-    
+
 void CDrmStdKeyStorage::GetTrustedRootsL(
     RPointerArray<HBufC8>& aRootList)
     {
@@ -467,26 +467,26 @@
     TEntry entry;
     TUint8 c;
     TInt r = KErrNone;
-    
+
     LOG(_L("CDrmStdKeyStorage::GetTrustedRootsL ->"));
     aRootList.ResetAndDestroy();
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     if (iFs.GetDir(KKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName tempPath;
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     tempPath.Format( KKeyStoragePath, (TUint)driveLetter );
-    
+
     if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #endif
         {
         LOG(_L("  Getting roots on C:"));
@@ -510,20 +510,20 @@
             }
         CleanupStack::PopAndDestroy(dir);
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     if (iFs.GetDir(KRomKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter );
-    
+
     if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #endif
         {
         LOG(_L("  Getting roots on Z:"));
@@ -552,7 +552,7 @@
 
 // -----------------------------------------------------------------------------
 // DrmStdKeyStorage::GetCertificateChainL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CDrmStdKeyStorage::GetCertificateChainL(
@@ -562,7 +562,7 @@
     TInt i;
     CDir* dir = NULL;
     HBufC8* cert = NULL;
-    
+
     LOG(_L("CDrmStdKeyStorage::GetCertificateChainL ->"));
     if (!iRootSelected)
         {
@@ -617,7 +617,7 @@
     CSHA1* hasher = NULL;
     TBuf8<SHA1_HASH> publicKeyHash;
     TFileName fileName;
-    
+
     LOG(_L("CDrmStdKeyStorage::ImportDataL ->"));
     n = aCertificateChain.Count();
     cert = CX509Certificate::NewLC(aCertificateChain[n - 1]);
@@ -628,25 +628,25 @@
     CleanupStack::PushL(hasher);
     hasher->Update(*publicKey);
     publicKeyHash.Copy(hasher->Final());
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     fileName.Copy(KKeyStoragePath);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName keyStorageDir;
     keyStorageDir.Format( KKeyStoragePath, (TUint)driveLetter );
-    
+
     fileName.Copy(keyStorageDir);
-    
+
 #endif
-    
+
     for (i = 0; i < SHA1_HASH; i++)
         {
         fileName.AppendNumFixedWidth(publicKeyHash[i], EHex, 2);
@@ -675,17 +675,17 @@
 void CDrmStdKeyStorage::GetDeviceSpecificKeyL(
     TBuf8<KDeviceSpecificKeyLength>& aKey)
     {
-    
+
     HBufC8* key = NULL;
-    TInt n;    
-    CSHA1* hasher = NULL;  
+    TInt n;
+    CSHA1* hasher = NULL;
     TBuf8<SHA1_HASH> hash;
-    
+
     if (iDeviceSpecificKey.Compare(KDefaultKey) == 0)
         {
-        
+
         GetImeiL();
-        
+
         HBufC8* buf = HBufC8::NewLC( iImei->Size() + sizeof(VID_DEFAULT) );
         TPtr8 ptr( buf->Des() );
         ptr.Copy( *iImei );
@@ -708,7 +708,7 @@
             n--;
             }
         }
-    
+
     aKey.Copy(iDeviceSpecificKey);
     }
 
@@ -760,7 +760,7 @@
     RInteger input;
     HBufC8* output;
     TInt keyLength = KKeyLength;
-    
+
     LOG(_L("CDrmStdKeyStorage::ModularExponentiateWithKeyL ->"));
     input = OS2IPL(aInput);
     CleanupClosePushL(input);
@@ -782,7 +782,7 @@
     HBufC8* buffer = NULL;
     HBufC* name = NULL;
     CX509Certificate* cert = NULL;
-    
+
     LOG(_L("CDrmStdKeyStorage::CheckRootForCmlaL ->"));
     __UHEAP_MARK;
     iFs.GetDir(KSingingCertPattern, KEntryAttNormal, ESortByName, dir);
@@ -805,7 +805,7 @@
     LOG(_L("CDrmStdKeyStorage::CheckRootForCmlaL <-"));
     __UHEAP_MARKEND;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::GetRdbSerialNumberL
 // -----------------------------------------------------------------------------
@@ -815,42 +815,42 @@
     {
     HBufC8* buffer = NULL;
     TUint att;
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
     if (iFs.Att(KSerialNumberFile, att) != KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName serialNoFile;
     serialNoFile.Format( KSerialNumberFile, (TUint)driveLetter );
-    
+
     if (iFs.Att(serialNoFile, att) != KErrNone)
-    
+
 #endif
         {
         GenerateNewRdbSerialNumberL();
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
     ReadFileL(iFs, KSerialNumberFile, buffer);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     ReadFileL(iFs, serialNoFile, buffer);
-    
+
 #endif
-    
+
     aSerialNumber.Copy(*buffer);
     delete buffer;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::GenerateNewRdbSerialNumberL
 // -----------------------------------------------------------------------------
@@ -861,29 +861,29 @@
     TPtr8 random( const_cast<TUint8*>(serialNumber.Ptr()),
                   KRdbSerialNumberLength,
                   KRdbSerialNumberLength );
-    
+
     RandomDataGetL(random,KRdbSerialNumberLength);
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     WriteFileL(iFs, KSerialNumberFile, random);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName serialNoFile;
     serialNoFile.Format( KSerialNumberFile, (TUint)driveLetter );
-    
+
     WriteFileL(iFs, serialNoFile, random);
-    
+
 #endif
-    
+
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::UdtEncryptL
 // -----------------------------------------------------------------------------
@@ -898,31 +898,31 @@
     TX509KeyFactory factory;
     CRSAPKCS1v15Encryptor* encryptor = NULL;
     TPtr8 result(const_cast<TUint8*>(output->Ptr()), 0, 256);
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     ReadFileL(iFs, KUdtCertFileName, buffer);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName udtCertFile;
     udtCertFile.Format( KUdtCertFileName, (TUint)driveLetter );
-    
+
     ReadFileL(iFs, udtCertFile, buffer);
-    
+
 #endif
-    
+
     CleanupStack::PushL(buffer);
     cert = CX509Certificate::NewL(*buffer);
     CleanupStack::PushL(cert);
     key = factory.RSAPublicKeyL(cert->PublicKey().KeyData());
     CleanupStack::PushL(key);
-       
+
     encryptor = CRSAPKCS1v15Encryptor::NewLC(*key);
     encryptor->EncryptL(aInput, result);
 
@@ -950,19 +950,19 @@
 #ifndef RD_MULTIPLE_DRIVE
 
     if (iFs.GetDir(KKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName tempPath;
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     tempPath.Format( KKeyStoragePath, (TUint)driveLetter );
-    
+
     if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #endif
         {
         CleanupStack::PushL(dir);
@@ -970,17 +970,17 @@
             {
             if ((*dir)[i].IsDir())
                 {
-                
+
 #ifndef RD_MULTIPLE_DRIVE
-                
+
                 dirName.Copy(KKeyStoragePath);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
                 dirName.Copy(tempPath);
-    
+
 #endif
-                
+
                 dirName.Append((*dir)[i].iName);
                 dirName.Append('\\');
                 User::LeaveIfError(iFs.SetSessionPath(dirName));
@@ -995,20 +995,20 @@
             }
         CleanupStack::PopAndDestroy(dir);
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
     if (iFs.GetDir(KRomKeyStoragePath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
-    
+
     tempPath.Format( KRomKeyStoragePath, (TUint)driveLetter );
-    
+
     if (iFs.GetDir(tempPath, KEntryAttDir, ESortByName, dir) == KErrNone)
-    
+
 #endif
         {
         CleanupStack::PushL(dir);
@@ -1016,17 +1016,17 @@
             {
             if ((*dir)[i].IsDir())
                 {
-                
+
 #ifndef RD_MULTIPLE_DRIVE
-                
+
                 dirName.Copy(KRomKeyStoragePath);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
                 dirName.Copy(tempPath);
-    
+
 #endif
-                
+
                 dirName.Append((*dir)[i].iName);
                 dirName.Append('\\');
                 User::LeaveIfError(iFs.SetSessionPath(dirName));
@@ -1043,7 +1043,7 @@
         }
     iFs.SetSessionPath( path );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::GetIMEIL
 // -----------------------------------------------------------------------------
@@ -1056,24 +1056,24 @@
         }
 
 #if (defined __WINS__ || defined WINSCW)
-    // Default IMEI used for emulator   
+    // Default IMEI used for emulator
     _LIT( KDefaultSerialNumber, "123456789123456789" );
     iImei = KDefaultSerialNumber().AllocL();
-        
+
     return *iImei;
 #else
- 
+
     TInt error( KErrNone );
     TInt count( 0 );
     TInt count2( 0 );
     TUint32 caps( 0 );
     TBool found (EFalse);
-    
+
     RTelServer etelServer;
     RMobilePhone phone;
-    
+
     TUint KMaxImeiTries = 5;
-    
+
     for ( TUint8 i = 0; i < KMaxImeiTries; ++i )
         {
         error = etelServer.Connect();
@@ -1081,31 +1081,31 @@
             {
             User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) );
             }
-        else 
+        else
             {
             break;
             }
         }
-    
+
     User::LeaveIfError( error );
     CleanupClosePushL( etelServer );
-    
-    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );  
-    
+
+    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
+
     TUnloadModule unload;
     unload.iServer = &etelServer;
     unload.iName = &KMmTsyModuleName;
-    
+
     TCleanupItem item( DoUnloadPhoneModule, &unload );
     CleanupStack::PushL( item );
     User::LeaveIfError( etelServer.EnumeratePhones( count ) );
-        
+
     for ( count2 = 0; count2 < count && !found; ++count2 )
         {
         RTelServer::TPhoneInfo phoneInfo;
         User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) );
-        
-        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )   
+
+        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )
            {
             User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) );
             User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
@@ -1119,45 +1119,45 @@
         // Not found.
         User::Leave( KErrNotFound );
         }
-   
+
     User::LeaveIfError( phone.GetIdentityCaps( caps ) );
     if (!( caps & RMobilePhone::KCapsGetSerialNumber ))
         {
          User::Leave( KErrNotFound );
         }
-        
+
     RMobilePhone::TMobilePhoneIdentityV1 id;
     TRequestStatus status;
-    
+
     phone.GetPhoneId( status, id );
-       
+
     User::WaitForRequest( status );
-        
+
     User::LeaveIfError( status.Int() );
-        
+
     iImei = id.iSerialNumber.AllocL();
-        
+
     CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer
-        
+
     HBufC8* buf = HBufC8::NewL( iImei->Size() );
     TPtr8 ptr( buf->Des() );
     ptr.Copy( *iImei );
-        
+
     LOG(_L("IMEI:"));
     LOGHEX(ptr);
     delete buf;
-    
+
     return *iImei;
-#endif /* __WINS__ , WINSCW */ 
-       
+#endif /* __WINS__ , WINSCW */
+
     }
-    
-    
+
+
 // -----------------------------------------------------------------------------
 // CDrmStdKeyStorage::RandomDataGetL
 // -----------------------------------------------------------------------------
 //
-    
+
 void CDrmStdKeyStorage::RandomDataGetL( TDes8& aData, const TInt aLength )
     {
     if ( aLength <= 0 )
--- a/omadrm/drmengine/legacy/src/DRMCommon.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/legacy/src/DRMCommon.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,30 +19,30 @@
 // INCLUDE FILES
 
 #include <f32file.h>
-#include <s32file.h> 
+#include <s32file.h>
 #include <apmstd.h>
-#include <WSPDecoder.h>
-#include <WSPEncoder.h>
+#include <wspdecoder.h>
+#include <wspencoder.h>
 
 #include <barsc.h>
-#include <barsread.h> 
+#include <barsread.h>
 
 #include <DRMCommon.rsg>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DRMCommon.h"
 #include "DRMRightsClient.h"
 #include "DcfCommon.h"
 #include "Oma1Dcf.h"
-#include "Oma2Dcf.h"
-#include "DRMPermission.h"
+#include "oma2dcf.h"
+#include "DrmPermission.h"
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -90,25 +90,25 @@
 
 /*
 LOCAL_C TInt CheckContentRightsL(
-    const TDesC8& aContentURI, 
+    const TDesC8& aContentURI,
     TUint32 aRightsSpec);
 
 LOCAL_C TInt IsProtectedContentL(
-    const TDesC8& aContent, 
+    const TDesC8& aContent,
     TBool& aProtection);
 
 LOCAL_C TInt GetNewHeaderBuffer(
-    HBufC8*& aOldHeaderBuf, 
-    const TDesC8& aHeaderName, 
-    const TDesC8& aHeaderValue, 
+    HBufC8*& aOldHeaderBuf,
+    const TDesC8& aHeaderName,
+    const TDesC8& aHeaderValue,
     HBufC8*& aNewHeaderBuf
     );
 
 LOCAL_C TInt WriteNewFile(
-    TFileName aFileName, 
-    HBufC8*& aHeaderBuf, 
-    TUint32& aFirstPartLength, 
-    TUint32& aDataLength, 
+    TFileName aFileName,
+    HBufC8*& aHeaderBuf,
+    TUint32& aFirstPartLength,
+    TUint32& aDataLength,
     TUint32& aDataPartPos
     );
 
@@ -133,92 +133,92 @@
 */
 
 LOCAL_C void GetActiveRightsL(
-    const TDesC8& aContentURI, 
-    TUint32 aRightsSpec, 
+    const TDesC8& aContentURI,
+    TUint32 aRightsSpec,
     CDRMRights*& aRightsObject);
 
 LOCAL_C TInt CheckFileRightsL(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     TUint32 aRightsSpec);
 
 LOCAL_C TInt CheckFileRightsL(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     TUint32 aRightsSpec);
 
 LOCAL_C TInt IsProtectedFileL(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     TBool& aProtection);
 
 LOCAL_C TInt IsProtectedFileL(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     TBool& aProtection);
 
 LOCAL_C TInt GetContentInfoL(
-    const TDesC8& aContent, 
-    DRMCommon::TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    const TDesC8& aContent,
+    DRMCommon::TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength);
 
 LOCAL_C TInt GetFileInfoL(
-    const TDesC& aFileName, 
-    DRMCommon::TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    const TDesC& aFileName,
+    DRMCommon::TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength);
 
 LOCAL_C TInt GetFileInfoL(
-    RFile& aFileHandle, 
-    DRMCommon::TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    RFile& aFileHandle,
+    DRMCommon::TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength);
 
 LOCAL_C void GetContentHeaderL(
-    const TDesC8& aContent, 
-    const TDesC8& aHeaderName, 
+    const TDesC8& aContent,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue);
 
 LOCAL_C void GetFileHeaderL(
-    const TFileName& aFileName, 
-    const TDesC8& aHeaderName, 
+    const TFileName& aFileName,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue);
 
 LOCAL_C void GetFileHeaderL(
-    RFile& aFileHandle, 
-    const TDesC8& aHeaderName, 
+    RFile& aFileHandle,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue);
 
 LOCAL_C void SetContentHeaderL(
-    HBufC8*& aContent, 
-    const TDesC8& aHeaderName, 
+    HBufC8*& aContent,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue);
 
 LOCAL_C void SetFileHeaderL(
-    const TDesC16& aFileName, 
-    const TDesC8& aHeaderName, 
+    const TDesC16& aFileName,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue);
 
 LOCAL_C void SetFileHeaderL(
-    RFile& aFileHandle, 
-    const TDesC8& aHeaderName, 
+    RFile& aFileHandle,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue);
 
 LOCAL_C void GetSingleRightsObjectL(
-    const TDesC8& aContentURI, 
-    TUint32 aLocalID, 
+    const TDesC8& aContentURI,
+    TUint32 aLocalID,
     CDRMRights*& aRightsObject);
 
 LOCAL_C void GetDetailedContentRightsL(
-    const TDesC8& aContentURI, 
+    const TDesC8& aContentURI,
     RPointerArray<CDRMRights>*& aRightsList);
 
 LOCAL_C void GetDetailedFileRightsL(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     RPointerArray<CDRMRights>*& aRightsList);
 
 LOCAL_C void GetDetailedFileRightsL(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     RPointerArray<CDRMRights>*& aRightsList);
 
 LOCAL_C TInt RegisterDynamicDataTypeL(
@@ -230,18 +230,18 @@
 LOCAL_C TInt CalculatePaddingL(
     COma1Dcf* dcf);
 
-LOCAL_C void DoResetAndDestroy( TAny* aPtr );  
+LOCAL_C void DoResetAndDestroy( TAny* aPtr );
 
 
 LOCAL_C TInt GetFileHandleRead(
-    RFs& aFileServer, 
-    RFile& aFile, 
+    RFs& aFileServer,
+    RFile& aFile,
     const TDesC& aFileName );
 
-LOCAL_C void AddParents( 
-    DRMCommon* aDrmCommon, 
+LOCAL_C void AddParents(
+    DRMCommon* aDrmCommon,
     RPointerArray<CDRMRights>& aRights );
-	
+
 // FORWARD DECLARATIONS
 
 using namespace ContentAccess;
@@ -258,13 +258,13 @@
     ( reinterpret_cast< RPointerArray< CDRMPermission >* >( aPtr ) )->
         ResetAndDestroy();
     }
-    
-    
+
+
 // -----------------------------------------------------------------------------
 // GetPermission
 // -----------------------------------------------------------------------------
 LOCAL_C void GetPermission(
-    RDRMRightsClient& aClient, 
+    RDRMRightsClient& aClient,
     const TDesC8& aUri,
     TIntent aIntent,
     CDRMPermission*& aPermission )
@@ -272,19 +272,19 @@
     TInt r = KErrNone;
     CDRMPermission* permission = NULL;
     TUint32 reason = 0;
-    
+
     TRAP( r, permission = aClient.GetActiveRightsL( aIntent, aUri, reason ) );
     if ( permission != NULL )
         {
         if ( aPermission == NULL )
             {
-            TRAP_IGNORE( aPermission = CDRMPermission::NewL() ); 
+            TRAP_IGNORE( aPermission = CDRMPermission::NewL() );
             }
         aPermission->Merge( *permission );
         delete permission;
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // GetActiveRightsL
 // Returns a possible active rights object. Adopts to broken callers who still
@@ -298,7 +298,7 @@
     CDRMPermission* permission = NULL;
     RDRMRightsClient client;
     HBufC8* uri = NULL;
-        
+
     User::LeaveIfError( client.Connect() );
     CleanupClosePushL( client );
 
@@ -336,14 +336,14 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 LOCAL_C TInt IsProtectedFileL(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     TBool& aProtection)
     {
     RFs fs;
@@ -353,11 +353,11 @@
 
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
-    
-    
+
+
     r = GetFileHandleRead( fs, file, aFileName );
     User::LeaveIfError(r);
-    
+
     CleanupClosePushL(file);
     dcf = CDcfCommon::NewL(file);
     if (dcf != NULL)
@@ -374,14 +374,14 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 LOCAL_C TInt IsProtectedFileL(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     TBool& aProtection)
     {
     TInt r = KErrNone;
@@ -401,17 +401,17 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 TInt GetContentInfoL(
-    const TDesC8& aContent, 
-    DRMCommon::TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    const TDesC8& aContent,
+    DRMCommon::TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength)
     {
     TInt r = KErrNone;
@@ -420,7 +420,7 @@
     if (dcf != NULL)
         {
         CleanupStack::PushL( dcf );
-            
+
         if (dcf->iContentID->Left(4).Compare(KLDPrefix) == 0 ||
             dcf->iContentID->Left(4).Compare(KFLPrefix) == 0 ||
             dcf->iRightsIssuerURL == NULL)
@@ -466,17 +466,17 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 TInt GetFileInfoL(
-    const TDesC& aFileName, 
-    DRMCommon::TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    const TDesC& aFileName,
+    DRMCommon::TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength)
     {
     RFs fs;
@@ -489,11 +489,11 @@
     aProtection = DRMCommon::ENoDCFFile;
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
-    
+
     r = GetFileHandleRead( fs, file, aFileName );
     User::LeaveIfError(r);
     CleanupClosePushL(file);
-    
+
     dcf = CDcfCommon::NewL(file);
     if (dcf != NULL)
         {
@@ -502,7 +502,7 @@
             {
             dcf2 = static_cast<COma2Dcf*>(dcf);
             }
-            
+
         if (dcf->iContentID->Left(4).Compare(KLDPrefix) == 0 ||
             dcf->iContentID->Left(4).Compare(KFLPrefix) == 0 ||
             dcf->iRightsIssuerURL == NULL)
@@ -529,7 +529,7 @@
             {
             aMIMEType = NULL;
             }
-        
+
         // Insert domain RO if it exists
         if (dcf2 != NULL && dcf2->iRightsObjects.Count() > 0)
             {
@@ -537,7 +537,7 @@
             data = CData::NewL(file, KDefaultContentObject);
             delete data;
             }
-            
+
         if (dcf->iVersion == EOma1Dcf && !dcf->iPlainTextLengthValid)
             {
             CalculatePaddingL(static_cast<COma1Dcf*>(dcf));
@@ -551,17 +551,17 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 TInt GetFileInfoL(
-    RFile& aFileHandle, 
-    DRMCommon::TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    RFile& aFileHandle,
+    DRMCommon::TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength)
     {
     TInt r = KErrNone;
@@ -571,7 +571,7 @@
     TInt initialPos = 0;
 
     // Store the initial filePos
-    User::LeaveIfError(aFileHandle.Seek(ESeekCurrent, initialPos)); 
+    User::LeaveIfError(aFileHandle.Seek(ESeekCurrent, initialPos));
 
     aProtection = DRMCommon::ENoDCFFile;
 
@@ -618,7 +618,7 @@
             data = CData::NewL(aFileHandle, KDefaultContentObject);
             delete data;
             }
-            
+
         if (dcf->iVersion == EOma1Dcf && !dcf->iPlainTextLengthValid)
             {
             CalculatePaddingL(static_cast<COma1Dcf*>(dcf));
@@ -633,14 +633,14 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 TInt CheckFileRightsL(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     TUint32 aRightsSpec)
     {
     RFs fs;
@@ -649,14 +649,14 @@
     TInt r = DRMCommon::ENoRights;
     RDRMRightsClient client;
     TUint32 reason = 0;
-    
+
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
-    
+
     r = GetFileHandleRead(fs, file, aFileName);
     User::LeaveIfError(r);
     CleanupClosePushL(file);
-    
+
     dcf = CDcfCommon::NewL(file);
     if ( dcf == NULL )
         {
@@ -671,21 +671,21 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 TInt CheckFileRightsL(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     TUint32 aRightsSpec)
     {
     CDcfCommon* dcf = NULL;
     TInt r = DRMCommon::ENoRights;
     RDRMRightsClient client;
     TUint32 reason = 0;
-    
+
     dcf = CDcfCommon::NewL(aFileHandle);
     if ( dcf == NULL )
         {
@@ -700,28 +700,28 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetSingleRightsObjectL(
-    const TDesC8& aContentURI, 
-    TUint32 aLocalID, 
+    const TDesC8& aContentURI,
+    TUint32 aLocalID,
     CDRMRights*& aRightsObject)
     {
     RDRMRightsClient client;
     CDRMPermission* p = NULL;
     CDRMAsset* a = NULL;
-    
+
     aRightsObject = NULL;
     User::LeaveIfError(client.Connect());
     CleanupClosePushL(client);
-    
-    aRightsObject = CDRMRights::NewL(); 
+
+    aRightsObject = CDRMRights::NewL();
     CleanupStack::PushL(aRightsObject);
-    
+
     p = client.GetDbEntryL(aContentURI, aLocalID);
     CleanupStack::PushL(p);
     aRightsObject->SetPermissionL(*p);
@@ -730,21 +730,21 @@
     a = CDRMAsset::NewLC();
     aRightsObject->SetAssetL(*a);
     CleanupStack::PopAndDestroy();
-    
+
     aRightsObject->SetContentURIAndLocalID(aContentURI.AllocL(), aLocalID);
     CleanupStack::Pop(); // aRightsObject
     CleanupStack::PopAndDestroy(); // client
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetDetailedContentRightsL(
-    const TDesC8& aContentURI, 
+    const TDesC8& aContentURI,
     RPointerArray<CDRMRights>*& aRightsList)
     {
     RDRMRightsClient client;
@@ -754,7 +754,7 @@
     TInt i;
     // Need a temporary pointer
     HBufC8* contentId = NULL;
-    
+
     aRightsList = NULL;
     User::LeaveIfError(client.Connect());
     CleanupClosePushL(client);
@@ -809,30 +809,30 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetDetailedFileRightsL(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     RPointerArray<CDRMRights>*& aRightsList)
     {
-    
+
     CDcfCommon* dcf = NULL;
     RFile file;
     RFs fs;
     TInt r = KErrNone;
-    
+
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
 
     r = GetFileHandleRead( fs, file, aFileName );
     User::LeaveIfError(r);
     CleanupClosePushL(file);
-    
-    
+
+
     dcf = CDcfCommon::NewL(file);
     if (dcf == NULL)
         {
@@ -841,22 +841,22 @@
     CleanupStack::PushL(dcf);
     GetDetailedContentRightsL(*dcf->iContentID, aRightsList);
     CleanupStack::PopAndDestroy(3); // dcf, file, client
-   
+
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetDetailedFileRightsL(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     RPointerArray<CDRMRights>*& aRightsList)
     {
     CDcfCommon* dcf = NULL;
-    
+
     dcf = CDcfCommon::NewL(aFileHandle);
     if (dcf == NULL)
         {
@@ -868,16 +868,16 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 LOCAL_C void  GetNewHeaderBufferL(
-    HBufC8*& aOldHeaderBuf, 
-    const TDesC8& aHeaderName, 
-    const TDesC8& aHeaderValue, 
+    HBufC8*& aOldHeaderBuf,
+    const TDesC8& aHeaderName,
+    const TDesC8& aHeaderValue,
     HBufC8*& aNewHeaderBuf
     )
     {
@@ -886,7 +886,7 @@
     TPtr8 headerPtr(aOldHeaderBuf->Des());
     TPtr8 headerNamePtr(NULL, 0, 0);
     TPtr8 newHeaderPtr(NULL, 0, 0);
-    
+
     HBufC8* headerName = HBufC8::NewL(aHeaderName.Length() + 1);
     // Find the position of the text in the header
     headerNamePtr.Set(headerName->Des());
@@ -909,7 +909,7 @@
         newHeaderPtr.Copy(headerPtr.Left(offset + aHeaderName.Length() + 1));
         newHeaderPtr.Append(aHeaderValue);
         newHeaderPtr.Append(headerPtr.Right(headerPtr.Length() -
-            (offset + aHeaderName.Length() + 1 + oldHeaderValueLength)));                        
+            (offset + aHeaderName.Length() + 1 + oldHeaderValueLength)));
         }
     else
         {
@@ -921,11 +921,11 @@
         newHeaderPtr.Append(KHeaderNameEnding);
         newHeaderPtr.Append(aHeaderValue);
         newHeaderPtr.Append(KHeaderEnding);
-        }        
+        }
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
@@ -943,14 +943,14 @@
     RFileWriteStream temp;
     TPtr8 ptr(NULL, 0, 0);
     TInt offset = 0;
-    
+
     // Find the path of the file to be modified and put the tempfile
     // into that directory
     tempFilePath.Set(aOriginalFileName.Left(
         aOriginalFileName.LocateReverse('\\') + 1));
     User::LeaveIfError(temp.Temp(aFs, tempFilePath, aTempFileName, EFileWrite));
     CleanupClosePushL( temp );
-    
+
     temp.WriteUint8L(1);
     temp.WriteUint8L(aDcf.iMimeType->Length());
     temp.WriteUint8L(aDcf.iContentID->Length());
@@ -973,20 +973,20 @@
         {
         ptr.Set(buffer->Des());
         ptr.SetLength(0);
-        aOriginalFile.Read(ptr);         
+        aOriginalFile.Read(ptr);
         if (ptr.Length() > 0)
             {
             temp.WriteL(ptr);
             }
         }
     while (ptr.Length() > 0);
-    temp.CommitL();           
+    temp.CommitL();
     CleanupStack::PopAndDestroy(); // temp
     CleanupStack::PopAndDestroy(); //buffer
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
@@ -1006,14 +1006,14 @@
     TPtr8 ptr(NULL, 0, 0);
     TInt offset = 0;
     TInt fileSize = 0;
-    
+
     // Find the path of the file to be modified and put the tempfile
     // into that directory
     tempFilePath.Set(_L("C:\\"));
-    User::LeaveIfError( temp.Temp( aFs, tempFilePath, tempFile, 
+    User::LeaveIfError( temp.Temp( aFs, tempFilePath, tempFile,
                         EFileWrite));
     CleanupClosePushL( temp );
-    
+
     temp.WriteUint8L(1);
     temp.WriteUint8L(aDcf.iMimeType->Length());
     temp.WriteUint8L(aDcf.iContentID->Length());
@@ -1036,7 +1036,7 @@
         {
         ptr.Set(buffer->Des());
         ptr.SetLength(0);
-        aOriginalFile.Read(ptr);         
+        aOriginalFile.Read(ptr);
         if (ptr.Length() > 0)
             {
             temp.WriteL(ptr);
@@ -1044,57 +1044,57 @@
         }
     while (ptr.Length() > 0);
     temp.CommitL();
-    
+
     CleanupStack::PopAndDestroy(2); //buffer, temp
     // Get the size of the temp file
 
 
     User::LeaveIfError( tempFileHandle.Open( aFs, tempFile, EFileRead ));
-    CleanupClosePushL( tempFileHandle );    
-    tempFileHandle.Size( fileSize );               
-    
-    
+    CleanupClosePushL( tempFileHandle );
+    tempFileHandle.Size( fileSize );
+
+
     // Set the fileSize of the original file
     User::LeaveIfError( aOriginalFile.SetSize( fileSize ) );
     offset = 0;
     User::LeaveIfError( tempFileHandle.Seek( ESeekStart, offset ) );
     orig.Attach( aOriginalFile );
     CleanupClosePushL( orig );
-     
-    buffer = HBufC8::NewLC(KBufferSize);    
+
+    buffer = HBufC8::NewLC(KBufferSize);
     // Copy the file over because we can't use other copy things:
     do
         {
         ptr.Set(buffer->Des());
         ptr.SetLength(0);
-        tempFileHandle.Read(ptr);         
+        tempFileHandle.Read(ptr);
         if (ptr.Length() > 0)
             {
             orig.WriteL(ptr);
             }
         }
     while (ptr.Length() > 0);
-    
-    // Write the changes    
+
+    // Write the changes
     orig.CommitL();
-    
+
     // close the tempfile
     CleanupStack::PopAndDestroy(3); // buffer, tempFileHandle, orig
-    
+
     // Delete the temp file
     User::LeaveIfError( aFs.Delete( tempFile ) );
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 LOCAL_C void SetFileHeaderL(
-    const TDesC16& aFileName, 
-    const TDesC8& aHeaderName, 
+    const TDesC16& aFileName,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue)
     {
     __UHEAP_MARK;
@@ -1110,7 +1110,7 @@
 
     CleanupClosePushL(file);
     dcf = COma1Dcf::NewL(file);
-    
+
     CleanupStack::PushL(dcf);
     GetNewHeaderBufferL(dcf->iHeaders, aHeaderName, aHeaderValue, newHeaderBuf);
     delete dcf->iHeaders;
@@ -1120,29 +1120,29 @@
     CleanupStack::PopAndDestroy(2); // file, dcf
     User::LeaveIfError( fs.Replace( tempFileName, aFileName ) );
     CleanupStack::PopAndDestroy(); // fs
-    
+
     __UHEAP_MARKEND;
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 LOCAL_C void SetFileHeaderL(
-    RFile& aFileHandle, 
-    const TDesC8& aHeaderName, 
+    RFile& aFileHandle,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue)
     {
     HBufC8* newHeaderBuf = NULL;
     COma1Dcf* dcf = NULL;
     RFs fs;
-    
+
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL( fs );
-    
+
     dcf = COma1Dcf::NewL(aFileHandle);
     if (dcf == NULL)
         {
@@ -1158,15 +1158,15 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void SetContentHeaderL(
-    HBufC8*& aContent, 
-    const TDesC8& aHeaderName, 
+    HBufC8*& aContent,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue)
     {
     HBufC8* newHeaderBuf = NULL;
@@ -1211,33 +1211,33 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetHeaderL(
-    const TDesC8& aContent, 
-    const TDesC8& aHeaderName, 
+    const TDesC8& aContent,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
-    
+
     TInt i;
     TInt j;
     TPtrC8 ptr( aContent );
-    
+
     // Add Room for CRLF and Semicolon:
-    HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 );  
-    TPtr8 searchBuf( const_cast<TUint8*>(buffer->Ptr()), 0, buffer->Des().MaxSize() );  
+    HBufC8* buffer = HBufC8::NewMaxLC( aHeaderName.Length() + 3 );
+    TPtr8 searchBuf( const_cast<TUint8*>(buffer->Ptr()), 0, buffer->Des().MaxSize() );
 
     searchBuf.Copy(aHeaderName);
     searchBuf.Append(KHeaderNameEnding);
-    
-    // First see if the     
+
+    // First see if the
     i = ptr.Find(searchBuf);
     User::LeaveIfError( i );
-        
+
     if( i > 0 )
         {
         // if it's not the first one, use the search buffer:
@@ -1245,31 +1245,31 @@
         searchBuf.Copy(KHeaderEnding);
         searchBuf.Append(aHeaderName);
         searchBuf.Append(KHeaderNameEnding);
-    
-        // First see if the     
+
+        // First see if the
         i = ptr.Find(searchBuf);
-        User::LeaveIfError( i );      
+        User::LeaveIfError( i );
         }
-    // Move search buffer    
-    i += searchBuf.Length();  
-    
+    // Move search buffer
+    i += searchBuf.Length();
+
     j = ptr.Mid(i).Find(KHeaderEnding);
     User::LeaveIfError( j );
-            
-    aHeaderValue = ptr.Mid(i, j).AllocL();  
-    CleanupStack::PopAndDestroy(); // buffer  
+
+    aHeaderValue = ptr.Mid(i, j).AllocL();
+    CleanupStack::PopAndDestroy(); // buffer
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetContentHeaderL(
-    const TDesC8& aContent, 
-    const TDesC8& aHeaderName, 
+    const TDesC8& aContent,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
     COma1Dcf* dcf = NULL;
@@ -1280,15 +1280,15 @@
     CleanupStack::PopAndDestroy(); // dcf
     }
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetFileHeaderL(
-    const TFileName& aFileName, 
-    const TDesC8& aHeaderName, 
+    const TFileName& aFileName,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
     RFs fs;
@@ -1304,15 +1304,15 @@
     }
 
 // -----------------------------------------------------------------------------
-// 
+//
 //
 // Parameters:
 //
 // Returns:
 // -----------------------------------------------------------------------------
 void GetFileHeaderL(
-    RFile& aFileHandle, 
-    const TDesC8& aHeaderName, 
+    RFile& aFileHandle,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
     CDcfCommon* dcf = NULL;
@@ -1355,31 +1355,31 @@
     TInt err = 0;
     TDataType type;
     RFs fs;
-    RFileReadStream reader;    
-    
+    RFileReadStream reader;
+
     aCount = 0;
     err = fs.Connect();
-    if (!err) 
+    if (!err)
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-        
+
     err = reader.Open(fs, KDataTypesFile, EFileRead);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     fs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName dataTypesFile;
-	dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
-          
+    dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
+
     err = reader.Open(fs, dataTypesFile, EFileRead);
-    
+
 #endif
-        
+
         if (err == KErrNotFound)
             {
             err = DRMCommon::EOk;
@@ -1391,19 +1391,19 @@
                 TRAP(err, (reader >> type));
                 if (err == KErrNone) aCount++;
                 }
-            
+
             if (err == KErrEof)
                 {
                 err = DRMCommon::EOk;
                 }
-            
+
             reader.Release();
             reader.Close();
             }
         }
-    
+
     fs.Close();
-    
+
     return err;
     }
 
@@ -1419,7 +1419,7 @@
 //      KErrEof: Data type not found
 // -----------------------------------------------------------------------------
 LOCAL_C TInt SupportedDynamicDataType(
-    const TInt aIndex, 
+    const TInt aIndex,
     TDataType& aDataType)
     {
     TInt err = KErrNone;
@@ -1427,50 +1427,50 @@
     RFs fs;
     TDataType type;
     RFileReadStream reader;
-    
+
     err = fs.Connect();
-    if (!err) 
+    if (!err)
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-        
+
         err = reader.Open(fs, KDataTypesFile, EFileRead);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
         TInt driveNumber( -1 );
         TChar driveLetter;
         DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-    	fs.DriveToChar( driveNumber, driveLetter );
-        
-    	TFileName dataTypesFile;
-	    dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
-        
+        fs.DriveToChar( driveNumber, driveLetter );
+
+        TFileName dataTypesFile;
+        dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
+
         err = reader.Open(fs, dataTypesFile, EFileRead);
-    
+
 #endif
-        
-        if (!err) 
+
+        if (!err)
             {
             i = -1;
-            while (err == 0 && i != aIndex) 
+            while (err == 0 && i != aIndex)
                 {
                 TRAP(err, (reader >> type));
                 i++;
                 }
-            
+
             if (!err)
                 {
-                aDataType = type;  
+                aDataType = type;
                 }
-            
+
             reader.Release();
             reader.Close();
             }
         }
-    
+
     fs.Close();
-    
+
     return err;
     }
 
@@ -1486,7 +1486,7 @@
 //      KErrEof: Data type not found
 // -----------------------------------------------------------------------------
 LOCAL_C TInt SupportedStaticDataType(
-    const TInt aIndex, 
+    const TInt aIndex,
     TDataType& aDataType)
     {
     TInt err = 0;
@@ -1497,51 +1497,51 @@
     RResourceFile resourceFile;
     HBufC8* res = NULL;
     TResourceReader theReader;
-    
+
     err = fs.Connect();
     if (err)
         {
         fs.Close();
         return err;
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     TRAP(err, resourceFile.OpenL(fs, KResourceFile));
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
     fs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName resFile;
-	resFile.Format( KResourceFile, (TUint)driveLetter );
-    
+    resFile.Format( KResourceFile, (TUint)driveLetter );
+
     TRAP(err, resourceFile.OpenL(fs, resFile));
-    
+
 #endif
     if (err)
         {
         fs.Close();
         return err;
         }
-    
-    TRAP(err, (res = resourceFile.AllocReadL(DATATYPE))); 
+
+    TRAP(err, (res = resourceFile.AllocReadL(DATATYPE)));
     if (err)
         {
         resourceFile.Close();
         fs.Close();
         return err;
         }
-    
+
     theReader.SetBuffer(res);
     index = aIndex + 1;
     TPtrC temp16(theReader.ReadTPtrC(index, res));
     length = temp16.Length();
     HBufC8* temp = NULL;
-    temp = HBufC8::NewMax(length); 
+    temp = HBufC8::NewMax(length);
     if (temp)
         {
         TPtr8 ptr(temp->Des());
@@ -1556,19 +1556,19 @@
         {
         err = KErrNoMemory;
         }
-    
-    if (temp) 
+
+    if (temp)
         {
         delete temp;
         }
-    
+
     temp = NULL;
     resourceFile.Close();
-    if (res) 
+    if (res)
         {
         delete res;
         }
-    
+
     res = NULL;
     fs.Close();
     return err;
@@ -1593,52 +1593,52 @@
     RFileWriteStream writer;
     RFileReadStream reader;
     RFs fs;
-    
+
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
-    
+
     // Open the data types file
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
     User::LeaveIfError(reader.Open(fs, KDataTypesFile, EFileRead));
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     fs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName dataTypesFile;
-	dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
-    
+    dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
+
     User::LeaveIfError(reader.Open(fs, dataTypesFile, EFileRead));
-    
+
 #endif
-    
+
     CleanupReleasePushL(reader);
-    
+
     // Create and open a replacement file
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     User::LeaveIfError(writer.Replace(fs, KTempFile, EFileWrite));
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName tempFile;
     tempFile.Format( KTempFile, (TUint)driveLetter );
-    
+
     User::LeaveIfError(writer.Replace(fs, tempFile, EFileWrite));
-    
+
 #endif
-    
+
     CleanupReleasePushL(writer);
-    
+
     // Write all dynamic types into the replacement file, excluding the
     // data type to be removed
-    
+
     r = KErrNone;
     for (i = 0; r == KErrNone; i++)
         {
@@ -1651,22 +1651,22 @@
         }
     CleanupStack::PopAndDestroy();
     CleanupStack::PopAndDestroy();
-    
+
     // Replace the data type file with the replacement file
-    
+
 #ifndef RD_MULTIPLE_DRIVE
 
     fs.Replace(KTempFile, KDataTypesFile);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     fs.Replace(tempFile, dataTypesFile);
-    
+
 #endif
-    
-    
+
+
     CleanupStack::PopAndDestroy();
-    
+
     return DRMCommon::EOk;
     }
 
@@ -1686,52 +1686,52 @@
     RFileWriteStream writer;
     RFileReadStream reader;
     RFs fs;
-    
+
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
-    
+
     // Create and open a replacement file
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     User::LeaveIfError(writer.Replace(fs, KTempFile, EFileWrite));
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
     fs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName tempFile;
-	tempFile.Format( KTempFile, (TUint)driveLetter );
-    
+    tempFile.Format( KTempFile, (TUint)driveLetter );
+
     User::LeaveIfError(writer.Replace(fs, tempFile, EFileWrite));
-    
+
 #endif
-    
+
     CleanupReleasePushL(writer);
-    
+
     // Write the new data type into the replacement file
-    
+
     writer << aDataType;
     writer.CommitL();
-    
+
     // Write all other dynamic types into the replacement file
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     err = reader.Open(fs, KDataTypesFile, EFileRead);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName dataTypesFile;
     dataTypesFile.Format( KDataTypesFile, (TUint)driveLetter );
-    
+
     err = reader.Open(fs, dataTypesFile, EFileRead);
-    
+
 #endif
-    
+
     if (err == KErrNone)
         {
         CleanupReleasePushL(reader);
@@ -1741,23 +1741,23 @@
             }
         CleanupStack::PopAndDestroy();
         }
-    
+
     CleanupStack::PopAndDestroy();
-    
+
     // Replace the data type file with the replacement file
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     fs.Replace(KTempFile, KDataTypesFile);
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     fs.Replace(tempFile, dataTypesFile);
-    
+
 #endif
-    
+
     CleanupStack::PopAndDestroy();
-    
+
     return DRMCommon::EOk;
     }
 
@@ -1803,7 +1803,7 @@
 
     return dcf->iPadding;
     }
-    
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -1813,7 +1813,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C DRMCommon::DRMCommon(void)
     {
-    } 
+    }
 
 // -----------------------------------------------------------------------------
 // DRMCommon::ConstructL
@@ -1821,7 +1821,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void DRMCommon::ConstructL()
     {
-    } 
+    }
 
 // -----------------------------------------------------------------------------
 // DRMCommon::NewL
@@ -1847,13 +1847,13 @@
 // Checks if the give rights for a specific content URI are available.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::CheckContentRights(
-    const TDesC8& aContentID, 
+    const TDesC8& aContentID,
     TUint32 aRightsSpec)
     {
     TInt r = ENoRights;
     RDRMRightsClient client;
     TUint32 reason = 0;
-    
+
     if (client.Connect() == KErrNone)
         {
         r = client.CheckRights(aRightsSpec, aContentID, reason);
@@ -1868,7 +1868,7 @@
 // opening a given file and reading the content URI from there.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::CheckFileRights(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     TUint32 aRightsSpec)
     {
     TInt r = KErrNone;
@@ -1887,7 +1887,7 @@
 // opening a given file and reading the content URI from there.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::CheckFileRights(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     TUint32 aRightsSpec)
     {
     TInt r = KErrNone;
@@ -1906,7 +1906,7 @@
 // predefined header string.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::IsProtectedContent(
-    const TDesC8& aContent, 
+    const TDesC8& aContent,
     TBool& aProtection)
     {
     if (COma1Dcf::IsValidDcf(aContent) || COma2Dcf::IsValidDcf(aContent))
@@ -1926,7 +1926,7 @@
 // predefined header string.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::IsProtectedFile(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     TBool& aProtection)
     {
     TInt r = KErrNone;
@@ -1940,27 +1940,27 @@
 // predefined header string.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::IsProtectedFile(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     TBool& aProtection)
     {
     TInt r = KErrNone;
     TRAP(r, IsProtectedFileL(aFileHandle, aProtection));
     return r;
     }
-    
+
 // -----------------------------------------------------------------------------
 // DRMCommon::GetContentInfo
 // Returns DRM information about a memory buffer.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetContentInfo(
-    const TDesC8& aContent, 
-    TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    const TDesC8& aContent,
+    TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength)
     {
     TInt r = KErrNone;
-    TRAP(r, GetContentInfoL(aContent, aProtection, aMIMEType, aContentURI, 
+    TRAP(r, GetContentInfoL(aContent, aProtection, aMIMEType, aContentURI,
         aDataLength));
     return r;
     }
@@ -1970,14 +1970,14 @@
 // Returns DRM information about a file.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetFileInfo(
-    const TDesC& aFileName, 
-    TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    const TDesC& aFileName,
+    TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength)
     {
     TInt r = KErrNone;
-    TRAP(r, GetFileInfoL(aFileName, aProtection, aMIMEType, aContentURI, 
+    TRAP(r, GetFileInfoL(aFileName, aProtection, aMIMEType, aContentURI,
         aDataLength));
     return r;
     }
@@ -1987,14 +1987,14 @@
 // Returns DRM information about a file.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetFileInfo(
-    RFile& aFileHandle, 
-    TContentProtection& aProtection, 
-    HBufC8*& aMIMEType, 
-    HBufC8*& aContentURI, 
+    RFile& aFileHandle,
+    TContentProtection& aProtection,
+    HBufC8*& aMIMEType,
+    HBufC8*& aContentURI,
     TUint& aDataLength)
     {
     TInt r = KErrNone;
-    TRAP(r, GetFileInfoL(aFileHandle, aProtection, aMIMEType, aContentURI, 
+    TRAP(r, GetFileInfoL(aFileHandle, aProtection, aMIMEType, aContentURI,
         aDataLength));
     return r;
     }
@@ -2004,8 +2004,8 @@
 // Returns an optional header from a memory buffer containing encrypted content.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetContentHeader(
-    const TDesC8& aContent, 
-    const TDesC8& aHeaderName, 
+    const TDesC8& aContent,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
     TInt r = KErrNone;
@@ -2019,8 +2019,8 @@
 // Returns an optional header from a file containing encrypted content.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetFileHeader(
-    const TFileName& aFileName, 
-    const TDesC8& aHeaderName, 
+    const TFileName& aFileName,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
     TInt r = KErrNone;
@@ -2034,8 +2034,8 @@
 // Returns an optional header from a file containing encrypted content.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetFileHeader(
-    RFile& aFileHandle, 
-    const TDesC8& aHeaderName, 
+    RFile& aFileHandle,
+    const TDesC8& aHeaderName,
     HBufC8*& aHeaderValue)
     {
     TInt r = KErrNone;
@@ -2049,8 +2049,8 @@
 // Sets the specified optional header field of a DCF buffer.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::SetContentHeader(
-    HBufC8*& aContent, 
-    const TDesC8& aHeaderName, 
+    HBufC8*& aContent,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue)
     {
     TInt r = KErrNone;
@@ -2064,8 +2064,8 @@
 // Sets the specified optional header field of a DCF buffer.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::SetFileHeader(
-    const TDesC16& aFileName, 
-    const TDesC8& aHeaderName, 
+    const TDesC16& aFileName,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue)
     {
     TInt r = KErrNone;
@@ -2079,8 +2079,8 @@
 // Sets the specified optional header field of a DCF buffer.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::SetFileHeader(
-    RFile& aFileHandle, 
-    const TDesC8& aHeaderName, 
+    RFile& aFileHandle,
+    const TDesC8& aHeaderName,
     const TDesC8& aHeaderValue)
     {
     TInt r = KErrNone;
@@ -2094,8 +2094,8 @@
 // Looks up the rights object using the content URI and the local ID.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetSingleRightsObject(
-    const TDesC8& aContentURI, 
-    TUint32 aLocalID, 
+    const TDesC8& aContentURI,
+    TUint32 aLocalID,
     CDRMRights*& aRightsObject)
     {
     TInt r = KErrNone;
@@ -2108,7 +2108,7 @@
 // Returns all rights objects for a content URI
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetDetailedContentRights(
-    const TDesC8& aContentURI, 
+    const TDesC8& aContentURI,
     RPointerArray<CDRMRights>*& aRightsList)
     {
     TInt r = KErrNone;
@@ -2126,7 +2126,7 @@
 // Returns all rights objects for a content URI from a given file
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetDetailedFileRights(
-    const TDesC& aFileName, 
+    const TDesC& aFileName,
     RPointerArray<CDRMRights>*& aRightsList)
     {
     TInt r = KErrNone;
@@ -2138,13 +2138,13 @@
         }
     return r;
     }
-    
+
 // -----------------------------------------------------------------------------
 // DRMCommon::GetDetailedFileRights
 // Returns all rights objects for a content URI from a given file
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::GetDetailedFileRights(
-    RFile& aFileHandle, 
+    RFile& aFileHandle,
     RPointerArray<CDRMRights>*& aRightsList)
     {
     TInt r = KErrNone;
@@ -2155,7 +2155,7 @@
         AddParents( const_cast<DRMCommon*>(this), *aRightsList );
         }
     return r;
-    }    
+    }
 
 // -----------------------------------------------------------------------------
 // DRMCommon::GetActiveRights
@@ -2167,13 +2167,13 @@
     CDRMRights*& aRightsObject)
     {
     TInt r = KErrNone;
-    
+
     TRAP( r, GetActiveRightsL( aContentURI, aConstraints, aRightsObject ) );
     if(r != KErrNone)
         {
-        return DRMCommon::ENoRights;    
+        return DRMCommon::ENoRights;
         }
-    else 
+    else
         {
         CDRMRights::TRestriction restriction;
         CDRMRights::TExpiration expiration;
@@ -2192,7 +2192,7 @@
     {
     RDRMRightsClient client;
     TInt error = client.Connect();
-    
+
     aURIList = NULL;
     if (!error)
         {
@@ -2214,7 +2214,7 @@
             }
         client.Close();
         }
-    
+
     return error;
     }
 
@@ -2225,16 +2225,16 @@
 EXPORT_C TInt DRMCommon::Connect()
     {
     RDRMRightsClient client; // Used to start RightsServer in bootup
-    TInt ignore = 0;				 // error will be ignored, if it fails to start the
+    TInt ignore = 0;                 // error will be ignored, if it fails to start the
                              // rights server there is nothing we can really
                              // do about it, and normally this would work and
                              // return AOk, just used because of the SkinSrv
                              // Bootup thing
     ignore = client.Connect();        // Called by SkinSrv during bootup
-		if( ignore ) 
-		    {
-		    // The error shouldn't matter since it will be retried	
-		    }
+        if( ignore )
+            {
+            // The error shouldn't matter since it will be retried
+            }
     client.Close();
     return EOk;
     }
@@ -2274,8 +2274,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TVersion DRMCommon::Version()
     {
-    return TVersion(KClientVersionMajor, 
-        KClientVersionMinor, 
+    return TVersion(KClientVersionMajor,
+        KClientVersionMinor,
         KClientVersionBuild);
     }
 
@@ -2285,8 +2285,8 @@
 // -----------------------------------------------------------------------------
 EXPORT_C TVersion DRMCommon::ServerVersion()
     {
-    return TVersion(KServerVersionMajor, 
-        KServerVersionMinor, 
+    return TVersion(KServerVersionMajor,
+        KServerVersionMinor,
         KServerVersionBuild);
     }
 
@@ -2300,19 +2300,19 @@
     TInt err = 0;
     TInt staticTotal = 0;
     TInt dynamicTotal = 0;
-    
-    err = StaticDataTypesCount(staticTotal);    
+
+    err = StaticDataTypesCount(staticTotal);
     if (err)
         {
-        return err;  
+        return err;
         }
-    
+
     err = DynamicDataTypesCount(dynamicTotal);
     if (err)
         {
-        return err;  
+        return err;
         }
-    
+
     aCount = staticTotal + dynamicTotal;
     return err;
     }
@@ -2322,13 +2322,13 @@
 // Returns a specific DRM enabled MIME type.
 // -----------------------------------------------------------------------------
 EXPORT_C TInt DRMCommon::SupportedDataType(
-    const TInt aIndex, 
+    const TInt aIndex,
     TDataType& aDataType)
     {
     TInt err = KErrNone;
     TInt total = 0;
     TInt stat = 0;
-    
+
     err = DataTypesCount(total);
     if (!err) err = StaticDataTypesCount(stat);
     if (!err)
@@ -2346,7 +2346,7 @@
             err = KErrArgument;
             }
         }
-    
+
     return err;
     }
 
@@ -2361,51 +2361,51 @@
     RFs fs;
     RResourceFile resourceFile;
     TResourceReader theReader;
-    
+
     err = fs.Connect();
-    
+
     if (err)
         {
         fs.Close();
         return err;
         }
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     TRAP(err, resourceFile.OpenL(fs, KResourceFile));
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
     fs.DriveToChar( driveNumber, driveLetter );
-    
+
     TFileName resFile;
-	resFile.Format( KResourceFile, (TUint)driveLetter );
-    
+    resFile.Format( KResourceFile, (TUint)driveLetter );
+
     TRAP(err, resourceFile.OpenL(fs, resFile));
-    
+
 #endif
     if (err)
         {
         fs.Close();
         return err;
         }
-    
+
     HBufC8* res = NULL;
-    TRAP(err, (res = resourceFile.AllocReadL(DATATYPE))); 
+    TRAP(err, (res = resourceFile.AllocReadL(DATATYPE)));
     if (err)
         {
         resourceFile.Close();
         fs.Close();
         return err;
         }
-    
-    
+
+
     theReader.SetBuffer(res);
     aCount = theReader.ReadInt8();
-    
+
     delete res;
     res = NULL;
     resourceFile.Close();
@@ -2424,7 +2424,7 @@
     TInt err = KErrNone;
     TInt i;
     TDataType type;
-    
+
     if (aDataType.Des().Length() > 0)
         {
         err = DataTypesCount(total);
@@ -2433,10 +2433,10 @@
             err = SupportedDataType(i, type);
             if (type == aDataType)
                 {
-                err = KErrAlreadyExists;   
+                err = KErrAlreadyExists;
                 }
             }
-        
+
         if (!err)
             {
             TRAP(err, RegisterDynamicDataTypeL(aDataType));
@@ -2444,7 +2444,7 @@
         }
     else
         {
-        err = KErrArgument;  
+        err = KErrArgument;
         }
     return err;
     }
@@ -2459,7 +2459,7 @@
     TInt r;
     TInt count;
     TInt total;
-    
+
     StaticDataTypesCount(count);
     r = DataTypesCount(total);
     if (r == KErrNone && aIndex >= count && aIndex < total)
@@ -2495,7 +2495,7 @@
                 CDRMRights::TRestriction restriction;
                 CDRMRights::TExpiration expiration;
                 TUint32 constraints;
-                aRights->GetRightsInfo(EUnknown, restriction, expiration, 
+                aRights->GetRightsInfo(EUnknown, restriction, expiration,
                     constraints);
                 if ( expiration == CDRMRights::EValidRights)
                     {
@@ -2507,11 +2507,11 @@
             delete parents;
             }
         }
-    */    
+    */
     }
- 
- 
- 
+
+
+
 
 // -----------------------------------------------------------------------------
 // GetFileHandle
@@ -2521,8 +2521,8 @@
 // 3)  EFileShareReadersOnly
 // -----------------------------------------------------------------------------
 LOCAL_C TInt GetFileHandleRead(
-    RFs& aFileServer, 
-    RFile& aFile, 
+    RFs& aFileServer,
+    RFile& aFile,
     const TDesC& aFileName )
     {
     TInt error = KErrNone;
@@ -2536,10 +2536,10 @@
         if( error != KErrNone )
             {
             // 3) Try to open in EFileShareReadersOnly
-            error = aFile.Open( aFileServer, aFileName, EFileRead | EFileShareReadersOnly );            
+            error = aFile.Open( aFileServer, aFileName, EFileRead | EFileShareReadersOnly );
             }
         }
-    return error;   
+    return error;
     };
 
 // -----------------------------------------------------------------------------
@@ -2549,19 +2549,19 @@
 // 2)  EFileShareAny
 // 3)  EFileShareReadersOnly
 // -----------------------------------------------------------------------------
-LOCAL_C void AddParents( DRMCommon* aDrmCommon, 
-                         RPointerArray<CDRMRights>& aRights ) 
+LOCAL_C void AddParents( DRMCommon* aDrmCommon,
+                         RPointerArray<CDRMRights>& aRights )
     {
     HBufC8* parent = NULL;
     RPointerArray<CDRMRights>* parents = NULL;
     TInt error = KErrNone;
     RPointerArray<HBufC8> usedParents;
-    
-    
+
+
     for( TInt i = 0; i < aRights.Count(); i++ )
         {
         parent = aRights[i]->GetPermission().iParentUID;
-        
+
         for(TInt counter = 0; counter < usedParents.Count(); counter++ )
             {
             if( parent && !usedParents[counter]->Compare( *parent ) )
@@ -2569,28 +2569,28 @@
                 parent = NULL;
                 }
             }
-        
+
         if( parent != NULL )
             {
             TRAP( error, usedParents.AppendL( parent ) );
-            
+
             if( aDrmCommon->GetDetailedContentRights(parent->Des(), parents) == KErrNone )
                 {
                 for( TInt j = parents->Count()-1; j >= 0;j-- )
-                    { 
+                    {
                     TRAP( error, aRights.AppendL( (*parents)[j] ) );
                     (*parents)[j] = NULL;
                     parents->Remove(j);
                     }
-                parents->ResetAndDestroy();    
+                parents->ResetAndDestroy();
                 delete parents;
-                parents = NULL;    
+                parents = NULL;
                 }
-            
+
             }
         }
     usedParents.Reset();
-    usedParents.Close();        
+    usedParents.Close();
     }
 
 // -----------------------------------------------------------------------------
--- a/omadrm/drmengine/legacy/src/drmcommon.rss	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/legacy/src/drmcommon.rss	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/omadrm/drmengine/notifier/inc/DRMNotifierClient.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/notifier/inc/DRMNotifierClient.h	Wed Jun 23 17:42:58 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  This class handles communications between a notifier client & 
+* Description:  This class handles communications between a notifier client &
 *                DRM server in DRM notifier.
 *
 */
@@ -22,7 +22,7 @@
 #define RDRMNOTIFIERCLIENT_H
 
 //  INCLUDES
-#include <E32STD.H>
+#include <e32std.h>
 #include <DRMEvent.h>
 
 // CONSTANTS
@@ -36,7 +36,7 @@
 
 /**
 *  This class handles all client/server communications.
-*  
+*
 *  @lib DRMCommon.dll
 *  @since S60Rel2.6
 */
@@ -46,16 +46,16 @@
        /**
         * C++ default constructor.
         */
-       RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, 
+       RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait,
                           TPtr8* aPtr, TPtr8* aWaitPtr);
-       
+
        /**
         * Destructor.
         */
        virtual ~RDRMNotifierClient();
-       
+
     public: // New functions
-        
+
        /**
        * This method opens a connection to the server.
        * @since S60Rel2.6
@@ -72,7 +72,7 @@
        * @since S60Rel2.6
        * @param aStatus  the status will be updated when the a notification
        *                 has been received
-       * @return none 
+       * @return none
        */
        void WaitForCompletion( TRequestStatus& aStatus );
 
@@ -86,7 +86,7 @@
        * @since S60Rel2.6
        * @param aStatus  the status will be updated when all notifications have
        *                 been forwarded
-       * @return none 
+       * @return none
        */
        void SendEvent( TRequestStatus& aStatus );
 
@@ -100,7 +100,7 @@
        * @since S60Rel2.6
        * @param aEventType  the event type to listen to
        * @param aURI  optional URI to limit the C/S communication
-       * @return none 
+       * @return none
        */
        void RegisterForType( TDRMEventType aEventType, HBufC8* aURI = 0 );
 
@@ -108,14 +108,14 @@
        /**
        * UnRegisterFromType
        *
-       * Unregister from the server from listening to specific event types, 
-       * if a URI is provided notifications of the type that have that URI 
+       * Unregister from the server from listening to specific event types,
+       * if a URI is provided notifications of the type that have that URI
        * as affected URI will get unregistered
        *
        * @since S60Rel2.6
        * @param aEventType  the event type to listen to
        * @param aURI  optional URI to limit the C/S communication
-       * @return none 
+       * @return none
        */
        void UnRegisterFromType( TDRMEventType aEventType, HBufC8* aURI = 0 );
 
@@ -131,13 +131,13 @@
        */
        void CancelRequest();
 
-       
+
     public: // Functions from base classes
-        void Close();      
+        void Close();
     protected:  // New functions
-        
+
     protected:  // Functions from base classes
-        
+
     private:
 
         // Prohibit copy constructor
@@ -153,12 +153,12 @@
         TPtr8* iData;
         TPtr8* iWaitData;
         TPckg<TInt> numdata;
-        
+
     public:     // Friend classes
     protected:  // Friend classes
     private:    // Friend classes
     };
 
 #endif      // RDRMNOTIFIERCLIENT_H
-            
+
 // End of File
--- a/omadrm/drmengine/notifier/src/DRMNotifierClient.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/notifier/src/DRMNotifierClient.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,9 +20,9 @@
 // INCLUDE FILES
 #include    "DRMNotifierClient.h"
 #include "drmnotifierclientserver.h"
-#include "drmrightsclient.h"
+#include "DRMRightsClient.h"
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 // MACROS
 // LOCAL CONSTANTS AND MACROS
@@ -38,7 +38,7 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-RDRMNotifierClient::RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, 
+RDRMNotifierClient::RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait,
                                        TPtr8* aPtr, TPtr8* aWaitPtr) :
     iEventType( aEventType ),
     iEventTypeWait( aEventTypeWait ),
@@ -48,7 +48,7 @@
     {
    // Nothing
     }
-    
+
 // Destructor
 RDRMNotifierClient::~RDRMNotifierClient()
     {
@@ -64,15 +64,15 @@
 //
 TInt RDRMNotifierClient::Connect( void )
     {
-    const TVersion requiredVersion( 
+    const TVersion requiredVersion(
         DRMNotifier::KServerMajorVersion,
         DRMNotifier::KServerMinorVersion,
         DRMNotifier::KServerBuildVersion );
-    
+
     TInt ret = KErrNotFound;
     TUint8 count( 0 );
     TUint8 cont( 1 );
-    
+
     do
         {
         ret = CreateSession( DRMNotifier::KServerName,
@@ -91,7 +91,7 @@
             }
         }
     while ( cont && ( count < 2 ) );
-    
+
     return ret;
     }
 
@@ -101,7 +101,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void RDRMNotifierClient::Close() 
+void RDRMNotifierClient::Close()
     {
     RHandleBase::Close();
     }
@@ -113,11 +113,11 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void RDRMNotifierClient::SendEvent(TRequestStatus& aStatus) 
+void RDRMNotifierClient::SendEvent(TRequestStatus& aStatus)
     {
     // Send the message.
     SendReceive( DRMNotifier::ENotifyClients, TIpcArgs(iData, *iEventType),
-		aStatus );
+        aStatus );
     };
 
 // -----------------------------------------------------------------------------
@@ -126,13 +126,13 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void RDRMNotifierClient::WaitForCompletion(TRequestStatus& aStatus) 
-    {   
+void RDRMNotifierClient::WaitForCompletion(TRequestStatus& aStatus)
+    {
     numdata.Set(reinterpret_cast<TUint8*>(iEventTypeWait),sizeof(TDRMEventType),sizeof(TDRMEventType));
-        
+
     // Send the message.
     SendReceive( DRMNotifier::ERecieveNotification, TIpcArgs(iWaitData, &numdata),
-		aStatus );
+        aStatus );
     };
 
 // -----------------------------------------------------------------------------
@@ -141,7 +141,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void RDRMNotifierClient::RegisterForType( TDRMEventType aEventType, 
+void RDRMNotifierClient::RegisterForType( TDRMEventType aEventType,
                                           HBufC8* aURI )
     {
     TPckg<TInt> eventType(0);
@@ -155,7 +155,7 @@
         // Send the message.
         SendReceive( DRMNotifier::ERegisterURI, TIpcArgs(&uriPkg, &eventType));
         }
-    else 
+    else
         {
         // Send the message.
         SendReceive( DRMNotifier::ERegister, TIpcArgs(&eventType));
@@ -168,7 +168,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void RDRMNotifierClient::UnRegisterFromType( TDRMEventType aEventType, 
+void RDRMNotifierClient::UnRegisterFromType( TDRMEventType aEventType,
                                              HBufC8* aURI)
     {
     TPckg<TInt> eventType(0);
@@ -182,7 +182,7 @@
         // Send the message.
         SendReceive( DRMNotifier::EUnRegisterURI, TIpcArgs(&uriPkg, &eventType));
         }
-    else 
+    else
         {
         // Send the message.
         SendReceive( DRMNotifier::EUnRegister, TIpcArgs(&eventType));
@@ -202,4 +202,4 @@
     SendReceive( DRMNotifier::ECancelNotification);
     };
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/notifier/src/DRMNotifierSession.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 #include <s32file.h>
 #include <f32file.h>
-#include "drmcommon.h"
+#include "DRMCommon.h"
 #include "DRMNotifierSession.h"
 #include "DRMNotifierServer.h"
 #include "drmnotifierclientserver.h"
@@ -29,7 +29,7 @@
 using namespace DRMNotifier;
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 
 
@@ -70,7 +70,7 @@
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 //
-CDRMNotifierSession* CDRMNotifierSession::NewL( CDRMMessageStorage* aStorage) 
+CDRMNotifierSession* CDRMNotifierSession::NewL( CDRMMessageStorage* aStorage)
     {
     CDRMNotifierSession* self = new( ELeave ) CDRMNotifierSession( aStorage );
     CleanupStack::PushL( self );
@@ -102,7 +102,7 @@
     for( i = 0; i < iMessageQueue.Count(); i++ )
         {
         if( this->iStorage ) // coverity check
-            {    
+            {
             iStorage->UpdateMessage(iMessageQueue[i]);
             }
         }
@@ -159,9 +159,9 @@
     {
     LOG( _L8( "ServiceL called" ) );
     // Trap possible errors...
-    
+
     TRAPD( error, DispatchL( aMessage ) );
-    
+
     if ( error )
         {
         LOG( _L8( "DispatcL threw an exception" ) );
@@ -179,7 +179,7 @@
 // Default constructor.
 // -----------------------------------------------------------------------------
 //
-CDRMNotifierSession::CDRMNotifierSession( CDRMMessageStorage* aStorage ) : 
+CDRMNotifierSession::CDRMNotifierSession( CDRMMessageStorage* aStorage ) :
     // Base class' constructor is called first.
     iStorage( aStorage )
     {
@@ -197,13 +197,16 @@
 
 // -----------------------------------------------------------------------------
 // CDRMNotifierSession::DispatchL
-// Checks which command the user requested, and forwards the request to 
+// Checks which command the user requested, and forwards the request to
 // appropriate private method. This helps to keep the code more readable.
 // -----------------------------------------------------------------------------
 //
-void CDRMNotifierSession::DispatchL( const RMessage2& aMessage ) 
+void CDRMNotifierSession::DispatchL( const RMessage2& aMessage )
     {
-		RDebug::Printf(">>> [%s] %d", _S8(__PRETTY_FUNCTION__), aMessage.Function());
+    #ifdef _DEBUG
+    RDebug::Printf(">>> [%s] %d", _S8(__PRETTY_FUNCTION__), aMessage.Function());
+    #endif
+
     switch ( aMessage.Function() )
         {
         case ENotifyClients:
@@ -280,7 +283,7 @@
         {
         NotifyL( iMessageQueue[0], ETrue );
         }
- 
+
     // Message complete will be set elsewhere.
     // All done.
     }
@@ -321,18 +324,18 @@
 
     iIsInStorage = EFalse;
 
-	iIsListening = EFalse;
-	
-	if ( !iListener.IsNull() )
-		{
-		iListener.Complete( KErrCancel );
-		}
-	
+    iIsListening = EFalse;
+
+    if ( !iListener.IsNull() )
+        {
+        iListener.Complete( KErrCancel );
+        }
+
     aMessage.Complete( KErrNone );
     }
 // -----------------------------------------------------------------------------
 // CDRMNotifierSession::RegisterURIL
-// Get the information from the client, construct a rights object, and add 
+// Get the information from the client, construct a rights object, and add
 // it to the database.
 // -----------------------------------------------------------------------------
 //
@@ -358,7 +361,7 @@
 
 // -----------------------------------------------------------------------------
 // CDRMNotifierSession::UnRegisterURIL
-// Get the information from the client, construct a rights object, and add 
+// Get the information from the client, construct a rights object, and add
 // it to the database.
 // -----------------------------------------------------------------------------
 //
@@ -484,7 +487,7 @@
     TPtr8 data( reinterpret_cast<TUint8*>(&aMessage->iEventType),
                 sizeof(TDRMEventType),
                 sizeof(TDRMEventType));
-    TPtr8 event( aMessage->iMessageData, DRMNotifier::KDRMSizeOfMessage, 
+    TPtr8 event( aMessage->iMessageData, DRMNotifier::KDRMSizeOfMessage,
                  DRMNotifier::KDRMSizeOfMessage );
 
     iListener.WriteL(0, event);
@@ -521,4 +524,4 @@
     }
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/ro/inc/DRMProtectedRoParser.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/inc/DRMProtectedRoParser.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,11 +22,11 @@
 
 //  INCLUDES
 #include <e32std.h>
-#include <Xml/Parser.h>
-#include <Xml/ContentHandler.h>
-#include <Xml/XmlParserErrors.h>
-#include <Xml/Attribute.h>
-#include "DrmRightsClient.h"
+#include <xml/parser.h>
+#include <xml/contenthandler.h>
+#include <xml/xmlparsererrors.h>
+#include <xml/attribute.h>
+#include "DRMRightsClient.h"
 
 using namespace Xml;
 
@@ -52,24 +52,24 @@
             EXmlParser,
             EWbxmlParser
             };
-            
+
         static const TInt KMaxElementCount = 40;
         static const TInt KMaxElementNesting = 16;
-        
+
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         IMPORT_C static CDrmProtectedRoParser* NewL();
-        
+
         /**
         * Destructor.
         */
         IMPORT_C ~CDrmProtectedRoParser();
 
     public: // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -83,7 +83,7 @@
         IMPORT_C void ParseAndStoreL(
             const TDesC8& aProtectedRo,
             RPointerArray<CDRMRights>& aResultRights);
-            
+
         IMPORT_C HBufC8* GetRiUrlL(
             const TDesC8& aProtectedRo);
 
@@ -99,7 +99,7 @@
         * From ?base_class ?member_description.
         * @param aDocParam Specifies the various parameters of the document.
         * @arg   aDocParam.iCharacterSetName The character encoding of the document.
-        * @param aErrorCode is the error code. 
+        * @param aErrorCode is the error code.
         *        If this is not KErrNone then special action may be required.
         */
         void OnStartDocumentL(
@@ -108,7 +108,7 @@
 
         /**
         * From ?base_class ?member_description.
-        * @param aErrorCode is the error code. 
+        * @param aErrorCode is the error code.
         *        If this is not KErrNone then special action may be required.
         */
         void OnEndDocumentL(
@@ -123,8 +123,8 @@
         */
         void OnStartElementL(
             const RTagInfo& aElement,
-            const RAttributeArray& aAttributes, 
-			TInt aErrorCode);
+            const RAttributeArray& aAttributes,
+            TInt aErrorCode);
 
         /**
         * From ?base_class ?member_description.
@@ -138,8 +138,8 @@
 
         /**
         * From ?base_class ?member_description.
-        * @param aBytes is the raw content data for the element. 
-        *        The client is responsible for converting the data to the 
+        * @param aBytes is the raw content data for the element.
+        *        The client is responsible for converting the data to the
         *        required character set if necessary.
         *        In some instances the content may be binary and must not be converted.
         * @param aErrorCode is the error code.
@@ -158,8 +158,8 @@
         */
         void OnStartPrefixMappingL(
             const RString& aPrefix,
-            const RString& aUri, 
-			TInt aErrorCode);
+            const RString& aUri,
+            TInt aErrorCode);
 
         /**
         * From ?base_class ?member_description.
@@ -200,8 +200,8 @@
         */
         void OnProcessingInstructionL(
             const TDesC8& aTarget,
-            const TDesC8& aData, 
-			TInt aErrorCode);
+            const TDesC8& aData,
+            TInt aErrorCode);
 
         /**
         * From ?base_class ?member_description.
@@ -218,7 +218,7 @@
 
         /**
         * From ?base_class ?member_description.
-        * @return				0 if no interface matching the uid is found.
+        * @return               0 if no interface matching the uid is found.
                 Otherwise, the this pointer cast to that interface.
         * @param aUid the uid identifying the required interface.
         */
@@ -226,7 +226,7 @@
             const TInt32 aUid);
 
     protected:  // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -260,7 +260,7 @@
             const TDesC8& aData,
             TInt& aStart,
             TInt& aEnd);
-            
+
         /**
         * Handle a parsed domain RO which could not be added to the rights DB
         * because the device is not part of the domain.
@@ -272,13 +272,13 @@
             const TDesC8& aContentId,
             const TDesC8& aDomainRoData,
             CParsedProtectedRo* aDomainRo);
-            
+
         /**
         * Adds ROAP namespace URI to aProtectedRo if not already present
         * @since Series 60 3.0
         * @param aProtectedRo protected RO element
         * @return protected RO element, if namespace was not added NULL
-        */    
+        */
         HBufC8* CDrmProtectedRoParser::AddRoapNamespaceL(
             TDesC8& aProtectedRo ) const;
 
@@ -294,24 +294,24 @@
     private:  // Data
         // The XML parser
         CParser* iParser;
-        
+
         // Result of parsing the protected RO element
         CParsedProtectedRo* iRights;
-        
+
         // Expected element names
         RString iElements[KMaxElementCount];
-        
+
         // Parsing stack
         TInt iElementStack[KMaxElementNesting];
-        
+
         // Depth of the parsing stack
         TInt iElementStackDepth;
-        
+
         // Content between elements
         HBufC8* iContent;
 
     };
 
-#endif      // DRMPROTECTEDROPARSER_H   
-            
+#endif      // DRMPROTECTEDROPARSER_H
+
 // End of File
--- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00.h	Wed Jun 23 17:42:58 2010 +0100
@@ -24,50 +24,50 @@
 
 #include <e32std.h>
 #include <stringpool.h>
-#include <Xml/Plugins/StringDictionary.h>
+#include <xml/plugins/stringdictionary.h>
 
 
 class CDrmRel1_0StringDict00 : public CBase, public Xml::MStringDictionary
 /**
-The DrmRel1_0StringDict00 class is a derived class defining the API of a single string dictionary. 
+The DrmRel1_0StringDict00 class is a derived class defining the API of a single string dictionary.
 
 Derived classes must add all elements, attributes names, and attribute values that belong
-to this string dictionary as static string tables to the StringPool. WBXML token mappings between 
+to this string dictionary as static string tables to the StringPool. WBXML token mappings between
 strings and WBXML tokens should also be maintained.
 
 @internalTechnology
 @interim This is the first drop of this component.
 */
-	{
+    {
 public:
-	static Xml::MStringDictionary* NewL(TAny* aStringPool);
-	virtual ~CDrmRel1_0StringDict00();
-	void ConstructL();
+    static Xml::MStringDictionary* NewL(TAny* aStringPool);
+    virtual ~CDrmRel1_0StringDict00();
+    void ConstructL();
 
-	void ElementL(TInt aToken, RString& aElement) const;
-	void AttributeL(TInt aToken, RString& aAttribute) const;
-	void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const;
-	void AttributeValueL(TInt aToken, RString& aValue) const;
+    void ElementL(TInt aToken, RString& aElement) const;
+    void AttributeL(TInt aToken, RString& aAttribute) const;
+    void AttributeValuePairL(TInt aToken, RString& aAttribute, RString& aValue) const;
+    void AttributeValueL(TInt aToken, RString& aValue) const;
 
-	TBool CompareThisDictionary(const RString& aDictionaryDescription) const;
+    TBool CompareThisDictionary(const RString& aDictionaryDescription) const;
 
-	TInt SwitchCodePage(TInt aCodePage);
-	void PublicIdentifier(RString& aPubId);
-	void NamespaceUri(RString& aUri);
+    TInt SwitchCodePage(TInt aCodePage);
+    void PublicIdentifier(RString& aPubId);
+    void NamespaceUri(RString& aUri);
 
-	void Release();
+    void Release();
 
 public:
 
-	// CodePage tokens.
-	//
-	// Note: There will be correlation between these token values and their
-	// strings via the CDictionaryCodePage using the RStringPool.
+    // CodePage tokens.
+    //
+    // Note: There will be correlation between these token values and their
+    // strings via the CDictionaryCodePage using the RStringPool.
 
-	enum TTagToken
+    enum TTagToken
         {
-		// CodePage 00
-		// -//OMA//DTD DRMREL 1.0//EN
+        // CodePage 00
+        // -//OMA//DTD DRMREL 1.0//EN
         ERights = 0x05,
         EContext = 0x06,
         EVersion = 0x07,
@@ -87,37 +87,37 @@
         EStart = 0x15,
         EEnd = 0x16,
         EInterval = 0x17
-    	};
+        };
 
 
-	enum TAttributeToken
+    enum TAttributeToken
         {
-		// CodePage 00
-		// -//OMA//DTD DRMREL 1.0//EN
+        // CodePage 00
+        // -//OMA//DTD DRMREL 1.0//EN
         EXmlnsOEx = 0x05,
         EXmlnsODd = 0x06,
         EXmlnsDs = 0x07
-    	};
+        };
 
 
 
-	enum TAttributeValueToken
+    enum TAttributeValueToken
         {
-		// CodePage 00
-		// -//OMA//DTD DRMREL 1.0//EN
+        // CodePage 00
+        // -//OMA//DTD DRMREL 1.0//EN
         EValueXmlnsOEx = 0x05,
         EValueXmlnsODd = 0x06,
         EValueXmlnsDs = 0x07,
         EOdrlEx = 0x85,
         EOdrlDd = 0x86,
         EXmlDsig = 0x87
-	    };
+        };
 
 
 
 private:
 
-	CDrmRel1_0StringDict00(RStringPool* aStringPool);
+    CDrmRel1_0StringDict00(RStringPool* aStringPool);
 
 private:
 
@@ -125,17 +125,17 @@
 The StringPool for this string dictionary.
 We don't own this.
 */
-	RStringPool				iStringPool;
+    RStringPool             iStringPool;
 
-	Xml::CDictionaryCodePage*	iCodepage00Table;
+    Xml::CDictionaryCodePage*   iCodepage00Table;
 
-	TInt					iCodePage;
+    TInt                    iCodePage;
 
-	};
+    };
 
 
-const TInt iTagCodePage00[] = 
-	{
+const TInt iTagCodePage00[] =
+    {
     CDrmRel1_0StringDict00::ERights,
     CDrmRel1_0StringDict00::EContext,
     CDrmRel1_0StringDict00::EVersion,
@@ -155,30 +155,30 @@
     CDrmRel1_0StringDict00::EStart,
     CDrmRel1_0StringDict00::EEnd,
     CDrmRel1_0StringDict00::EInterval,
-	0 // ok to end with zero as this is used by a global token
-    }; 
+    0 // ok to end with zero as this is used by a global token
+    };
 
 
-const TInt iAttributeCodePage00[] = 
-	{
+const TInt iAttributeCodePage00[] =
+    {
     CDrmRel1_0StringDict00::EXmlnsOEx,
     CDrmRel1_0StringDict00::EXmlnsODd,
     CDrmRel1_0StringDict00::EXmlnsDs,
-	0  // ok to end with zero as this is used by a global token
+    0  // ok to end with zero as this is used by a global token
     };
 
 
 
-const TInt iAttributeValueCodePage00[] = 
-	{
+const TInt iAttributeValueCodePage00[] =
+    {
     CDrmRel1_0StringDict00::EXmlnsOEx,
     CDrmRel1_0StringDict00::EXmlnsODd,
     CDrmRel1_0StringDict00::EXmlnsDs,
     CDrmRel1_0StringDict00::EOdrlEx,
     CDrmRel1_0StringDict00::EOdrlDd,
     CDrmRel1_0StringDict00::EXmlDsig,
-	0 // ok to end with zero as this is used by a global token
-    }; 
+    0 // ok to end with zero as this is used by a global token
+    };
 
 
 #endif //__SISTRINGDICT00_H__
--- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeTable.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeTable.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,27 +21,27 @@
 #ifndef STRINGTABLE_DrmRel1_0StringDict00AttributeTable
 #define STRINGTABLE_DrmRel1_0StringDict00AttributeTable
 
-#include "StringPool.h"
+#include "stringpool.h"
 
 struct TStringTable;
 
 /** A String table */
-class DrmRel1_0StringDict00AttributeTable 
-	{
+class DrmRel1_0StringDict00AttributeTable
+    {
 public:
-	enum TStrings
-		{
-		// Element names
-		// CodePage 00
-		/** xmlns:o-ex */
-		EXmlnsOEx,
-		/** xmlns:o-dd */
-		EXmlnsODd,
-		/** xmlns:ds */
-		EXmlnsDs
-		};
-	static const TStringTable Table;	
-	};
+    enum TStrings
+        {
+        // Element names
+        // CodePage 00
+        /** xmlns:o-ex */
+        EXmlnsOEx,
+        /** xmlns:o-dd */
+        EXmlnsODd,
+        /** xmlns:ds */
+        EXmlnsDs
+        };
+    static const TStringTable Table;
+    };
 
 #endif // STRINGTABLE_DrmRel1_0StringDict00AttributeTable
 
--- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeValueTable.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00AttributeValueTable.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,31 +21,31 @@
 #ifndef STRINGTABLE_DrmRel1_0StringDict00AttributeValueTable
 #define STRINGTABLE_DrmRel1_0StringDict00AttributeValueTable
 
-#include "StringPool.h"
+#include "stringpool.h"
 
 struct TStringTable;
 
 /** A String table */
-class DrmRel1_0StringDict00AttributeValueTable 
-	{
+class DrmRel1_0StringDict00AttributeValueTable
+    {
 public:
-	enum TStrings
-		{
-		/**  */
-		EXmlnsOEx,
-		/**  */
-		EXmlnsODd,
-		/**  */
-		EXmlnsDs,
-		/** http://odrl.net/1.1/ODRL-EX */
-		EOdrlEx,
-		/** http://odrl.net/1.1/ODRL-DD */
-		EOdrlDd,
-		/** http://www.w3.org/2000/09/xmldsig/ */
-		EXmlDsig
-		};
-	static const TStringTable Table;	
-	};
+    enum TStrings
+        {
+        /**  */
+        EXmlnsOEx,
+        /**  */
+        EXmlnsODd,
+        /**  */
+        EXmlnsDs,
+        /** http://odrl.net/1.1/ODRL-EX */
+        EOdrlEx,
+        /** http://odrl.net/1.1/ODRL-DD */
+        EOdrlDd,
+        /** http://www.w3.org/2000/09/xmldsig/ */
+        EXmlDsig
+        };
+    static const TStringTable Table;
+    };
 
 #endif // STRINGTABLE_DrmRel1_0StringDict00AttributeValueTable
 
--- a/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00TagTable.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/inc/DrmRel1_0StringDict00TagTable.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,65 +22,65 @@
 #ifndef STRINGTABLE_DrmRel1_0StringDict00TagTable
 #define STRINGTABLE_DrmRel1_0StringDict00TagTable
 
-#include "StringPool.h"
+#include "stringpool.h"
 
 struct TStringTable;
 
 /** A String table */
-class DrmRel1_0StringDict00TagTable 
-	{
+class DrmRel1_0StringDict00TagTable
+    {
 public:
-	enum TStrings
-		{
-		// Element names
-		// CodePage 00
-		/** rights */
-		ERights,
-		/** context */
-		EContext,
-		/** version */
-		EVersion,
-		/** uid */
-		EUid,
-		/** agreement */
-		EAgreement,
-		/** asset */
-		EAsset,
-		/** KeyInfo */
-		EKeyInfo,
-		/** KeyValue */
-		EKeyValue,
-		/** permission */
-		EPermission,
-		/** play */
-		EPlay,
-		/** display */
-		EDisplay,
-		/** execute */
-		EExecute,
-		/** print */
-		EPrint,
-		/** constraint */
-		EConstraint,
-		/** count */
-		ECount,
-		/** datetime */
-		EDateTime,
-		/** start */
-		EStart,
-		/** end */
-		EEnd,
-		/** interval */
-		EInterval,
-		/** -//OMA//DTD DRMREL 1.0//EN */
-		EUri,
-		/** 14~0 */
-		EPublicId,
-		/** -//OMA//DTD DRMREL 1.0//EN~0 */
-		EFormalPublicId
-		};
-	static const TStringTable Table;	
-	};
+    enum TStrings
+        {
+        // Element names
+        // CodePage 00
+        /** rights */
+        ERights,
+        /** context */
+        EContext,
+        /** version */
+        EVersion,
+        /** uid */
+        EUid,
+        /** agreement */
+        EAgreement,
+        /** asset */
+        EAsset,
+        /** KeyInfo */
+        EKeyInfo,
+        /** KeyValue */
+        EKeyValue,
+        /** permission */
+        EPermission,
+        /** play */
+        EPlay,
+        /** display */
+        EDisplay,
+        /** execute */
+        EExecute,
+        /** print */
+        EPrint,
+        /** constraint */
+        EConstraint,
+        /** count */
+        ECount,
+        /** datetime */
+        EDateTime,
+        /** start */
+        EStart,
+        /** end */
+        EEnd,
+        /** interval */
+        EInterval,
+        /** -//OMA//DTD DRMREL 1.0//EN */
+        EUri,
+        /** 14~0 */
+        EPublicId,
+        /** -//OMA//DTD DRMREL 1.0//EN~0 */
+        EFormalPublicId
+        };
+    static const TStringTable Table;
+    };
 
 #endif // STRINGTABLE_DrmRel1_0StringDict00TagTable
 
--- a/omadrm/drmengine/ro/inc/DrmRightsParser.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/inc/DrmRightsParser.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,9 +20,9 @@
 #define DRMRIGHTSPARSER_H
 
 //  INCLUDES
-#include <Xml/Parser.h>
-#include <Xml/ContentHandler.h>
-#include <Xml/XmlParserErrors.h>
+#include <xml/parser.h>
+#include <xml/contenthandler.h>
+#include <xml/xmlparsererrors.h>
 
 using namespace Xml;
 
@@ -50,7 +50,7 @@
             EXmlParser,
             EWbxmlParser
             };
-            
+
         enum TSoftwareSchemaType
             {
             ESymbianSid,
@@ -61,7 +61,7 @@
         static const TInt KMaxElementNesting = 16;
 
     public:  // Constructors and destructor
-        
+
         /**
         * Create a parser object
         * @since Series 60 3.0
@@ -70,14 +70,14 @@
         */
         IMPORT_C static CDrmRightsParser* NewL(
             TParserType aType = EXmlParser);
-        
+
         /**
         * Destructor.
         */
         IMPORT_C ~CDrmRightsParser();
 
     public: // New functions
-        
+
         /**
         * Parse one rights object
         * @since Series 60 3.0
@@ -104,7 +104,7 @@
         * From MContentHandler
         * @param aDocParam Specifies the various parameters of the document.
         * @arg   aDocParam.iCharacterSetName The character encoding of the document.
-        * @param aErrorCode is the error code. 
+        * @param aErrorCode is the error code.
         *        If this is not KErrNone then special action may be required.
         */
         void OnStartDocumentL(
@@ -113,7 +113,7 @@
 
         /**
         * From MContentHandler
-        * @param aErrorCode is the error code. 
+        * @param aErrorCode is the error code.
         *        If this is not KErrNone then special action may be required.
         */
         void OnEndDocumentL(
@@ -128,8 +128,8 @@
         */
         void OnStartElementL(
             const RTagInfo& aElement,
-            const RAttributeArray& aAttributes, 
-			TInt aErrorCode);
+            const RAttributeArray& aAttributes,
+            TInt aErrorCode);
 
         /**
         * From MContentHandler
@@ -143,8 +143,8 @@
 
         /**
         * From MContentHandler
-        * @param aBytes is the raw content data for the element. 
-        *        The client is responsible for converting the data to the 
+        * @param aBytes is the raw content data for the element.
+        *        The client is responsible for converting the data to the
         *        required character set if necessary.
         *        In some instances the content may be binary and must not be converted.
         * @param aErrorCode is the error code.
@@ -163,8 +163,8 @@
         */
         void OnStartPrefixMappingL(
             const RString& aPrefix,
-            const RString& aUri, 
-			TInt aErrorCode);
+            const RString& aUri,
+            TInt aErrorCode);
 
         /**
         * From MContentHandler
@@ -205,8 +205,8 @@
         */
         void OnProcessingInstructionL(
             const TDesC8& aTarget,
-            const TDesC8& aData, 
-			TInt aErrorCode);
+            const TDesC8& aData,
+            TInt aErrorCode);
 
         /**
         * From MContentHandler
@@ -232,7 +232,7 @@
             const TInt32 aUid);
 
     protected:  // New functions
-        
+
         /**
         * Match the state of the current stack to the predefined states
         * @since Series 60 3.0
@@ -248,7 +248,7 @@
         */
         void TransformRightsObjectL(
             RPointerArray<CDRMRights>& aResult);
-            
+
         /**
         * Return the value of an attribute as a buffer
         * @since Series 60 3.0
@@ -275,10 +275,10 @@
         * Parse the time string and return the TTime
         */
         TTime ParseRelTimeL(TDesC8& aRelTimeString);
-        
+
         /**
         * Parse the interval string and return the interval
-        */        
+        */
         TTimeIntervalSeconds ParseRelInterval(TDesC8& aRelTimeString);
 
 
@@ -298,25 +298,25 @@
     protected:  // Data
         // XML Parser
         CParser* iParser;
-        
+
         // Parsed rigths object
         CParsedRightsObject* iRights;
-        
+
         // Predefined XML element names
         RString iElements[KMaxElementCount];
-        
+
         // Current parsing stack
         TInt iElementStack[KMaxElementNesting];
-        
+
         // Depth of the current parsing stack
         TInt iElementStackDepth;
-        
+
         // Content between elements
         HBufC8* iContent;
-        
+
         // Determines if the input is XML or WBXML
         TParserType iParserType;
-        
+
         // Determines what kind of software constraint the RO contains
         TSoftwareSchemaType iSoftwareSchemeType;
 
@@ -327,6 +327,6 @@
         HBufC8* iUnknownTag;
     };
 
-#endif      // DRMRIGHTSPARSER_H   
-            
+#endif      // DRMRIGHTSPARSER_H
+
 // End of File
--- a/omadrm/drmengine/ro/src/DRMConstraint.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DRMConstraint.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,18 +19,18 @@
 // INCLUDE FILES
 #include <s32strm.h>
 #include <s32mem.h>
-#include "DRMConstraint.h"
+#include "DrmConstraint.h"
 
 // CONSTANTS
 
 // Synchronizing marker in the beginning of the stream in order to synchronize
-// to an externalized Constraint object having the new structure.  
+// to an externalized Constraint object having the new structure.
 const TInt32 KSyncMark = 0xAFCE;
 
 // Old and new version number of the Constraint object
 const TInt8 KVersion3_2_0 = 0;
-const TInt8 KVersion3_2_1 = 1; 
-   
+const TInt8 KVersion3_2_1 = 1;
+
 const TInt KSanityDataLengthLow = 0;
 const TInt KSanityDataLengthHigh = 32768;
 
@@ -55,17 +55,17 @@
 // Appends the strings of array aFrom to array aTo
 // -----------------------------------------------------------------------------
 //
-LOCAL_C void AppendToArrayL( RPointerArray<HBufC8>& aTo, 
+LOCAL_C void AppendToArrayL( RPointerArray<HBufC8>& aTo,
                              const RPointerArray<HBufC8>& aFrom )
     {
     HBufC8* addData = NULL;
-    
+
     for( TInt i = 0; i < aFrom.Count(); i++ )
         {
         addData = aFrom[i]->AllocLC();
         aTo.AppendL( addData );
-        CleanupStack::Pop( addData ); 
-        }    
+        CleanupStack::Pop( addData );
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -76,13 +76,13 @@
 LOCAL_C TInt CountArrayStoreSize( const RPointerArray<HBufC8>& aArray )
     {
     TInt size = 0;
-    
+
     for(TInt i = 0; i < aArray.Count(); i++ )
         {
         size += sizeof(TInt);
         size += aArray[i]->Size();
         }
-    return size;    
+    return size;
     }
 // -----------------------------------------------------------------------------
 // WriteArrayToStreamL
@@ -98,12 +98,12 @@
         aStream.WriteL( aArray[i]->Des() );
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // ReadArrayFromStringL
 // Reads the array from the string
 // -----------------------------------------------------------------------------
-//    
+//
 LOCAL_C void ReadArrayFromStringL( const TDesC8& aString,
                                    RPointerArray<HBufC8>& aArray )
     {
@@ -112,29 +112,29 @@
     HBufC8* addData = NULL;
     TPtr8 dataBuffer(NULL,0,0);
     CleanupClosePushL( inRead );
-    
-    
+
+
     aArray.ResetAndDestroy();
-    
-    
+
+
     for( TInt i = 0; i < aString.Size();)
         {
-        // If there is not enough data to read the integer 
+        // If there is not enough data to read the integer
         // it means that it's an old version and the whole thing is the
-        // string since in previous versions only one string is stored        
+        // string since in previous versions only one string is stored
         if(( aString.Size() - i) < sizeof(TInt) )
             {
             aArray.ResetAndDestroy();
             addData = aString.AllocLC();
             aArray.AppendL( addData );
             CleanupStack::Pop();
-            CleanupStack::PopAndDestroy(); // inRead              
-            return;            
+            CleanupStack::PopAndDestroy(); // inRead
+            return;
             }
-        
+
         size = inRead.ReadInt32L();
         i += sizeof(TInt);
-        
+
         // If the size is negative or the size left is not large enough
         // it means that it's an old version and the whole thing is the
         // string since in previous versions only one string is stored.
@@ -144,35 +144,35 @@
             addData = aString.AllocLC();
             aArray.AppendL( addData );
             CleanupStack::Pop();
-            CleanupStack::PopAndDestroy(); // inRead            
+            CleanupStack::PopAndDestroy(); // inRead
             return;
             }
-        addData = HBufC8::NewMaxLC( size );    
+        addData = HBufC8::NewMaxLC( size );
 
         // Set the read buffer:
         dataBuffer.Set(const_cast<TUint8*>(addData->Ptr()), 0, size);
-        
+
         // Read the data:
         inRead.ReadL( dataBuffer );
-        
+
         aArray.AppendL( addData );
         CleanupStack::Pop( addData );
 
         i += size;
         }
-    CleanupStack::PopAndDestroy();    
+    CleanupStack::PopAndDestroy();
     return;
     }
-    
+
 // -----------------------------------------------------------------------------
 // IsIndividualConstraintValid
 // -----------------------------------------------------------------------------
 //
-LOCAL_C TBool IsIndividualConstraintValid( const RPointerArray<HBufC8>& aConstraint, 
+LOCAL_C TBool IsIndividualConstraintValid( const RPointerArray<HBufC8>& aConstraint,
                                            const RPointerArray<HBufC8>& aValidConstraints)
     {
     TInt retVal = 0;
-    
+
     for( TInt i = 0; i < aConstraint.Count(); i++ )
         {
         for( TInt j = 0; j < aValidConstraints.Count(); j++ )
@@ -184,7 +184,7 @@
                 }
             }
         }
-    return EFalse;    
+    return EFalse;
     };
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -200,8 +200,8 @@
     CDRMConstraint* self = new( ELeave ) CDRMConstraint();
     CleanupStack::PushL( self );
     self->ConstructL();
-    
-    return self;    
+
+    return self;
     };
 
 // -----------------------------------------------------------------------------
@@ -213,9 +213,9 @@
     {
     CDRMConstraint* self = NewLC();
     CleanupStack::Pop();
-    
+
     return self;
-    }; 
+    };
 
 // -----------------------------------------------------------------------------
 // Default Constructor - First phase.
@@ -224,8 +224,8 @@
 //
 EXPORT_C CDRMConstraint::CDRMConstraint() :
     iSyncMark( KSyncMark ),
-    iVersion( KVersion3_2_1 ), // Version number for differentiation 
-                               // in InternalizeL. 
+    iVersion( KVersion3_2_1 ), // Version number for differentiation
+                               // in InternalizeL.
     iStartTime( Time::NullTTime() ),
     iEndTime( Time::NullTTime() ),
     iIntervalStart( Time::NullTTime() ),
@@ -233,38 +233,38 @@
     iCounter( 0 ),
     iOriginalCounter( 0 ),
     iTimedCounter( 0 ),
-	iTimedInterval( 0 ),
-	iAccumulatedTime( 0 ),
-	iVendorId( TUid::Null() ),
-	iSecureId( TUid::Null() ),
+    iTimedInterval( 0 ),
+    iAccumulatedTime( 0 ),
+    iVendorId( TUid::Null() ),
+    iSecureId( TUid::Null() ),
     iActiveConstraints( 0 ),
     iDrmMeteringInfo( NULL ),
-    iOriginalTimedCounter( 0 ) 
+    iOriginalTimedCounter( 0 )
     {
     }
-    
+
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
-// 
+//
 EXPORT_C CDRMConstraint::~CDRMConstraint()
     {
 
     iIndividual.ResetAndDestroy();
     iIndividual.Close();
-    
+
     iSystem.ResetAndDestroy();
-    iSystem.Close(); 
-            
-#ifdef RD_DRM_METERING       
+    iSystem.Close();
+
+#ifdef RD_DRM_METERING
     if( iDrmMeteringInfo )
         {
         delete iDrmMeteringInfo;
         iDrmMeteringInfo = NULL;
         }
 #endif
-        
-    }; 
+
+    };
 
 // -----------------------------------------------------------------------------
 // CDRMConstraint::ExternalizeL
@@ -272,43 +272,43 @@
 //
 EXPORT_C void CDRMConstraint::ExternalizeL( RWriteStream& aStream ) const
     {
-    
+
     // used for the buffers
     TInt32 dataLength = 0;
-    
+
     // write the synchronizing marker
     aStream.WriteInt32L( iSyncMark );
-    
+
     // Write the version number
     aStream.WriteInt32L( iVersion );
-    
+
     // Write the start time
     WriteInt64L( iStartTime.Int64(), aStream );
-    
+
     // Write the end time
     WriteInt64L( iEndTime.Int64(), aStream );
-    
+
     // Write the interval start time
-    WriteInt64L( iIntervalStart.Int64(), aStream ); 
-    
-    // Write the interval   
+    WriteInt64L( iIntervalStart.Int64(), aStream );
+
+    // Write the interval
     aStream.WriteInt32L( iInterval.Int() );
-    
+
     // Write the counter
     aStream.WriteInt32L( iCounter );
-    
+
     // Write the original counter
     aStream.WriteInt32L( iOriginalCounter );
-    
+
     // Write the timed counter
     aStream.WriteInt32L( iTimedCounter );
 
     // Write the timed interval
     aStream.WriteInt32L( iTimedInterval.Int() );
-    
+
     // Write the accumulated time
     aStream.WriteInt32L( iAccumulatedTime.Int() );
-    
+
     // Write the individual
     dataLength = 0;
     if ( iIndividual.Count() )
@@ -319,58 +319,58 @@
 
     if ( dataLength )
         {
-        WriteArrayToStreamL( aStream, iIndividual );       
-        }         
-    
+        WriteArrayToStreamL( aStream, iIndividual );
+        }
+
     // Software Vendor Id
     aStream.WriteInt32L( iVendorId.iUid );
-    
+
     // Secure Id of the allowed application
     aStream.WriteInt32L( iSecureId.iUid );
-    
+
     // Active constraints
     aStream.WriteUint32L( iActiveConstraints );
-    
+
     // Metering info
-#ifdef RD_DRM_METERING    
+#ifdef RD_DRM_METERING
     dataLength = 0;
     if ( iDrmMeteringInfo )
         {
         dataLength = sizeof( TTimeIntervalSeconds ) + sizeof( TUint8 );
         }
-    
+
     aStream.WriteInt32L( dataLength );
-    
+
     if ( dataLength )
         {
         aStream.WriteInt32L( iDrmMeteringInfo->iGraceTime.Int() );
         aStream.WriteInt8L( iDrmMeteringInfo->iAllowUseWithoutMetering );
         }
-   
+
 #endif
-    
+
     // Write the system
     dataLength = 0;
     if ( iSystem.Count() )
         {
         dataLength = CountArrayStoreSize( iSystem );
         }
-    
+
     aStream.WriteInt32L( dataLength );
-        
+
     if ( dataLength )
         {
         WriteArrayToStreamL( aStream, iSystem );
         }
-            
+
     // write the original timed counter
     aStream.WriteInt32L( iOriginalTimedCounter );
-        
+
     // For future use
     aStream.WriteInt32L( 0 );
-    
+
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMConstraint::InternalizeL
 // -----------------------------------------------------------------------------
@@ -380,271 +380,271 @@
 
     TInt64 timeData = 0;
     TInt32 temp = 0;
-    
+
     // used for the buffers
     TInt dataLength = 0;
     HBufC8* dataPart = NULL;
     TPtr8 dataBuffer(NULL,0,0);
-    
+
     // Read the (possible) synchronizing marker.
     iSyncMark = aStream.ReadInt32L();
-    
+
     if ( iSyncMark != KSyncMark )
         {
-         
+
         // The structure of the externalized Permission object is the old one.
         // The first four bytes constitute half of the eight bytes of Start time.
-        // Read another four bytes from the stream (and apply bit modifications) 
+        // Read another four bytes from the stream (and apply bit modifications)
         // in order to reconstruct the Start time (iStartTime).
         temp = aStream.ReadInt32L();
-        
+
         timeData = temp;
         timeData <<= 32;
-        
+
         Mem::Copy( &timeData, &iSyncMark, sizeof(TInt32) );
-        
+
         iStartTime = timeData;
         timeData = 0;
-         
-        // The version is marked as old version for differentiation in 
+
+        // The version is marked as old version for differentiation in
         // InternalizeL.
         iVersion = KVersion3_2_0;
-                             
+
         }
-    else 
+    else
         {
         // The structure of the externalized Permission object is the new one.
-        // Read the version and Start time.    
+        // Read the version and Start time.
         iVersion = aStream.ReadInt32L();
-        
+
         // Read the start time
         ReadInt64L( timeData, aStream );
         iStartTime = timeData;
-        
+
         }
-     
+
     // Read the end time
     ReadInt64L( timeData, aStream );
     iEndTime = timeData;
-    
+
     // Read the interval start time
-    ReadInt64L( timeData, aStream ); 
+    ReadInt64L( timeData, aStream );
     iIntervalStart = timeData;
-    
-    // Read the interval   
+
+    // Read the interval
     iInterval = aStream.ReadInt32L();
-    
+
     // Read the counter
     iCounter = aStream.ReadInt32L();
-    
+
     // Read the original counter
     iOriginalCounter = aStream.ReadInt32L();
-    
+
     // Read the timed counter
     iTimedCounter = aStream.ReadInt32L();
 
     // Read the timed interval
     iTimedInterval = aStream.ReadInt32L();
-    
+
     // Read the accumulated time
     iAccumulatedTime = aStream.ReadInt32L();
-    
+
     // Read the individual
     dataLength = aStream.ReadInt32L();
-    
+
     SanitizeL( dataLength );
-    
+
     if( dataLength > 0 )
         {
         // Reserve a new buffer:
         dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
         // Set the read buffer:
         dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
         // Read the data:
         aStream.ReadL( dataBuffer );
-        
-        
+
+
         // Fill the array from the string
         ReadArrayFromStringL( dataBuffer, iIndividual);
-        
-        // Pop the buffer 
+
+        // Pop the buffer
         CleanupStack::PopAndDestroy(); // dataPart
-                    
+
         }
     else
         {
-        iIndividual.ResetAndDestroy();       
-        }           
-    
-    
-    // Read the system 
+        iIndividual.ResetAndDestroy();
+        }
+
+
+    // Read the system
     if ( iVersion == KVersion3_2_0 ) // Constraint has the old structure.
         {
-        
+
         dataLength = aStream.ReadInt32L();
-        
+
         SanitizeL( dataLength );
-        
+
         if( dataLength > 0 )
             {
             // Reserve a new buffer:
             dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
             // Set the read buffer:
-            dataBuffer.Set( const_cast<TUint8*>(dataPart->Ptr()), 0, 
+            dataBuffer.Set( const_cast<TUint8*>(dataPart->Ptr()), 0,
                             dataLength );
-        
+
             // Read the data:
             aStream.ReadL( dataBuffer );
-        
-            // Pop the buffer 
+
+            // Pop the buffer
             CleanupStack::Pop(); // dataPart
-                
-            // If an old content identifier exists delete it        
+
+            // If an old content identifier exists delete it
+            if ( iSystem.Count() )
+                {
+                iSystem.ResetAndDestroy();
+                }
+
+            // assign the new content id
+            iSystem.AppendL( dataPart );
+            }
+        else
+            {
+            // If an old system exists delete it
             if ( iSystem.Count() )
                 {
                 iSystem.ResetAndDestroy();
                 }
-        
-            // assign the new content id
-            iSystem.AppendL( dataPart );    
             }
-        else
-            {
-            // If an old system exists delete it 
-            if ( iSystem.Count() )
-                {
-                iSystem.ResetAndDestroy();
-                }        
-            }  
         }
-    
+
     // Software Vendor Id
     iVendorId.iUid = aStream.ReadInt32L();
-    
+
     // Secure Id of the allowed application
-    iSecureId.iUid = aStream.ReadInt32L(); 
-    
+    iSecureId.iUid = aStream.ReadInt32L();
+
     // Active constraints
-    iActiveConstraints = aStream.ReadUint32L();    
+    iActiveConstraints = aStream.ReadUint32L();
 
-#ifdef RD_DRM_METERING    
-    
+#ifdef RD_DRM_METERING
+
     // Do not read metering information if the version
     // is the old one because Metering is not activated in it.
     if ( iVersion == KVersion3_2_1 )
         {
-        
+
         // Metering info
         dataLength = aStream.ReadInt32L();
-    
+
         SanitizeL( dataLength );
-        
+
         if( dataLength > 0 )
             {
-        
+
             if( !iDrmMeteringInfo )
                 {
                 // Reserve a new metering information instance
                 iDrmMeteringInfo = new (ELeave)TDrmMeteringInfo;
                 }
-            else 
+            else
                 {
                 iDrmMeteringInfo->iGraceTime = 0;
                 iDrmMeteringInfo->iAllowUseWithoutMetering = EFalse;
                 }
-        
-            // Read grace time 
+
+            // Read grace time
             iDrmMeteringInfo->iGraceTime = aStream.ReadInt32L();
-        
-            // Read whether content can be consumed without 
+
+            // Read whether content can be consumed without
             // metering being used
-            iDrmMeteringInfo->iAllowUseWithoutMetering = 
+            iDrmMeteringInfo->iAllowUseWithoutMetering =
                 aStream.ReadInt8L();
-           
+
             }
         else
             {
-        
-            // If old metering information exists delete it 
+
+            // If old metering information exists delete it
             if( iDrmMeteringInfo )
                 {
                 delete iDrmMeteringInfo;
                 iDrmMeteringInfo = NULL;
-                }        
+                }
             }
         }
-    
+
 #endif //RD_DRM_METERING
 
     // Read the system and original timed counter
     // according to the new structure.
     if ( iVersion == KVersion3_2_1 )
         {
-        
+
         dataLength = aStream.ReadInt32L();
-        
+
         SanitizeL( dataLength );
-            
+
         if( dataLength > 0 )
             {
             // Reserve a new buffer:
             dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
             // Set the read buffer:
             dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
             // Read the data:
             aStream.ReadL( dataBuffer );
-        
+
             // Fill the array from the string
             ReadArrayFromStringL( dataBuffer, iSystem);
-        
-            // Pop the buffer 
+
+            // Pop the buffer
             CleanupStack::PopAndDestroy(); // dataPart
-                    
+
             }
         else
             {
-            iSystem.ResetAndDestroy();       
-            }         
-    
+            iSystem.ResetAndDestroy();
+            }
+
         // Read the original timed counter
         iOriginalTimedCounter = aStream.ReadInt32L();
-    
+
         // For future use or development, reads the data at the end of the stream
         dataLength = aStream.ReadInt32L();
-        
+
         SanitizeL( dataLength );
-        
+
         if ( dataLength > 0 )
             {
-      
+
             // Reserve a new buffer:
             dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
             // Set the read buffer:
             dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
             // Read the data:
             aStream.ReadL( dataBuffer );
-        
-            // Pop the buffer 
+
+            // Pop the buffer
             CleanupStack::PopAndDestroy( dataPart );
             }
         }
-    
-    // Constraint can be considered to have the new structure from now on. 
-    if ( iVersion == KVersion3_2_0 ) 
+
+    // Constraint can be considered to have the new structure from now on.
+    if ( iVersion == KVersion3_2_0 )
         {
         iSyncMark = KSyncMark;
-        iVersion = KVersion3_2_1; 
+        iVersion = KVersion3_2_1;
         }
-    
+
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMConstraint::Stateful
 // -----------------------------------------------------------------------------
@@ -654,35 +654,35 @@
     // counters, timed counters and accumulated are stateful
     if ( iActiveConstraints &  (EConstraintCounter |
                                EConstraintTimedCounter |
-                               EConstraintAccumulated ) ) 
+                               EConstraintAccumulated ) )
         {
         return ETrue;
         }
-        
+
      // Non-Activated interval is stateful
     if ( ( iActiveConstraints & EConstraintInterval ) &&
-        iIntervalStart == Time::NullTTime() ) 
+        iIntervalStart == Time::NullTTime() )
         {
         return ETrue;
         }
-        
+
     return EFalse;
     };
 
 // -----------------------------------------------------------------------------
 // CDRMConstraint::Size
 // -----------------------------------------------------------------------------
-//   
+//
 EXPORT_C TInt CDRMConstraint::Size() const
     {
     TInt size = 0;
-    
+
     // synchronizing marker
     size += sizeof(TInt32);
-    
+
     // version number
     size += sizeof(TInt32);
-    
+
     // usage start time
     size += sizeof(TTime);
 
@@ -702,13 +702,13 @@
     size += sizeof(TDRMCounter);
 
     // timed counter
-	size += sizeof(TDRMCounter);
+    size += sizeof(TDRMCounter);
 
     // Interval of the timed counter constraint
-	size += sizeof(TTimeIntervalSeconds);
+    size += sizeof(TTimeIntervalSeconds);
 
     // accumulated time
-	size += sizeof(TTimeIntervalSeconds);
+    size += sizeof(TTimeIntervalSeconds);
 
     // individual allowed usage
     size += sizeof(TInt32);
@@ -716,114 +716,114 @@
 
     // Software Vendor Id
     size += sizeof(TUid);
-    
+
     // Secure Id of the allowed application
     size += sizeof(TUid);
-	
-	// Bitmask of active constraints
+
+    // Bitmask of active constraints
     size += sizeof(TUint32);
-    
-#ifdef RD_DRM_METERING    
+
+#ifdef RD_DRM_METERING
     // Metering information
     size += sizeof(TInt32);
-    
+
     if (iDrmMeteringInfo)
         {
-        size += sizeof(TTimeIntervalSeconds); 
+        size += sizeof(TTimeIntervalSeconds);
         size += sizeof(TUint8);
         }
-    
+
 #endif //RD_DRM_METERING
-    
+
     // system allowed usage
     size += sizeof(TInt32);
     size += CountArrayStoreSize(iSystem);
-    
+
     // original timed counter value
     size += sizeof(TDRMCounter);
-    
+
     // For future use
     size += sizeof(TInt32);
-    
+
     return size;
-       
-    };    
+
+    };
 
 // -----------------------------------------------------------------------------
 // CDRMConstraint::Expired
 // -----------------------------------------------------------------------------
-//      
+//
 EXPORT_C TBool CDRMConstraint::Expired( const TTime& aTime ) const
     {
-	// Full Rights do not expire
-	if ( iActiveConstraints == EConstraintNone )
-		{
-		return EFalse;
-		}
+    // Full Rights do not expire
+    if ( iActiveConstraints == EConstraintNone )
+        {
+        return EFalse;
+        }
 
-	// First check counters, accumulated time and timed counters
-	// if any of these is expired the whole thing is expired regardless of the
-	// actual time based constrants or future rights
-	
+    // First check counters, accumulated time and timed counters
+    // if any of these is expired the whole thing is expired regardless of the
+    // actual time based constrants or future rights
+
     // Counters
-    if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 ) 
-    	{
-    	return ETrue;	
-    	}
-    		
-    // Accumulated time	
+    if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 )
+        {
+        return ETrue;
+        }
+
+    // Accumulated time
     if ( ( iActiveConstraints & EConstraintAccumulated ) && iAccumulatedTime.Int() == 0 )
-    	{
-    	return ETrue;
-    	}
-    		
+        {
+        return ETrue;
+        }
+
      // Timed Counters
-    if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 ) 
-    	{
-    	return ETrue;	
-    	} 
-    		
+    if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 )
+        {
+        return ETrue;
+        }
+
 
     // Dont check time based rights
     if ( aTime != Time::NullTTime() )
-    	{	
-    	
-    	// Check for activated intervals
-    	if ( ( iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() )
-    		{
-        	TTimeIntervalSeconds current;
-        
-        	aTime.SecondsFrom( iIntervalStart, current );
-        
-        	if ( current >= iInterval )
-            	{
-            	return ETrue;
-            	}    			
-    		}
-    	
-    	// Check for end time
-    	if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime )
-    		{
-    		return ETrue;	
-    		}	
-    		
-    	// Check for start time, future rights	
-    	if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime )
-    		{
-    		return EFalse;	
-    		}
-    	}
+        {
+
+        // Check for activated intervals
+        if ( ( iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() )
+            {
+            TTimeIntervalSeconds current;
+
+            aTime.SecondsFrom( iIntervalStart, current );
+
+            if ( current >= iInterval )
+                {
+                return ETrue;
+                }
+            }
+
+        // Check for end time
+        if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime )
+            {
+            return ETrue;
+            }
+
+        // Check for start time, future rights
+        if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime )
+            {
+            return EFalse;
+            }
+        }
 
     return EFalse;
     }
 // -----------------------------------------------------------------------------
 // CDRMConstraint::Merge
 // -----------------------------------------------------------------------------
-//      
+//
 EXPORT_C void CDRMConstraint::Merge( const CDRMConstraint& aConstraint )
     {
     TInt error = KErrNone;
-    
+
     if ( this != &aConstraint )
         {
         if ( aConstraint.iActiveConstraints & EConstraintStartTime )
@@ -838,7 +838,7 @@
                 iActiveConstraints |= EConstraintStartTime;
                 }
             }
-            
+
         if ( aConstraint.iActiveConstraints & EConstraintEndTime )
             {
             if ( iActiveConstraints & EConstraintEndTime )
@@ -851,7 +851,7 @@
                 iActiveConstraints |= EConstraintEndTime;
                 }
             }
-            
+
         if ( aConstraint.iActiveConstraints & EConstraintCounter )
             {
             if ( iActiveConstraints & EConstraintCounter )
@@ -866,7 +866,7 @@
                 iActiveConstraints |= EConstraintCounter;
                 }
             }
-        
+
         if ( aConstraint.iActiveConstraints & EConstraintInterval )
             {
             if ( iActiveConstraints & EConstraintInterval )
@@ -881,7 +881,7 @@
                 iActiveConstraints |= EConstraintInterval;
                 }
             }
-            
+
         if ( aConstraint.iActiveConstraints & EConstraintTimedCounter )
             {
             if ( iActiveConstraints & EConstraintTimedCounter )
@@ -899,7 +899,7 @@
                 iActiveConstraints |= EConstraintTimedCounter;
                 }
             }
-        
+
         if ( aConstraint.iActiveConstraints & EConstraintAccumulated )
             {
             if ( iActiveConstraints & EConstraintAccumulated )
@@ -912,20 +912,20 @@
                 iActiveConstraints |= EConstraintAccumulated;
                 }
             }
-             
+
         if( aConstraint.iActiveConstraints & EConstraintIndividual )
             {
             // Ignore the error since we don't return an error code or leave
             TRAP( error, AppendToArrayL( iIndividual, aConstraint.iIndividual ) );
             }
-            
+
         }
     }
 
 // -----------------------------------------------------------------------------
-// CDRMConstraint::Consume  
+// CDRMConstraint::Consume
 // -----------------------------------------------------------------------------
-//  
+//
 EXPORT_C void CDRMConstraint::Consume( const TTime& aCurrentTime )
     {
     if ( ( iActiveConstraints & EConstraintInterval ) &&
@@ -933,7 +933,7 @@
         {
         iIntervalStart = aCurrentTime;
         }
-        
+
     if ( iActiveConstraints & EConstraintCounter )
         {
         --iCounter;
@@ -946,13 +946,13 @@
 //
 EXPORT_C void CDRMConstraint::DuplicateL( const CDRMConstraint& aConstraint )
     {
-    
+
     // synchronizing marker
     iSyncMark = aConstraint.iSyncMark;
-    
+
     // version number
     iVersion = aConstraint.iVersion;
-    
+
     // usage start time
     iStartTime = aConstraint.iStartTime;
 
@@ -972,50 +972,50 @@
     iOriginalCounter = aConstraint.iOriginalCounter;
 
     // timed counter
-	iTimedCounter = aConstraint.iTimedCounter;
+    iTimedCounter = aConstraint.iTimedCounter;
 
     // Interval of the timed counter constraint
-	iTimedInterval = aConstraint.iTimedInterval;
+    iTimedInterval = aConstraint.iTimedInterval;
 
     // accumulated time
-	iAccumulatedTime = aConstraint.iAccumulatedTime;
+    iAccumulatedTime = aConstraint.iAccumulatedTime;
 
     // individual allowed usage
     iIndividual.ResetAndDestroy();
-    
+
     AppendToArrayL( iIndividual, aConstraint.iIndividual );
-	
+
     // Software Vendor Id
     iVendorId = aConstraint.iVendorId;
-	
+
     // Secure Id of the allowed application
     iSecureId = aConstraint.iSecureId;
-	
-	// Bitmask of active constraints
-    iActiveConstraints = aConstraint.iActiveConstraints;	// Bitmask
 
-#ifdef RD_DRM_METERING    
+    // Bitmask of active constraints
+    iActiveConstraints = aConstraint.iActiveConstraints;    // Bitmask
+
+#ifdef RD_DRM_METERING
     // Metering information
     if ( aConstraint.iDrmMeteringInfo )
         {
-        
+
         if( !iDrmMeteringInfo )
             {
             iDrmMeteringInfo = new (ELeave) TDrmMeteringInfo;
             }
-    
+
         iDrmMeteringInfo->iGraceTime = aConstraint.iDrmMeteringInfo->iGraceTime;
-        iDrmMeteringInfo->iAllowUseWithoutMetering = aConstraint.iDrmMeteringInfo->iAllowUseWithoutMetering; 
+        iDrmMeteringInfo->iAllowUseWithoutMetering = aConstraint.iDrmMeteringInfo->iAllowUseWithoutMetering;
         }
 #endif
-    
+
     // system allowed usage
     iSystem.ResetAndDestroy();
     AppendToArrayL( iSystem, aConstraint.iSystem );
-    
+
     // original timed counter value
     iOriginalTimedCounter = aConstraint.iOriginalTimedCounter;
-    
+
     };
 
 
@@ -1026,88 +1026,88 @@
 EXPORT_C TBool CDRMConstraint::Valid( const TTime& aTime,
                                       const RPointerArray<HBufC8>& aIndividual,
                                       TUint32& aRejection ) const
-	{
-	TBool drmTime = EFalse;
-	// Null the rejection requirement:
-	aRejection = EConstraintNone;
-	
-	// Full Rights are always valid
-	if ( iActiveConstraints == EConstraintNone )
-		{
-		return ETrue;
-		}
+    {
+    TBool drmTime = EFalse;
+    // Null the rejection requirement:
+    aRejection = EConstraintNone;
 
-	// First check counters, accumulated time and timed counters
-	// if any of these are invalid the whole thing is invalid regardless of the
-	// actual time based constraints
-	
+    // Full Rights are always valid
+    if ( iActiveConstraints == EConstraintNone )
+        {
+        return ETrue;
+        }
+
+    // First check counters, accumulated time and timed counters
+    // if any of these are invalid the whole thing is invalid regardless of the
+    // actual time based constraints
+
     // Counters
-    if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 ) 
-    	{
-    	aRejection |= EConstraintCounter;
-    	}
-    		
-    // Accumulated time	
+    if ( ( iActiveConstraints & EConstraintCounter ) && iCounter < 1 )
+        {
+        aRejection |= EConstraintCounter;
+        }
+
+    // Accumulated time
     if ( ( iActiveConstraints & EConstraintAccumulated ) && iAccumulatedTime.Int() == 0 )
-    	{
-    	aRejection |= EConstraintAccumulated;
-    	}
-    		
+        {
+        aRejection |= EConstraintAccumulated;
+        }
+
      // Timed Counters
-    if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 ) 
-    	{
-    	aRejection |= EConstraintTimedCounter;	
-    	} 
-    		
+    if ( ( iActiveConstraints & EConstraintTimedCounter ) && iTimedCounter < 1 )
+        {
+        aRejection |= EConstraintTimedCounter;
+        }
+
     // Dont check time based rights
     if ( aTime != Time::NullTTime() )
-    	{	
-    	drmTime = ETrue;
-    	// Check for activated intervals
-    	if ( (iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() )
-    		{
-        	TTimeIntervalSeconds current;
-        
-        	aTime.SecondsFrom( iIntervalStart, current );
-        
-        	if ( ( current >= iInterval ) || ( aTime < iIntervalStart ) )
-            	{
-            	aRejection |= EConstraintInterval;
-            	}    			
-    		}
-    	
-    	// Check for end time
-    	if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime ) 
-    	    {
-    	    aRejection |= EConstraintEndTime;
-    	    }
-    	    
-    	if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime )     
-    		{
-    		aRejection |= EConstraintStartTime;	
-    		}	
-    	}
+        {
+        drmTime = ETrue;
+        // Check for activated intervals
+        if ( (iActiveConstraints & EConstraintInterval) && iIntervalStart != Time::NullTTime() )
+            {
+            TTimeIntervalSeconds current;
+
+            aTime.SecondsFrom( iIntervalStart, current );
+
+            if ( ( current >= iInterval ) || ( aTime < iIntervalStart ) )
+                {
+                aRejection |= EConstraintInterval;
+                }
+            }
+
+        // Check for end time
+        if ( ( iActiveConstraints & EConstraintEndTime ) && aTime >= iEndTime )
+            {
+            aRejection |= EConstraintEndTime;
+            }
+
+        if ( ( iActiveConstraints & EConstraintStartTime ) && aTime < iStartTime )
+            {
+            aRejection |= EConstraintStartTime;
+            }
+        }
     else
         {
         drmTime = EFalse;
-        
-    	// Check for activated intervals
-    	if ( (iActiveConstraints & EConstraintInterval) )
-    		{
-            aRejection |= EConstraintInterval; 			
-    		}
-    	
-    	// Check for end time
-    	if ( ( iActiveConstraints & EConstraintEndTime ) ) 
-    	    {
-    	    aRejection |= EConstraintEndTime;
-    	    }
-    	    
-    	if( ( iActiveConstraints & EConstraintStartTime ) )     
-    		{
-    		aRejection |= EConstraintStartTime;	
-    		}
-        }	
+
+        // Check for activated intervals
+        if ( (iActiveConstraints & EConstraintInterval) )
+            {
+            aRejection |= EConstraintInterval;
+            }
+
+        // Check for end time
+        if ( ( iActiveConstraints & EConstraintEndTime ) )
+            {
+            aRejection |= EConstraintEndTime;
+            }
+
+        if( ( iActiveConstraints & EConstraintStartTime ) )
+            {
+            aRejection |= EConstraintStartTime;
+            }
+        }
 
     // IMSI Checking:
     if( iActiveConstraints & EConstraintIndividual )
@@ -1120,7 +1120,7 @@
             {
             aRejection |= EConstraintIndividual;
             }
-        }        
+        }
 
     if( aRejection )
         {
@@ -1128,12 +1128,12 @@
         if( !drmTime )
             {
             aRejection |= EConstraintNullDrmTime;
-            }       
-        return EFalse;        
+            }
+        return EFalse;
         }
 
-    return ETrue;		
-	};
+    return ETrue;
+    };
 
 
 // -----------------------------------------------------------------------------
@@ -1144,7 +1144,7 @@
 void CDRMConstraint::ConstructL()
     {
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMConstraint::WriteInt64L
 // -----------------------------------------------------------------------------
@@ -1152,10 +1152,10 @@
 void CDRMConstraint::WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const
     {
     TPtr8 output(NULL,0,0);
-    
-    output.Set( reinterpret_cast<TUint8*>(const_cast<TInt64*>(&aWrite)), 
+
+    output.Set( reinterpret_cast<TUint8*>(const_cast<TInt64*>(&aWrite)),
                 sizeof(TInt64), sizeof(TInt64) );
-    
+
     aStream.WriteL( output, sizeof(TInt64) );
     };
 
@@ -1166,9 +1166,9 @@
 void CDRMConstraint::ReadInt64L( TInt64& aRead, RReadStream& aStream )
     {
     TPtr8 input(NULL,0,0);
-    
+
     input.Set( reinterpret_cast<TUint8*>(&aRead), 0, sizeof(TInt64) );
-    
-    aStream.ReadL( input, sizeof(TInt64) );    
-    };        
+
+    aStream.ReadL( input, sizeof(TInt64) );
+    };
 // End of File
--- a/omadrm/drmengine/ro/src/DRMPermission.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DRMPermission.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,24 +21,24 @@
 #include <s32strm.h>
 #include <s32mem.h>
 #include <caf/caf.h>
-#include "DRMPermission.h"
-#include "DRMConstraint.h"
+#include "DrmPermission.h"
+#include "DrmConstraint.h"
 #include "drmlog.h"
-#include "OMA2Agent.h"
+#include "Oma2Agent.h"
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
 // Synchronizing marker in the beginning of the stream in order to synchronize
-// to externalized Permission object having the new structure.  
+// to externalized Permission object having the new structure.
 const TInt32 KSyncMark = 0xAFCE;
 
 // Old and new version number of the Permission object
 const TInt8 KVersion3_2_0 = 0;
-const TInt8 KVersion3_2_1 = 1;   
+const TInt8 KVersion3_2_1 = 1;
 
 
 const TInt KSanityDataLengthLow = 0;
@@ -84,8 +84,8 @@
     CDRMPermission* self = new( ELeave ) CDRMPermission();
     CleanupStack::PushL( self );
     self->ConstructL();
-    
-    return self;    
+
+    return self;
     };
 
 
@@ -98,7 +98,7 @@
     {
     CDRMPermission* self = NewLC();
     CleanupStack::Pop();
-    
+
     return self;
     };
 
@@ -108,7 +108,7 @@
 //
 CDRMPermission::CDRMPermission() :
     iSyncMark( KSyncMark ),
-    iVersion( KVersion3_2_1 ), // Version number for differentiation in 
+    iVersion( KVersion3_2_1 ), // Version number for differentiation in
                                // InternalizeL.
     iUniqueID( 0 ),
     iOriginalInsertTime( Time::NullTTime() ),
@@ -128,9 +128,9 @@
     iRiId.SetLength( KRiIdSize );
     iRiId.Fill( 0 );
     };
-    
-    
-    
+
+
+
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
@@ -148,31 +148,31 @@
         delete iPlay;
         iPlay = NULL;
         }
-        
+
     if( iDisplay )
         {
         delete iDisplay;
         iDisplay = NULL;
         }
-        
+
     if( iExecute )
         {
         delete iExecute;
         iExecute = NULL;
         }
-        
+
     if( iExport )
         {
         delete iExport;
         iExport = NULL;
         }
-        
+
     if( iPrint )
         {
         delete iPrint;
         iPrint = NULL;
         }
-       
+
     if( iParentUID )
         {
         delete iParentUID;
@@ -190,88 +190,88 @@
         delete iDomainID;
         iDomainID = NULL;
         }
-        
+
     if( iOnExpiredUrl )
         {
         delete iOnExpiredUrl;
         iOnExpiredUrl = NULL;
         }
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMPermission::ExternalizeL
 // -----------------------------------------------------------------------------
 //
 EXPORT_C void CDRMPermission::ExternalizeL( RWriteStream& aStream ) const
     {
-    
+
     // used for the buffers
     TInt dataLength = 0;
-    
+
     // Used for mode
     TUint8 exportMode = 0;
-    
+
     // Write the synchronizing marker
     aStream.WriteInt32L( iSyncMark );
-    
+
     // Write the version number
     aStream.WriteInt32L( iVersion );
-    
+
     // Unique ID of the permission
     aStream.WriteUint32L( iUniqueID );
-    
+
     // The original insertion time
     WriteInt64L( iOriginalInsertTime.Int64(), aStream );
-    
+
     // Top level constraint
-    if( !iTopLevel ) 
+    if( !iTopLevel )
         {
         User::Leave( KErrNotReady );
         }
     iTopLevel->ExternalizeL( aStream );
-    
+
     // Play constraint
     if( !iPlay )
         {
         User::Leave( KErrNotReady );
         }
     iPlay->ExternalizeL( aStream );
-    
+
     // Display constraint
     if( !iDisplay )
         {
         User::Leave( KErrNotReady );
         }
     iDisplay->ExternalizeL( aStream );
-    
+
     // Execute constraint
     if( !iExecute )
         {
         User::Leave( KErrNotReady );
         }
     iExecute->ExternalizeL( aStream );
-    
+
     // Print constraint
     if( !iPrint )
         {
         User::Leave( KErrNotReady );
         }
     iPrint->ExternalizeL( aStream );
-    
+
     // Export constraint
     if( !iExport )
         {
         User::Leave( KErrNotReady );
         }
     iExport->ExternalizeL( aStream );
-    
+
     // Export mode
     exportMode = iExportMode;
     aStream.WriteUint8L( exportMode );
-    
+
     // Content id of the parent rights object
     dataLength = 0;
-    if( iParentUID ) 
+    if( iParentUID )
         {
         dataLength = iParentUID->Length();
         }
@@ -279,47 +279,47 @@
 
     if( dataLength )
         {
-        aStream.WriteL( iParentUID->Des() );        
-        }             
-    
+        aStream.WriteL( iParentUID->Des() );
+        }
+
     // Rights Object if of the rights delivery container
-    dataLength = 0;    
+    dataLength = 0;
     if( iRoID )
         {
         dataLength = iRoID->Length();
         }
     aStream.WriteInt32L( dataLength );
-    
+
     if( dataLength )
         {
-        aStream.WriteL( iRoID->Des() );        
+        aStream.WriteL( iRoID->Des() );
         }
-    
+
     // Domain identifier
-    dataLength = 0;    
+    dataLength = 0;
     if( iDomainID )
         {
         dataLength = iDomainID->Length();
         }
     aStream.WriteInt32L( dataLength );
-    
+
     if( dataLength )
         {
-        aStream.WriteL( iDomainID->Des() );        
-        }    
-       
-    // Available rights    
+        aStream.WriteL( iDomainID->Des() );
+        }
+
+    // Available rights
     aStream.WriteUint16L( iAvailableRights );
 
-    // Version number of the rights object    
+    // Version number of the rights object
     aStream.WriteUint16L( iRightsObjectVersion.iVersionMain );
     aStream.WriteUint16L( iRightsObjectVersion.iVersionSub );
-    
+
     // Info bits
     aStream.WriteInt32L( iInfoBits );
-    
+
     aStream.WriteL( iRiId );
-     
+
     // OnExpiredUrl
     dataLength = 0;
     if ( iOnExpiredUrl )
@@ -327,37 +327,37 @@
         dataLength = iOnExpiredUrl->Length();
         }
     aStream.WriteInt32L( dataLength );
-    
+
     if ( dataLength )
         {
         aStream.WriteL( iOnExpiredUrl->Des() );
         }
-    
+
     // For future use
     aStream.WriteInt32L( 0 );
-    
+
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMPermission::InternalizeL
 // -----------------------------------------------------------------------------
 //
 EXPORT_C void CDRMPermission::InternalizeL( RReadStream& aStream )
-    {    
-    
+    {
+
     TInt64 timeData = 0;
-    
+
     // used for the buffers
     TInt dataLength = 0;
     TPtr8 dataBuffer(NULL,0,0);
     HBufC8* dataPart = NULL;
-    
+
     // (Possible) synchronizing marker
     iSyncMark = aStream.ReadInt32L();
-    
+
     if ( iSyncMark == KSyncMark )
         {
-        
+
         // The internalized Permission object has the new structure if the
         // synchronizing marker is found in the beginning of the stream. In that
         // case read version number and Unique ID.
@@ -367,276 +367,276 @@
         iUniqueID = aStream.ReadUint32L();
 
         }
-    else 
+    else
         {
-        
+
         // The internalized Permission object has the old structure. The
         // stream information that was read to iSyncMark is actually the
         // Unique ID.
         iUniqueID = (TDRMUniqueID)iSyncMark;
         iVersion = KVersion3_2_0; // Old version, needed for differentation
-        
+
         }
-            
+
     // The original insertion time
     ReadInt64L( timeData, aStream );
     iOriginalInsertTime = timeData;
-    
+
     // Top level constraint
     if( !iTopLevel )
         {
         iTopLevel = CDRMConstraint::NewL();
         }
-        
+
     iTopLevel->InternalizeL( aStream );
-    
+
     // Play constraint
     if( !iPlay )
         {
         iPlay = CDRMConstraint::NewL();
         }
-         
+
     iPlay->InternalizeL( aStream );
-    
+
     // Display constraint
     if( !iDisplay )
         {
         iDisplay = CDRMConstraint::NewL();
         }
-        
+
     iDisplay->InternalizeL( aStream );
-    
+
     // Execute constraint
     if( !iExecute )
         {
         iExecute = CDRMConstraint::NewL();
         }
-         
+
     iExecute->InternalizeL( aStream );
-    
+
     // Print constraint
     if( !iPrint)
         {
         iPrint = CDRMConstraint::NewL();
         }
-         
+
     iPrint->InternalizeL( aStream );
-    
+
     // Export constraint
-     
+
     iExport->InternalizeL( aStream );
-    
+
     // Export mode
     iExportMode = static_cast<TExportMode>(aStream.ReadUint8L());
-    
+
     // Content id of the parent rights object
     dataLength = aStream.ReadInt32L();
-    
+
     SanitizeL( dataLength );
-    
+
     if( dataLength > 0 )
         {
         // Reserve a new buffer:
         dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
         // Set the read buffer:
         dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
         // Read the data:
         aStream.ReadL( dataBuffer );
-        
-        // Pop the buffer 
+
+        // Pop the buffer
         CleanupStack::Pop(); // dataPart
-                
-        // If an old content identifier exists delete it        
+
+        // If an old content identifier exists delete it
         if( iParentUID )
             {
             delete iParentUID;
             iParentUID = NULL;
             }
-        
+
         // assign the new content id
-        iParentUID = dataPart;    
+        iParentUID = dataPart;
         }
     else
         {
-        // If an old individual exists delete it 
+        // If an old individual exists delete it
         if( iParentUID )
             {
             delete iParentUID;
             iParentUID = NULL;
-            }        
-        }           
-    
-    
+            }
+        }
+
+
     // Rights Object if of the rights delivery container
     // Read the individual
     dataLength = aStream.ReadInt32L();
 
     SanitizeL( dataLength );
-        
+
     if( dataLength > 0 )
         {
         // Reserve a new buffer:
         dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
         // Set the read buffer:
         dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
         // Read the data:
         aStream.ReadL( dataBuffer );
-        
-        // Pop the buffer 
+
+        // Pop the buffer
         CleanupStack::Pop(); // dataPart
-                
-        // If an old content identifier exists delete it        
+
+        // If an old content identifier exists delete it
         if( iRoID )
             {
             delete iRoID;
             iRoID = NULL;
             }
-        
+
         // assign the new content id
-        iRoID = dataPart;    
+        iRoID = dataPart;
         }
     else
         {
-        // If an old individual exists delete it 
+        // If an old individual exists delete it
         if( iRoID )
             {
             delete iRoID;
             iRoID = NULL;
-            }        
-        }           
-    
+            }
+        }
+
     // Domain identifier
     dataLength = aStream.ReadInt32L();
 
     SanitizeL( dataLength );
-        
+
     if( dataLength > 0 )
         {
         // Reserve a new buffer:
         dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
         // Set the read buffer:
         dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
         // Read the data:
         aStream.ReadL( dataBuffer );
-        
-        // Pop the buffer 
+
+        // Pop the buffer
         CleanupStack::Pop(); // dataPart
-                
-        // If an old content identifier exists delete it        
+
+        // If an old content identifier exists delete it
+        if( iDomainID )
+            {
+            delete iDomainID;
+            iDomainID = NULL;
+            }
+
+        // assign the new content id
+        iDomainID = dataPart;
+        }
+    else
+        {
+        // If an old individual exists delete it
         if( iDomainID )
             {
             delete iDomainID;
             iDomainID = NULL;
             }
-        
-        // assign the new content id
-        iDomainID = dataPart;    
         }
-    else
-        {
-        // If an old individual exists delete it 
-        if( iDomainID )
-            {
-            delete iDomainID;
-            iDomainID = NULL;
-            }        
-        }           
-    
+
 
-    // Available rights    
+    // Available rights
     iAvailableRights = aStream.ReadUint16L();
 
-    // Version number of the rights object    
+    // Version number of the rights object
     iRightsObjectVersion.iVersionMain = aStream.ReadUint16L();
     iRightsObjectVersion.iVersionSub = aStream.ReadUint16L();
-    
+
     // Information bits
     iInfoBits = aStream.ReadInt32L();
-    
+
     aStream.ReadL( iRiId );
-    
+
     // New structure of Permission object
     if ( iVersion == KVersion3_2_1 )
         {
-        
+
         // OnExpiredUrl
         dataLength = aStream.ReadInt32L();
-    
+
         SanitizeL( dataLength );
-        
+
         if( dataLength > 0 )
             {
-            
+
             // Reserve a new buffer:
             dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
             // Set the read buffer:
-            dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, 
+            dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0,
                            dataLength);
-        
+
             // Read the data:
             aStream.ReadL( dataBuffer );
-        
-            // Pop the buffer 
+
+            // Pop the buffer
             CleanupStack::Pop(); // dataPart
-                
-            // If an old OnExpiredUrl exists delete it        
+
+            // If an old OnExpiredUrl exists delete it
             if( iOnExpiredUrl )
                 {
                 delete iOnExpiredUrl;
                 iOnExpiredUrl = NULL;
                 }
-        
+
             // assign the new OnExpiredUrl
-            iOnExpiredUrl = dataPart;    
+            iOnExpiredUrl = dataPart;
             }
             else
             {
-            // If an old OnExpiredUrl exists delete it 
+            // If an old OnExpiredUrl exists delete it
             if( iOnExpiredUrl )
                 {
                 delete iOnExpiredUrl;
                 iOnExpiredUrl = NULL;
-                }        
-            }           
-      
+                }
+            }
+
         // For future use or development, reads the data at the end of the stream
         dataLength = aStream.ReadInt32L();
-    
+
         SanitizeL( dataLength );
-        
+
         if ( dataLength > 0 )
             {
             // Reserve a new buffer:
             dataPart = HBufC8::NewMaxLC( dataLength );
-        
+
             // Set the read buffer:
             dataBuffer.Set(const_cast<TUint8*>(dataPart->Ptr()), 0, dataLength);
-        
+
             // Read the data:
             aStream.ReadL( dataBuffer );
-        
-            // Delete the buffer 
+
+            // Delete the buffer
             CleanupStack::PopAndDestroy( dataPart );
             }
         }
-    
-    // Permission can be considered to have the new structure after 
-    // internalization. 
-    if ( iVersion == KVersion3_2_0 ) 
+
+    // Permission can be considered to have the new structure after
+    // internalization.
+    if ( iVersion == KVersion3_2_0 )
         {
         iSyncMark = KSyncMark;
-        iVersion = KVersion3_2_1; 
+        iVersion = KVersion3_2_1;
         }
-        
+
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMPermission::Stateful
 // -----------------------------------------------------------------------------
@@ -653,19 +653,19 @@
         }
     else if( (iAvailableRights & ERightsDisplay) &&  iDisplay->Stateful() )
         {
-        return ETrue;    
+        return ETrue;
         }
     else if( (iAvailableRights & ERightsExecute) &&  iExecute->Stateful() )
         {
-        return ETrue;    
+        return ETrue;
         }
     else if( (iAvailableRights & ERightsPrint) &&  iPrint->Stateful() )
         {
         return ETrue;
         }
-    return EFalse;        
+    return EFalse;
     };
-	
+
 // -----------------------------------------------------------------------------
 // CDRMPermission::SoftwareConstrained
 // -----------------------------------------------------------------------------
@@ -685,25 +685,25 @@
     else if ( (iAvailableRights & ERightsDisplay) &&
         iDisplay->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) )
         {
-        return ETrue;    
+        return ETrue;
         }
     else if ( (iAvailableRights & ERightsExecute) &&
         iExecute->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) )
         {
-        return ETrue;    
+        return ETrue;
         }
     else if ( (iAvailableRights & ERightsPrint) &&
         iPrint->iActiveConstraints & ( EConstraintVendor | EConstraintSoftware ) )
         {
         return ETrue;
         }
-    return EFalse;        
+    return EFalse;
     };
-	
+
 // -----------------------------------------------------------------------------
 // CDRMPermission::Child
 // -----------------------------------------------------------------------------
-//	
+//
 EXPORT_C TBool CDRMPermission::Child() const
     {
     return iParentUID ? ETrue : EFalse;
@@ -712,105 +712,105 @@
 // -----------------------------------------------------------------------------
 // CDRMPermission::Size
 // -----------------------------------------------------------------------------
-//	
+//
 EXPORT_C TInt CDRMPermission::Size() const
     {
     TInt size = 0;
-    
+
     // synchronizing marker
     size += sizeof(TInt32);
-    
+
     // Version number
     size += sizeof(TInt32);
-    
+
     // Unique ID of the permission
     size += sizeof(TDRMUniqueID);
-    
+
     // The original insertion time
     size += sizeof(TTime);
-    
+
     // Top level constraint
     size += iTopLevel->Size();
-    
+
     // Play constraint
     size += iPlay->Size();
-    
+
     // Display constraint
     size += iDisplay->Size();
-    
+
     // Execute constraint
     size += iExecute->Size();
-    
+
     // Print constraint
     size += iPrint->Size();
-    
+
     // Export constraint
     size += iExport->Size();
-    
+
     // Export mode
     size += sizeof(TUint8);
-    
+
     // Content id of the parent rights object
     size += sizeof(TInt32);
-    
+
     if( iParentUID )
         {
         size += iParentUID->Size();
         }
-    
+
     // Rights Object if of the rights delivery container
     size += sizeof(TInt32);
-    
+
     if( iRoID )
         {
         size += iRoID->Size();
         }
-    
+
     // Domain identifier
     size += sizeof(TInt32);
-        
+
     if( iDomainID )
         {
         size += iDomainID->Size();
         }
-    
+
     // Available rights
     size += sizeof(TUint16);
-    
+
     // Version number of the rights object
     size += sizeof(TUint16);
     size += sizeof(TUint16);
-    
+
     // infobits
     size += sizeof(TInt32);
-    
+
     // RI ID
     size += KRiIdSize;
-      
+
     // OnExpiredUrl
     size += sizeof(TInt32);
-    
+
     if ( iOnExpiredUrl )
         {
         size += iOnExpiredUrl->Size();
         }
-    
+
     // For future use
     size += sizeof(TInt32);
-    
+
     return size;
-    
+
     };
 
 // -----------------------------------------------------------------------------
 // CDRMPermission::ConstraintForIntent
 // -----------------------------------------------------------------------------
-//	
-EXPORT_C CDRMConstraint* CDRMPermission::ConstraintForIntent( 
+//
+EXPORT_C CDRMConstraint* CDRMPermission::ConstraintForIntent(
     const ContentAccess::TIntent aIntent )
     {
     CDRMConstraint* r = NULL;
-    
+
     switch ( aIntent )
         {
         case ContentAccess::EPlay:
@@ -838,14 +838,14 @@
                 }
             break;
         }
-        
+
     return r;
     }
 
 // -----------------------------------------------------------------------------
 // CDRMPermission::ConstraintForIntent
 // -----------------------------------------------------------------------------
-//	
+//
 EXPORT_C CDRMConstraint* CDRMPermission::TopLevelConstraint()
     {
     if ( iAvailableRights & ERightsTopLevel )
@@ -861,18 +861,18 @@
 // -----------------------------------------------------------------------------
 // CDRMPermission::ConsumeRights
 // -----------------------------------------------------------------------------
-//	
+//
 EXPORT_C void CDRMPermission::ConsumeRights( const TIntent aIntent, const TTime& aCurrentTime )
     {
-    //__ASSERT_DEBUG( !( aIntent == ERightsTopLevel ), User::Leave( KErrArgument ) ); 
-    
+    //__ASSERT_DEBUG( !( aIntent == ERightsTopLevel ), User::Leave( KErrArgument ) );
+
     CDRMConstraint* constraint( TopLevelConstraint() );
-    
+
     if ( constraint )
         {
         constraint->Consume( aCurrentTime );
         }
-    
+
     constraint = ConstraintForIntent( aIntent );
     if ( constraint )
         {
@@ -891,8 +891,8 @@
     CleanupClosePushL( stream );
 
     InternalizeL( stream );
-    
-    CleanupStack::PopAndDestroy(); // Stream   
+
+    CleanupStack::PopAndDestroy(); // Stream
     };
 
 
@@ -909,10 +909,10 @@
     CleanupClosePushL( stream );
 
     ExternalizeL( stream );
-    
+
     CleanupStack::PopAndDestroy(); // Stream
     CleanupStack::Pop();
-    return data;    
+    return data;
     };
 
 // -----------------------------------------------------------------------------
@@ -921,64 +921,64 @@
 //
 EXPORT_C void CDRMPermission::DuplicateL( const CDRMPermission& aPermission )
     {
-    
+
     // Synchronizing marker
     iSyncMark = aPermission.iSyncMark;
-    
+
     // Version number
     iVersion = aPermission.iVersion;
-    
+
     // Unique ID of the permission
     iUniqueID = aPermission.iUniqueID;
-    
+
     // The original insertion time
     iOriginalInsertTime = aPermission.iOriginalInsertTime;
-    
+
     // Top level constraint
     if( !iTopLevel )
         {
         iTopLevel = CDRMConstraint::NewL();
         }
     iTopLevel->DuplicateL( *(aPermission.iTopLevel ) );
-    
+
     // Play constraint
     if( !iPlay )
         {
         iPlay = CDRMConstraint::NewL();
         }
     iPlay->DuplicateL( *(aPermission.iPlay ) );
-    
+
     // Display constraint
     if( !iDisplay )
         {
         iDisplay = CDRMConstraint::NewL();
         }
     iDisplay->DuplicateL( *(aPermission.iDisplay ) );
-    
+
     // Execute constraint
     if( !iExecute )
         {
         iExecute = CDRMConstraint::NewL();
         }
     iExecute->DuplicateL( *(aPermission.iExecute ) );
-    
+
     // Print constraint
     if( !iPrint )
         {
         iPrint = CDRMConstraint::NewL();
         }
     iPrint->DuplicateL( *(aPermission.iPrint ) );
-    
+
     // Export constraint
     if( !iExport )
         {
         iExport = CDRMConstraint::NewL();
         }
-    iExport->DuplicateL( *(aPermission.iExport ) ); 
-    
+    iExport->DuplicateL( *(aPermission.iExport ) );
+
     // Export mode
     iExportMode = aPermission.iExportMode;
-    
+
     // Content id of the parent rights object
     if( iParentUID )
         {
@@ -990,52 +990,52 @@
         {
         iParentUID = aPermission.iParentUID->AllocL();
         }
-        
+
     // Rights Object if of the rights delivery container
     if( iRoID )
         {
         delete iRoID;
         iRoID = NULL;
         }
-        
+
     if( aPermission.iRoID )
         {
         iRoID = aPermission.iRoID->AllocL();
         }
-        
+
     // Domain identifier
     if( iDomainID )
         {
         delete iDomainID;
         iDomainID = NULL;
         }
-        
-    if( aPermission.iDomainID )   
+
+    if( aPermission.iDomainID )
         {
         iDomainID = aPermission.iDomainID->AllocL();
         }
     // Available rights
-    iAvailableRights  = aPermission.iAvailableRights;	// Bitmask
-    
+    iAvailableRights  = aPermission.iAvailableRights;   // Bitmask
+
     // Version number of the rights object
     iRightsObjectVersion.iVersionMain = aPermission.iRightsObjectVersion.iVersionMain;
     iRightsObjectVersion.iVersionSub = aPermission.iRightsObjectVersion.iVersionSub;
-    
+
     // info bits
     iInfoBits = aPermission.iInfoBits;
-    
+
     // OnExpiredUrl
     if ( iOnExpiredUrl )
         {
         delete iOnExpiredUrl;
         iOnExpiredUrl = NULL;
         }
-        
-    if ( aPermission.iOnExpiredUrl )    
+
+    if ( aPermission.iOnExpiredUrl )
         {
         iOnExpiredUrl = aPermission.iOnExpiredUrl->AllocL();
         }
-    
+
     };
 
 
@@ -1044,57 +1044,57 @@
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TBool CDRMPermission::Expired( const TTime& aTime )
-	{
-	if( iTopLevel && iAvailableRights & ERightsTopLevel )
-		{
-		if( iTopLevel->Expired( aTime ) )
-			{
-			return ETrue;	
-			}	
-		}
+    {
+    if( iTopLevel && iAvailableRights & ERightsTopLevel )
+        {
+        if( iTopLevel->Expired( aTime ) )
+            {
+            return ETrue;
+            }
+        }
 
-	if( iPlay && iAvailableRights & ERightsPlay)
-		{
-		if( !iPlay->Expired( aTime ) )
-			{
-			return EFalse;
-			}	
-		}
+    if( iPlay && iAvailableRights & ERightsPlay)
+        {
+        if( !iPlay->Expired( aTime ) )
+            {
+            return EFalse;
+            }
+        }
 
-	if( iDisplay && iAvailableRights & ERightsDisplay )
-		{
-		if( !iDisplay->Expired( aTime ) )
-			{
-			return EFalse;	
-			}	
-		}
+    if( iDisplay && iAvailableRights & ERightsDisplay )
+        {
+        if( !iDisplay->Expired( aTime ) )
+            {
+            return EFalse;
+            }
+        }
 
-	if( iExecute && iAvailableRights & ERightsExecute )
-		{
-		if( !iExecute->Expired( aTime ) )
-			{
-			return EFalse;
-			}	
-		}
+    if( iExecute && iAvailableRights & ERightsExecute )
+        {
+        if( !iExecute->Expired( aTime ) )
+            {
+            return EFalse;
+            }
+        }
 
-	if( iPrint && iAvailableRights & ERightsPrint )
-		{
-		if( !iPrint->Expired( aTime ) )
-			{
-			return EFalse;	
-			}	
-		}
+    if( iPrint && iAvailableRights & ERightsPrint )
+        {
+        if( !iPrint->Expired( aTime ) )
+            {
+            return EFalse;
+            }
+        }
 
-	if( iExport && iAvailableRights & ERightsExport )
-		{
-		if( !iExport->Expired( aTime ) )
-			{
-			return EFalse;	
-			}	
-		}
-		
-	return ETrue;									
-	};
+    if( iExport && iAvailableRights & ERightsExport )
+        {
+        if( !iExport->Expired( aTime ) )
+            {
+            return EFalse;
+            }
+        }
+
+    return ETrue;
+    };
 
 
 // -----------------------------------------------------------------------------
@@ -1103,15 +1103,15 @@
 //
 EXPORT_C TBool CDRMPermission::Valid( const TTime& aTime,
                                       const RPointerArray<HBufC8>& aIndividual,
-                                      TUint32& aRejection, 
+                                      TUint32& aRejection,
                                       const TRightsType aType ) const
-	{
-	// Always check that if the top level rights are present
-	// that they are valid
+    {
+    // Always check that if the top level rights are present
+    // that they are valid
     if( iTopLevel && !iTopLevel->Valid( aTime, aIndividual, aRejection ) )
         {
         aRejection |= aRejection;
-        return EFalse;	
+        return EFalse;
         }
 
     switch( aType )
@@ -1119,90 +1119,90 @@
         case ERightsTopLevel:
             if( !iTopLevel )
                 {
-                return EFalse;	
+                return EFalse;
                 }
-            break;            
+            break;
         case ERightsPlay:
             if( !iPlay )
                 {
-                return EFalse;	
+                return EFalse;
+                }
+            else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            break;
+        case ERightsDisplay:
+            if( !iDisplay )
+                {
+                return EFalse;
+                }
+            else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            break;
+        case ERightsExecute:
+            if( !iExecute )
+                {
+                return EFalse;
+                }
+            else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            break;
+        case ERightsPrint:
+            if( !iPrint )
+                {
+                return EFalse;
+                }
+            else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
                 }
-    		else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}	
-    		break;    	
-    	case ERightsDisplay:
-    	    if( !iDisplay )
-    	    	{
-    	    	return EFalse;	
-    	    	}
-    		else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;
-    		    }
-    		break;      	
-    	case ERightsExecute:
-    	    if( !iExecute )
-    	    	{
-    	    	return EFalse;	
-    	        }
-    		else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		break;      	
-    	case ERightsPrint:
-    	    if( !iPrint )
-    	    	{
-    	    	return EFalse;	
-    	    	}
-    		else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		break;      	
-    	case ERightsExport:
-    	    if( !iExport )
-    	    	{
-    	    	return EFalse;	
-    	    	}
-    		else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		break;      	
+            break;
+        case ERightsExport:
+            if( !iExport )
+                {
+                return EFalse;
+                }
+            else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            break;
         default:
-    	  	// No constraints are defined, top level doesn't work
-    	  	// on it's own, the permission is invalid
-    	  	if( !iPrint && !iDisplay && !iExecute && !iPrint )
-    	  		{
-    	  		return EFalse;	
-    	  		}
-			else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}    			   	  		    	
-			else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) )
-    			{
-    			return EFalse;	
-    			}
-    		break;		    			   	  
-    	}
-    return ETrue;                                  		
-    }; 
+            // No constraints are defined, top level doesn't work
+            // on it's own, the permission is invalid
+            if( !iPrint && !iDisplay && !iExecute && !iPrint )
+                {
+                return EFalse;
+                }
+            else if( iPlay && !iPlay->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            else if( iDisplay && !iDisplay->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            else if( iPrint && !iPrint->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            else if( iExecute && !iExecute->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            else if( iExport && !iExport->Valid( aTime, aIndividual, aRejection ) )
+                {
+                return EFalse;
+                }
+            break;
+        }
+    return ETrue;
+    };
 
 
 
@@ -1217,11 +1217,11 @@
     iPlay = CDRMConstraint::NewL();
     iDisplay = CDRMConstraint::NewL();
     iExecute = CDRMConstraint::NewL();
-    iPrint = CDRMConstraint::NewL();                
+    iPrint = CDRMConstraint::NewL();
     iExport = CDRMConstraint::NewL();
-    
+
     iRightsObjectVersion.iVersionMain = EOma1Rights;
-    iRightsObjectVersion.iVersionSub = 0;                
+    iRightsObjectVersion.iVersionSub = 0;
     };
 
 
@@ -1231,9 +1231,9 @@
 //
 void CDRMPermission::WriteInt64L( const TInt64& aWrite, RWriteStream& aStream ) const
     {
-    TPtr8 output( reinterpret_cast<TUint8*>(const_cast<TInt64*>(&aWrite)), 
+    TPtr8 output( reinterpret_cast<TUint8*>(const_cast<TInt64*>(&aWrite)),
                   sizeof(TInt64), sizeof(TInt64) );
-        
+
     aStream.WriteL( output, sizeof(TInt64) );
     }
 
@@ -1244,8 +1244,8 @@
 void CDRMPermission::ReadInt64L( TInt64& aRead, RReadStream& aStream )
     {
     TPtr8 input( reinterpret_cast<TUint8*>(&aRead), 0, sizeof(TInt64) );
-    
-    aStream.ReadL( input, sizeof(TInt64) );    
+
+    aStream.ReadL( input, sizeof(TInt64) );
     };
 
 
@@ -1254,15 +1254,15 @@
 // -----------------------------------------------------------------------------
 //
 EXPORT_C void CDRMPermission::Merge( const CDRMPermission& aPermission )
-	{
-	iTopLevel->Merge( *( aPermission.iTopLevel ) );
-	iPlay->Merge( *( aPermission.iPlay ) );
-	iDisplay->Merge( *( aPermission.iDisplay ) );
-	iExecute->Merge( *( aPermission.iExecute ) );
-	iPrint->Merge( *( aPermission.iPrint ) );
-	iExport->Merge( *( aPermission.iExport ) );
-	iAvailableRights |= aPermission.iAvailableRights;
-	iInfoBits |= aPermission.iInfoBits;
-	}
-	
+    {
+    iTopLevel->Merge( *( aPermission.iTopLevel ) );
+    iPlay->Merge( *( aPermission.iPlay ) );
+    iDisplay->Merge( *( aPermission.iDisplay ) );
+    iExecute->Merge( *( aPermission.iExecute ) );
+    iPrint->Merge( *( aPermission.iPrint ) );
+    iExport->Merge( *( aPermission.iExport ) );
+    iAvailableRights |= aPermission.iAvailableRights;
+    iInfoBits |= aPermission.iInfoBits;
+    }
+
 // End of File
--- a/omadrm/drmengine/ro/src/DrmProtectedRoParser.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DrmProtectedRoParser.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,16 +22,16 @@
 #include <apmstd.h>
 #include <utf.h>
 #include <stringpool.h>
-#include <xml/ParserFeature.h>
+#include <xml/parserfeature.h>
 
 #ifdef _DEBUG
 #include <flogger.h>
 #endif // _DEBUG
-#include "base64.h"
+#include "Base64.h"
 #include "DcfCommon.h"
 #include "DrmRightsParser.h"
-#include "DrmProtectedRoParser.h"
-#include "DrmRightsClient.h"
+#include "DRMProtectedRoParser.h"
+#include "DRMRightsClient.h"
 #include "hash.h"
 #include "DRMCommon.h"
 #include "OmaCrypto.h"
@@ -40,7 +40,7 @@
 #include "RoapMessage.h"
 #include "DcfRep.h"
 #include "DcfEntry.h"
-#include "Oma2Dcf.h"
+#include "oma2dcf.h"
 
 using namespace Roap;
 using namespace Xml;
@@ -804,7 +804,7 @@
         if ( integrityCheck && !r )
             {
             // Only add the rigths which were parsed in this loop
-    
+
             for ( TInt i( n ); i < aResultRights.Count(); i++)
                 {
                 cid = NULL;
--- a/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeTable.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeTable.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,8 +18,8 @@
 
 // Autogenerated from \epoc32\build\generated\Xml\DrmRel1_0StringDict00AttributeTable.st by the stringtable tool - Do not edit
 #include <e32std.h>
-#include "StringPool.h"
-#include "StringTableSupport.h"
+#include "stringpool.h"
+#include "stringtablesupport.h"
 #include "DrmRel1_0StringDict00AttributeTable.h"
 #ifdef _DEBUG
 #undef _DEBUG
@@ -31,10 +31,10 @@
 
 // Intermediate
 const void * const KStringPointers[] =
-	{
-	(const void*)&K1,
-	(const void*)&K2,
-	(const void*)&K3
-	};
+    {
+    (const void*)&K1,
+    (const void*)&K2,
+    (const void*)&K3
+    };
 
 const TStringTable DrmRel1_0StringDict00AttributeTable::Table = {3, KStringPointers, ETrue};
--- a/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeValueTable.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DrmRel1_0StringDict00AttributeValueTable.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,8 +18,8 @@
 
 // Autogenerated from \epoc32\build\generated\Xml\DrmRel1_0StringDict00AttributeValueTable.st by the stringtable tool - Do not edit
 #include <e32std.h>
-#include "StringPool.h"
-#include "StringTableSupport.h"
+#include "stringpool.h"
+#include "stringtablesupport.h"
 #include "DrmRel1_0StringDict00AttributeValueTable.h"
 #ifdef _DEBUG
 #undef _DEBUG
@@ -34,13 +34,13 @@
 
 // Intermediate
 const void * const KStringPointers[] =
-	{
-	(const void*)&K1,
-	(const void*)&K2,
-	(const void*)&K3,
-	(const void*)&K4,
-	(const void*)&K5,
-	(const void*)&K6
-	};
+    {
+    (const void*)&K1,
+    (const void*)&K2,
+    (const void*)&K3,
+    (const void*)&K4,
+    (const void*)&K5,
+    (const void*)&K6
+    };
 
 const TStringTable DrmRel1_0StringDict00AttributeValueTable::Table = {6, KStringPointers, ETrue};
--- a/omadrm/drmengine/ro/src/DrmRel1_0StringDict00TagTable.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DrmRel1_0StringDict00TagTable.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,8 +18,8 @@
 
 // Autogenerated from \epoc32\build\generated\Xml\DrmRel1_0StringDict00TagTable.st by the stringtable tool - Do not edit
 #include <e32std.h>
-#include "StringPool.h"
-#include "StringTableSupport.h"
+#include "stringpool.h"
+#include "stringtablesupport.h"
 #include "DrmRel1_0StringDict00TagTable.h"
 #ifdef _DEBUG
 #undef _DEBUG
@@ -50,29 +50,29 @@
 
 // Intermediate
 const void * const KStringPointers[] =
-	{
-	(const void*)&K1,
-	(const void*)&K2,
-	(const void*)&K3,
-	(const void*)&K4,
-	(const void*)&K5,
-	(const void*)&K6,
-	(const void*)&K7,
-	(const void*)&K8,
-	(const void*)&K9,
-	(const void*)&K10,
-	(const void*)&K11,
-	(const void*)&K12,
-	(const void*)&K13,
-	(const void*)&K14,
-	(const void*)&K15,
-	(const void*)&K16,
-	(const void*)&K17,
-	(const void*)&K18,
-	(const void*)&K19,
-	(const void*)&K20,
-	(const void*)&K21,
-	(const void*)&K22
-	};
+    {
+    (const void*)&K1,
+    (const void*)&K2,
+    (const void*)&K3,
+    (const void*)&K4,
+    (const void*)&K5,
+    (const void*)&K6,
+    (const void*)&K7,
+    (const void*)&K8,
+    (const void*)&K9,
+    (const void*)&K10,
+    (const void*)&K11,
+    (const void*)&K12,
+    (const void*)&K13,
+    (const void*)&K14,
+    (const void*)&K15,
+    (const void*)&K16,
+    (const void*)&K17,
+    (const void*)&K18,
+    (const void*)&K19,
+    (const void*)&K20,
+    (const void*)&K21,
+    (const void*)&K22
+    };
 
 const TStringTable DrmRel1_0StringDict00TagTable::Table = {22, KStringPointers, ETrue};
--- a/omadrm/drmengine/ro/src/DrmRights.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DrmRights.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 
 #include "DrmAsset.h"
-#include "DrmRights.h"
+#include "DRMRights.h"
 #include "DrmPermission.h"
 #include "DrmConstraint.h"
 
--- a/omadrm/drmengine/ro/src/DrmRightsParser.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/ro/src/DrmRightsParser.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -24,14 +24,14 @@
 #include <utf.h>
 #include <stringpool.h>
 #include <xml/parserfeature.h>
-#include "DrmRights.h"
+#include "DRMRights.h"
 #include "DcfCommon.h"
 #include "DrmRightsParser.h"
-#include "DrmRightsClient.h"
+#include "DRMRightsClient.h"
 #include "hash.h"
-#include "base64.h"
-#include "DRMPermission.h"
-#include "DRMConstraint.h"
+#include "Base64.h"
+#include "DrmPermission.h"
+#include "DrmConstraint.h"
 #include "DRMClockClient.h"
 
 // MODULE DATA STRUCTURES
@@ -1216,7 +1216,7 @@
                     iRights->iCurrentConstraint->iDrmMeteringInfo->iGraceTime = n;
 
                     CleanupStack::PopAndDestroy( b );
-                    b = NULL; 
+                    b = NULL;
                     }
                 b = GetAttributeValueL( aAttributes, KContentAccessGrantedAttribute );
                 // put value to content access granted without metering
--- a/omadrm/drmengine/roap/inc/JoinDomainResp.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/inc/JoinDomainResp.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,7 +23,7 @@
 //  INCLUDES
 #include <hash.h>
 #include "RoapMessage.h"
-#include "DrmRightsClient.h"
+#include "DRMRightsClient.h"
 
 namespace Roap
 {
@@ -57,19 +57,19 @@
 class CJoinDomainResp : public CRoapMessage
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static CJoinDomainResp* NewL();
-        
+
         /**
         * Destructor.
         */
         virtual ~CJoinDomainResp();
 
     public: // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -87,9 +87,9 @@
         * @return ?description
         */
         //?type ?member_function( ?type ?arg1 );
-        
+
     protected:  // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -99,7 +99,7 @@
         //?type ?member_function( ?type ?arg1 );
 
     protected:  // Functions from base classes
-        
+
         /**
         * From ?base_class ?member_description
         */
@@ -129,7 +129,7 @@
         TBuf8<SHA1_HASH> iRiId;
         TBuf8<SHA1_HASH> iDomainKeyRiId;
         RPointerArray<HBufC8> iMacs;
-                
+
         TTime iDomainExpiration;
         TBool iHashChainSupport;
         RPointerArray<HBufC8> iDomainKeys;
@@ -139,7 +139,7 @@
         HBufC8* iErrorUrl;
         RPointerArray<HBufC8> iDomainKeyIDs;
         TKeyTransportScheme iTransportScheme;
-    
+
     protected:  // Data
         // ?one_line_short_description_of_data
         //?data_declaration;
@@ -147,7 +147,7 @@
     private:    // Data
         // ?one_line_short_description_of_data
         //?data_declaration;
-         
+
         // Reserved pointer for future extension
         //TAny* iReserved;
 
@@ -161,6 +161,6 @@
     };
 }
 
-#endif      // JOINDOMAINRESP_H   
-            
+#endif      // JOINDOMAINRESP_H
+
 // End of File
--- a/omadrm/drmengine/roap/inc/MeteringReportReq.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/inc/MeteringReportReq.h	Wed Jun 23 17:42:58 2010 +0100
@@ -27,7 +27,7 @@
 #include "RoapMessage.h"
 #include "RoapDef.h"
 #include "OmaCrypto.h"
-#include "CMLACrypto.h"
+#include "CmlaCrypto.h"
 
 namespace Roap
 {
@@ -44,19 +44,19 @@
 NONSHARABLE_CLASS( CMeteringReportReq ): public CRoapMessage
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static CMeteringReportReq* NewL();
-        
+
         /**
         * Destructor.
         */
         virtual ~CMeteringReportReq();
 
     public: // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -82,9 +82,9 @@
         * @return ?description
         */
         virtual HBufC8* MessageAsXmlL(void);
-        
+
     protected:  // New functions
-        
+
         /**
         * ?member_description.
         * @since Series ?XX ?SeriesXX_version
@@ -94,7 +94,7 @@
         //?type ?member_function( ?type ?arg1 );
 
     protected:  // Functions from base classes
-        
+
         /**
         * From ?base_class ?member_description
         */
@@ -130,7 +130,7 @@
         HBufC8* iSignature;
         HBufC8* iCipherValue;
         HBufC8* iEncryptedMekAndMak;
-        HBufC8* iMac;       
+        HBufC8* iMac;
         // Optional nonce from the trigger
         HBufC8* iTriggerNonce;
         TKeyTransportScheme iAlgorithmInUse;
@@ -142,7 +142,7 @@
     private:    // Data
         // ?one_line_short_description_of_data
         //?data_declaration;
-         
+
         // Reserved pointer for future extension
         //TAny* iReserved;
 
@@ -156,6 +156,6 @@
     };
 }
 
-#endif      // METERINGREPORTREQ_H   
-            
+#endif      // METERINGREPORTREQ_H
+
 // End of File
--- a/omadrm/drmengine/roap/inc/RespParser.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/inc/RespParser.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,9 +21,9 @@
 #define RESPPARSER_H
 
 //  INCLUDES
-#include <Xml/Parser.h>
-#include <Xml/ContentHandler.h>
-#include <Xml/XmlParserErrors.h>
+#include <xml/parser.h>
+#include <xml/contenthandler.h>
+#include <xml/xmlparsererrors.h>
 
 using namespace Xml;
 
@@ -73,6 +73,6 @@
     };
 }
 
-#endif      // ROAPPARSER_H   
-            
+#endif      // ROAPPARSER_H
+
 // End of File
--- a/omadrm/drmengine/roap/inc/RoapConnection.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/inc/RoapConnection.h	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -23,7 +23,6 @@
 
 #include <e32base.h>
 #include <es_sock.h>
-#include <CommDbConnPref.h>
 
 namespace Roap
 {
@@ -86,7 +85,6 @@
         RConnection iConnection;
         TState iState;
         TRequestStatus* iParentStatus;
-        TCommDbConnPref iConnPref;
     };
 }
 
--- a/omadrm/drmengine/roap/inc/RoapParser.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/inc/RoapParser.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,9 +21,9 @@
 #define ROAPPARSER_H
 
 //  INCLUDES
-#include <Xml/Parser.h>
-#include <Xml/ContentHandler.h>
-#include <Xml/XmlParserErrors.h>
+#include <xml/parser.h>
+#include <xml/contenthandler.h>
+#include <xml/xmlparsererrors.h>
 #include "RoapMessage.h"
 
 using namespace Xml;
--- a/omadrm/drmengine/roap/inc/RoapSyncWrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/inc/RoapSyncWrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #define CROAPSYNCWRAPPER_H
 
 #include <e32base.h>
-#include <roapobserver.h>
+#include <RoapObserver.h>
 
 /**
 *  Synchronous wrapper for ROAP protocol suite.
--- a/omadrm/drmengine/roap/src/JoinDomainReq.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/JoinDomainReq.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "base64.h"
+#include "Base64.h"
 #include "JoinDomainReq.h"
 #include "RoapDef.h"
 
@@ -100,7 +100,7 @@
 CJoinDomainReq* CJoinDomainReq::NewL()
     {
     CJoinDomainReq* self = new( ELeave ) CJoinDomainReq;
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -108,7 +108,7 @@
     return self;
     }
 
-    
+
 // Destructor
 CJoinDomainReq::~CJoinDomainReq()
     {
@@ -174,7 +174,7 @@
             }
         BufAppendL(b, KReqCertChainEnd);
         }
-        
+
     if (iPeerKeyIdentifier.Length() ||
         iOcspResponderKeyId ||
         iOcspInfoStored ||
@@ -182,19 +182,19 @@
         {
         BufAppendL(b, KReqExtensions);
         }
-        
+
     if (iPeerKeyIdentifier.Length())
         {
         BufAppendL(b, KReqPeerKey);
         BufAppendBase64L(b, iPeerKeyIdentifier);
         BufAppendL(b, KReqPeerKeyEnd);
         }
-        
+
     if (iOcspInfoStored)
         {
         BufAppendL(b, KReqNoOcspResponse);
         }
-        
+
     if (iOcspResponderKeyId)
         {
         BufAppendL(b, KReqOcspResponderKeyId);
@@ -206,7 +206,7 @@
         {
         BufAppendL(b, KReqHashChainSupport);
         }
-               
+
     if (iPeerKeyIdentifier.Length() ||
         iOcspResponderKeyId ||
         iOcspInfoStored ||
--- a/omadrm/drmengine/roap/src/LeaveDomainReq.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/LeaveDomainReq.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "base64.h"
+#include "Base64.h"
 #include "LeaveDomainReq.h"
 
 using namespace Roap;
@@ -85,7 +85,7 @@
 CLeaveDomainReq* CLeaveDomainReq::NewL()
     {
     CLeaveDomainReq* self = new( ELeave ) CLeaveDomainReq;
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -93,7 +93,7 @@
     return self;
     }
 
-    
+
 // Destructor
 CLeaveDomainReq::~CLeaveDomainReq()
     {
@@ -158,7 +158,7 @@
             }
         BufAppendL(b, KReqCertChainEnd);
         }
-        
+
     if ( iNotMember )
         {
         BufAppendL(b, KReqNotDomainMember);
--- a/omadrm/drmengine/roap/src/MeteringReportReq.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/MeteringReportReq.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "base64.h"
+#include "Base64.h"
 #include "MeteringReportReq.h"
 #include "RoapLog.h"
 
@@ -66,7 +66,7 @@
 
 // Note the two versions below are because of different namespace
 // normalisation of element roap:X509SPKIHash on canonicalisation of
-// whole request to be signed and on canonicalisation of element 
+// whole request to be signed and on canonicalisation of element
 // <meteringReport> to be MAC calculated.
 // when changing one of these another one must be cahnges too.
 //
@@ -103,9 +103,9 @@
 // ----------------------------------------------------------------------------
 // MeteringReportElementAsTextL
 //
-// write content of to given flat buffer 
+// write content of to given flat buffer
 // Used from MessageAsXmlL and from InsertMacL
-// Note content depends on value of 
+// Note content depends on value of
 // ----------------------------------------------------------------------------
 LOCAL_C inline void MeteringReportElementAsTextL(
     CBufFlat*& aBuf,
@@ -153,7 +153,7 @@
         }
     else
         {
-        // used in mac calculation 
+        // used in mac calculation
         // canonical form requires namespace definition for namespace roap
         Roap::CRoapMessage::BufAppendL( aBuf, KReqRoapX509AndHashNs );
         }
@@ -167,7 +167,7 @@
     // key wrapping info
     Roap::CRoapMessage::BufAppendBase64L( aBuf, *aReq.iEncryptedMekAndMak );
 
-    Roap::CRoapMessage::BufAppendL( aBuf, KReqCipherValueEnd );    
+    Roap::CRoapMessage::BufAppendL( aBuf, KReqCipherValueEnd );
 
     // Insert 128-bit encrypted MAC value
     if ( aReq.iMac )
--- a/omadrm/drmengine/roap/src/RegistrationReq.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RegistrationReq.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "base64.h"
+#include "Base64.h"
 #include "RegistrationReq.h"
 
 using namespace Roap;
@@ -107,7 +107,7 @@
 CRegistrationReq* CRegistrationReq::NewL()
     {
     CRegistrationReq* self = new( ELeave ) CRegistrationReq;
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -115,7 +115,7 @@
     return self;
     }
 
-    
+
 // Destructor
 CRegistrationReq::~CRegistrationReq()
     {
@@ -176,7 +176,7 @@
             }
         BufAppendL(b, KReqCertChainEnd);
         }
-        
+
     if (iTrustedAuthorities.Count() > 0)
         {
         BufAppendL(b, KReqTrustedAuthorities);
@@ -186,16 +186,16 @@
             BufAppendBase64L(b, *iTrustedAuthorities[i]);
             BufAppendL(b, KReqTrustedRootEnd);
             }
-        BufAppendL(b, KReqTrustedAuthoritiesEnd);     
+        BufAppendL(b, KReqTrustedAuthoritiesEnd);
         }
-        
+
     if (iServerInfo)
         {
         BufAppendL(b, KReqServerInfo);
         BufAppendL(b, *iServerInfo);
-        BufAppendL(b, KReqServerInfoEnd);    
+        BufAppendL(b, KReqServerInfoEnd);
         }
-        
+
     if ((iDeviceDetailsManufacturer &&
          iDeviceDetailsModel &&
          iDeviceDetailsVersion) ||
@@ -205,26 +205,26 @@
         {
         BufAppendL(b, KReqExtensions);
         }
-        
+
     if (iPeerKeyIdentifier.Length())
         {
         BufAppendL(b, KReqPeerKey);
         BufAppendBase64L(b, iPeerKeyIdentifier);
         BufAppendL(b, KReqPeerKeyEnd);
         }
-        
+
      if (iOcspInfoStored)
         {
         BufAppendL(b, KReqNoOcspResponse);
         }
-        
+
      if (iOcspResponderKeyId)
         {
         BufAppendL(b, KReqOcspResponderKeyId);
         BufAppendBase64L(b, *iOcspResponderKeyId);
         BufAppendL(b, KReqOcspResponderKeyIdEnd);
         }
-         
+
     if (iDeviceDetailsManufacturer != NULL &&
         iDeviceDetailsModel != NULL &&
         iDeviceDetailsVersion != NULL)
@@ -237,7 +237,7 @@
         BufAppendL(b, *iDeviceDetailsVersion);
         BufAppendL(b, KReqDevDetailsEnd);
         }
-        
+
     if ((iDeviceDetailsManufacturer &&
          iDeviceDetailsModel &&
          iDeviceDetailsVersion) ||
@@ -256,4 +256,4 @@
     return r;
     }
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/roap/src/RightsReq.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RightsReq.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "base64.h"
+#include "Base64.h"
 #include "RightsReq.h"
 
 using namespace Roap;
@@ -108,7 +108,7 @@
 CRightsReq* CRightsReq::NewL()
     {
     CRightsReq* self = new( ELeave ) CRightsReq;
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -116,7 +116,7 @@
     return self;
     }
 
-    
+
 // Destructor
 CRightsReq::~CRightsReq()
     {
@@ -197,7 +197,7 @@
             }
         BufAppendL(b, KReqCertChainEnd);
         }
-        
+
     if (iTransTrackIDs.Count() ||
         iPeerKeyIdentifier.Length() ||
         iOcspResponderKeyId ||
@@ -205,26 +205,26 @@
         {
         BufAppendL(b, KReqExtensions);
         }
-        
+
     if (iPeerKeyIdentifier.Length())
         {
         BufAppendL(b, KReqPeerKey);
         BufAppendBase64L(b, iPeerKeyIdentifier);
         BufAppendL(b, KReqPeerKeyEnd);
         }
-        
+
     if (iOcspInfoStored)
         {
         BufAppendL(b, KReqNoOcspResponse);
         }
-        
+
     if (iOcspResponderKeyId)
         {
         BufAppendL(b, KReqOcspResponderKeyId);
         BufAppendBase64L(b, *iOcspResponderKeyId);
         BufAppendL(b, KReqOcspResponderKeyIdEnd);
         }
-        
+
     for ( TInt i = 0; i < iTransTrackIDs.Count() && i < iContentIDs.Count(); i++ )
         {
         BufAppendL(b, KReqTransactionContentId);
@@ -234,7 +234,7 @@
         BufAppendL(b, *iTransTrackIDs[i]);
         BufAppendL(b, KReqTransactionIdEnd);
         }
-               
+
     if (iTransTrackIDs.Count() ||
          iPeerKeyIdentifier.Length() ||
          iOcspResponderKeyId ||
@@ -251,4 +251,4 @@
     return r;
     }
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/roap/src/RoapConnection.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RoapConnection.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,54 +22,16 @@
 #include <cmconnectionmethoddef.h>
 #include <cmmanager.h>
 #include <centralrepository.h>
-#include <CommDbConnPref.h>
+#include <extendedconnpref.h>
 #include <cdblen.h>
+#include <cdbcols.h> // IAP, COMMDB_ID
 #include <es_enum.h>
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <BrowserUiSDKCRKeys.h>
-#endif
 #include "RoapConnection.h"
 #include "RoapDef.h"
 #include "RoapLog.h"
 
 
 
-#ifndef __SERIES60_NATIVE_BROWSER
-    const TUid KCRUidBrowser   = {0x10008D39};
-    const TUint32 KBrowserDefaultAccessPoint =  0x0000000E;
-    const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-    const TUint32 KBrowserNGDefaultSnapId = 0x00000053;
-#endif
-
-
-// ================= LOCAL FUNCTIONS =========================================
-// ---------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
-// ---------------------------------------------------------------------------
-//
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
-    RCmManager& aCmManager,
-    const TUint32 aDefaultSnap )
-    {
-    RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
-    CleanupClosePushL( dest );
-    TUint32 iapIdOfDest( 0 );
-
-    if ( dest.ConnectionMethodCount() <= 0 )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-    CleanupClosePushL( cMeth );
-
-    iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-    CleanupStack::PopAndDestroy( &cMeth );
-    CleanupStack::PopAndDestroy( &dest );
-    return iapIdOfDest;
-    }
-
 // ================= MEMBER FUNCTIONS =======================
 
 // ---------------------------------------------------------------------------
@@ -104,8 +66,6 @@
 ( TUint32 aIap, TRequestStatus* aStatus )
     {
     LOGLIT( "CRoapConnection::ConnectL" )
-    const TInt KAlwaysAskSelectionMode( 1 );
-    const TInt KDestinationSelectionMode( 2 );
 
     if ( iState == EInit )
         {
@@ -120,11 +80,9 @@
         CleanupClosePushL<RConnection>( iConnection );
 
         TConnectionInfoBuf connInfo;
-        TInt ap = 0;
-        TInt alwaysAsk = 0;
-        TUint count;
+        TUint count(0);
         User::LeaveIfError( iConnection.EnumerateConnections( count ) );
-        TUint i;
+        TUint i(0);
         if ( count )
             {
             // Select from existing connections. Try to make AP match.
@@ -152,71 +110,44 @@
         else
             {
             // No existing connections, create new one.
-#ifdef __WINS__
-            // WINS connection creation does not work if preferences are given.
-            // Defaults are to be used always.
-            iConnection.Start( iStatus );
-#else
-            // Note: the TCommDbConnPref must NOT be stack variable.
-            // It must persist until completion of RConnection::Start().
-            iConnPref.SetDirection( ECommDbConnectionDirectionOutgoing );
-            //iConnPref.SetDialogPreference( ECommDbDialogPrefWarn )
-            iConnPref.SetBearerSet( ECommDbBearerCSD | ECommDbBearerWcdma );
-            // New connection is always created with user-selected AP
-            // so 0 is used instead of aIap.
+            // Create overrides
+            TConnPrefList prefList;
+            TExtendedConnPref prefs;
+
+            prefs.SetNoteBehaviour(TExtendedConnPref::ENoteBehaviourConnSilent);
 
-            TInt defaultSnap( 0 );
-            CRepository* repository( NULL );
-            repository = CRepository::NewL( KCRUidBrowser );
-            CleanupStack::PushL( repository );
-
-            repository->Get( KBrowserDefaultAccessPoint, ap);
-            repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-            repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-            CleanupStack::PopAndDestroy( repository );
-            repository = NULL;
-
-            TUint32 iapd32 = 0;
-            TInt err = KErrNone;
-
-            if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
+            //Fetch default connection
+            TBool hasDefault(ETrue);
+            TCmDefConnValue defConn;
+            RCmManager cmManager;
+            cmManager.OpenLC();
+            cmManager.ReadDefConnL(defConn);
+            if (defConn.iType == ECmDefConnConnectionMethod)
                 {
-                alwaysAsk = KAlwaysAskSelectionMode;
+                prefs.SetIapId(defConn.iId);
+                }
+            else if (defConn.iType == ECmDefConnDestination)
+                {
+                prefs.SetSnapId(defConn.iId);
                 }
             else
                 {
-                RCmManager cmManager;
-                cmManager.OpenLC();
-                if ( !alwaysAsk )
-                    {
-                    TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL(
-                            ap, CMManager::ECmIapId ) );
-                    }
-                else if ( alwaysAsk == KDestinationSelectionMode )
-                    {
-                    TRAP( err, iapd32 = IapIdOfDefaultSnapL(
-                            cmManager, defaultSnap ) );
-                    }
-                CleanupStack::PopAndDestroy( &cmManager );
+                hasDefault = EFalse;
                 }
-
-            if ( err || alwaysAsk == KAlwaysAskSelectionMode )
+            // End of fetch default connection
+            if (hasDefault)
                 {
-                // Always ask
-                LOGLIT( "SetDialogPreference( ECommDbDialogPrefPrompt )" )
-                iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt );
-                iapd32 = 0;
+                prefList.AppendL(&prefs);
+
+                // Start an Outgoing Connection with overrides
+                iConnection.Start(prefList, iStatus);
                 }
             else
                 {
-                // User defined
-                LOGLIT( "SetDialogPreference( ECommDbDialogPrefDoNotPrompt )" )
-                iConnPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+                // No default found --> trying with query
+                iConnection.Start(iStatus);
                 }
-
-            iConnPref.SetIapId( iapd32 );
-            iConnection.Start( iConnPref, iStatus );
-#endif
+            CleanupStack::PopAndDestroy(&cmManager);
             iState = EConnecting;
             SetActive();    // The only path with a real async request.
             }
--- a/omadrm/drmengine/roap/src/RoapEng.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RoapEng.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -23,10 +23,10 @@
 #include <DocumentHandler.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include  <PathInfo.h>
-#include  <DriveInfo.h>
+#include  <pathinfo.h>
+#include  <driveinfo.h>
 #else
-#include  <PathInfo.h>
+#include  <pathinfo.h>
 #endif
 
 #ifndef __WINS__
@@ -37,7 +37,7 @@
 
 #include <flogger.h>
 #include <x509cert.h>
-#include <x509CertExt.h>
+#include <x509certext.h>
 #include <hash.h>
 #include <utf.h>
 #include <asn1dec.h>
@@ -45,7 +45,7 @@
 #include <e32base.h>  // CleanupResetAndDestroyPushL dependencies
 
 #include "cleanupresetanddestroy.h" // CleanupResetAndDestroyPushL
-#include "DrmRights.h"
+#include "DRMRights.h"
 #include "RoapEng.h"
 #include "RoapTrigger.h"
 #include "wbxmlroaptriggerparser.h"
@@ -72,14 +72,15 @@
 #include "RoapLog.h"
 #include "RoapObserver.h"
 #include "CmlaCrypto.h"
-#include "DrmRiContext.h"
-#include "DrmDomainContext.h"
-#include "DrmProtectedRoParser.h"
+#include "DRMRIContext.h"
+#include "DRMDomainContext.h"
+#include "DRMProtectedRoParser.h"
 #include "DRMClockClient.h"
 #include "DcfRep.h"
-#include "dcfentry.h"
+#include "DcfEntry.h"
 #include "Base64.h"
 #include "drmsettingsplugininternalcrkeys.h"
+#include "buffercontainers.h"
 
 
 #define STUB_C_CLASS_IN_NAMESPACE( n, c ) namespace n { class c: public CBase { private: c(); public: virtual ~c(); }; } n::c::c() {} n::c::~c() {}
@@ -2162,7 +2163,7 @@
 #ifndef __WINS__
     TInt numPhone = 0;
     TUint32 caps = 0;
-    TName tsyName;
+    DRM::CNameContainer* tsyName(NULL);
     RMobilePhone phone;
     RTelServer etelServer;
     RTelServer::TPhoneInfo phoneInfo;
@@ -2173,18 +2174,20 @@
     CleanupClosePushL( etelServer );
 
     User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
-    User::LeaveIfError( etelServer.EnumeratePhones( numPhone) );
+    User::LeaveIfError( etelServer.EnumeratePhones( numPhone ) );
 
+    tsyName = DRM::CNameContainer::NewLC();
     for (TInt i(0); i < numPhone; i++)
         {
         User::LeaveIfError( etelServer.GetPhoneInfo( i, phoneInfo ) );
-        User::LeaveIfError( etelServer.GetTsyName( i,tsyName ) );
+        User::LeaveIfError( etelServer.GetTsyName( i,tsyName->iBuffer ) );
 
-        if ( tsyName.CompareF( KMmTsyModuleName ) == 0)
+        if ( !tsyName->iBuffer.CompareF( KMmTsyModuleName ) )
             {
             break;
             }
         }
+    CleanupStack::PopAndDestroy( tsyName );
 
     User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
     CleanupClosePushL( phone );
--- a/omadrm/drmengine/roap/src/RoapEngBase.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RoapEngBase.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,8 +17,8 @@
 
 
 // INCLUDE FILES
-#include <DrmRights.h>
-#include <DrmRightsClient.h>
+#include <DRMRights.h>
+#include <DRMRightsClient.h>
 // #include <GenericParam.h> // from S60
 #include "RoapEngBase.h"
 #include "RoapHttpHandler.h"
@@ -27,7 +27,7 @@
 #include "RoapMessage.h"
 #include "RoapLog.h"
 #include "RoapObserver.h"
-#include "DrmRiContext.h"
+#include "DRMRIContext.h"
 #include "RoapStorageClient.h"
 
 using namespace Roap;
--- a/omadrm/drmengine/roap/src/RoapHttpHandler.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RoapHttpHandler.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,18 +19,22 @@
 // INCLUDE FILES
 #include <stringpool.h>
 #include <http/thttphdrval.h>
-#include <HttpFilterCommonStringsExt.h>
-
-#include "RoapHttpHandler.h"
-#include "RoapObserver.h"
-#include "RoapDef.h"
-#include "RoapLog.h"
+#include <httpfiltercommonstringsext.h>
 
 //#include <CookieFilterInterface.h>
 //#include <uaproffilter_interface.h>
 //#include <HttpFilterProxyInterface.h>
 #include <httpfilteriopinterface.h>
 
+#include "RoapHttpHandler.h"
+#include "RoapConnection.h"
+#include "RoapResponse.h"
+#include "RoapObserver.h"
+#include "RoapDef.h"
+#include "RoapLog.h"
+
+#include "buffercontainers.h"
+
 
 using namespace Roap;
 
@@ -39,12 +43,8 @@
 // The time out value in HTTP, 30 sec
 LOCAL_D const TInt KRoapTimeoutValue = 60000000;
 
-_LIT8( KTestUserName, "iopvf" );
-_LIT8( KTestPassword, "r72005" );
-/*
-_LIT8( KTestUserName, "moria" );
-_LIT8( KTestPassword, "mellon" );
-*/
+_LIT8( KTestUserName, "" );
+_LIT8( KTestPassword, "" );
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -564,6 +564,7 @@
             {
             LOG( _L("HTTP event ERedirectRequiresConfirmation received") );
             iTransaction.SubmitL();
+            break;
             }
 
         default:
@@ -641,13 +642,13 @@
 
         if ( iResponse->iDataType == TDataType( KMultipartRelatedType ) )
             {
-            TPath tempPath;
-            TFileName fileName;
+            DRM::CPathContainer* tempPath( DRM::CPathContainer::NewLC() );
+            DRM::CFileNameContainer* fileName( DRM::CFileNameContainer::NewLC() );
             TInt maxSize( 0 );
 
             if ( iObserver )
                 {
-                iObserver->ContentDownloadInfoL( tempPath, fileName, maxSize );
+                iObserver->ContentDownloadInfoL( tempPath->iBuffer, fileName->iBuffer, maxSize );
                 }
 
             boundaryStr = srtPool.StringF( HttpFilterCommonStringsExt::EBoundary,
@@ -666,8 +667,10 @@
                 LOG( _L("Error: multipart boundary missing") );
                    User::Leave( KErrRoapGeneral );
                 }
-            iResponse->SetDcfPathL( tempPath );
-            iResponse->SetContentNameL( fileName );
+            iResponse->SetDcfPathL( tempPath->iBuffer );
+            iResponse->SetContentNameL( fileName->iBuffer );
+            CleanupStack::PopAndDestroy( fileName );
+            CleanupStack::PopAndDestroy( tempPath );
             iReportBytes = ETrue;
 
             if ( iObserver )
--- a/omadrm/drmengine/roap/src/RoapResponse.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RoapResponse.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 #undef _ROAP_TESTING
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 // INCLUDE FILES
@@ -30,7 +30,7 @@
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -68,7 +68,7 @@
     iPdu = HBufC8::NewL( 0 );
     iMultipartState = EOther;
     iMaxSize = -1;
-    }    
+    }
 
 // -----------------------------------------------------------------------------
 // CRoapResponse::NewL()
@@ -101,7 +101,7 @@
     {
     return *iPdu;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CRoapResponse::PduFileName()
 // -----------------------------------------------------------------------------
@@ -110,7 +110,7 @@
     {
     return iDcfFileName;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CRoapResponse::SetPduFileName()
 // -----------------------------------------------------------------------------
@@ -119,48 +119,48 @@
     const TPath& aPath )
     {
     LOG( _L("CRoapResponse::SetDcfPathL->") );
-    
+
     RFs fs;
     RFile file;
     User::LeaveIfError( fs.Connect() );
     CleanupClosePushL( fs );
-    
+
     if ( aPath.Length() > 3 )
         {
         User::LeaveIfError( file.Temp( fs, aPath, iDcfFileName,
                             EFileShareExclusive | EFileWrite ) );
         }
-    else 
+    else
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-        
+
         User::LeaveIfError( file.Temp( fs, KMultipartPduTempPath(), iDcfFileName,
                             EFileShareExclusive | EFileWrite ) );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
         _LIT( KDriveRoot, "%c:\\");
         TInt driveNumber( -1 );
         TChar driveLetter;
         DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	    fs.DriveToChar( driveNumber, driveLetter );
-    
-	    TFileName multipartTemp;
-	    multipartTemp.Format( KDriveRoot, (TUint)driveLetter );
-        
+        fs.DriveToChar( driveNumber, driveLetter );
+
+        TFileName multipartTemp;
+        multipartTemp.Format( KDriveRoot, (TUint)driveLetter );
+
         User::LeaveIfError( file.Temp( fs, multipartTemp, iDcfFileName,
                             EFileShareExclusive | EFileWrite ) );
-    
+
 #endif
         }
-    LOG2( _L("iDcfFileName: %S"), &iDcfFileName );    
-        
+    LOG2( _L("iDcfFileName: %S"), &iDcfFileName );
+
     file.Close();
     CleanupStack::PopAndDestroy();
     LOG( _L("CRoapResponse::SetDcfFileName <-") );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CRoapResponse::AppendPduFileDataL()
 // -----------------------------------------------------------------------------
@@ -170,7 +170,7 @@
     {
     WriteL( aData );
     }
-    
+
 // ---------------------------------------------------------
 // CRoapResponse::DataType()
 // ---------------------------------------------------------
@@ -182,7 +182,7 @@
 
 // -----------------------------------------------------------------------------
 // CRoapResponse::HandleBodyDataL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CRoapResponse::HandleBodyDataL(
@@ -200,7 +200,7 @@
         {
         RFs fs;
         RFile file;
-        
+
         LOG( _L("  saving DCF data") );
         User::LeaveIfError( fs.Connect() );
         CleanupClosePushL( fs );
@@ -215,7 +215,7 @@
 
 // -----------------------------------------------------------------------------
 // CRoapResponse::StartBodyPartL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CRoapResponse::StartBodyPartL()
@@ -240,7 +240,7 @@
 
 // -----------------------------------------------------------------------------
 // CRoapResponse::EndBodyPartL
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CRoapResponse::EndBodyPartL()
@@ -248,32 +248,32 @@
     LOG( _L("CRoapResponse::EndBodyPartL ->") );
     LOG( _L("CRoapResponse::EndBodyPartL <-") );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CRoapResponse::SetContentNameL
-// 
+//
 // -----------------------------------------------------------------------------
-//    
+//
 void CRoapResponse::SetContentNameL( const TDes& aName )
     {
     LOG( _L("CRoapResponse::SetContentNameL") );
-    
+
     delete iContentName;
     iContentName = NULL;
-    
+
     iContentName = aName.AllocL();
     }
 
 
 // -----------------------------------------------------------------------------
 // CRoapResponse::GetContentNameLC
-// 
+//
 // -----------------------------------------------------------------------------
 //
 void CRoapResponse::GetContentNameLC( HBufC*& aName ) const
     {
     LOG( _L("CRoapResponse::GetContentName") );
-        
+
     if ( iContentName )
         aName = iContentName->AllocLC();
     else
@@ -281,25 +281,25 @@
     }
 // -----------------------------------------------------------------------------
 // CRoapResponse::SetMaxSize
-// 
+//
 // -----------------------------------------------------------------------------
-//    
+//
 void CRoapResponse::SetMaxSize( const TInt& aSize )
     {
     LOG( _L("CRoapResponse::SetMaxSize") );
-    
+
     iMaxSize = aSize;
     }
 
 
 // -----------------------------------------------------------------------------
 // CRoapResponse::MaxSize
-// 
+//
 // -----------------------------------------------------------------------------
 //
 TInt CRoapResponse::MaxSize() const
     {
     LOG( _L("CRoapResponse::MaxSize") );
-        
+
     return iMaxSize;
     }
--- a/omadrm/drmengine/roap/src/RoapSigner.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roap/src/RoapSigner.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -26,7 +26,7 @@
 #include <hash.h>
 #include <asn1enc.h>
 #include <x509cert.h>
-#include "base64.h"
+#include "Base64.h"
 #include "RoapSigner.h"
 #include "RoapStorageClient.h"
 #include "RoapLog.h"
--- a/omadrm/drmengine/roapstorage/inc/RoapStorageSession.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roapstorage/inc/RoapStorageSession.h	Wed Jun 23 17:42:58 2010 +0100
@@ -157,8 +157,7 @@
 
     void UpdateDrmTimeL( const RMessage2& aMessage );
 
-    void
-        CRoapStorageSession::VerifyOcspResponsesL( const RMessage2& aMessage );
+    void VerifyOcspResponsesL( const RMessage2& aMessage );
 
     void GetOcspResponderIdL( const RMessage2& aMessage );
 
--- a/omadrm/drmengine/roapstorage/src/RoapStorageClient.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roapstorage/src/RoapStorageClient.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -31,7 +31,7 @@
 #include "DRMRIContext.h"
 #include "DRMDomainContext.h"
 #include "drmroapclientserver.h"
-#include "drmrightsclient.h"
+#include "DRMRightsClient.h"
 #include "cleanupresetanddestroy.h" // CleanupResetAndDestroyPushL
 // LOCAL CONSTANTS AND MACROS
 
--- a/omadrm/drmengine/roapstorage/src/RoapStorageServer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roapstorage/src/RoapStorageServer.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  
+* Description:
 *
 */
 
@@ -21,7 +21,7 @@
 #include <e32std.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "RoapStorageServer.h"
@@ -29,10 +29,10 @@
 #include "RoapLog.h"
 #include "drmroapclientserver.h"
 #include "drmcommonclientserver.h"
-#include "drmkeystorage.h"
+#include "DrmKeyStorage.h"
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 // MACROS
 
@@ -77,42 +77,42 @@
 // This function starts the actual server under TRAP harness and starts
 // waiting for connections. This function returns only if there has been
 // errors during server startup or the server is stopped for some reason.
-// 
+//
 // Returns: TInt: Symbian OS error code.
 // -----------------------------------------------------------------------------
-LOCAL_C TInt StartRoapServer( RSemaphore& aClientSem ) 
+LOCAL_C TInt StartRoapServer( RSemaphore& aClientSem )
 
     {
     TInt error = KErrNone;
     CRoapStorageServer* server = NULL;
     TUint8 count = 0;
 
-    do 
+    do
         {
         ++count;
         TRAP( error, ( server = CRoapStorageServer::NewL() ) );
-        if ( error ) 
+        if ( error )
            {
            User::After( TTimeIntervalMicroSeconds32(KWaitingTime) );
            }
-       
+
         } while( error && ( count <= KMaxStartTries ) );
-    
-    if( error ) 
+
+    if( error )
         {
         return error;
         }
-        
+
     // Release the semaphore...
     aClientSem.Signal();
     aClientSem.Close();
-    
+
     // Start waiting for connections
     CActiveScheduler::Start();
-    
+
     // Delete CRoapStorageServer
     delete server;
-    
+
     return KErrNone;
     }
 
@@ -121,19 +121,19 @@
 // Read a file into a buffer
 // -----------------------------------------------------------------------------
 LOCAL_C void ReadFileL( RFs& aFs, HBufC8*& aContent, const TDesC& aName )
-	{	
-	TInt size = 0;
-	RFile file;
-	
-	User::LeaveIfError( file.Open( aFs, aName, EFileRead ) );
-	CleanupClosePushL( file );
+    {
+    TInt size = 0;
+    RFile file;
+
+    User::LeaveIfError( file.Open( aFs, aName, EFileRead ) );
+    CleanupClosePushL( file );
     User::LeaveIfError( file.Size( size ) );
     aContent = HBufC8::NewLC( size );
     TPtr8 ptr( aContent->Des() );
     User::LeaveIfError( file.Read( ptr, size) );
     CleanupStack::Pop(); // aContent
-	CleanupStack::PopAndDestroy(); // file
-	}
+    CleanupStack::PopAndDestroy(); // file
+    }
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -147,14 +147,14 @@
     CRoapStorageServer* self = new( ELeave ) CRoapStorageServer();
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop( self ); 
+    CleanupStack::Pop( self );
     return self;
     }
 
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
-CRoapStorageServer::~CRoapStorageServer() 
+CRoapStorageServer::~CRoapStorageServer()
     {
     iRFs.Close();
     delete iRoapStorage;
@@ -165,7 +165,7 @@
 // From CActive. Complete the request and restart the scheduler.
 // -----------------------------------------------------------------------------
 //
-TInt CRoapStorageServer::RunError( TInt aError ) 
+TInt CRoapStorageServer::RunError( TInt aError )
     {
     // Inform the client.
     Message().Complete( aError );
@@ -187,8 +187,8 @@
     // Check that the versions are compatible.
     if ( ! User::QueryVersionSupported( TVersion( KServerMajorVersion,
                                                   KServerMinorVersion,
-                                                  KServerBuildVersion ), 
-                                        aVersion ) ) 
+                                                  KServerBuildVersion ),
+                                        aVersion ) )
         {
         // Sorry, no can do.
         User::Leave( KErrNotSupported );
@@ -202,59 +202,59 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CRoapStorageServer::CRoapStorageServer() : 
+CRoapStorageServer::CRoapStorageServer() :
     CServer2( EPriorityStandard ),
     iRoapStorage( NULL )
     {
     // Nothing
     }
-    
+
 // -----------------------------------------------------------------------------
 // CRoapStorageServer::ConstructL
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
 //
-void CRoapStorageServer::ConstructL() 
+void CRoapStorageServer::ConstructL()
     {
     TInt err = KErrNone;
-    
+
     User::RenameThread( KRoapStorageThread );
     StartL( Roap::KServerName );
     User::LeaveIfError(iRFs.Connect());
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
-    iRoapStorage = CDRMContextDB::NewL( KRIContextFile(), 
+
+    iRoapStorage = CDRMContextDB::NewL( KRIContextFile(),
                                         KDomainContextFile(),
                                         iRFs );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	iRFs.DriveToChar( driveNumber, driveLetter );
-	
-	TFileName riContextFile;
-	riContextFile.Format( KRIContextFileName, (TUint)driveLetter );
-    
+    iRFs.DriveToChar( driveNumber, driveLetter );
+
+    TFileName riContextFile;
+    riContextFile.Format( KRIContextFileName, (TUint)driveLetter );
+
     TFileName domainContextFile;
-	domainContextFile.Format( KDomainContextFileName, (TUint)driveLetter );
-    
-    iRoapStorage = CDRMContextDB::NewL( riContextFile, 
+    domainContextFile.Format( KDomainContextFileName, (TUint)driveLetter );
+
+    iRoapStorage = CDRMContextDB::NewL( riContextFile,
                                         domainContextFile,
                                         iRFs );
-    
+
 #endif
-    
+
     TRAP( err, ImportKeysL() );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CRoapStorageServer::ContextDB
 // Return the internal ROAP storage object
 // -----------------------------------------------------------------------------
-//       
+//
 CDRMContextDB* CRoapStorageServer::ContextDB()
     {
     return iRoapStorage;
@@ -267,10 +267,10 @@
 // at a time. The file names are DevicePrivateKey.der, DeviceCert.der and
 // SigningCertXX.der.
 // -----------------------------------------------------------------------------
-//       
+//
 void CRoapStorageServer::ImportKeysL()
     {
-    MDrmKeyStorage* storage = NULL; 
+    MDrmKeyStorage* storage = NULL;
     HBufC8* privateKey = NULL;
     HBufC8* cert = NULL;
     RArray<TPtrC8> certChain;
@@ -280,96 +280,96 @@
     TInt i;
     CDir* dir = NULL;
     TInt err = KErrNone;
-    
+
     __UHEAP_MARK;
     LOG( _L( "CRoapStorageServer::ImportKeysL" ) );
     CleanupClosePushL( buffers );
     CleanupClosePushL( certChain );
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     ReadFileL( iRFs, privateKey, KDeviceKeyFileName );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName tempPath;
     TFileName tempPath2;
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	iRFs.DriveToChar( driveNumber, driveLetter );
-	
-	tempPath.Format( KDeviceKeyFileName, (TUint)driveLetter );
-    
+    iRFs.DriveToChar( driveNumber, driveLetter );
+
+    tempPath.Format( KDeviceKeyFileName, (TUint)driveLetter );
+
     ReadFileL( iRFs, privateKey, tempPath );
-    
+
 #endif
-    
+
     CleanupStack::PushL( privateKey );
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     ReadFileL( iRFs, cert, KDeviceCertFileName );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
-	tempPath2.Format( KDeviceCertFileName, (TUint)driveLetter );
-    
+
+    tempPath2.Format( KDeviceCertFileName, (TUint)driveLetter );
+
     ReadFileL( iRFs, cert, tempPath2 );
-    
+
 #endif
-    
+
     CleanupStack::PushL( cert );
     buffers.AppendL( cert );
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     iRFs.Delete( KDeviceKeyFileName );
     iRFs.Delete( KDeviceCertFileName );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
-	iRFs.Delete( tempPath );
+
+    iRFs.Delete( tempPath );
     iRFs.Delete( tempPath2 );
-    
+
 #endif
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     User::LeaveIfError( iRFs.GetDir( KInputFilePattern, KEntryAttNormal,
         ESortByName, dir ) );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
-	tempPath.Format( KInputFilePattern, (TUint)driveLetter );
-    
+
+    tempPath.Format( KInputFilePattern, (TUint)driveLetter );
+
     User::LeaveIfError( iRFs.GetDir( tempPath, KEntryAttNormal,
         ESortByName, dir ) );
-    
+
 #endif
-    
+
     CleanupStack::PushL( dir );
-    
+
     for ( i = 0; i < dir->Count(); i++ )
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
         fileName.Copy( KImportDir );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
-	    tempPath.Format( KImportDir, (TUint)driveLetter );
-        
+
+        tempPath.Format( KImportDir, (TUint)driveLetter );
+
         fileName.Copy( tempPath );
-    
+
 #endif
-        
+
         fileName.Append( (*dir)[i].iName );
         ReadFileL( iRFs, cert, fileName );
         CleanupStack::PushL( cert );
         buffers.AppendL( cert );
-        
+
         iRFs.Delete( fileName );
         }
     for ( i = 0; i < buffers.Count(); i++ )
@@ -394,21 +394,21 @@
 // -----------------------------------------------------------------------------
 //
 
-TInt StartupRoapStorage( TAny* ) 
-    {    
+TInt StartupRoapStorage( TAny* )
+    {
     TInt error = KErrNone;
     CTrapCleanup* trap = CTrapCleanup::New();
     __ASSERT_ALWAYS( trap, User::Invariant() );
-    
+
     CActiveScheduler* scheduler = new CActiveScheduler();
     __ASSERT_ALWAYS( scheduler, User::Invariant() );
-    
+
     CActiveScheduler::Install( scheduler );
     RSemaphore clientSem;
     __ASSERT_ALWAYS( clientSem.OpenGlobal( KDRMEngCommonSemaphore ) == 0, User::Invariant() );
-    
+
     error = StartRoapServer( clientSem );
-    
+
     if ( error ) {
         // Server creation failed. Release the semaphore.
         // In case of successful startup, CRoapStorageServer
@@ -416,15 +416,15 @@
         clientSem.Signal();
         clientSem.Close();
         }
-    
-    delete scheduler; 
+
+    delete scheduler;
     scheduler = NULL;
-    
+
     delete trap;
     trap = NULL;
-    
+
     // __ASSERT_ALWAYS( !error, User::Invariant() );
-    
+
     return KErrNone;
     }
 
--- a/omadrm/drmengine/roapstorage/src/RoapStorageSession.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roapstorage/src/RoapStorageSession.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -31,7 +31,7 @@
 #include <random.h>
 #endif //RD_DRM_METERING
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 #include <e32base.h>  // CleanupResetAndDestroyPushL dependencies
 #include "drmaescrypto.h"
@@ -41,22 +41,22 @@
 #include "DRMDomainContext.h"
 #include "RoapStorageServer.h"
 #include "CmlaCrypto.h"
-#include "DrmAesCrypto.h"
+#include "drmaescrypto.h"
 #include "DrmKeyStorage.h"
 #include "RoapDef.h"
 #include "RoapLog.h"
 #include "drmroapclientserver.h"
-#include "drmclockclient.h"
-#include "DrmTypes.h"
-#include "drmpointerarray.h"
+#include "DRMClockClient.h"
+#include "DRMTypes.h"
+#include "DRMPointerArray.h"
 //OCSP classes
-#include "roapocsp.h"
+#include "RoapOcsp.h"
 #include "responsedecoder.h"
 #include "certid.h"
 //drm clock
-#include "drmclockclient.h"
+#include "DRMClockClient.h"
 
-#include "base64.h"
+#include "Base64.h"
 
 #include "cleanupresetanddestroy.h" // CleanupResetAndDestroyPushL
 // NAMESPACES
--- a/omadrm/drmengine/roapstorage/src/response.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/roapstorage/src/response.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 #include <x509cert.h>
 #include <x500dn.h>
 
-#include "roapocsp.h"
+#include "RoapOcsp.h"
 #include "oids.h"
 #include "certid.h"
 
Binary file omadrm/drmengine/server/data/101F51F2.exc has changed
--- a/omadrm/drmengine/server/inc/DRMActiveDeletion.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Active object handling "Delete Expired Permission"
-*
-*/
-
-
-#ifndef DRMACTIVEDELETION_H
-#define DRMACTIVEDELETION_H
-
-// INCLUDES
-
-#include <e32base.h>
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FORWARD DECLARATIONS
-class CDRMRightsDB;
-class CDRMDbSession;                                                         
-
-// FUNCTION PROTOTYPES
-
-// CLASS DECLARATION
-
-/**
-*  CDRMActiveDeletion implements expired rights cleanup callback
-*  for drm rights database
-*
-*  @lib RightsServer.exe
-*  @since 3.0
-*/
-NONSHARABLE_CLASS( CDRMActiveDeletion ) : public CActive
-    {
-    public: // Constructors and destructor
-        
-        /**
-        * NewL
-        *
-        * Creates an instance of the CDRMRightCleaner class and returns a pointer
-        * to it
-        *
-        * @since    3.0
-        * @param    aFs : Open file server session
-        * @param    aDatabase : CDRMRightsDB object
-        * @param    aStatus : The request status to complete when the operation is 
-        *                     fully done
-        * @param    aDatabasePath : full pathname of the database path
-        * @param    aTime : Time to check expiration against 
-        *
-        * @return   Functional CDRMActiveDeletion object, Function leaves if an error
-        *           occurs.
-        */
-        static CDRMActiveDeletion* NewLC( const RMessagePtr2& aMessage,
-                                          CDRMDbSession& aSession );
-          
-        /**
-        * Destructor
-        */
-        virtual ~CDRMActiveDeletion();
-
-    public: // New functions    
-
-        /**
-        * ActivateL
-        * 
-        * Activates the object by adding it to scheduler etc.
-        *
-        * @since    3.0
-        * @return   None
-        *
-        */      
-        void ActivateL( const TTime& aSecureTime,
-                        CDRMRightsDB& aDb );
-         
-    protected:
-    
-        /**
-        * Default Constructor - First phase.
-        */
-        CDRMActiveDeletion( const RMessagePtr2& aMessage,
-                            CDRMDbSession& aSession ); 
-        
-        /**
-        * From CActive: RunL.
-        */
-        void RunL();
-
-        /**
-        * From CActive: DoCancel performs cancel
-        */        
-        void DoCancel();
-      
-        /**
-        * From CActive: RunError checks the errors from RunL.
-        */
-        // void RunError();                        
-                        
-    private:
-        /**
-        * Default Constructor - First phase. Prevented.
-        */
-        CDRMActiveDeletion(); 
-    
-        /**
-        * Assignment operator - Prevented
-        */
-        CDRMActiveDeletion& operator =( const CDRMActiveDeletion& );    
-    
-        /**
-        * Copy constructor - Prevented
-        */
-        CDRMActiveDeletion( const CDRMActiveDeletion& );                
-     
-    private:
-        // The message.
-        const RMessagePtr2& iMessage;
-        CDRMDbSession& iSession;
-    
-        // The instane doing the deletion.
-        CActive* iActiveOperation;
-    };
-
-#endif      // DRMACTIVEDELETION_H   
-            
-// End of File
--- a/omadrm/drmengine/server/inc/DRMDbSession.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/DRMDbSession.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,11 +23,11 @@
 #include <e32base.h>
 #include <caf/caf.h>
 #include "DRMTypes.h"
-#include "DRMConstraint.h"
+#include "DrmConstraint.h"
 #include "DRMEngineClientServer.h"
 #include "drmcommonclientserver.h"
 #include "drmenginetypedefs.h"
-#include "roapstorageclient.h"
+#include "RoapStorageClient.h"
 
 // CONSTANTS
 // MACROS
--- a/omadrm/drmengine/server/inc/DRMDbSession.inl	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/DRMDbSession.inl	Wed Jun 23 17:42:58 2010 +0100
@@ -18,7 +18,7 @@
 
 
 // INCLUDE FILES
-#include "DRMConstraint.h"
+#include "DrmConstraint.h"
 #include "DRMRightsServer.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
@@ -28,7 +28,7 @@
     {
     if ( ( ( aConstraint.iActiveConstraints & EConstraintCounter ) &&
            ( aConstraint.iCounter < 1 ) ) ||
-         ( ( aConstraint.iActiveConstraints & 
+         ( ( aConstraint.iActiveConstraints &
              EConstraintInterval ) &&
            ( aConstraint.iIntervalStart != Time::NullTTime() ) ) )
         {
@@ -37,7 +37,7 @@
 
     return EFalse;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMDbSession::UpdateSecureTime
 // Update secure time.
@@ -59,4 +59,4 @@
 
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/server/inc/DRMObsoleteFinder.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/DRMObsoleteFinder.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 // INCLUDES
 
 #include <e32base.h>
-#include "drmpointerarray.h"
+#include "DRMPointerArray.h"
 
 // CONSTANTS
 
@@ -35,7 +35,7 @@
 class CDir;
 class CDRMRightsDB;
 class CDcfRep;
-                                                         
+
 
 // FUNCTION PROTOTYPES
 
@@ -52,7 +52,7 @@
 NONSHARABLE_CLASS( CDRMObsoleteFinder ) : public CActive
     {
     public: // Constructors and destructor
-        
+
         /**
         * NewL
         *
@@ -62,7 +62,7 @@
         * @since    3.0
         * @param    aFs : Open file server session
         * @param    aDatabase : CDRMRightsDB object
-        * @param    aStatus : The request status to complete when the operation is 
+        * @param    aStatus : The request status to complete when the operation is
         *                     fully done
         * @param    aStream : stream to write the result into
         * @param    aPerformScan : if a filesystem scan need to be performed
@@ -75,29 +75,29 @@
                                         TRequestStatus& aStatus,
                                         RWriteStream& aStream,
                                         TBool aPerformScan );
-          
+
         /**
         * Destructor
         */
         virtual ~CDRMObsoleteFinder();
 
-    public: // New functions    
+    public: // New functions
 
         /**
         * ExecuteCleanupLD
-        * 
+        *
         * Delete expired permissions. The object is deleted when
         * the function completes
         *
         * @since    3.0
         * @return   None
         *
-        */      
+        */
         void ExecuteFinderLD();
-        
-        
+
+
         void DoCleanup();
-         
+
     protected:
         /**
         * From CActive: RunL.
@@ -107,28 +107,28 @@
 
         /**
         * From CActive: DoCancel performs cancel
-        */        
+        */
         void DoCancel();
-      
+
         /**
         * From CActive: RunError checks the errors from RunL.
         */
-        TInt RunError( TInt aError );                        
-                        
+        TInt RunError( TInt aError );
+
     private:
         /**
         * Default Constructor - First phase. Prevented.
         */
-        CDRMObsoleteFinder(); 
-    
+        CDRMObsoleteFinder();
+
         /**
         * Default Constructor - First phase.
         */
         CDRMObsoleteFinder( RFs& aFs,
                             CDRMRightsDB* aDatabase,
                             TRequestStatus& aStatus,
-                            RWriteStream& aStream ); 
-        
+                            RWriteStream& aStream );
+
         /**
         * ConstructL
         *
@@ -136,18 +136,18 @@
         *
         * @since  3.0
         * @return Leaves if an error occurs
-        */  
-        void ConstructL( const TBool aPerformScan );  
+        */
+        void ConstructL( const TBool aPerformScan );
 
         /**
         * Assignment operator - Prevented
         */
-        CDRMObsoleteFinder& operator =( const CDRMObsoleteFinder& );    
-    
+        CDRMObsoleteFinder& operator =( const CDRMObsoleteFinder& );
+
         /**
         * Copy constructor - Prevented
         */
-        CDRMObsoleteFinder( const CDRMObsoleteFinder& );                
+        CDRMObsoleteFinder( const CDRMObsoleteFinder& );
 
 
         /**
@@ -171,42 +171,42 @@
         * @leave    Symbian OS error code
         */
         void ObsoleteToStreamL();
-     
+
     private:
         // Dcf repository client
         CDcfRep* iDcfClient;
-        
+
         // List of content id's
         CDRMPointerArray<HBufC8>* iContents;
-        
+
         // List of content id's
         CDRMPointerArray<HBufC8>* iParents;
-        
+
         // List of content id's
         CDRMPointerArray<HBufC8>* iNoContents;
-                               
+
         // Index we are going at:
         TInt iIndex;
-    
+
         // fileserver session
         RFs& iFileServer;
 
         // output stream
         RWriteStream& iStream;
-    
+
         // rights database file, fileserver subsession
         CDRMRightsDB* iRightsDb;
-    
+
         // request status to be set complete
         TRequestStatus& iOperationStatus;
-        
+
         // State of the active object
         TInt iState;
-        
+
         // Cancelling status
         TInt iCancel;
     };
 
-#endif      // DRMOBSOLETEFINDER_H   
-            
+#endif      // DRMOBSOLETEFINDER_H
+
 // End of File
--- a/omadrm/drmengine/server/inc/DRMPointerArray.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/DRMPointerArray.h	Wed Jun 23 17:42:58 2010 +0100
@@ -29,17 +29,17 @@
         inline RDRMPointerArray( TInt aMinGrowBy, TInt aFactor );
         inline RDRMPointerArray();
         virtual ~RDRMPointerArray();
-        
-        // If set to ETrue, RPointerArray::ResetAndDestroy() is called 
+
+        // If set to ETrue, RPointerArray::ResetAndDestroy() is called
         // automatically in destructor. Otherwise only RPointerArrary::Close()
         // is called.
         inline void SetAutoCleanup( const TBool aCleanup );
-                
+
     protected:
         TBool iDoResetAndDestroy;
     };
 
-template < class T > NONSHARABLE_CLASS( CDRMPointerArray ) : public CBase, public RDRMPointerArray< class T >
+template < class T > NONSHARABLE_CLASS( CDRMPointerArray ) : public CBase, public RDRMPointerArray< T >
     {
     public:
         static CDRMPointerArray* NewLC( TInt aGranularity );
@@ -48,21 +48,21 @@
         static CDRMPointerArray* NewL( TInt aMinGrowBy, TInt aFactor );
         static CDRMPointerArray* NewLC();
         static CDRMPointerArray* NewL();
-        
-        // Note: Does not do ResetAndDestroy() by default. 
+
+        // Note: Does not do ResetAndDestroy() by default.
         // Use SetAutoCleanup to do reallyclean.
         ~CDRMPointerArray();
-        
-        
+
+
     protected:
         explicit CDRMPointerArray( TInt aGranularity );
         CDRMPointerArray( TInt aMinGrowBy, TInt aFactor );
-        CDRMPointerArray();        
-        
+        CDRMPointerArray();
+
     private:
     };
 
 
-#include "drmpointerarray.inl"
+#include "DRMPointerArray.inl"
 
 #endif // DRMPOINTERARRAY_H
\ No newline at end of file
--- a/omadrm/drmengine/server/inc/DRMReplayCache.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/DRMReplayCache.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 
 //  INCLUDES
 #include <e32std.h>
-#include <D32DBMS.H>
+#include <d32dbms.h>
 
 // CONSTANTS
 // MACROS
@@ -43,35 +43,35 @@
 NONSHARABLE_CLASS( RDRMReplayCache )
     {
     public: // Constructors and destructor
-    
+
     /**
     * Constructor.
     * @since S60Rel3.0
     */
     RDRMReplayCache( RFs& aFs );
-    
+
     /**
     * Default constructor.
     * @since S60Rel3.0
     */
     RDRMReplayCache();
-    
+
     public: // New functions
-    
+
     /**
     * Sets the ifs according to this reference.
     *
     * @since S60Rel3.0
-    * @param aFs Reference to open file server session. 
+    * @param aFs Reference to open file server session.
     */
     void Set( RFs& aFs );
-    
+
     /**
     * Closes the cache.
     * @since S60Rel3.0
     */
     void Close();
-    
+
     /**
     * Initializes the view.
     * @since S60Rel3.0
@@ -80,13 +80,13 @@
     */
     void InitL( const TDesC& aTimedDb,
                 const TDesC& aPlainDb );
-                
+
     /**
     * Destructor.
     * @since S60Rel3.0
     */
     ~RDRMReplayCache();
-    
+
     /**
     * Add an entry to the DB. Overloaded.
     * @since S60Rel3.0
@@ -94,7 +94,7 @@
     * @param aaTime Timestamp of the permission.
     * @param aaTime Insertion time.
     */
-    void AddL( const TDesC8& aID, 
+    void AddL( const TDesC8& aID,
                const TTime& aTime,
                const TTime& aInsertionTime  );
 
@@ -104,7 +104,7 @@
     * @param aID    Content-ID.
     * @param aaTime Insertion time.
     */
-    void AddL( const TDesC8& aID, 
+    void AddL( const TDesC8& aID,
                const TTime& aInsertionTime  );
 
     /**
@@ -114,9 +114,9 @@
     * @param aaTime Timestamp of the permission.
     * @return Boolean.
     */
-    TBool InCacheL( const TDesC8& aCID, 
+    TBool InCacheL( const TDesC8& aCID,
                     const TTime& aTime );
-    
+
     /**
     * Checks whether an entry is in cache. Overloaded.
     * @since S60Rel3.0
@@ -131,9 +131,9 @@
         ETimeDb,
         EPlainDb
         };
-        
+
     private: // Private functions
-    
+
     /**
     * Initializes the database.
     * @since S60Rel3.0
@@ -141,7 +141,7 @@
     * @param aFileName File name.
     * @param aId Database ID.
     */
-    void InitDbL( RDbNamedDatabase& aDb, 
+    void InitDbL( RDbNamedDatabase& aDb,
                   const TDesC& aFileName,
                   TDatabaseId aId );
 
@@ -151,7 +151,7 @@
     * @param aDb Database.
     * @param aFileName File name.
     */
-    void OpenDbL( RDbNamedDatabase& aDb, 
+    void OpenDbL( RDbNamedDatabase& aDb,
                   const TDesC& aFileName );
 
     /**
@@ -162,7 +162,7 @@
     * @param aId Database ID.
     */
     void ReplaceDbL( RDbNamedDatabase& aDb,
-                     const TDesC& aFileName, 
+                     const TDesC& aFileName,
                      TDatabaseId aId );
 
     /**
@@ -171,10 +171,10 @@
     * @param aView View to initialize.
     * @param aDb Database ID.
     */
-    void InitViewLC( RDbView& aView, 
+    void InitViewLC( RDbView& aView,
                      TDatabaseId aDb,
                      TBool aUpdate );
-    
+
     /**
     * Compare the given ID to the ID in the current position of the view.
     * @since S60Rel3.0
@@ -183,7 +183,7 @@
     * @return Boolean.
     */
     TBool CompareCIDL( RDbRowSet& aView, const TDesC8& aCID );
-    
+
     /**
     * Push a cleanup item to the cleanup stack in order to rollback
     * the database.
@@ -191,7 +191,7 @@
     * @param aDb Database.
     */
     void PushL( RDbDatabase& aDb );
-    
+
     /**
     * Pop the cleanup item pushed in by PushL
     * @since S60Rel3.0
@@ -202,36 +202,36 @@
     * Delete items starting from the oldest one.
     * @since S60Rel3.0
     * @param aView View.
-    * @param aHowMany How many items to delete. 
+    * @param aHowMany How many items to delete.
     */
     void DeleteOldestsL( RDbRowSet& aView, TInt16 aHowMany );
-    
+
     /**
     * Compacts the view to the upper limit of the view capacity.
     * @since S60Rel3.0
     * @param aView View to compact.
     */
     void CompactViewL( RDbRowSet& aView );
-    
+
     /**
     * Insert a content-id to the current position in the view.
     * @since S60Rel3.0
     * @param aView View to which the insertion is made.
-    * @param aId ID to add.    
+    * @param aId ID to add.
     */
-    void InsertIdL( RDbRowSet& aView, 
+    void InsertIdL( RDbRowSet& aView,
                     const TDesC8& aId );
-    
+
     private: // Data
     // File server session handle. Not owned by this object.
     RFs* iFs;
-    
+
     // Database for timestamped items.
     RDbNamedDatabase iTimeDb;
-    
+
     // Database for the items without timestamp.
     RDbNamedDatabase iPlainDb;
     // RDbView iView;
     };
 
-#endif //DRMREPLAYCACHE_H   
\ No newline at end of file
+#endif //DRMREPLAYCACHE_H
\ No newline at end of file
--- a/omadrm/drmengine/server/inc/DRMRightsServer.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/DRMRightsServer.h	Wed Jun 23 17:42:58 2010 +0100
@@ -24,9 +24,9 @@
 #include <f32file.h>
 #include <abclient.h>
 #include "drmcommonclientserver.h"
-#include "drmreplaycache.h"
+#include "DRMReplayCache.h"
 #include "drmmeteringdb.h"
-#include "drmclockclient.h"
+#include "DRMClockClient.h"
 #include "dbwatcher.h"
 #include "procwatcher.h"
 #include "watcherobserver.h"
@@ -39,7 +39,7 @@
 class CDRMBackupObserver;
 class CDRMBackup;
 class RMobilePhone;
-        
+
 // CLASS DECLARATION
 
 /**
@@ -51,46 +51,46 @@
 NONSHARABLE_CLASS( CDRMRightsServer ) : public CServer2, public MWatcherObserver
     {
     public:  // Constructors and destructor
-        
+
         /**
          * Two-phased constructor.
          * @since S60Rel2.5
          * @return Pointer to newly created server instance.
          */
         static CDRMRightsServer* NewL();
-        
+
         /**
          * Destructor.
          * @since S60Rel2.5
          */
         ~CDRMRightsServer();
-        
+
     public: // New functions
 
         /**
         * This method returns a handle to DRM Notifier.
         * @since S60Rel2.6
         * @return Handle to DRM Notifier.
-        */ 
+        */
         CDRMNotifier& Notifier();
 
         /**
         * This method starts the ROAP storage server
-        * 
+        *
         * @since S60Rel3.0
-        */ 
+        */
         void StartRoapStorageL();
-        
+
         /**
         * This method returns the handle to the rights database.
-        * 
+        *
         * @since S60Rel2.6
         * @return Handle to the rights database.
-        */ 
+        */
         CDRMRightsDB& Database();
 
         RFs& FileServerSession();
-        
+
         /**
         * This method returns the handle to the metering database.
         *
@@ -98,7 +98,7 @@
         * @return Handle to the metering database.
         */
         RDrmMeteringDb& MeteringDatabase();
-        
+
         RDRMReplayCache& ReplayCache();
 
         /**
@@ -117,23 +117,23 @@
         * @return Truth value: Is the time a secure time or not.
         */
         TBool GetSecureTime( TTime& aTime ) const;
-        
+
         /**
-         * 
+         *
          */
         const TDesC& GetIMEIL();
 
         /**
-         * 
+         *
          */
         const CDRMPointerArray<HBufC8>& GetIMSIL();
-        
+
         /**
         * This function is used to handle backup restore events for
         * the DRM system
         */
-        void HandleBackupEventL( TInt aBackupEvent );     
-        
+        void HandleBackupEventL( TInt aBackupEvent );
+
         /**
         * Checks if a content ID is in the list of currently consumed contents
         * with count constraints
@@ -143,7 +143,7 @@
         * @return ETrue if the content ID is in the list
         */
         TBool HasActiveCountConstraint( const TDesC8& aContentId );
-        
+
         /**
         * Removes a content ID from the list of currently consumed contents
         * with count constraints
@@ -152,7 +152,7 @@
         * @param aContentId content ID to remove
         */
         void RemoveActiveCountConstraint( const TDesC8& aContentId );
-        
+
         /**
         * Adds a content ID to the list of currently consumed contents
         * with count constraints
@@ -161,7 +161,7 @@
         * @param aContentId content ID to add
         */
         void AddActiveCountConstraintL( const TDesC8& aContentId );
-        
+
         /**
         * Import rights objects on startup
         *
@@ -169,7 +169,7 @@
         * @param aImportDir Directory to import from
         */
         void ImportRightsObjectsL( const TDesC& aImportDir );
-        
+
         /**
          * Stop watching the DCF repository server and the rights DB
          * @since 3.1
@@ -177,31 +177,31 @@
         void StopWatchingL();
 
     public: // Functions from base classes
-    
+
         //class MBackupOperationObserver
-        
-        /** 
+
+        /**
          * HandleNotifyL
          * @since S60Rel2.5
          * @param aBackupOperationAttributes Event related attributes.
          */
-        void HandleNotifyL(const TUid aUid, const TDesC& aKey, 
-            const TDesC& aValue); 
+        void HandleNotifyL(const TUid aUid, const TDesC& aKey,
+            const TDesC& aValue);
 
         //class MWatcherObserver
-        
-        /** 
+
+        /**
          * Called when the RDB has been modified
          *
          * @since S60 3.0
          * @param aObject Changed directory
          */
         void WatchedObjectChangedL( const TDesC& aObject );
-            
+
     protected:  // New functions
-        
+
     protected:  // Functions from base classes
-    
+
         //class CServer
         /**
          * RunError.
@@ -211,20 +211,20 @@
          * error.
          */
         TInt RunError( TInt aError );
-        
+
     private:
         /**
          * C++ default constructor.
          * @since S60Rel2.5
          */
         CDRMRightsServer();
-        
+
         /**
          * By default Symbian 2nd phase constructor is private.
          * @since S60Rel2.5
          */
         void ConstructL();
-        
+
         /**
          * This method fetches the database key and stores
          * it to the given descriptor.
@@ -232,81 +232,81 @@
          * @param aKey Descriptor where the key is stored.
          */
         void GetDbKeyL( TDRMKey& aKey );
-        
-        /** 
+
+        /**
          * This method generates the actual key from key seed.
          * @since S60Rel2.5
          * @param aKeySeed Key seed.
          * @param aKey     The key produced.
          */
-        void GenerateKeyL( HBufC*& aKeySeed, 
+        void GenerateKeyL( HBufC*& aKeySeed,
                            TDRMKey& aKey ) const;
 
-        
+
         void StartThreadL( const TDesC& aThreadName,
-                           TThreadFunction aFunc, 
+                           TThreadFunction aFunc,
                            RSemaphore& aSemaphore );
 
 
         void AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone = NULL);
-		    static void Release(TAny* aIndividualConstraintExtension);
+            static void Release(TAny* aIndividualConstraintExtension);
 
     private: // Functions from base classes
         // Class CServer
-        /** 
+        /**
          * NewSessionL
          * @since S60Rel2.5
          */
         CSession2* NewSessionL( const TVersion& aVersion,
                                 const RMessage2& aMessage) const;
-        
+
     public:     // Data
-        
+
     protected:  // Data
-        
+
     private:    // Data
         CDRMRightsDB* iDb;
-        
+
         CDRMNotifier* iNotifier;
-        
+
         RFs iFs;
         RDRMReplayCache iCache;
-        RDrmMeteringDb iMeteringDb; 
+        RDrmMeteringDb iMeteringDb;
         RDRMClockClient iClock;
         RPointerArray<CDRMXOma>* iXOmaHeaders;
         RPointerArray<HBufC8> iActiveCountConstraints;
-        
+
         HBufC* iIMEI;
-        
+
         // Backup Observer
         CDRMBackupObserver* iBackupObserver;
-        
+
         // BackupHandler
         CDRMBackup* iBackupHandler;
-        
+
         // Backup client
-        conn::CActiveBackupClient* iActiveBackupClient;        
-        
+        conn::CActiveBackupClient* iActiveBackupClient;
+
         // RDB Watcher
         CDbWatcher* iDbWatcher;
 
         // Peer process watcher
         CProcWatcher* iProcWatcher;
-        
+
         // Watching causes a restart
         TBool iArmed;
-        
+
         CDRMPointerArray<HBufC8>* iIMSI;
         TBool iGetImsi;
-                
+
     public:     // Friend classes
-        
+
     protected:  // Friend classes
-        
+
     private:    // Friend classes
-        
+
 };
 
-#endif      // CDRMRIGHTSSERVER_H   
+#endif      // CDRMRIGHTSSERVER_H
 
 // End of File
--- a/omadrm/drmengine/server/inc/drmenginetypedefs.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/drmenginetypedefs.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,7 +20,7 @@
 #define DRMENGINETYPEDEFS_H
 
 #include "DRMPointerArray.h"
-#include "drmpermission.h"
+#include "DrmPermission.h"
 
 typedef CDRMPointerArray< CDRMPermission > CDRMPermissionList;
 typedef RDRMPointerArray< CDRMPermission > RDRMPermissionList;
--- a/omadrm/drmengine/server/inc/drmlog.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/drmlog.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 
 //  INCLUDES
 #if (defined _DEBUG || defined _LOGGING)
-#include <E32SVR.H>
+#include <e32svr.h>
 #include <flogger.h>
 
 // CONSTANTS
@@ -39,6 +39,14 @@
 #define DRMLOG2( a, b ) \
     RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b); \
     RDebug::Print( a, b );
+
+#define DRMLOG6( a, b, c, d, e, f ) \
+    RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b, c, d, e, f); \
+    RDebug::Print( a, b, c, d, e, f );
+
+#define DRMLOG7( a, b, c, d, e, f, g ) \
+    RFileLogger::WriteFormat(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, a, b, c, d, e, f, g); \
+    RDebug::Print( a, b, c, d, e, f, g );
      
 #define DRMLOGHEX( a ) \
     RFileLogger::HexDump(_L("drm"), DRMFLOGFILE, EFileLoggingModeAppend, _S(""), _S(""), (a).Ptr(), (a).Size());
@@ -47,6 +55,8 @@
 
 #define DRMLOG( a ) 
 #define DRMLOG2( a, b ) 
+#define DRMLOG6( a, b, c, d, e, f )
+#define DRMLOG7( a, b, c, d, e, f, g )
 #define DRMLOGHEX( a )
 
 #endif // _DEBUG
--- a/omadrm/drmengine/server/inc/drmmeteringdb.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/inc/drmmeteringdb.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,8 @@
 //  INCLUDES
 #include <e32std.h>
 #include <caf/caf.h>
-#include <D32DBMS.H>
+#include <caf/cafplatform.h>
+#include <d32dbms.h>
 #include "DRMPointerArray.h"
 
 // CONSTANTS
@@ -37,103 +38,103 @@
 // CLASS DECLARATION
 
 /**
-*  Content metering information database. This class manages storing 
-*  information of Content ID, Rights Issuer ID, metered count and metered 
-*  accumulated time. 
+*  Content metering information database. This class manages storing
+*  information of Content ID, Rights Issuer ID, metered count and metered
+*  accumulated time.
 *
 *  @lib RightsServer.exe
 *  @since 3.2
 */
 NONSHARABLE_CLASS( RDrmMeteringDb )
     {
-        
+
     public: // Constructors and destructor
-    
+
         /**
         * Constructor.
         * @since S60 3.2
         */
         RDrmMeteringDb( RFs& aFs );
-    
+
         /**
         * Default constructor.
         * @since S60 3.2
         */
         RDrmMeteringDb();
-    
+
         public: // New functions
-    
+
         /**
         * Sets the iFs according to this reference.
         *
         * @since S60 3.2
-        * @param aFs Reference to open file server session. 
+        * @param aFs Reference to open file server session.
         */
         void Set( RFs& aFs );
-    
+
         /**
         * Closes the database.
         * @since S60 3.2
         */
         void Close();
-    
+
         /**
         * Initializes the database.
         * @since S60 3.2
         * @param aFileName File name of the database
         */
         void InitL( const TDesC& aFileName );
-                
+
         /**
         * Destructor.
         * @since S60 3.2
         */
         ~RDrmMeteringDb();
-    
+
         /**
         * Add a metering data entry to the database.
         * @since S60 3.2
         * @param aMeteringData One metering data entry
         */
         void AddL( const CDrmMeteringDbData* aMeteringData );
-        
-        /**  
-        * Get the metering data list based on the Rights Issuer Id from the 
-        * metering database. Return value is ETrue if at least one entry was 
-        * found corresponding to the given Rights Issuer Id. Return value is 
-        * EFalse if no entry was found. The function will leave if an error 
-        * happens in the handling of the database or if the Rights Issuer Id 
+
+        /**
+        * Get the metering data list based on the Rights Issuer Id from the
+        * metering database. Return value is ETrue if at least one entry was
+        * found corresponding to the given Rights Issuer Id. Return value is
+        * EFalse if no entry was found. The function will leave if an error
+        * happens in the handling of the database or if the Rights Issuer Id
         * is empty or too long.
         * @since S60 3.2
         * @param aRiId Rights Issuer Id
         * @param aMeteringDataList Metering data list for a Rights Issuer
         * @return Boolean
         */
-        TBool GetL( const TDesC8& aRiId, 
+        TBool GetL( const TDesC8& aRiId,
                     CDRMPointerArray< CDrmMeteringDbData >& aMeteringDataList );
-        
+
         /**
-        * Delete all the metering data information associated to the given 
+        * Delete all the metering data information associated to the given
         * Rights Issuer Id from the metering database. Return value is ETrue
-        * if at least one entry was found corresponding to the given Rights 
-        * Issuer Id. Return value is EFalse if no entry was found. The function 
-        * will leave if an error happens in the handling of the database or if 
-        * the Rights Issuer Id is empty or too long. 
+        * if at least one entry was found corresponding to the given Rights
+        * Issuer Id. Return value is EFalse if no entry was found. The function
+        * will leave if an error happens in the handling of the database or if
+        * the Rights Issuer Id is empty or too long.
         * @since S60 3.2
-        * @param aRiId Rights Issuer Id 
+        * @param aRiId Rights Issuer Id
         * @return Boolean
         */
         TBool DeleteL( const TDesC8& aRiId );
-        
+
     private: // Private functions
-    
+
         /**
         * Opens a database.
         * @since S60 3.2
         * @param aDb Database.
         * @param aFileName File name.
         */
-        void OpenDbL( RDbNamedDatabase& aDb, 
+        void OpenDbL( RDbNamedDatabase& aDb,
                       const TDesC& aFileName );
 
         /**
@@ -151,34 +152,34 @@
         * @param aView View to initialize.
         */
         void InitViewLC( RDbView& aView );
-    
+
         /**
         * Compare the Rights Issuer Id and Content Id to their counterparts in
-        * the current row of the view. Return value is ETrue only if both the 
+        * the current row of the view. Return value is ETrue only if both the
         * Content Id and the Rights Issuer Id match their counterpart Ids in
-        * the view. Overloaded.  
-        * 
+        * the view. Overloaded.
+        *
         * @since S60 3.2
         * @param aView View.
         * @param aCID Content Id
         * @param aRiId Rights Issuer Id
         * @return Boolean
         */
-        TBool CompareIDL( RDbRowSet& aView, 
-                          const TDesC8& aCID, 
+        TBool CompareIDL( RDbRowSet& aView,
+                          const TDesC8& aCID,
                           const TDesC8& aRiId );
-        
+
         /**
-        * Compare the Rights Issuer Id to its counterpart in the current row 
-        * of the view. Overloaded.  
-        * 
+        * Compare the Rights Issuer Id to its counterpart in the current row
+        * of the view. Overloaded.
+        *
         * @since S60 3.2
         * @param aView View.
         * @param aRiId Rights Issuer Id
         * @return Boolean
         */
         TBool CompareIDL( RDbRowSet& aView, const TDesC8& aRiId );
-            
+
         /**
         * Push a cleanup item to the cleanup stack in order to rollback
         * the database.
@@ -186,7 +187,7 @@
         * @param aDb Database.
         */
         void PushL( RDbDatabase& aDb );
-    
+
         /**
         * Pop the cleanup item pushed in by PushL
         * @since S60 3.2
@@ -196,10 +197,10 @@
     private: // Data
         // File server session handle. Not owned by this object.
         RFs* iFs;
-    
-        // Metering database 
+
+        // Metering database
         RDbNamedDatabase iDb;
-    
+
     };
 
-#endif //DRMMETERINGDB_H   
\ No newline at end of file
+#endif //DRMMETERINGDB_H
\ No newline at end of file
--- a/omadrm/drmengine/server/src/DRMActiveDeletion.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of the parent storage for Decision Making Machine
-*
-*/
-
-
-// INCLUDE FILES
-#include "drmactivedeletion.h"
-#include "drmrightsdb.h"
-#include "drmrightscleaner.h"
-#include "drmdbsession.h"
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES  
-
-// CONSTANTS
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-    
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CDRMActiveDeletion::NewLC
-//
-// Two-phase constructor.
-// -----------------------------------------------------------------------------
-//
-CDRMActiveDeletion* CDRMActiveDeletion::NewLC( const RMessagePtr2& aMessage,
-                                               CDRMDbSession& aSession )
-    {
-    CDRMActiveDeletion* self = new( ELeave ) CDRMActiveDeletion( aMessage,
-                                                                 aSession );
-    CleanupStack::PushL( self );
-    
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-// CDRMActiveDeletion::~CDRMActiveDeletion
-//
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-CDRMActiveDeletion::~CDRMActiveDeletion()
-    {
-    if ( iActiveOperation )
-        {
-        // Construction was successful, but 
-        // something has went wrong.
-
-        iActiveOperation->Cancel(); 
-        iMessage.Complete( KErrCancel );
-        }
-    }
-    
-// -----------------------------------------------------------------------------
-// CDRMActiveDeletion::ActivateL
-//
-// Activate the thing by issuing a request to the DB and executing it also.
-// -----------------------------------------------------------------------------
-//
-void CDRMActiveDeletion::ActivateL( const TTime& aTime,
-                                    CDRMRightsDB& aDb )
-    {
-    CActiveScheduler::Add( this );
-    
-    CDRMRightsCleaner* cleaner = 
-        aDb.DeleteExpiredPermissionsL( aTime, iStatus );
-    CleanupStack::PushL( cleaner );
-    cleaner->ExecuteCleanupLD();
-    CleanupStack::Pop();
-    
-    SetActive();
-    iActiveOperation = cleaner;    
-    }
-
-// -----------------------------------------------------------------------------
-// CDRMActiveDeletion::RunL
-//
-// Handles the completition of the request.
-// -----------------------------------------------------------------------------
-//
-void CDRMActiveDeletion::RunL()
-    {
-    // All done.
-    iMessage.Complete( iStatus.Int() );
-    
-    // iActiveOperation deletes itself.
-    iActiveOperation = NULL;
-    
-    Deque();
-    
-    iSession.AsyncOperationDone();
-    }
-    
-// -----------------------------------------------------------------------------
-// CDRMActiveDeletion::DoCancel
-//
-// Cancels the operation.
-// -----------------------------------------------------------------------------
-//
-void CDRMActiveDeletion::DoCancel()
-    {
-    iActiveOperation->Cancel();
-    iActiveOperation = NULL;
-    }
-
-// -----------------------------------------------------------------------------
-// CDRMActiveDeletion::CDRMActiveDeletion
-//
-// Constructor.
-// -----------------------------------------------------------------------------
-//
-CDRMActiveDeletion::CDRMActiveDeletion( const RMessagePtr2& aMessage,
-                                        CDRMDbSession& aSession ):
-CActive( EPriorityLow ),
-iMessage( aMessage ),
-iSession( aSession )
-    {
-    // Nothing
-    }
-    
-// End of file
--- a/omadrm/drmengine/server/src/DRMActiveOperation.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMActiveOperation.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,15 +17,15 @@
 
 
 // INCLUDE FILES
-#include "drmactiveoperation.h"
+#include "DRMActiveOperation.h"
 #include "drmrightsdb.h"
-#include "drmrightscleaner.h"
-#include "drmobsoletefinder.h"
-#include "drmdbsession.h"
+#include "DRMRightsCleaner.h"
+#include "DRMObsoleteFinder.h"
+#include "DRMDbSession.h"
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -42,7 +42,7 @@
 
 // ============================= LOCAL FUNCTIONS ===============================
 
-    
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -59,7 +59,7 @@
                                                                  aSession,
                                                                  aOperation );
     CleanupStack::PushL( self );
-    
+
     return self;
     }
 
@@ -73,30 +73,30 @@
     {
     // Close the stream
     iFileStream.Close();
-    
+
     if( iFileName )
         {
-        if( iFileServer ) 
-            {	
-            iFileServer->Delete( *iFileName );        
+        if( iFileServer )
+            {
+            iFileServer->Delete( *iFileName );
             }
         delete iFileName;
-        iFileName = NULL;  
+        iFileName = NULL;
         }
-        
+
     if ( iActiveOperation )
         {
-        // Construction was successful, but 
+        // Construction was successful, but
         // something has went wrong.
-        
+
         iActiveOperation->Cancel();
         if( !iMessage.IsNull() )
             {
-            iMessage.Complete( KErrCancel );           
+            iMessage.Complete( KErrCancel );
             }
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMActiveOperation::ActivateL
 //
@@ -107,15 +107,15 @@
                                      const TTime& aTime )
     {
     CActiveScheduler::Add( this );
-    
+
 
-    CDRMRightsCleaner* cleaner = 
+    CDRMRightsCleaner* cleaner =
         aDb.DeleteExpiredPermissionsL( aTime, iStatus );
     CleanupStack::PushL( cleaner );
     cleaner->ExecuteCleanupLD();
     CleanupStack::Pop();
     SetActive();
-    iActiveOperation = cleaner;             
+    iActiveOperation = cleaner;
     }
 
 // -----------------------------------------------------------------------------
@@ -126,31 +126,31 @@
 //
 void CDRMActiveOperation::ActivateL( CDRMRightsDB& aDb,
                                      RFs& aFileServer,
-                                     const TDesC& aTempPath, 
+                                     const TDesC& aTempPath,
                                      const TBool aPerformScan )
     {
     CActiveScheduler::Add( this );
 
     iFileName = new (ELeave) TFileName;
     iFileServer = &aFileServer;
-     
-    User::LeaveIfError( 
-        iFileStream.Temp( aFileServer, 
-                         aTempPath, 
-                         *iFileName, 
+
+    User::LeaveIfError(
+        iFileStream.Temp( aFileServer,
+                         aTempPath,
+                         *iFileName,
                          EFileWrite | EFileStream ) );
-    
+
     CDRMObsoleteFinder* finder = CDRMObsoleteFinder::NewL(aFileServer,
                                                           &aDb,
-                                                          iStatus, 
+                                                          iStatus,
                                                           iFileStream,
                                                           aPerformScan );
     CleanupStack::PushL( finder );
     finder->ExecuteFinderLD();
     CleanupStack::Pop();
     SetActive();
-    iActiveOperation = finder;              
-    }  
+    iActiveOperation = finder;
+    }
 
 // -----------------------------------------------------------------------------
 // CDRMActiveOperation::Remove
@@ -165,12 +165,12 @@
         case EOperationExportObsolete:
             {
             static_cast<CDRMObsoleteFinder*>(iActiveOperation)->DoCleanup();
-            } 
-            break;            
-        default: 
+            }
+            break;
+        default:
             {
             static_cast<CDRMRightsCleaner*>(iActiveOperation)->DoCleanup();
-            } 
+            }
             break;
         }
     }
@@ -184,30 +184,30 @@
 void CDRMActiveOperation::RunL()
     {
     TFileName* fileName = NULL;
-    
+
     // All done.
     if( !iMessage.IsNull() )
         {
-        iMessage.Complete( iStatus.Int() );           
-        }    
-    
+        iMessage.Complete( iStatus.Int() );
+        }
+
     // iActiveOperation deletes itself.
     iActiveOperation = NULL;
-    
+
     Deque();
-    
+
     if( iOperation == EOperationExportObsolete )
         {
         fileName = iFileName;
         iFileName = NULL;
-        iSession.AsyncOperationDone(fileName);            
+        iSession.AsyncOperationDone(fileName);
         }
-    else 
+    else
         {
-        iSession.AsyncOperationDone();            
+        iSession.AsyncOperationDone();
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMActiveOperation::DoCancel
 //
@@ -217,8 +217,8 @@
 void CDRMActiveOperation::DoCancel()
     {
     }
-    
-    
+
+
 
 // -----------------------------------------------------------------------------
 // CDRMActiveOperation::CDRMActiveOperation
@@ -237,5 +237,5 @@
     {
     // Nothing
     }
-    
+
 // End of file
--- a/omadrm/drmengine/server/src/DRMDbSession.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMDbSession.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -24,21 +24,21 @@
 #include <caf/caf.h>
 #include <x509keys.h>
 #include <asn1dec.h>
-#include <dcfrep.h>
+#include <DcfRep.h>
 
 #include <e32math.h>
 #include <utf.h>
 
-#include <SysUtil.h>    // Disk space checking
+#include <sysutil.h>    // Disk space checking
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "Oma2Agent.h"
-#include "DRMPermission.h"
+#include "DrmPermission.h"
 #include "DRMDbSession.h"
-#include "drmengineclientserver.h"
+#include "DRMEngineClientServer.h"
 #include "DRMRightsServer.h"
 #include "RoapStorageClient.h"
 #include "OmaCrypto.h"
@@ -46,8 +46,8 @@
 #include "DrmKeyStorage.h"
 #include "drmrightsdb.h"
 #include "drmparentstorage.h"
-#include "DrmDomainContext.h"
-#include "DrmRiContext.h"
+#include "DRMDomainContext.h"
+#include "DRMRIContext.h"
 #include "drmenginetypedefs.h"
 #include "DRMXOma.h"
 
@@ -58,8 +58,8 @@
 #include "DRMActiveOperation.h"
 #include "drmconsume.h"
 #include "drmlog.h"
-#include "drmpointerarray.h"
-#include "base64.h"
+#include "DRMPointerArray.h"
+#include "Base64.h"
 
 #ifdef RD_DRM_METERING
 #include "drmmeteringdbdata.h"
--- a/omadrm/drmengine/server/src/DRMObsoleteFinder.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMObsoleteFinder.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,26 +18,26 @@
 
 // INCLUDE FILES
 
-#include <e32std.h>		// RPointerArray
-#include <e32def.h>		// Type definitions
+#include <e32std.h>     // RPointerArray
+#include <e32def.h>     // Type definitions
 
 #include <caf/caf.h>
-#include <dcfrep.h>
-#include "DRMCommon.h"	// DRM Error messages
+#include <DcfRep.h>
+#include "DRMCommon.h"  // DRM Error messages
 #include "DRMObsoleteFinder.h"
-#include "DRMRightsDB.h"
+#include "drmrightsdb.h"
 #include "drmlog.h"
-#include <dcfrep.h>
+#include <DcfRep.h>
 
-#include <SysUtil.h>    // Disk space checking
+#include <sysutil.h>    // Disk space checking
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -61,12 +61,12 @@
 
 LOCAL_C TInt CompareHBufC8( const HBufC8& aFirst, const HBufC8& aSecond )
     {
-	return aFirst.Compare( aSecond );
+    return aFirst.Compare( aSecond );
     };
 
 // ============================ MEMBER FUNCTIONS ===============================
 
-        
+
 // -----------------------------------------------------------------------------
 // CDRMObsoleteFinder::NewL
 // Two-phased constructor.
@@ -78,74 +78,74 @@
                                             RWriteStream& aStream,
                                             TBool aPerformScan )
     {
-    CDRMObsoleteFinder* self = new( ELeave ) CDRMObsoleteFinder( aFs, 
-                                                        aDatabase, aStatus, 
+    CDRMObsoleteFinder* self = new( ELeave ) CDRMObsoleteFinder( aFs,
+                                                        aDatabase, aStatus,
                                                         aStream );
     CleanupStack::PushL( self );
     self->ConstructL( aPerformScan );
     CleanupStack::Pop();
-    
+
     return self;
     }
-  
-        
+
+
 // -----------------------------------------------------------------------------
-// Destructor        
+// Destructor
 // -----------------------------------------------------------------------------
 //
 CDRMObsoleteFinder::~CDRMObsoleteFinder()
     {
     // just in case
     Cancel();
-    
+
     if( iDcfClient )
         {
         delete iDcfClient;
-        iDcfClient = NULL;    
+        iDcfClient = NULL;
         }
-    
+
     if( iContents )
         {
         delete iContents;
-        iContents = NULL;   
+        iContents = NULL;
         }
 
     if( iParents )
         {
         delete iParents;
-        iParents = NULL;            
+        iParents = NULL;
         }
-     
+
     if( iNoContents )
         {
         delete iNoContents;
-        iNoContents = NULL;            
-        }            
+        iNoContents = NULL;
+        }
     };
 
 // -----------------------------------------------------------------------------
-// CDRMObsoleteFinder::ExecuteCleanupLD        
+// CDRMObsoleteFinder::ExecuteCleanupLD
 // -----------------------------------------------------------------------------
-//    
+//
 void CDRMObsoleteFinder::ExecuteFinderLD()
     {
     TRequestStatus* status = 0;
-    
-    if( !IsAdded() ) 
+
+    if( !IsAdded() )
         {
-        CActiveScheduler::Add(this);        
+        CActiveScheduler::Add(this);
         }
-    if ( !IsActive() ) 
+    if ( !IsActive() )
         {
-        SetActive();        
+        SetActive();
         }
-    
+
     iOperationStatus = KRequestPending;
     status = &iStatus;
-    User::RequestComplete(status,KErrNone);        
+    User::RequestComplete(status,KErrNone);
     };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // Default Constructor - First phase.
 // -----------------------------------------------------------------------------
 //
@@ -162,66 +162,66 @@
     iStream( aStream ),
     iRightsDb( aDatabase ),
     iOperationStatus( aStatus ),
-    iState( KScanFileSystem )                         
+    iState( KScanFileSystem )
     {
-        
-    }; 
-        
+
+    };
 
-// -----------------------------------------------------------------------------                        
+
+// -----------------------------------------------------------------------------
 // CDRMObsoleteFinder::ConstructL
 // -----------------------------------------------------------------------------
-// 
+//
 void CDRMObsoleteFinder::ConstructL( const TBool aPerformScan )
     {
     // if the scan needs to be done, the initial state is different:
     if( aPerformScan )
         {
-        iState = KScanFileSystem;    
+        iState = KScanFileSystem;
         }
     else
         {
-        iState = KScanContents;    
-        } 
-       
+        iState = KScanContents;
+        }
+
     // connect to dcf repository
     iDcfClient = CDcfRep::NewL();
-    
+
     // Create a new list
-    iContents = CDRMPointerArray<HBufC8>::NewL();    
-    
+    iContents = CDRMPointerArray<HBufC8>::NewL();
+
     // Create a new list
-    iParents = CDRMPointerArray<HBufC8>::NewL();  
+    iParents = CDRMPointerArray<HBufC8>::NewL();
 
     // Create a new list
-    iNoContents = CDRMPointerArray<HBufC8>::NewL();  
-        
-    };  
+    iNoContents = CDRMPointerArray<HBufC8>::NewL();
 
-// -----------------------------------------------------------------------------                        
+    };
+
+// -----------------------------------------------------------------------------
 // CDRMObsoleteFinder::RunError
 // -----------------------------------------------------------------------------
-//  
+//
 TInt CDRMObsoleteFinder::RunError(TInt aError)
     {
     TRequestStatus* status = 0;
-    
+
     if( aError != KErrNone )
         {
         status = &iOperationStatus;
-        User::RequestComplete( status, aError );                
-        delete this;            
+        User::RequestComplete( status, aError );
+        delete this;
         }
     return KErrNone;
     };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMObsoleteFinder::RunL
 // -----------------------------------------------------------------------------
-//      
+//
 void CDRMObsoleteFinder::RunL()
     {
-    TRequestStatus* status = 0;    
+    TRequestStatus* status = 0;
     TInt error = KErrNone;
     HBufC8* buffer = NULL;
 
@@ -232,8 +232,8 @@
         {
         case KScanFileSystem:
             iState = KScanContents;
-            iDcfClient->RefreshDcf( iStatus );            
-            SetActive();    
+            iDcfClient->RefreshDcf( iStatus );
+            SetActive();
             break;
         case KScanContents:
             if( iIndex == -1 )
@@ -241,94 +241,94 @@
                 // Get the contents
                 iRightsDb->GetContentIDListL( *iContents );
                 // Reset the index
-                iIndex = 0;  
+                iIndex = 0;
                 }
-            else 
+            else
                 {
-                iIndex++;                     
-                }  
-                
+                iIndex++;
+                }
+
             if( iIndex >= iContents->Count() )
                 {
                 iState = KRemoveUsedParents;
-                iIndex = -1;   
+                iIndex = -1;
                 }
-            else 
+            else
                 {
                 // Check if there is content
                 TRAP( error, iDcfClient->OrderListL( *(*iContents)[iIndex] ));
-        
+
                 // If an error occurs, leave if it's ok, continue
                 if( error != KErrNotFound )
                     {
-                    User::LeaveIfError( error ); 
-                    
+                    User::LeaveIfError( error );
+
                     // Get all the parents
-                    if( !error ) 
+                    if( !error )
                         {
-                        GetParentsL( *(*iContents)[iIndex], *iParents );   
-                        }                      
+                        GetParentsL( *(*iContents)[iIndex], *iParents );
+                        }
                     }
-                // If the error is not found, add to the no content list    
+                // If the error is not found, add to the no content list
                 else
                     {
                     buffer = (*iContents)[iIndex]->AllocLC();
                     iNoContents->AppendL( buffer );
-                    CleanupStack::Pop();    
-                    }                       
+                    CleanupStack::Pop();
+                    }
                 }
             SetActive();
             status = &iStatus;
-            User::RequestComplete(status,KErrNone);              
+            User::RequestComplete(status,KErrNone);
             break;
         case KRemoveUsedParents:
             if( iIndex == -1 )
                 {
-                iIndex = 0;  
+                iIndex = 0;
                 }
-            else 
+            else
                 {
-                iIndex++;                     
+                iIndex++;
                 }
-                  
+
             if( iIndex >= iParents->Count() )
                 {
                 iState = KWriteTempFile;
-                iIndex = -1; 
+                iIndex = -1;
                 }
             else
                 {
                 // Find the parent
-                error = iNoContents->FindInOrder( (*iParents)[iIndex], 
+                error = iNoContents->FindInOrder( (*iParents)[iIndex],
                                        TLinearOrder<HBufC8>(CompareHBufC8));
-                                      
+
                 if( error != KErrNotFound )
                     {
                     buffer = (*iNoContents)[error];
                     iNoContents->Remove( error );
                     delete buffer;
-                    buffer = 0;    
-                    }                                                           
+                    buffer = 0;
+                    }
                 }
             SetActive();
             status = &iStatus;
-            User::RequestComplete(status,KErrNone);                 
+            User::RequestComplete(status,KErrNone);
             break;
         case KWriteTempFile:
             ObsoleteToStreamL();
             // we are complete:
             status = &iOperationStatus;
-            User::RequestComplete( status, KErrNone );                
-            delete this; 
-            return;                          
+            User::RequestComplete( status, KErrNone );
+            delete this;
+            return;
         default:
             // illegal status, return error and delete object
             status = &iOperationStatus;
             User::RequestComplete( status, KErrGeneral );
-            delete this; 
-            return;                       
+            delete this;
+            return;
         }
-    };    
+    };
 
 
 // ----------------------------------------------------------------------------
@@ -340,45 +340,45 @@
     {
     HBufC8* parentId = NULL;
     TInt error = KErrNone;
-    CDRMPointerArray<CDRMPermission>* permissions = 
+    CDRMPointerArray<CDRMPermission>* permissions =
       CDRMPointerArray<CDRMPermission>::NewLC();
     permissions->SetAutoCleanup( ETrue );
-    CDRMPointerArray<CDRMPermission>& perm = *permissions;  
+    CDRMPointerArray<CDRMPermission>& perm = *permissions;
 
     TRAP( error, iRightsDb->GetDBEntryByContentIDL( aContentId, *permissions ) );
-    
+
     // If there are no keys it means that there is encryption key and such, but
     // no available permissions
     if( error == KErrCANoRights )
         {
         CleanupStack::PopAndDestroy(); // permissions
-        return;    
+        return;
         }
-    else 
+    else
         {
-        User::LeaveIfError(error);    
+        User::LeaveIfError(error);
         }
-        
+
     for( TInt i = 0; i < permissions->Count(); i++, error = KErrNone )
         {
         // Check if the permission has a parent
-        if( perm[i]->iParentUID ) 
+        if( perm[i]->iParentUID )
             {
             // if it does, insert it to the aParents array
-            error = aParents.FindInOrder( perm[i]->iParentUID, 
+            error = aParents.FindInOrder( perm[i]->iParentUID,
                                           TLinearOrder<HBufC8>(CompareHBufC8));
             if( error == KErrNotFound )
                 {
                 parentId = perm[i]->iParentUID->AllocLC();
-                User::LeaveIfError( aParents.InsertInOrder(parentId, 
+                User::LeaveIfError( aParents.InsertInOrder(parentId,
                                     TLinearOrder<HBufC8>(CompareHBufC8)) );
-                CleanupStack::Pop();       
+                CleanupStack::Pop();
                 }
             }
         }
 
-    CleanupStack::PopAndDestroy(); // permissions     
-    }; 
+    CleanupStack::PopAndDestroy(); // permissions
+    };
 
 
 // -----------------------------------------------------------------------------
@@ -402,25 +402,25 @@
 
 #ifndef RD_MULTIPLE_DRIVE
 
-    if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer, 
-                                                size, 
+    if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer,
+                                                size,
                                                 EDriveC ) )
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
 
-    if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer, 
-                                                size, 
+    if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServer,
+                                                size,
                                                 driveNumber ) )
-    
+
 #endif
 
         {
         DRMLOG( _L( "CDRMDbSession::UriListToFileL: KErrDiskFull" ) );
         User::Leave( KErrDiskFull );
-        }     
+        }
     // Write the whole stuff into the file.
     while( count < iNoContents->Count() )
         {
@@ -428,34 +428,34 @@
         iStream.WriteL( *(*iNoContents)[count] );
         ++count;
         }
-    // Finish with a 0    
-    iStream.WriteUint16L( 0 );    
-    
+    // Finish with a 0
+    iStream.WriteUint16L( 0 );
+
     iStream.CommitL();
     }
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMObsoleteFinder::DoCancel
 // -----------------------------------------------------------------------------
-//      
+//
 void CDRMObsoleteFinder::DoCancel()
-    {  
-    }; 
+    {
+    };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMObsoleteFinder::DoCleanup
 // -----------------------------------------------------------------------------
-//      
+//
 void CDRMObsoleteFinder::DoCleanup()
     {
-    TRequestStatus* status = 0;      
+    TRequestStatus* status = 0;
     if( iCancel <= 0 )
         {
         iCancel = 1;
         status = &iStatus;
         User::RequestComplete(status, KErrCancel);
-        }       
-    }; 
+        }
+    };
 
 
 
--- a/omadrm/drmengine/server/src/DRMReplayCache.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMReplayCache.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,14 +19,14 @@
 // INCLUDE FILES
 
 #include <f32file.h>
-#include <S32FILE.H>
-#include <BAUTILS.H>
-#include "drmreplaycache.h"
+#include <s32file.h>
+#include <bautils.h>
+#include "DRMReplayCache.h"
 
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -46,12 +46,12 @@
 LOCAL_C const TUint16 KDbMaxNumOfItems = 100;
 
 // MODULE DATA STRUCTURES
-NONSHARABLE_STRUCT( TDoDeleteFile ) 
+NONSHARABLE_STRUCT( TDoDeleteFile )
     {
     RFs* iFs;
     const TDesC* iFile;
     };
-    
+
 // LOCAL FUNCTION PROTOTYPES
 LOCAL_C void DoRollBack( TAny* aAny );
 LOCAL_C void DoDeleteFile( TAny* aAny );
@@ -63,7 +63,7 @@
 // -----------------------------------------------------------------------------
 // DoRollBack
 //
-// Do a rollback operation to the RDbDatabase* 
+// Do a rollback operation to the RDbDatabase*
 // -----------------------------------------------------------------------------
 //
 LOCAL_C void DoRollBack( TAny* aAny )
@@ -80,8 +80,8 @@
 LOCAL_C void DoDeleteFile( TAny* aAny )
     {
     TDoDeleteFile* s = reinterpret_cast< TDoDeleteFile* >( aAny );
-    
-    s->iFs->Delete( *( s->iFile ) );    
+
+    s->iFs->Delete( *( s->iFile ) );
     }
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -89,7 +89,7 @@
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::RDRMReplayCache
 //
-// Default constructor 
+// Default constructor
 // -----------------------------------------------------------------------------
 //
 RDRMReplayCache::RDRMReplayCache():
@@ -97,13 +97,13 @@
 iTimeDb(),
 iPlainDb()
     {
-    // Nothing.    
+    // Nothing.
     }
 
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::RDRMReplayCache
 //
-// Constructor 
+// Constructor
 // -----------------------------------------------------------------------------
 //
 RDRMReplayCache::RDRMReplayCache( RFs& aFs ) :
@@ -113,14 +113,14 @@
     {
     // Nothing.
     }
-    
+
 
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::Set
 //
 // Set iFs to given aFs.
 // -----------------------------------------------------------------------------
-//    
+//
 void RDRMReplayCache::Set( RFs& aFs )
     {
     iFs = &aFs;
@@ -131,7 +131,7 @@
 //
 // Closes the databases.
 // -----------------------------------------------------------------------------
-//    
+//
 void RDRMReplayCache::Close()
     {
     // iView.Close();
@@ -144,7 +144,7 @@
 //
 // Initialize the databases.
 // -----------------------------------------------------------------------------
-//    
+//
 void RDRMReplayCache::InitL( const TDesC& aTimedDb,
                              const TDesC& aPlainDb )
     {
@@ -159,16 +159,16 @@
 // Check whether the given entry is in cache. Overloaded.
 // -----------------------------------------------------------------------------
 //
-TBool RDRMReplayCache::InCacheL( const TDesC8& aID, 
+TBool RDRMReplayCache::InCacheL( const TDesC8& aID,
                                  const TTime& aTime )
     {
     TBool res = EFalse;
-    
+
     RDbView view;
     InitViewLC( view, ETimeDb, EFalse );
-    
+
     view.FirstL();
-    
+
     while ( view.AtRow() && !res )
         {
         view.GetL();
@@ -180,9 +180,9 @@
             }
         view.NextL();
         }
-        
+
     CleanupStack::PopAndDestroy(); // view
-    
+
     return res;
     }
 
@@ -191,27 +191,27 @@
 //
 // Check whether the given entry is in cache. Overloaded.
 // -----------------------------------------------------------------------------
-//   
+//
 TBool RDRMReplayCache::InCacheL( const TDesC8& aID )
     {
     TBool res = EFalse;
-    
+
     RDbView view;
     InitViewLC( view, EPlainDb, EFalse );
-    
+
     view.FirstL();
-    
+
     while ( view.AtRow() && !res )
         {
         view.GetL();
-        
+
         res = CompareCIDL( view, aID );
-        
+
         view.NextL();
         }
-        
+
     CleanupStack::PopAndDestroy(); // view
-    
+
     return res;
     }
 
@@ -220,73 +220,73 @@
 //
 // Add an entry to the database. Overloaded.
 // -----------------------------------------------------------------------------
-//    
-void RDRMReplayCache::AddL( const TDesC8& aID, 
+//
+void RDRMReplayCache::AddL( const TDesC8& aID,
                             const TTime& aTime,
                             const TTime& aInsertionTime )
     {
     RDbColWriteStream stream;
     RDbView view;
-        
+
     PushL( iTimeDb );
-    
+
     InitViewLC( view, ETimeDb, ETrue );
     CompactViewL( view );
 
-    // Oldest ones are in the list earlier, and as long as clock works 
+    // Oldest ones are in the list earlier, and as long as clock works
     // correctly, insertiontime(n-1)<insertiontime(n).
     view.EndL();
-    
+
     User::LeaveIfError( iTimeDb.Begin() );
-    
-    view.InsertL(); 
-    
+
+    view.InsertL();
+
     InsertIdL( view, aID );
     view.SetColL( KDbViewInsertionTimeOrdinal, aInsertionTime.Int64() );
     view.SetColL( KDbViewTimeOrdinal, aTime.Int64() );
-    
+
     view.PutL();
-    
+
     CleanupStack::PopAndDestroy(); // view
-    
+
     User::LeaveIfError( iTimeDb.Commit() );
     User::LeaveIfError( iTimeDb.Compact() );
-    
+
     Pop(); // iTimeDb
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::AddL
 //
 // Add an entry to the database. Overloaded.
 // -----------------------------------------------------------------------------
-//   
+//
 void RDRMReplayCache::AddL( const TDesC8& aID,
                             const TTime& aInsertionTime )
     {
-    
+
     RDbView view;
-    
+
     PushL( iPlainDb );
-    
+
     InitViewLC( view, EPlainDb, ETrue );
     CompactViewL( view );
-    
+
     view .EndL();
-    
+
     User::LeaveIfError( iPlainDb.Begin() );
-    
+
     view.InsertL();
     InsertIdL( view, aID );
     view.SetColL( KDbViewInsertionTimeOrdinal, aInsertionTime.Int64() );
-    
+
     view.PutL();
-    
+
     CleanupStack::PopAndDestroy(); // view
-    
+
     User::LeaveIfError( iPlainDb.Commit() );
     User::LeaveIfError( iPlainDb.Compact() );
-    
+
     Pop(); // iPlainDb
     }
 
@@ -295,14 +295,14 @@
 //
 // Initialize the databases.
 // -----------------------------------------------------------------------------
-//       
-void RDRMReplayCache::InitDbL( RDbNamedDatabase& aDb, 
+//
+void RDRMReplayCache::InitDbL( RDbNamedDatabase& aDb,
                                const TDesC& aFileName,
                                TDatabaseId aId )
     {
     TInt error = KErrNone;
     TBool exists = BaflUtils::FileExists( *iFs, aFileName );
-    
+
     if ( exists )
         {
         TRAP( error, OpenDbL( aDb, aFileName ) );
@@ -312,13 +312,13 @@
         ReplaceDbL( aDb, aFileName, aId );
         }
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::~RDRMReplayCache
 //
 // Destructor.
 // -----------------------------------------------------------------------------
-//   
+//
 RDRMReplayCache::~RDRMReplayCache()
     {
     }
@@ -328,29 +328,29 @@
 //
 // Open the database.
 // -----------------------------------------------------------------------------
-//   
-void RDRMReplayCache::OpenDbL( RDbNamedDatabase& aDb, 
+//
+void RDRMReplayCache::OpenDbL( RDbNamedDatabase& aDb,
                                const TDesC& aFileName )
     {
     CDbTableNames* tables = NULL;
-    
+
     User::LeaveIfError( aDb.Open( *iFs, aFileName ) );
     CleanupClosePushL( aDb );
-    
+
     if ( aDb.IsDamaged() )
         {
         User::LeaveIfError( aDb.Recover() );
         }
-        
+
     // Sanity check.
     tables = aDb.TableNamesL();
     CleanupStack::PushL( tables );
-    
+
     if ( tables->Count() != 1 || ( *tables )[ 0 ].Compare( KReplayCacheTable ) )
         {
         User::Leave( KErrCorrupt );
         }
-    
+
     CleanupStack::PopAndDestroy(); // tables
     CleanupStack::Pop(); // aDb
     }
@@ -360,9 +360,9 @@
 //
 // Replace the database.
 // -----------------------------------------------------------------------------
-//       
-void RDRMReplayCache::ReplaceDbL( RDbNamedDatabase& aDb, 
-                                  const TDesC& aFileName, 
+//
+void RDRMReplayCache::ReplaceDbL( RDbNamedDatabase& aDb,
+                                  const TDesC& aFileName,
                                   TDatabaseId aId )
     {
     CDbColSet*  colSet = NULL;
@@ -370,92 +370,92 @@
     TDbCol cidCol( KCIDColName, EDbColLongText8 );
     TDbCol insertionTimeCol( KInsertionTimeColName, EDbColInt64 );
     TDbCol timeCol( KTimeColName, EDbColInt64 );
-    
+
     TDoDeleteFile deletefile = { iFs, &aFileName };
-    
+
     TCleanupItem item( DoDeleteFile, &deletefile );
     CleanupStack::PushL( item );
-    
+
     User::LeaveIfError( aDb.Replace( *iFs, aFileName ) );
     CleanupClosePushL( aDb );
-    
+
     // Add columns
     colSet = CDbColSet::NewLC();
     colSet->AddL( cidCol );
     colSet->AddL( insertionTimeCol );
-    
+
     if ( aId == ETimeDb )
         {
         colSet->AddL( timeCol );
         }
-    
+
     User::LeaveIfError( aDb.Begin() );
     User::LeaveIfError( aDb.CreateTable( KReplayCacheTable, *colSet ) );
     User::LeaveIfError( aDb.Commit() );
-    
+
     CleanupStack::PopAndDestroy(); // colSet
-    CleanupStack::Pop(); // aDb    
+    CleanupStack::Pop(); // aDb
     CleanupStack::Pop(); // item
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::InitViewLC
 //
 // Initialize the view.
 // -----------------------------------------------------------------------------
-//   
-void RDRMReplayCache::InitViewLC( RDbView& aView, 
-                                  TDatabaseId aId, 
+//
+void RDRMReplayCache::InitViewLC( RDbView& aView,
+                                  TDatabaseId aId,
                                   TBool aUpdate )
     {
     RDbDatabase* db = ( aId ==  ETimeDb ? &iTimeDb : &iPlainDb );
-    
-    User::LeaveIfError( 
-        aView.Prepare( *db, 
-                       TDbQuery( KViewInitQuery, EDbCompareCollated ), 
+
+    User::LeaveIfError(
+        aView.Prepare( *db,
+                       TDbQuery( KViewInitQuery, EDbCompareCollated ),
                        aUpdate ? RDbRowSet::EUpdatable : RDbRowSet::EReadOnly ) );
-    
+
     CleanupClosePushL( aView );
-    
+
     User::LeaveIfError( aView.EvaluateAll() );
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::CompareCIDL
 //
 // Compare whether the rowset's CID matches the given CID.
 // -----------------------------------------------------------------------------
-//       
-TBool RDRMReplayCache::CompareCIDL( RDbRowSet& aView, 
+//
+TBool RDRMReplayCache::CompareCIDL( RDbRowSet& aView,
                                     const TDesC8& aCID )
     {
     TBool res = EFalse;
-    
+
     TInt size = aView.ColLength( KDbViewIDOrdinal );
-    
+
     RDbColReadStream colData;
     colData.OpenLC( aView, KDbViewIDOrdinal );
-    
-    // The data contains also the cardinality of the CID data, but anyway... 
+
+    // The data contains also the cardinality of the CID data, but anyway...
     HBufC8* des = HBufC8::NewLC( colData, size );
 
     if ( aCID.CompareC( *des ) == 0 )
         {
         res = ETrue;
         }
-    
+
     CleanupStack::PopAndDestroy(); // des
     CleanupStack::PopAndDestroy(); // colData
-    
+
     return res;
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMReplayCache::PushL
 //
 // Push a cleanup item to cleanup stack.
 // -----------------------------------------------------------------------------
-//   
+//
 void RDRMReplayCache::PushL( RDbDatabase& aDb )
     {
     TCleanupItem item( DoRollBack, &aDb );
@@ -467,7 +467,7 @@
 //
 // Pop a cleanup item pushed in by PushL.
 // -----------------------------------------------------------------------------
-//       
+//
 void RDRMReplayCache::Pop()
     {
     CleanupStack::Pop();
@@ -478,11 +478,11 @@
 //
 // Delete aHowMany entries from the view.
 // -----------------------------------------------------------------------------
-//       
+//
 void RDRMReplayCache::DeleteOldestsL( RDbRowSet& aView, TInt16 aHowMany )
     {
     aView.FirstL();
-    
+
     while ( aHowMany > 0 )
         {
         aView.DeleteL();
@@ -496,11 +496,11 @@
 //
 // Compact the view, deleting items if necessary.
 // -----------------------------------------------------------------------------
-//       
+//
 void RDRMReplayCache::CompactViewL( RDbRowSet& aView )
     {
     TInt count = aView.CountL();
-    
+
     if ( count >= KDbMaxNumOfItems )
         {
         // usually only one item is deleted, no need to use Begin/Commit.
@@ -513,17 +513,17 @@
 //
 // Insert content-ID to the view.
 // -----------------------------------------------------------------------------
-//       
-void RDRMReplayCache::InsertIdL( RDbRowSet& aView, 
+//
+void RDRMReplayCache::InsertIdL( RDbRowSet& aView,
                                  const TDesC8& aId )
     {
-    
+
     RDbColWriteStream stream;
     stream.OpenLC( aView, KDbViewIDOrdinal );
     stream << aId;
-    
+
     stream.CommitL();
     CleanupStack::PopAndDestroy(); // stream
     }
-    
+
 // End of File
--- a/omadrm/drmengine/server/src/DRMRightsCleaner.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMRightsCleaner.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,19 +19,19 @@
 
 // INCLUDE FILES
 
-#include <e32std.h>		// RPointerArray
-#include <e32def.h>		// Type definitions
+#include <e32std.h>     // RPointerArray
+#include <e32def.h>     // Type definitions
 
 #include <caf/caf.h>
-#include "DRMCommon.h"	// DRM Error messages
+#include "DRMCommon.h"  // DRM Error messages
 #include "DRMRightsCleaner.h"
-#include "DRMRightsDB.h"
+#include "drmrightsdb.h"
 #include "drmlog.h"
 
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -50,7 +50,7 @@
 // ============================= LOCAL FUNCTIONS ===============================
 // ============================ MEMBER FUNCTIONS ===============================
 
-        
+
 // -----------------------------------------------------------------------------
 // CDRMRightsCleaner::NewL
 // Two-phased constructor.
@@ -62,56 +62,56 @@
                                             const TDesC& aDatabasePath,
                                             const TTime& aTime )
     {
-    CDRMRightsCleaner* self = new( ELeave ) CDRMRightsCleaner( aFs, 
-                                                        aDatabase, aStatus, 
+    CDRMRightsCleaner* self = new( ELeave ) CDRMRightsCleaner( aFs,
+                                                        aDatabase, aStatus,
                                                         aDatabasePath, aTime );
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
-    
+
     return self;
     }
-  
-        
+
+
 // -----------------------------------------------------------------------------
-// Destructor        
+// Destructor
 // -----------------------------------------------------------------------------
 //
 CDRMRightsCleaner::~CDRMRightsCleaner()
     {
     // just in case
     Deque();
-    
+
     if( iCurrentDirectory )
         {
         delete iCurrentDirectory;
-        iCurrentDirectory = NULL;    
+        iCurrentDirectory = NULL;
         }
     };
 
 // -----------------------------------------------------------------------------
-// CDRMRightsCleaner::ExecuteCleanupLD        
+// CDRMRightsCleaner::ExecuteCleanupLD
 // -----------------------------------------------------------------------------
-//    
+//
 void CDRMRightsCleaner::ExecuteCleanupLD()
     {
     TRequestStatus* status = 0;
-    
-    if( !IsAdded() ) 
+
+    if( !IsAdded() )
         {
-        CActiveScheduler::Add(this);        
+        CActiveScheduler::Add(this);
         }
-    if ( !IsActive() ) 
+    if ( !IsActive() )
         {
-        SetActive();        
+        SetActive();
         }
-    
+
     iOperationStatus = KRequestPending;
     status = &iStatus;
-    User::RequestComplete(status,KErrNone);        
+    User::RequestComplete(status,KErrNone);
     };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // Default Constructor - First phase.
 // -----------------------------------------------------------------------------
 //
@@ -128,52 +128,52 @@
     iExpirationTime( aTime ),
     iCurrentDirectory( NULL ),
     iDirIndex( 0 ),
-    iCurrentFile( 0 )                                  
+    iCurrentFile( 0 )
     {
-        
-    }; 
-        
+
+    };
 
-// -----------------------------------------------------------------------------                        
+
+// -----------------------------------------------------------------------------
 // CDRMRightsCleaner::ConstructL
 // -----------------------------------------------------------------------------
-// 
+//
 void CDRMRightsCleaner::ConstructL()
-    {   
-    };  
+    {
+    };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMRightsCleaner::RunError
 // More or less just ignore all errors and call RunL again
 // -----------------------------------------------------------------------------
-//  
+//
 TInt CDRMRightsCleaner::RunError(TInt aError)
     {
-    TRequestStatus* status = 0;  
-    
+    TRequestStatus* status = 0;
+
     if( aError == KErrCancel )
         {
         // we are complete:
         status = &iOperationStatus;
-        User::RequestComplete( status, KErrNone );                
-        delete this;           
+        User::RequestComplete( status, KErrNone );
+        delete this;
         return KErrNone;
         }
-      
+
     SetActive();
     status = &iStatus;
-    User::RequestComplete(status,KErrNone);      
-    
+    User::RequestComplete(status,KErrNone);
+
     return KErrNone;
     };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMRightsCleaner::RunL
 // -----------------------------------------------------------------------------
-//      
+//
 void CDRMRightsCleaner::RunL()
     {
-    TRequestStatus* status = 0;    
+    TRequestStatus* status = 0;
     TInt error = KErrNone;
     TFileName path;
     TInt modIndex = 0;
@@ -181,7 +181,7 @@
 
     // If the status of the cleaning is other than KErrNone
     User::LeaveIfError( iStatus.Int() );
-    
+
     if( !iCurrentDirectory ||
         iCurrentFile >= iCurrentDirectory->Count() )
         {
@@ -190,58 +190,58 @@
             {
             // we are complete:
             status = &iOperationStatus;
-            User::RequestComplete( status, KErrNone );                
-            delete this; 
-            return;    
+            User::RequestComplete( status, KErrNone );
+            delete this;
+            return;
             }
-        
+
         // if it exists, delete it
         if( iCurrentDirectory )
             {
             delete iCurrentDirectory;
             iCurrentDirectory = 0;
             }
-        
+
         TFileName path = iDatabasePath;
-    
-    
+
+
         path.Append(iDirIndex < 10 ? iDirIndex + '0' : iDirIndex + 'a' - 10);
         path.Append('\\');
 
-       
+
         error =  iFileServer.GetDir(path, KEntryAttDir, ESortNone, iCurrentDirectory);
 
         DRMLOG(_L("Entering directory:"));
         DRMLOG( path );
 
-        // increase the dir counter    
+        // increase the dir counter
         iDirIndex++;
-        iCurrentFile = 0;                
+        iCurrentFile = 0;
         }
 
     if( !error && iCurrentDirectory->Count() )
         {
         modIndex = iDirIndex-1;
-        
+
         path = iDatabasePath;
         path.Append(modIndex < 10 ? modIndex + '0' : modIndex + 'a' - 10);
-        path.Append('\\');        
-                                
+        path.Append('\\');
+
         path.Append((*iCurrentDirectory)[iCurrentFile].iName);
-    
+
         DRMLOG(_L("Checking file:"));
         DRMLOG( path );
-    
+
         // increase the file counter
         iCurrentFile++;
-                                
+
         TRAP( error, removeFile = iRightsDb->DeleteExpiredL( path, iExpirationTime ) );
         if( error != KErrNone )
             {
             DRMLOG2( _L( "CDRMRightsCleaner: error %d cleaning:" ), error );
             DRMLOG( path );
             }
-        else 
+        else
             {
             if ( removeFile )
                 {
@@ -249,30 +249,30 @@
                 DRMLOG( path );
                 iFileServer.Delete( path );
                 }
-            }    
+            }
         }
-    
+
     SetActive();
     status = &iStatus;
-    User::RequestComplete(status, KErrNone);                
-    };    
+    User::RequestComplete(status, KErrNone);
+    };
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMRightsCleaner::DoCancel
 // -----------------------------------------------------------------------------
-//      
+//
 void CDRMRightsCleaner::DoCancel()
-    {     
-    }; 
+    {
+    };
 
 
-// -----------------------------------------------------------------------------                        
+// -----------------------------------------------------------------------------
 // CDRMRightsCleaner::DoCleanup
 // -----------------------------------------------------------------------------
-//      
+//
 void CDRMRightsCleaner::DoCleanup()
     {
-    TRequestStatus* status = 0;      
+    TRequestStatus* status = 0;
     if( iCancel <= 0 )
         {
         Cancel();
@@ -280,8 +280,8 @@
         SetActive();
         status = &iStatus;
         User::RequestComplete(status, KErrCancel);
-        }       
-    }; 
+        }
+    };
 
 
 
--- a/omadrm/drmengine/server/src/DRMRightsClient.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMRightsClient.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,16 +21,16 @@
 #include <etelmm.h>
 #include "DRMRightsClient.h"
 #include "DRMEngineClientServer.h"
-#include "DRMPermission.h"
-#include "DRMAsset.h"
+#include "DrmPermission.h"
+#include "DrmAsset.h"
 #include "drmlog.h"
 
 #ifdef __DRM_FULL
-#include "RDRMHelper.h"
+#include "rdrmhelper.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 // MACROS
 
@@ -51,45 +51,45 @@
 struct TDRMFileDeletion
     {
     TDRMFileDeletion() : iName( KNullDesC ) {};
-    ~TDRMFileDeletion() 
+    ~TDRMFileDeletion()
         {
         if ( iName.Length() )
             {
             iFs.Delete( iName );
             }
-        
+
         iFs.Close();
         }
-        
+
     RFs iFs;
     TFileName iName;
     };
 
 template< class T > struct RDRMArrayReset
     {
-    RDRMArrayReset( T& aItem ) : iItem( aItem ), 
+    RDRMArrayReset( T& aItem ) : iItem( aItem ),
                                  iCleanup( ResetAndDestroy, ( TAny* )this ) {};
     ~RDRMArrayReset() { };
-    void PushL() 
+    void PushL()
         {
         CleanupStack::PushL( iCleanup );
         };
-    
-    static void ResetAndDestroy( TAny* aSelf ) 
+
+    static void ResetAndDestroy( TAny* aSelf )
         {
-        ( ( RDRMArrayReset< T >* )( aSelf ) )->iItem.ResetAndDestroy(); 
+        ( ( RDRMArrayReset< T >* )( aSelf ) )->iItem.ResetAndDestroy();
         ( ( RDRMArrayReset< T >* )( aSelf ) )->iItem.Close();
         };
-    
-    private:        
+
+    private:
         RDRMArrayReset(); // prohibit
-    
+
     private:
         T& iItem;
         TCleanupItem iCleanup;
-        
+
     };
-    
+
 // LOCAL FUNCTION PROTOTYPES
 
 // FORWARD DECLARATIONS
@@ -108,7 +108,7 @@
     iPtr( NULL )
     {
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::~RDRMRightsClient
 // Destructor.
@@ -116,7 +116,7 @@
 //
 EXPORT_C RDRMRightsClient::~RDRMRightsClient()
     {
-    }    
+    }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::Connect
@@ -126,45 +126,45 @@
 EXPORT_C TInt RDRMRightsClient::Connect()
     {
     TInt ret = KErrNone;
-    TUint8 count = 0;    
-    
-    const TVersion requiredVersion( 
+    TUint8 count = 0;
+
+    const TVersion requiredVersion(
         DRMEngine::KServerMajorVersion,
         DRMEngine::KServerMinorVersion,
         DRMEngine::KServerBuildVersion );
-    
+
     FOREVER
         {
         DRMLOG( _L( "RDRMRightsClient::Connect(): Create a new session" ) );
         ret = CreateSession( DRMEngine::KServerName,
-                             requiredVersion, 
+                             requiredVersion,
                              KMaxMessageSlots );
-                         
+
         if ( ret == KErrNotFound && count < KStartupCount )
             {
             ret = StartServer();
             if ( ret )
                 {
-                break;   
+                break;
                 }
-            
+
             ++count;
             }
         else
             {
-            break;   
+            break;
             }
         }
 
 #ifdef __DRM_FULL
-    // startup code, if it starts it starts if not it will be tried again.        
+    // startup code, if it starts it starts if not it will be tried again.
     RDRMHelper helper;
     TInt ignore = helper.Connect(); // Start HelperServer
-    helper.Close();  
-#endif        
+    helper.Close();
+#endif
 
     DRMLOG2( _L( "RDRMRightsClient::Connect(): Result: %d" ), ret );
-    
+
     return ret;
     }
 
@@ -173,7 +173,7 @@
 // Closes the connection to the server.
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void RDRMRightsClient::Close() 
+EXPORT_C void RDRMRightsClient::Close()
     {
     DRMLOG( _L( "RDRMRightsClient::Close()" ) );
     RHandleBase::Close();
@@ -182,14 +182,14 @@
 EXPORT_C TInt RDRMRightsClient::StartServer()
     {
     DRMLOG( _L( "RDRMRightsClient::StartServer()" ) );
-    
+
     RSemaphore semaphore;
     RSemaphore semaphore2;
     TFindServer server( DRMEngine::KServerName );
     TFullName name;
     RProcess process;
     TInt error = KErrNone;
- 
+
     // "local" semaphore
      error = semaphore2.CreateGlobal( KRightsServerStarterSemaphore,   // name
                                     1 ,              // count
@@ -198,7 +198,7 @@
     if ( error == KErrAlreadyExists )
         {
         error = semaphore2.OpenGlobal( KRightsServerStarterSemaphore );
-        }  
+        }
 
 
     // Semaphore not created or opened, don't need to close
@@ -206,61 +206,61 @@
         {
         return error;
         }
-          
-    // Server updated semaphore      
+
+    // Server updated semaphore
     error = semaphore.CreateGlobal( DRMEngine::KDRMSemaphore,   // name
                                     0 ,              // count
                                     EOwnerThread );  // owner
-    
+
     if ( error == KErrAlreadyExists )
         {
         error = semaphore.OpenGlobal( DRMEngine::KDRMSemaphore );
-        }  
-  
+        }
+
     // Semaphore not created or opened, don't need to close
     if( error )
         {
         semaphore2.Close();
         return error;
         }
-        
+
     // Wait until server has done all its things.
     semaphore2.Wait();
-                
+
     // Check if the server is already running.
     error = server.Next( name );
-    
+
     if ( !error )
         {
         // Yep, it's already running.
         error = KErrNone;
         }
-    else 
+    else
         {
         error = process.Create( KServerFileName,
                                 KNullDesC );
-        
+
         if ( !error )
             {
             User::After( 1000 );
-            
+
             process.Resume();
             process.Close();
-            
+
             // Wait here for the server process startup to complete
             // server will signal the global semaphore
             semaphore.Wait();
             }
         }
-        
-    // Close both semaphores and signal the "local" one.    
-    semaphore.Close();         
+
+    // Close both semaphores and signal the "local" one.
+    semaphore.Close();
     semaphore2.Signal();
-    semaphore2.Close();   
-        
+    semaphore2.Close();
+
     DRMLOG2( _L( "RDRMRightsClient::StartServer(): %d" ), error );
-    return error; 
-    
+    return error;
+
     }
 
 // -----------------------------------------------------------------------------
@@ -270,21 +270,21 @@
 //
 EXPORT_C TInt RDRMRightsClient::AddRecord( const TDesC8& aCEK, // Content encryption key
                                   // The rights object which is to be added
-                                  const CDRMPermission& aRightsObject, 
-                                  const TDesC8& aCID, // Content-ID 
+                                  const CDRMPermission& aRightsObject,
+                                  const TDesC8& aCID, // Content-ID
                                   TDRMUniqueID& aID ) // Unique ID, out-parameter
     {
     DRMLOG( _L( "RDRMRightsClient::AddRecord" ) );
     TInt error = KErrArgument;
-    
+
     // Check the parameters.
     if ( aCEK.Length() )
         {
-        
+
         HBufC8* rightsData = NULL;
         TRAP( error, rightsData = aRightsObject.ExportL() );
         TInt size = aRightsObject.Size();
-        
+
         if ( rightsData && size > 0 )
             {
             // For C/S communications.
@@ -292,21 +292,21 @@
             TPtr8 uid( reinterpret_cast< TUint8* >( &aID ),
                        0,
                        sizeof( TDRMUniqueID ) );
-        
+
             rightsObject.Set( const_cast< TUint8* >( rightsData->Ptr() ),
                               size,
                               size );
-        
-              
+
+
             // Send the message.
-            error = SendReceive( DRMEngine::EAddRecord, 
+            error = SendReceive( DRMEngine::EAddRecord,
                              TIpcArgs( &aCID, &rightsObject, &aCEK, &uid ) );
-        
+
             delete rightsData;
             rightsData = NULL;
             }
         }
-    
+
     DRMLOG2( _L( "RDRMRightsClient::AddRecord: %d" ), error );
     return error;
     }
@@ -325,33 +325,33 @@
     TDRMUniqueID& aID ) // Unique ID, out-parameter
     {
     DRMLOG( _L( "RDRMRightsClient::AddProtectedRecord" ) );
-    
-    TInt error = KErrNone;                                                       
-    TInt message = DRMEngine::EAddProtectedRecord;                                                                                    
-    HBufC8* rightsData = NULL;                                                   
-    TInt size = aRightsObject.Size();                                            
-    TPtr8 rightsObject( NULL, 0 );                                               
-    TPtr8 uid( reinterpret_cast< TUint8* >( &aID ), 0,                           
-        sizeof( TDRMUniqueID ) );                                                
-    TPtr8 key( NULL, 0 );                                                        
-                                                                                 
-    TRAP( error, rightsData = aRightsObject.ExportL() );                                        
-    if ( !error ) 
-        {    
-        rightsObject.Set( const_cast< TUint8* >( rightsData->Ptr() ), size,          
+
+    TInt error = KErrNone;
+    TInt message = DRMEngine::EAddProtectedRecord;
+    HBufC8* rightsData = NULL;
+    TInt size = aRightsObject.Size();
+    TPtr8 rightsObject( NULL, 0 );
+    TPtr8 uid( reinterpret_cast< TUint8* >( &aID ), 0,
+        sizeof( TDRMUniqueID ) );
+    TPtr8 key( NULL, 0 );
+
+    TRAP( error, rightsData = aRightsObject.ExportL() );
+    if ( !error )
+        {
+        rightsObject.Set( const_cast< TUint8* >( rightsData->Ptr() ), size,
             size );
-                                                                            
-        if ( aDomainRecord )                                                         
+
+        if ( aDomainRecord )
             {
             message = DRMEngine::EAddDomainRecord;
-            }                                                                        
+            }
         error = SendReceive( message, TIpcArgs( &aCID, &rightsObject, &aProtectedCek, &uid ) );
 
         delete rightsData;
         rightsData = NULL;
         }
-    DRMLOG2( _L( "RDRMRightsClient::AddProtectedRecord: %d" ), error );          
-    return error; 
+    DRMLOG2( _L( "RDRMRightsClient::AddProtectedRecord: %d" ), error );
+    return error;
     }
 
 // -----------------------------------------------------------------------------
@@ -365,28 +365,28 @@
     {
     DRMLOG( _L( "RDRMRightsClient::GetDBEntries" ) );
     if( aId.Length() )
-        {   
+        {
         // Temporary file name from the server.
         TDRMFileDeletion item;
-        
+
         // Make sure that the array is empty.
         aRightsList.ResetAndDestroy();
-        
+
         // For file operations. Destructor of TDRMFileDeletion
         // deletes the file & closes the session.
-        User::LeaveIfError( item.iFs.Connect() );  
-                
-        User::LeaveIfError( SendReceive( DRMEngine::EGetEntryList, 
+        User::LeaveIfError( item.iFs.Connect() );
+
+        User::LeaveIfError( SendReceive( DRMEngine::EGetEntryList,
                                          TIpcArgs( &item.iName, &aId ) ) );
-        
+
         // Convert the file to a list.
         FileToListL( item.iFs, item.iName, aRightsList );
-        
-        DRMLOG( _L( "RDRMRightsClient::GetDBEntries ok" ) );    
-    
+
+        DRMLOG( _L( "RDRMRightsClient::GetDBEntries ok" ) );
+
         return;
         }
-    
+
     // Invalid parameter.
     User::Leave( KErrArgument );
     }
@@ -400,7 +400,7 @@
                                                  const TDRMUniqueID& aUniqueID )
     {
     DRMLOG( _L( "RDRMRightsClient::GetDbEntryL" ) );
-    
+
     CDRMPermission* permission = NULL;
     TInt size = 0;
     TPckg<TInt> package( size );
@@ -414,12 +414,12 @@
         size );
     User::LeaveIfError( SendReceive( DRMEngine::EGetPreparedData,
         TIpcArgs( &objectPkg) ) );
-    
+
     permission = CDRMPermission::NewLC();
     permission->ImportL( rightsData->Des() );
     CleanupStack::Pop(); // permission
     CleanupStack::PopAndDestroy(); // Rights data
-    
+
     DRMLOG( _L( "RDRMRightsClient::GetDbEntryL ok" ) );
     return permission;
     }
@@ -432,16 +432,16 @@
 EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID )
     {
     DRMLOG( _L( "RDRMRightsClient::DeleteDbEntry with CID" ) );
-    
+
     TInt error = KErrArgument;
-    
+
     // Check the parameter.
     if ( aContentID.Length() )
         {
-        return SendReceive( DRMEngine::EDeleteWithCID, 
+        return SendReceive( DRMEngine::EDeleteWithCID,
                             TIpcArgs( NULL, NULL, &aContentID ) );
         }
-    
+
     return error;
     }
 
@@ -454,26 +454,26 @@
                                                const TDRMUniqueID& aUniqueID )
     {
     DRMLOG( _L( "RDRMRightsClient::DeleteDbEntry with CID & UID" ) );
-    
+
     if ( aContentID.Length() )
         {
         // Something to do.
         // Put aUniqueID inside a descriptor.
         // Works even if its typedef is changed.
-        TPtrC8 uid( reinterpret_cast< TUint8* >( 
+        TPtrC8 uid( reinterpret_cast< TUint8* >(
                         const_cast< TDRMUniqueID* >( &aUniqueID ) ),
                     sizeof( TDRMUniqueID ) );
-        
-        return SendReceive( DRMEngine::EDeleteRO, 
+
+        return SendReceive( DRMEngine::EDeleteRO,
                             TIpcArgs( &uid, NULL, NULL, &aContentID ) );
         }
-    
+
     return KErrArgument;
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::ExportContentIDList
-// Overloaded method: requests all content IDs to be put to a file. 
+// Overloaded method: requests all content IDs to be put to a file.
 // Assumes that the given descriptor represents a buffer large enough to
 // contain the file name.
 // -----------------------------------------------------------------------------
@@ -481,15 +481,15 @@
 EXPORT_C TInt RDRMRightsClient::ExportContentIDList( TDes& aFileName )
     {
     DRMLOG( _L( "RDRMRightsClient::ExportContentIDLis" ) );
-    
-    return SendReceive( DRMEngine::EExportCIDs, 
+
+    return SendReceive( DRMEngine::EExportCIDs,
                         TIpcArgs( &aFileName ) );
-    
+
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::ExportContentIDList
-// Overloaded method: requests all content IDs to be put to a file, 
+// Overloaded method: requests all content IDs to be put to a file,
 // and then converts the file into RPointerArray.
 // -----------------------------------------------------------------------------
 //
@@ -498,7 +498,7 @@
     DRMLOG( _L( "RDRMRightsClient::ExportContentIDList to array" ) );
     TFileName name;
     aCIDList.ResetAndDestroy();
-    
+
     TInt error = ExportContentIDList( name );
     if ( !error )
         {
@@ -511,14 +511,14 @@
                 {
                 aCIDList.ResetAndDestroy();
                 }
-            
+
             fs.Delete( name );
             fs.Close();
             }
         }
-    
+
     DRMLOG2( _L( "RDRMRightsClient::ExportContentIDList: %d" ), error );
-            
+
     return error;
     }
 
@@ -540,11 +540,11 @@
     SendReceive( DRMEngine::EGetKey,
         TIpcArgs( aIntent, const_cast<TDesC8*>(&aContentID), &aKey ),
         status );
-        
+
     User::WaitForRequest( status );
 
     DRMLOG2( _L( "RDRMRightsClient::GetDecryptionKey: %d" ), status.Int() );
-    
+
     return status.Int();
     }
 
@@ -560,16 +560,16 @@
     {
     TInt error = KErrNone;
     TInt size = 0;
-    
+
     TPckg<TInt> package( size );
     TPckg<TUint32> package2( aRejection );
-        
+
     DRMLOG( _L( "RDRMRightsClient::CheckRights" ) );
     error = SendReceive( DRMEngine::ECheckRights, TIpcArgs( aIntent,
         &aContentID, &package, &package2 ) );
-        
+
     DRMLOG2( _L( "RDRMRightsClient::CheckRights: %d" ), error );
-    
+
     return error;
     }
 
@@ -587,10 +587,10 @@
     TInt r;
     TInt size = 0;
     TPckg<TInt> package( size );
-    TPckg<TUint32> package2( aRejection );    
+    TPckg<TUint32> package2( aRejection );
     CDRMPermission* permission = NULL;
     HBufC8* buffer = NULL;
-    
+
     DRMLOG( _L( "RDRMRightsClient::GetActiveRightsL" ) );
     r = SendReceive( DRMEngine::ECheckRights, TIpcArgs( aIntent, &aContentID,
         &package, &package2 ) );
@@ -613,7 +613,7 @@
         {
         User::Leave( r );
         }
-    
+
     DRMLOG( _L( "RDRMRightsClient::GetActiveRightsL: done" ) );
     return permission;
     }
@@ -631,21 +631,21 @@
 
     TInt count = 0;
     TInt error = KErrNone;
-    
+
     TPtr8 ptr( reinterpret_cast< TUint8* >( &count ),
-               0, 
+               0,
                sizeof( TInt ) );
-    
-    error = SendReceive( DRMEngine::ECount, 
+
+    error = SendReceive( DRMEngine::ECount,
                          TIpcArgs( &ptr ) );
-    
+
     if ( !error )
         {
         error = count;
         }
-    
+
     DRMLOG2( _L( "RDRMRightsClient::Count: %d" ), error );
-    
+
     return error;
     }
 
@@ -657,11 +657,11 @@
 EXPORT_C TInt RDRMRightsClient::DeleteAll()
     {
     DRMLOG( _L( "RDRMRightsClient::DeleteAll" ) );
-   
-    TInt error = SendReceive( DRMEngine::EDeleteAll, TIpcArgs( NULL ) ); 
+
+    TInt error = SendReceive( DRMEngine::EDeleteAll, TIpcArgs( NULL ) );
 
     DRMLOG2( _L( "RDRMRightsClient::DeleteAll: %d" ), error  );
-    
+
     return error;
     }
 
@@ -670,13 +670,13 @@
 // Consume the right with specific intent and contentID
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent, 
+EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent,
                                          const TDesC8& aContentID )
     {
     TInt error = KErrNone;
     DRMLOG( _L( "RDRMRightsClient::Consume" ) );
-   
-    error = SendReceive( DRMEngine::EConsume, 
+
+    error = SendReceive( DRMEngine::EConsume,
                          TIpcArgs( aIntent, &aContentID ) );
 
     DRMLOG2( _L( "RDRMRightsClient::Consume: %d" ), error  );
@@ -688,13 +688,13 @@
 // Check if Consume is possibke
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt RDRMRightsClient::CheckConsume( const TInt aIntent, 
+EXPORT_C TInt RDRMRightsClient::CheckConsume( const TInt aIntent,
                                               const TDesC8& aContentID )
     {
     TInt error = KErrNone;
     DRMLOG( _L( "RDRMRightsClient::CheckConsume" ) );
-   
-    error = SendReceive( DRMEngine::ECheckConsume, 
+
+    error = SendReceive( DRMEngine::ECheckConsume,
                          TIpcArgs( aIntent, &aContentID ) );
 
     DRMLOG2( _L( "RDRMRightsClient::CheckConsume: %d" ), error  );
@@ -717,7 +717,7 @@
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::ForwardLockURI( HBufC8*& aURI )
@@ -726,20 +726,20 @@
     TBuf8< DRMEngine::KMaxOmaV1CIDLength > buf;
     TInt error = SendReceive( DRMEngine::EGetFLUri,
                               TIpcArgs( &buf ) );
-                              
+
     if ( error )
         {
         aURI = NULL;
         return error;
         }
-        
+
     aURI = buf.Alloc();
 
     if ( aURI )
         {
         return KErrNone;
         }
-        
+
     return KErrNoMemory;
     }
 
@@ -749,23 +749,23 @@
 // Add domain rights object xml representation to the rdb
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt RDRMRightsClient::AddDomainRO( const TDesC8& aRoId, 
+EXPORT_C TInt RDRMRightsClient::AddDomainRO( const TDesC8& aRoId,
                                              const TDesC8& aXmlData )
     {
     DRMLOG( _L( "RDRMRightsClient::AddDomainRO" ) );
     TInt error = KErrArgument;
-    
+
     // Check the parameters.
     if ( aRoId.Length() && aXmlData.Length() )
-        {     
+        {
         // Send the message.
-        error = SendReceive( DRMEngine::EAddDomainRO, 
+        error = SendReceive( DRMEngine::EAddDomainRO,
                              TIpcArgs( &aRoId, &aXmlData) );
         }
-        
+
     DRMLOG2( _L( "RDRMRightsClient::AddDomainRO: %d" ), error );
-    return error;    
-    };        
+    return error;
+    };
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetDomainROL
@@ -775,37 +775,37 @@
 EXPORT_C HBufC8* RDRMRightsClient::GetDomainROL( const TDesC8& aRoId )
     {
     DRMLOG( _L( "RDRMRightsClient::GetDomainROL" ) );
-    
+
     // Check the parameter.
     if ( aRoId.Length() )
         {
         TInt size = 0;
         TPckg<TInt> package( size );
-        
+
         // Call the server. Throw an exception in case of an error.
-        User::LeaveIfError( 
-            SendReceive( DRMEngine::EGetDomainRO, 
+        User::LeaveIfError(
+            SendReceive( DRMEngine::EGetDomainRO,
                          TIpcArgs( &package, &aRoId ) ) );
 
         HBufC8* roData = HBufC8::NewMaxLC( size );
-        
+
         // Package 'object' into TPtr8.
         TPtr8 objectPkg( const_cast< TUint8* >( roData->Ptr() ),
                          size,
                          size );
 
-        User::LeaveIfError( 
-            SendReceive( DRMEngine::EGetPreparedData, 
+        User::LeaveIfError(
+            SendReceive( DRMEngine::EGetPreparedData,
                          TIpcArgs( &objectPkg) ) );
-        CleanupStack::Pop( roData ); // roData                 
+        CleanupStack::Pop( roData ); // roData
         return roData;
         }
-    
+
     User::Leave( KErrArgument );
-    
+
     // Never reached.
-    return NULL;    
-    }; 
+    return NULL;
+    };
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetDomainROL
@@ -823,7 +823,7 @@
     TInt roSize;
     TInt offset;
 
-        
+
     DRMLOG(_L("RDRMRightsClient::GetDomainRoForCidL"));
     User::LeaveIfError(SendReceive(DRMEngine::EGetDomainRoForCid,
         TIpcArgs(&aContentId, &pkg)));
@@ -839,64 +839,64 @@
         while (offset < size)
             {
             Mem::Copy( &roSize, ptr.Ptr()+offset, sizeof(TInt) );
-            offset += sizeof (TInt); 
+            offset += sizeof (TInt);
             ro = ptr.Mid(offset, roSize).AllocL();
             aRoList.Append(ro);
             offset += roSize;
             }
         CleanupStack::PopAndDestroy();
         }
-    }; 
+    };
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::Encrypt( const TDesC8& aIv,
                        TPtr8& aData,
                        TBool aAddPadding )
     {
-    return SendReceive( DRMEngine::EEncrypt, 
+    return SendReceive( DRMEngine::EEncrypt,
                         TIpcArgs( &aIv, &aData, aAddPadding ) );
-    }                       
+    }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::Decrypt( const TDesC8& aIv,
                        TPtr8& aData,
                        TBool aRemovePadding )
     {
-    return SendReceive( DRMEngine::EDecrypt, 
+    return SendReceive( DRMEngine::EDecrypt,
                         TIpcArgs( &aIv, &aData, aRemovePadding ) );
-    }                         
+    }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::InitializeKey( const TDesC8& aContentId )
     {
-    return SendReceive( DRMEngine::EInitializeKey, 
+    return SendReceive( DRMEngine::EInitializeKey,
                         TIpcArgs( &aContentId ) );
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::InitializeGroupKey( const TDesC8& aGroupId,
                                                     const TDesC8& aGroupKey,
                                                     TEncryptionMethod aMethod )
     {
-    return SendReceive( DRMEngine::EInitializeGroupKey, 
+    return SendReceive( DRMEngine::EInitializeGroupKey,
                         TIpcArgs( &aGroupId, &aGroupKey, aMethod ) );
-    }                                            
+    }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::DeleteDomainRO
@@ -906,21 +906,21 @@
 EXPORT_C TInt RDRMRightsClient::DeleteDomainRO( const TDesC8& aRoId )
     {
     DRMLOG( _L( "RDRMRightsClient::DeleteDomainRO" ) );
-    
+
     // Check the parameter.
     if ( aRoId.Length() )
         {
-        return SendReceive( DRMEngine::EDeleteDomainRO, 
+        return SendReceive( DRMEngine::EDeleteDomainRO,
                             TIpcArgs( &aRoId ) );
         }
-    
-    return KErrArgument;    
-    }; 
+
+    return KErrArgument;
+    };
 
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::IsInCache( const TDesC8& aID,
@@ -930,68 +930,68 @@
     DRMLOG( _L( "RDRMRightsClient::IsInCache" ) );
     TPckgC< TTime > timePckg( aTime );
     TPckg< TBool > inCache( aInCache );
-        
+
     return SendReceive( DRMEngine::EIsInCache,
                         TIpcArgs( &aID, &timePckg, &inCache ) );
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::IsInCache( const TDesC8& aID,
                                            TBool& aInCache )
     {
     DRMLOG( _L( "RDRMRightsClient::IsInCache" ) );
-    
+
     TPckg< TBool > inCache( aInCache );
-        
+
     return SendReceive( DRMEngine::EIsInCache,
                         TIpcArgs( &aID, NULL, &inCache ) );
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::AddToCache( const TDesC8& aID,
                                             const TTime& aTime )
     {
     DRMLOG( _L( "RDRMRightsClient::AddToCache" ) );
-    
+
     TPckgC< TTime > timePckg( aTime );
-    
+
     return SendReceive( DRMEngine::EAddToCache,
                         TIpcArgs( &aID, &timePckg ) );
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::AddToCache( const TDesC8& aID )
     {
     DRMLOG( _L( "RDRMRightsClient::AddToCache" ) );
-    
+
     return SendReceive( DRMEngine::EAddToCache,
                         TIpcArgs( &aID, NULL ) );
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::DeleteExpiredPermissions
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C void RDRMRightsClient::DeleteExpiredPermissions( TRequestStatus& aStatus )
     {
     DRMLOG( _L( "RDRMRightsClient::DeleteExpiredPermissions" ) );
-    
+
     SendReceive( DRMEngine::EDeleteExpired, aStatus );
     }
- 
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::SetEstimatedArrival
 // sets the estimated RO arrival time to the given delta
@@ -1004,13 +1004,13 @@
     TInt error = KErrNone;
 
     TPckg< TTimeIntervalSeconds > delta( aDeltaSeconds );
-    
-    error = SendReceive( DRMEngine::ESetEstimatedArrival, 
+
+    error = SendReceive( DRMEngine::ESetEstimatedArrival,
                          TIpcArgs( &aContentID, &delta ) );
-    
-    return error;    
+
+    return error;
     };
-                                  
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetEstimatedArrival
 // sets the amount of time in which the RO should arrive in
@@ -1023,14 +1023,14 @@
     TInt error = KErrNone;
 
     TPckg< TTimeIntervalSeconds > delta( aDeltaSeconds );
-    
-    error = SendReceive( DRMEngine::EGetEstimatedArrival, 
+
+    error = SendReceive( DRMEngine::EGetEstimatedArrival,
                          TIpcArgs( &aContentID, &delta ) );
-    
-    return error;     
-    }; 
- 
- 
+
+    return error;
+    };
+
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::SetName
 // sets the name.
@@ -1043,18 +1043,18 @@
     return SendReceive( DRMEngine::ESetName,
                         TIpcArgs( &aContentID, &aName ) );
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetName
 // Gets the name. Two-phase operation.
 // -----------------------------------------------------------------------------
-//    
+//
 EXPORT_C TInt RDRMRightsClient::GetName( const TDesC8& aContentID,
                                          HBufC*& aName )
     {
     DRMLOG( _L( "RDRMRightsClient::GetName" ) );
     TPckgBuf< TInt > size( 0 );
-    
+
     TInt error = SendReceive( DRMEngine::EGetName,
                               TIpcArgs( &aContentID, &size ) );
     if ( !error )
@@ -1073,10 +1073,10 @@
             if ( aName )
                 {
                 TPtr data( aName->Des() );
-                            
+
                 error = SendReceive( DRMEngine::EGetWideData,
                                      TIpcArgs( &data ) );
-                
+
                 if ( error )
                     {
                     delete aName; aName = NULL;
@@ -1088,47 +1088,47 @@
                 }
             }
         }
-        
+
     return error;
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::Cancel
 // -----------------------------------------------------------------------------
-//      
+//
 EXPORT_C void RDRMRightsClient::Cancel()
     {
     DRMLOG( _L(" RDRMRightsClient::Cancel" ) );
     SendReceive( DRMEngine::ECancel );
     }
-    
-    
+
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetUdtData
 // -----------------------------------------------------------------------------
-//   
+//
 EXPORT_C TInt RDRMRightsClient::GetUdtData( TDes8& aUdtData )
     {
     DRMLOG( _L( "RDRMRightsClient::GetUdtData" ) );
-    
+
     TInt error = SendReceive( DRMEngine::EGetUdtData,
                               TIpcArgs( &aUdtData ) );
-        
-    return error;        
-    };        
+
+    return error;
+    };
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::InitializeUdt
 // -----------------------------------------------------------------------------
-//   
+//
 EXPORT_C TInt RDRMRightsClient::InitiateUdt( const TDesC8& aKey )
     {
     DRMLOG( _L( "RDRMRightsClient::InitiateUdt" ) );
-    
+
     TInt error = SendReceive( DRMEngine::EInitiateUdt,
-                              TIpcArgs( &aKey ) );     
-    return error;        
-    };         
+                              TIpcArgs( &aKey ) );
+    return error;
+    };
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::InitOrphanedContentIdList
@@ -1138,38 +1138,38 @@
                                                       TRequestStatus& aStatus )
     {
     DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList" ) );
-        
-    SendReceive( DRMEngine::EInitOrphanedList, 
+
+    SendReceive( DRMEngine::EInitOrphanedList,
                  TIpcArgs( aPerformScan ), aStatus );
-                 
-    DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList done" ) );                        
+
+    DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList done" ) );
     };
 
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::ExportOrphanedContentIdList
 // -----------------------------------------------------------------------------
-//   
+//
 EXPORT_C TInt RDRMRightsClient::ExportOrphanedContentIdList( TDes& aFileName )
     {
     DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList" ) );
-    
-    return SendReceive( DRMEngine::EGetOrphanedList, 
+
+    return SendReceive( DRMEngine::EGetOrphanedList,
                         TIpcArgs( &aFileName ) );
-            
-    };        
-                 
+
+    };
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::ExportOrphanedContentIdList
 // -----------------------------------------------------------------------------
-//   
-EXPORT_C TInt RDRMRightsClient::ExportOrphanedContentIdList( 
+//
+EXPORT_C TInt RDRMRightsClient::ExportOrphanedContentIdList(
                         RPointerArray<HBufC8>& aContentIdList )
     {
     DRMLOG( _L( "RDRMRightsClient::ExportOrphanedContentIdList to array" ) );
     TFileName name;
     aContentIdList.ResetAndDestroy();
-    
+
     TInt error = ExportOrphanedContentIdList( name );
     if ( !error )
         {
@@ -1182,16 +1182,16 @@
                 {
                 aContentIdList.ResetAndDestroy();
                 }
-            
+
             fs.Delete( name );
             fs.Close();
             }
         }
-    
+
     DRMLOG2( _L( "RDRMRightsClient::ExportOrphanedContentIdList to array: %d" ), error );
-            
-    return error;        
-    }; 
+
+    return error;
+    };
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::EncodeRightsIssuerField
@@ -1201,28 +1201,28 @@
 // - base64encode(AES IV + AES encoded original field incl. padding)
 // -----------------------------------------------------------------------------
 //
-EXPORT_C TInt RDRMRightsClient::EncodeRightsIssuerField( 
+EXPORT_C TInt RDRMRightsClient::EncodeRightsIssuerField(
                                     const TDesC8& aOldValue,
                                     HBufC8*& aNewValue )
     {
     DRMLOG( _L( "RDRMRightsClient::EncodeRightsIssuerField" ) );
 
     TInt error( KErrNone );
-    
+
     TInt size( aOldValue.Length() ); // original length
     size += KDCFKeySize - ( size % KDCFKeySize ); // padding
     size += KDCFKeySize; // IV
     size += ( size + 2 ) / 3 * 4; // base64
     size += RMobilePhone::KPhoneSerialNumberSize;
     size += 3; // "flk"
-    
+
     aNewValue = HBufC8::New( size );
     if ( aNewValue )
         {
         TPtr8 des( aNewValue->Des() );
-        
+
         des = aOldValue;
-        
+
         error = SendReceive( DRMEngine::EEncodeRightsIssuerField,
                              TIpcArgs( &des ) );
         if ( error )
@@ -1235,25 +1235,25 @@
         {
         error = KErrNoMemory;
         }
-    
+
     DRMLOG2( _L( "RDRMRightsClient::EncodeRightsIssuerField> %d" ), error );
-    
+
     return error;
     }
-    
-EXPORT_C TInt RDRMRightsClient::DecodeRightsIssuerField( 
+
+EXPORT_C TInt RDRMRightsClient::DecodeRightsIssuerField(
                                     const TDesC8& aEncoded,
                                     HBufC8*& aDecoded )
     {
     DRMLOG( _L( "DRMRightsClient::DecodeRightsIssuerField" ) );
-    
+
     TInt error( KErrNone );
-    
+
     aDecoded = HBufC8::New( aEncoded.Length() );
     if ( aDecoded )
         {
         TPtr8 des( aDecoded->Des() );
-        
+
         error = SendReceive( DRMEngine::EDecodeRightsIssuerField,
                              TIpcArgs( &aEncoded,
                                       &des ) );
@@ -1272,15 +1272,15 @@
         {
         error = KErrNoMemory;
         }
-    
+
     DRMLOG2( _L( "DRMRightsClient::DecodeRightsIssuerField: error %d" ), error );
-    
+
     return error;
     }
-  
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::SetAuthenticationSeed
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::SetAuthenticationSeed( const TDesC8& aContentID,
@@ -1290,10 +1290,10 @@
     return SendReceive( DRMEngine::ESetAuthenticationSeed,
                         TIpcArgs( &aContentID, &aSeed ) );
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetAuthenticationSeed
-// 
+//
 // -----------------------------------------------------------------------------
 //
 EXPORT_C TInt RDRMRightsClient::GetAuthenticationSeed( const TDesC8& aContentID,
@@ -1302,7 +1302,7 @@
     DRMLOG( _L( "RDRMRightsClient::GetAuthenticationSeed" ) );
     return SendReceive( DRMEngine::EGetAuthenticationSeed,
                         TIpcArgs( &aContentID, &aSeed ) );
-    }                                                       
+    }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::FileToListL
@@ -1315,52 +1315,52 @@
     {
     DRMLOG( _L( "RDRMRightsClient::FileToListL" ) );
     TInt error = KErrNone;
-    
+
     // Temporary storage.
     CDRMPermission* tmpObject;
-    
+
     // To access the file data.
     RFileReadStream fileStream;
-    
+
     // How many objects there is in the file.
     TInt size = 0;
-    
+
     // Temporary counter.
     TInt count = 0;
-    
-    
+
+
     // Open the file.
     User::LeaveIfError( fileStream.Open( aFs, aFileName, EFileRead | EFileStream ) );
     CleanupClosePushL( fileStream );
-    
+
     size = fileStream.ReadInt32L();
-    
+
     while( count < size )
         {
         // Allocate a new RO.
         tmpObject = CDRMPermission::NewL();
-        
+
         // Read the object.
         TRAP( error, tmpObject->InternalizeL( fileStream ) );
-        
+
         if ( !error )
             {
             // Add the object into the list.
             error = aList.Append( tmpObject );
             }
-        
+
         if ( error )
             {
             delete tmpObject;
             User::Leave( error );
             }
-        
-        // Now tmpObject is under responsibility of aList. 
+
+        // Now tmpObject is under responsibility of aList.
         ++count;
         }
-    
+
     // All done.
-    CleanupStack::PopAndDestroy(); // fileStream 
+    CleanupStack::PopAndDestroy(); // fileStream
     }
 
 // -----------------------------------------------------------------------------
@@ -1376,10 +1376,10 @@
     RFileReadStream stream;
     TUint16 size = 0;
     TPtr8 data( NULL, 0, 0 );
-    
+
     User::LeaveIfError( stream.Open( aFs, aFile, EFileRead | EFileStream ) );
     CleanupClosePushL( stream );
-    
+
     size = stream.ReadUint16L();
     while( size > 0 )
         {
@@ -1390,22 +1390,22 @@
         CleanupStack::Pop(); // tmp
         size = stream.ReadUint16L();
         }
-    
+
     // All read, return.
-    
+
     CleanupStack::PopAndDestroy(); // stream
     }
 
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::VerifyMacL
-// Verifies the MAC. 
+// Verifies the MAC.
 // -----------------------------------------------------------------------------
-//    
+//
 EXPORT_C TInt RDRMRightsClient::VerifyMacL(const TDesC8& aSignedInfoElement,
                                   const TDesC8& aMacValue ) const
     {
     DRMLOG( _L( "RDRMRightsClient::VerifyMacL" ) );
-    
+
     TInt error = SendReceive( DRMEngine::EVerifyMac,
                               TIpcArgs( &aSignedInfoElement, &aMacValue) );
     return error;
@@ -1416,19 +1416,19 @@
 // RDRMRightsClient::GetSupportedIndividualsL
 // retrieves the supported individuals list
 // -----------------------------------------------------------------------------
-//    
+//
 EXPORT_C TInt RDRMRightsClient::GetSupportedIndividualsL(
                                     RPointerArray<HBufC8>& aIndividuals) const
     {
     DRMLOG( _L( "RDRMRightsClient::GetSupportedIndividualsL" ) );
-    TPckgBuf< TInt > size( 0 );    
+    TPckgBuf< TInt > size( 0 );
     TInt error = SendReceive( DRMEngine::EGetSupportedIndividuals,
                               TIpcArgs( &size) );
     HBufC8* dataBuf = NULL;
     HBufC8* individual = NULL;
     TInt indivSize;
     TInt offset;
-                                  
+
     if ( !error )
         {
         if ( !size() )
@@ -1441,17 +1441,17 @@
             if ( dataBuf )
                 {
                 TPtr8 data( dataBuf->Des() );
-                            
+
                 error = SendReceive( DRMEngine::EGetPreparedData,
                                      TIpcArgs( &data ) );
-                
+
                 if ( !error )
-                    { 
+                    {
                     offset = 0;
                     while (offset < size())
                         {
                         Mem::Copy( &indivSize, data.Ptr()+offset, sizeof(TInt) );
-                        offset += sizeof (TInt); 
+                        offset += sizeof (TInt);
                         individual = data.Mid(offset, indivSize).AllocLC();
                         aIndividuals.AppendL(individual);
                         CleanupStack::Pop(); // individual
@@ -1459,16 +1459,16 @@
                         }
                     }
                 }
-            CleanupStack::PopAndDestroy();   
+            CleanupStack::PopAndDestroy();
             }
-        }                                             
+        }
     return KErrNone;
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::StopWatching
 // -----------------------------------------------------------------------------
-//    
+//
 EXPORT_C void RDRMRightsClient::StopWatching() const
     {
     SendReceive( DRMEngine::EStopWatching );
@@ -1477,7 +1477,7 @@
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::UnwrapMacAndRek
 // -----------------------------------------------------------------------------
-//    
+//
 EXPORT_C TInt RDRMRightsClient::UnwrapMacAndRek( const TDesC8& aMacAndRek,
                                                  TKeyTransportScheme aTransportScheme,
                                                  const TDesC8& aRightsIssuerId,
@@ -1486,16 +1486,16 @@
     HBufC8* data = NULL;
     TPtr8 dataPtr( NULL, 0 );
     TInt err = KErrNone;
-    
+
     data = HBufC8::New( 1 + aMacAndRek.Size() );
-    
+
     if ( data )
         {
         dataPtr.Set( data->Des() );
-        dataPtr.SetLength( 1 ); 
+        dataPtr.SetLength( 1 );
         dataPtr[0] = aTransportScheme;
         dataPtr.Append( aMacAndRek );
-    
+
         if( aDomainId.Length() )
             {
             err = SendReceive( DRMEngine::EUnwrapDomainMacAndRek, TIpcArgs( &dataPtr,
@@ -1511,18 +1511,18 @@
         delete data;
         data = NULL;
         }
-    else 
+    else
         {
         err = KErrNoMemory;
         }
-    
+
     return err;
     }
-    
+
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetRandomDataL
 // -----------------------------------------------------------------------------
-//    
+//
 EXPORT_C void RDRMRightsClient::GetRandomDataL( TDes8& aRandomData ) const
     {
     if( !aRandomData.Length() )
@@ -1535,7 +1535,7 @@
 // -----------------------------------------------------------------------------
 // RDRMRightsClient::GetMeteringData()
 // -----------------------------------------------------------------------------
-//    
+//
 #ifndef RD_DRM_METERING
 EXPORT_C HBufC8* RDRMRightsClient::GetMeteringDataL( const TDesC8& /*aRiId*/ )
     {
@@ -1546,24 +1546,24 @@
     {
     TInt error = KErrNone;
     HBufC8* meteringData = NULL;
-       
+
     if ( aRiId.Length() )
         {
         TInt size = 0;
         TPckg<TInt> package( size );
-        
-        error = SendReceive( DRMEngine::EGetMeteringData, 
+
+        error = SendReceive( DRMEngine::EGetMeteringData,
                            TIpcArgs( &package, &aRiId ) );
-                           
+
         if ( error == KErrNotFound )
             {
             return NULL;
             }
-            
+
         User::LeaveIfError( error );
 
         meteringData = HBufC8::NewMaxLC( size );
-        
+
         // Package 'object' into TPtr8.
         TPtr8 objectPkg( const_cast< TUint8* >( meteringData->Ptr() ),
                          size,
@@ -1571,26 +1571,26 @@
 
         User::LeaveIfError( SendReceive( DRMEngine::EGetPreparedData,
                                          TIpcArgs( &objectPkg) ) );
-        
+
         CleanupStack::Pop(); // meteringData
         return meteringData;
         }
-    
+
     User::Leave( KErrArgument );
     return NULL;
     }
 #endif //RD_DRM_METERING
- 
+
  // -----------------------------------------------------------------------------
 // RDRMRightsClient::DeleteMeteringDataL
 // -----------------------------------------------------------------------------
-//    
+//
 #ifndef RD_DRM_METERING
 EXPORT_C TInt RDRMRightsClient::DeleteMeteringDataL( const TDesC8& /*aRiId*/ )
     {
     return KErrNotSupported;
     }
-#else    	
+#else
 EXPORT_C TInt RDRMRightsClient::DeleteMeteringDataL( const TDesC8& aRiId )
     {
     if ( aRiId.Length() )
@@ -1604,9 +1604,9 @@
         return KErrArgument;
         }
     }
-#endif 
+#endif
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
-              
-    
-//  End of File  
+
+
+//  End of File
--- a/omadrm/drmengine/server/src/DRMRightsClientStub.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +0,0 @@
-/*
-* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Client side class implementation
-*
-*/
-
-
-// INCLUDE FILES
-#include <s32file.h>
-#include "DRMRightsClient.h"
-#include "DRMClientServer.h"
-#ifdef _DRM_TESTING
-#include "logfile.h"
-#endif
-
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
-#ifdef CLIENT_STARTS_SERVER
-extern TInt DRMServerStarter();
-#endif
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::RDRMRightsClient
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RDRMRightsClient::RDRMRightsClient() :
-    iPtr( NULL )
-    {
-    }
-    
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::~RDRMRightsClient
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RDRMRightsClient::~RDRMRightsClient()
-    {
-    }    
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::Connect
-// Opens connection to the server.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::Connect()
-    {
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::Close
-// Closes the connection to the server.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void RDRMRightsClient::Close() 
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::AddRecord
-// Add a new entry to the rights database.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::AddRecord( const TDesC8& aCEK, // Content encryption key
-                                  // The rights object which is to be added
-                                  const CDRMPermission& aRightsObject, 
-                                  const TDesC8& aCID, // Content-ID 
-                                  TDRMUniqueID& aID ) // Unique ID, out-parameter
-    {
-    return KErrNone;
-    }
-
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::GetDBEntriesL
-// Get a file name from the server. The file contains the rights objects,
-// which are then converted to RPointerArray.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void RDRMRightsClient::GetDBEntriesL( const TDesC8& aId,
-                                      RPointerArray< CDRMPermission >& aRightsList )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::GetDbEntryL
-// Get a single RO from the server.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CDRMPermission* RDRMRightsClient::GetDbEntryL( const TDesC8& aContentID,
-                                                 const TDRMUniqueID& aUniqueID )
-    {
-    CDRMPermission* object = new (ELeave) CDRMPermission;
-    object->iUniqueID = aUniqueID;
-    return object;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::DeleteDbEntry
-// Deletes all rights objects associated with the given UID.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID )
-    {
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::DeleteDbEntry
-// Delete a single rights object identified by given parameters.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::DeleteDbEntry( const TDesC8& aContentID,
-                                      const TDRMUniqueID& aUniqueID )
-    {
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::ExportContentIDList
-// Overloaded method: requests all content IDs to be put to a file. 
-// Assumes that the given descriptor represents a buffer large enough to
-// contain the file name.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::ExportContentIDList( TDes& aFileName )
-    {
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::ExportContentIDList
-// Overloaded method: requests all content IDs to be put to a file, 
-// and then converts the file into RPointerArray.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::ExportContentIDList( RPointerArray< HBufC8 >& aCIDList )
-    {
-    return KErrNone;
-    }
-
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::GetDecryptionKey
-// Fetches the decryption key from the server.
-// Uses TR mechanisms. Uses asynchronous C/S call.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::GetDecryptionKey( const TInt aIntent,
-                                        const TDesC8& aContentID,
-                                        const TBool aUpdate,
-                                        TDes8& aKey )
-    {
-    aKey.Copy(_L("0000000000000000"));
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::CheckRights
-// Checks if appropriate rights exist for a certain content ID.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::CheckRights( const TInt aIntent,
-                                    const TDesC8& aContentID )
-    {
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::Count
-// Returns the amount of unique content IDs in the database.
-// If an error occurs, a negative value is returned (Symbian OS / DRM 3 specific
-// error code).
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::Count()
-    {
-    return 1;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::DeleteAll
-// Empties the database.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::DeleteAll()
-	{
-	return KErrNone;
-	}
-
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::Consume()
-// Consume the right with specific intent and contentID
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::Consume( const TInt aIntent, const TDesC8& aContentID, const TInt aActionIntent )
-	{
-	return KErrNone;
-	}
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::CalculatePadding
-// Calculate the padding from a data block and a certain content ID.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMRightsClient::CalculatePadding(
-    const TDesC8& aContentID,
-    const TDesC8& aLastTwoDataBlocks)
-    {
-    return 0;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::FileToListL
-// Converts the given file into an array.
-// -----------------------------------------------------------------------------
-//
-void RDRMRightsClient::FileToListL( RFs& aFs,
-                                   const TDesC& aFileName,
-                                   RPointerArray< CDRMPermission >& aList )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMRightsClient::URIFileToArrayL
-// Converts the given file into an array.
-// -----------------------------------------------------------------------------
-//
-void RDRMRightsClient::URIFileToArrayL( RFs& aFs,
-                                       const TDesC& aFile,
-                                       RPointerArray< HBufC8 >& aList )
-    {
-    }
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-//  End of File  
--- a/omadrm/drmengine/server/src/DRMRightsData.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMRightsData.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -24,12 +24,12 @@
 
 #include "DRMPointerArray.h"
 #include "DRMCommonData.h"
-#include "DRMPermission.h"
+#include "DrmPermission.h"
 #include "DRMRightsData.h"
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 const TInt KEncryptionKeySize = 16;
@@ -44,16 +44,16 @@
 
 // FORWARD DECLARATIONS
 
-class TPermData 
+class TPermData
     {
     public: // Constructor
     TPermData( HBufC8* aParentId, const TInt aIndex, TBool aIsValid ) :
         iParentId( aParentId ),
         iIndex( aIndex ),
         iIsValid( aIsValid ) { };
-    
-    public: // Member variables    
-    HBufC8* iParentId; 
+
+    public: // Member variables
+    HBufC8* iParentId;
     TInt iIndex;
     TBool iIsValid;
     };
@@ -67,7 +67,7 @@
 // -----------------------------------------------------------------------------
 //
 CDRMRightsData* CDRMRightsData::NewLC( CDRMCommonData* aData,
-                                       const TDesC8& aKey, 
+                                       const TDesC8& aKey,
                                        const TFileName& aRightsFile,
                                        RFs& aFileServer )
     {
@@ -75,24 +75,24 @@
     CleanupStack::PushL( self );
     self->ConstructL( aRightsFile, aKey );
 
-    return self;    
+    return self;
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::NewL
 // -----------------------------------------------------------------------------
 //
-CDRMRightsData* CDRMRightsData::NewL( CDRMCommonData* aData, 
+CDRMRightsData* CDRMRightsData::NewL( CDRMCommonData* aData,
                                       const TDesC8& aKey,
                                       const TFileName& aRightsFile,
                                       RFs& aFileServer )
     {
     CDRMRightsData* self = NewLC( aData, aKey, aRightsFile, aFileServer );
-    CleanupStack::Pop();	
-    
-    return self;    
+    CleanupStack::Pop();
+
+    return self;
     };
-                                 
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::OpenLC
 // -----------------------------------------------------------------------------
@@ -103,12 +103,12 @@
     CDRMCommonData* common = CDRMCommonData::NewL();
 
     CDRMRightsData* self = new( ELeave ) CDRMRightsData( common, aFileServer );
-    CleanupStack::PushL( self );    
+    CleanupStack::PushL( self );
     self->ConstructL( aRightsFile );
-    
+
     return self;
-    };    
-    
+    };
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::OpenL
 // -----------------------------------------------------------------------------
@@ -118,14 +118,14 @@
     {
     CDRMRightsData* self = OpenLC( aRightsFile, aFileServer );
     CleanupStack::Pop();
-    
-    return self;    
-    };    
-    
+
+    return self;
+    };
+
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
-// 
+//
 CDRMRightsData::~CDRMRightsData()
     {
     // Permanent File Store
@@ -134,17 +134,17 @@
         delete iStore;
         iStore = NULL;
         }
-        
-    // index array    
+
+    // index array
     iArray.Close();
-    
+
     // Common Data
     if( iData )
         {
         delete iData;
         iData = NULL;
         }
-    }; 
+    };
 
 
 // -----------------------------------------------------------------------------
@@ -169,35 +169,35 @@
         {
         User::Leave( KErrArgument );
         }
-           
-    // Open the stream 
+
+    // Open the stream
     stream.ReplaceLC( *iStore, iCommonId );
-    
+
     // Delete the old data if it's around
     // if the old data has been modified, write it as such
     if( iData != aData )
-    	{
+        {
         if( iData )
-        	{
-        	delete iData;
-        	iData = NULL;        	
-        	}
-    	iData = aData;        
+            {
+            delete iData;
+            iData = NULL;
+            }
+        iData = aData;
         }
-    
+
     // Write the data to the stream
     iData->ExternalizeL( stream );
-    
+
     // commit the stream
     stream.CommitL();
-    
+
     // commit the store
     iStore->CommitL();
-    
+
     // pop the stream
     CleanupStack::PopAndDestroy();
-    };        
-    
+    };
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::StoreNewPermissionL
 // -----------------------------------------------------------------------------
@@ -209,40 +209,40 @@
     TStreamId rootId;
     RStoreWriteStream stream;
     RStoreWriteStream rootStream;
-       
+
     // Create a new stream to the store:
     sid = stream.CreateLC( *iStore );
-    
-    aPermission.iUniqueID = sid.Value();   
+
+    aPermission.iUniqueID = sid.Value();
     aStream = sid.Value();
-    
+
     // Externalize the permission data
     aPermission.ExternalizeL( stream );
     stream.CommitL();
-        
+
     // add the id to the array
     iArray.InsertInUnsignedKeyOrder( aStream );
 
     // Get the stream id of the root
     rootId = iStore->Root();
-    
+
     // Open the root stream
     rootStream.ReplaceLC( *iStore, rootId );
-        
+
     // Store the changed index
-    StoreIndexL( rootStream );    
+    StoreIndexL( rootStream );
     rootStream.CommitL();
 
     // Commit the store
     iStore->CommitL();
-    
+
     CleanupStack::PopAndDestroy();  // root stream
     CleanupStack::PopAndDestroy();  // stream
-    
+
     iStore->CompactL();
     iStore->CommitL();
-    };    
-    
+    };
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::UpdatePermissionL
 // -----------------------------------------------------------------------------
@@ -252,30 +252,30 @@
     TStreamId sid( aPermission.iUniqueID );
     RStoreWriteStream stream;
     TInt index = 0;
-    
+
     // get the id from the array if it doesn't exist, error
     index = iArray.FindInUnsignedKeyOrder( aPermission.iUniqueID );
-    
+
     if( index == KErrNotFound )
         {
         User::Leave( KErrCANoPermission );
         }
-    
+
     // Replace the existing stream
     stream.ReplaceLC( *iStore, sid );
-    
+
     // Externalize the permission data
     aPermission.ExternalizeL( stream );
-    
+
     // Required by the ReplaceLC
     stream.CommitL();
 
-    // Commit the store    
+    // Commit the store
     iStore->CommitL();
-    
+
     CleanupStack::PopAndDestroy();
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::FetchPermissionL
 // -----------------------------------------------------------------------------
@@ -283,28 +283,28 @@
 void CDRMRightsData::FetchPermissionL( CDRMPermission& aPermission,
                                        const TDRMUniqueID& aStream ) const
     {
-    TStreamId sid( aStream );    
+    TStreamId sid( aStream );
     RStoreReadStream stream;
     TInt index = 0;
 
     // get the id from the array if it doesn't exist, error
     index = iArray.FindInUnsignedKeyOrder( aStream );
-    
+
     if( index == KErrNotFound )
         {
         User::Leave( KErrCANoPermission );
         }
-    
+
     // Open the root stream
     stream.OpenLC( *iStore, sid );
 
     // Read the common id
     aPermission.InternalizeL( stream );
-    
+
     // Close the stream
-    CleanupStack::PopAndDestroy();        
+    CleanupStack::PopAndDestroy();
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::DeletePermissionL
 // -----------------------------------------------------------------------------
@@ -315,10 +315,10 @@
     TStreamId rootId;
     TInt index = 0;
     RStoreWriteStream rootStream;
-        
+
     // get the id from the array if it doesn't exist, error
     index = iArray.FindInUnsignedKeyOrder( aStream );
-    
+
     if( index == KErrNotFound )
         {
         User::Leave( KErrCANoPermission );
@@ -326,52 +326,52 @@
 
     // Delete the stream from the store
     iStore->DeleteL( sid );
-            
-    iArray.Remove( index );       
-    
-    
+
+    iArray.Remove( index );
+
+
     // Get the stream id of the root
     rootId = iStore->Root();
-    
+
     // Open the root stream
     rootStream.ReplaceLC( *iStore, rootId );
-        
+
     // Store the changed index
-    StoreIndexL( rootStream );    
+    StoreIndexL( rootStream );
     rootStream.CommitL();
 
     // Commit the store
     iStore->CommitL();
-    
+
     CleanupStack::PopAndDestroy();  // root stream
-    
+
     // Compact and commit the changes
     iStore->CompactL();
-    iStore->CommitL();        
+    iStore->CommitL();
     };
-                           
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::FetchAllPermissionsL
 // -----------------------------------------------------------------------------
 //
-void CDRMRightsData::FetchAllPermissionsL( RPointerArray<CDRMPermission>& 
+void CDRMRightsData::FetchAllPermissionsL( RPointerArray<CDRMPermission>&
                                            aPointerArray)
     {
     CDRMPermission* perm = NULL;
 
-    if ( iArray.Count() == 0) 
+    if ( iArray.Count() == 0)
         {
         User::Leave( KErrCANoPermission );
         }
-    
+
     for( TInt count = 0; count < iArray.Count(); count++ )
         {
         perm = CDRMPermission::NewLC();
         FetchPermissionL( *perm, iArray[ count ] );
         aPointerArray.AppendL( perm );
-		CleanupStack::Pop();
+        CleanupStack::Pop();
         }
-    };    
+    };
 
 // -----------------------------------------------------------------------------
 // CDRMRightsData::DeleteAllPermissionsL
@@ -381,35 +381,35 @@
     {
     TStreamId rootId;
     RStoreWriteStream rootStream;
-    
+
     // Delete all permissions from the store
     for( TInt i = 0; i < iArray.Count(); i++ )
         {
         TStreamId sid( iArray[i] );
         iStore->DeleteL( sid );
         }
-        
-    // Reset the array    
+
+    // Reset the array
     iArray.Reset();
-    
+
     // Get the stream id of the root
     rootId = iStore->Root();
-    
+
     // Open the root stream
     rootStream.ReplaceLC( *iStore, rootId );
-        
+
     // Store the changed index
-    StoreIndexL( rootStream );    
+    StoreIndexL( rootStream );
     rootStream.CommitL();
 
     // Commit the store
     iStore->CommitL();
-    
+
     CleanupStack::PopAndDestroy();  // root stream
-    
+
     // Compact and Commit the store
     iStore->CompactL();
-    iStore->CommitL();          
+    iStore->CommitL();
     };
 
 // -----------------------------------------------------------------------------
@@ -420,21 +420,21 @@
 // -----------------------------------------------------------------------------
 //
 TInt CDRMRightsData::DeleteExpiredPermissionsL( const TTime& aTime, TBool& aParents )
-	{
-	CDRMPermission* permission = NULL;	   
-    RStoreReadStream stream;   
+    {
+    CDRMPermission* permission = NULL;
+    RStoreReadStream stream;
     TStreamId rootId;
     RStoreWriteStream rootStream;
     TBool remove = EFalse;
     TInt k = 0;
     TBool performDelete = ETrue;
-    
+
     // A list for the permissions:
     CDRMPointerArray<CDRMPermission>* permList = CDRMPointerArray<CDRMPermission>::NewLC();
     permList->SetAutoCleanup( ETrue );
     CDRMPointerArray<TPermData>* permDataList = CDRMPointerArray<TPermData>::NewLC();
     permDataList->SetAutoCleanup( ETrue );
-    
+
     // Fill the array:
     for( TInt j = 0  ; j < iArray.Count(); j++ )
         {
@@ -442,27 +442,27 @@
         // Create the sid:
         TStreamId psid( iArray[j] );
 
-    	// Open the correct stream
-    	stream.OpenLC( *iStore, psid );
+        // Open the correct stream
+        stream.OpenLC( *iStore, psid );
 
-	    permission = CDRMPermission::NewLC();
+        permission = CDRMPermission::NewLC();
 
-    	// Read the permission
-    	permission->InternalizeL( stream );
-    
+        // Read the permission
+        permission->InternalizeL( stream );
+
         permList->AppendL( permission );
-    	CleanupStack::Pop(); // permission
-    	        
+        CleanupStack::Pop(); // permission
+
         // if the permission has a parent check if we found now or have found an
         // expired one or a valid one,
-        // store info if required 
+        // store info if required
         if( permission->iParentUID )
             {
-            if( !aParents ) 
+            if( !aParents )
                 {
                 aParents = ETrue;
                 }
-            
+
             for( k = 0; k < permDataList->Count(); k++ )
                 {
                 if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID ) )
@@ -476,7 +476,7 @@
                     break;
                     }
                 }
-                
+
             // if it's not found, add it:
             if( k == permDataList->Count() )
                 {
@@ -484,99 +484,99 @@
                     {
                     perm = new(ELeave) TPermData( permission->iParentUID, j, ETrue);
                     }
-                else 
+                else
                     {
-                    perm = new(ELeave) TPermData( permission->iParentUID, j, EFalse);                       
+                    perm = new(ELeave) TPermData( permission->iParentUID, j, EFalse);
                     }
                 CleanupStack::PushL( perm );
                 permDataList->AppendL( perm );
-                CleanupStack::Pop(); // perm   
+                CleanupStack::Pop(); // perm
                 }
             }
-        
+
         // Close the stream
-    	CleanupStack::PopAndDestroy();  // stream       
+        CleanupStack::PopAndDestroy();  // stream
         }
-          
+
 
     // Delete all expired permissions from the store
     for( TInt i = iArray.Count() - 1 ; i >= 0; i-- )
         {
         permission = (*permList)[i];
-        
-		// Check if the permission is expired
-		// if it is, check if it has a parent and if it can be deleted
-		if( permission->Expired( aTime ) )
-			{
-			// if it has a parent go through the list and see if this can be deleted
-			// or not
-			if( permission->iParentUID )
-			    {
-			    performDelete = EFalse;
-			    for( k = 0; k < permDataList->Count(); k++ )
-			        {
-			        TPermData* aData = (*permDataList)[k];
-			        
-			        // since it's set up like this a pointer comparison is enough:
-			        if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID  ) ) 
-			            {
-			            if( i != (*permDataList)[k]->iIndex ) 
-			                {
-			                performDelete = ETrue;
-			                }
-			            }
-			        }
-			    }
-			
-		    if( performDelete )	
-		        {
+
+        // Check if the permission is expired
+        // if it is, check if it has a parent and if it can be deleted
+        if( permission->Expired( aTime ) )
+            {
+            // if it has a parent go through the list and see if this can be deleted
+            // or not
+            if( permission->iParentUID )
+                {
+                performDelete = EFalse;
+                for( k = 0; k < permDataList->Count(); k++ )
+                    {
+                    TPermData* aData = (*permDataList)[k];
+
+                    // since it's set up like this a pointer comparison is enough:
+                    if( !(*permDataList)[k]->iParentId->Compare( *permission->iParentUID  ) )
+                        {
+                        if( i != (*permDataList)[k]->iIndex )
+                            {
+                            performDelete = ETrue;
+                            }
+                        }
+                    }
+                }
+
+            if( performDelete )
+                {
                 // Create the sid:
                 TStreamId sid( iArray[i] );
-                		        
-			    iStore->Delete( sid );
-			
-	            // remove from the array		
-		        iArray.Remove( i );				
-		    
-		        if( !remove )
-		            {
-		            remove = ETrue;    
-		            }
-			    }    
-			}
-		performDelete = ETrue;			
+
+                iStore->Delete( sid );
+
+                // remove from the array
+                iArray.Remove( i );
+
+                if( !remove )
+                    {
+                    remove = ETrue;
+                    }
+                }
+            }
+        performDelete = ETrue;
         }
 
-    CleanupStack::PopAndDestroy( 2 ); // permDataList, permList 
-        
-    // Write the data into the the file   
+    CleanupStack::PopAndDestroy( 2 ); // permDataList, permList
+
+    // Write the data into the the file
     // if some of the rights have been removed
-    if( remove ) 
+    if( remove )
         {
         // Get the stream id of the root
         rootId = iStore->Root();
-    
+
         // Open the root stream
         rootStream.ReplaceLC( *iStore, rootId );
-        
+
         // Store the changed index
-        StoreIndexL( rootStream );    
+        StoreIndexL( rootStream );
         rootStream.CommitL();
 
         // Commit the store
         iStore->CommitL();
-    
+
         CleanupStack::PopAndDestroy();  // root stream
-        
+
         // Compact and Commit the store
         iStore->CompactL();
-        iStore->CommitL();             
+        iStore->CommitL();
         }
-           
-	return iArray.Count();	
-	}
 
-    
+    return iArray.Count();
+    }
+
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::StoreKeyL
 // -----------------------------------------------------------------------------
@@ -585,24 +585,24 @@
     {
     RStoreWriteStream stream;
     TUint32 size = 0;
-    
+
     stream.OpenLC( *iStore, iKeyId );
-    
-    if( iKeyExists ) 
+
+    if( iKeyExists )
         {
         size = KEncryptionKeySize;
         }
-        
-    stream.WriteUint32L( size );        
-    
+
+    stream.WriteUint32L( size );
+
     if( size )
         {
-        stream.WriteL( iKey, KEncryptionKeySize );        
+        stream.WriteL( iKey, KEncryptionKeySize );
         }
-        
+
     stream.CommitL();
     iStore->CommitL();
-        
+
     CleanupStack::PopAndDestroy();
     };
 
@@ -613,16 +613,16 @@
 HBufC8* CDRMRightsData::GetKeyL() const
     {
     HBufC8* key = NULL;
-    
+
     if( iKeyExists )
         {
         key = HBufC8::NewL( KEncryptionKeySize );
         *key = iKey;
         }
-        
+
     return key;
     }
-        
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::FetchKeyL
 // -----------------------------------------------------------------------------
@@ -631,23 +631,23 @@
     {
     RStoreReadStream stream;
     TUint32 size = 0;
-    
+
     // Open the root stream
     stream.OpenLC( *iStore, iKeyId );
-    
-    size = stream.ReadUint32L();  
-    
-    if( !size ) 
+
+    size = stream.ReadUint32L();
+
+    if( !size )
         {
         iKeyExists = EFalse;
         }
-    else 
+    else
         {
         stream.ReadL( iKey, KEncryptionKeySize );
         iKeyExists = ETrue;
         }
-    
-    CleanupStack::PopAndDestroy();    
+
+    CleanupStack::PopAndDestroy();
     };
 
 // -----------------------------------------------------------------------------
@@ -658,35 +658,35 @@
     {
     TStreamId rootId;
     RStoreWriteStream stream;
-    RStoreWriteStream stream2;    
+    RStoreWriteStream stream2;
     RStoreWriteStream rootStream;
-    TUint32 size = 0;    
-    
+    TUint32 size = 0;
+
     // Create and initialize the permanent file store
     iStore = CPermanentFileStore::ReplaceL( iFileServer, aRightsStore,
-                                            EFileRead|EFileWrite );                                          
+                                            EFileRead|EFileWrite );
     iStore->SetTypeL( KPermanentFileStoreLayoutUid );
-    iStore->CommitL(); 
-    
-    // Create the root stream:                                                   
+    iStore->CommitL();
+
+    // Create the root stream:
     rootId = rootStream.CreateLC( *iStore );
     rootStream.CommitL();
-    iStore->SetRootL( rootId );    
-    iStore->CommitL(); 
-        
+    iStore->SetRootL( rootId );
+    iStore->CommitL();
+
     // Create the common data
     iCommonId = stream.CreateLC( *iStore );
     iData->ExternalizeL( stream );
     stream.CommitL();
-    iStore->CommitL(); 
-        
+    iStore->CommitL();
+
     CleanupStack::PopAndDestroy(); // stream
-    
+
     // Create the key
     iKeyId = stream2.CreateLC( *iStore );
 
     // if the key exists set the key size accordingly
-    if( iKeyExists ) 
+    if( iKeyExists )
         {
         size = KEncryptionKeySize;
         }
@@ -697,21 +697,21 @@
         stream2.WriteL( iKey, KEncryptionKeySize );
         }
     stream2.CommitL();
-    iStore->CommitL(); 
-           
-    CleanupStack::PopAndDestroy(); // stream2                                      
-    CleanupStack::PopAndDestroy(); // rootStream  
-    
+    iStore->CommitL();
+
+    CleanupStack::PopAndDestroy(); // stream2
+    CleanupStack::PopAndDestroy(); // rootStream
+
     // Create the index now that we have all the data
-    rootId = iStore->Root(); 
-    
+    rootId = iStore->Root();
+
     rootStream.ReplaceLC(*iStore, rootId);
     StoreIndexL( rootStream );
     rootStream.CommitL();
-    iStore->CommitL(); 
-        
+    iStore->CommitL();
+
     // Commit the changes to the store as well
-    CleanupStack::PopAndDestroy(); // rootStream       
+    CleanupStack::PopAndDestroy(); // rootStream
     };
 
 
@@ -723,19 +723,19 @@
     {
     // Write the common id to the stream
     iCommonId.ExternalizeL( aStream );
-    
+
     // Write the key id to the stream
     iKeyId.ExternalizeL( aStream );
-    
+
     // Write the array size and possibly the array to the stream
     aStream.WriteInt32L( iArray.Count() );
-    
+
     for( TInt count = 0; count < iArray.Count(); count++ )
         {
         aStream.WriteUint32L( iArray[ count ] );
         }
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::FetchIndexL
 // -----------------------------------------------------------------------------
@@ -746,36 +746,36 @@
     RStoreReadStream stream;
     TInt count = 0;
     TDRMUniqueID id;
- 
+
     // Get the stream id of the root
     rootId = iStore->Root();
-    
+
     // Open the root stream
     stream.OpenLC( *iStore, rootId );
-    
+
     // Do the actual reading, reading also the key id and the common id
 
     // Read the common id
     iCommonId.InternalizeL( stream );
-    
-    // Read the key id 
+
+    // Read the key id
     iKeyId.InternalizeL( stream );
-    
+
     // read the count of the array:
     iArray.Reset();
-    
+
     count = stream.ReadInt32L();
-    
+
     for( ; count > 0; count-- )
         {
         id = stream.ReadUint32L();
         iArray.InsertInUnsignedKeyOrder( id );
         }
-     
+
     // Close the stream
-    CleanupStack::PopAndDestroy();    
+    CleanupStack::PopAndDestroy();
     };
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsData::FetchCommonDataL
 // -----------------------------------------------------------------------------
@@ -783,15 +783,15 @@
 void CDRMRightsData::FetchCommonDataL()
     {
     RStoreReadStream stream;
-    
+
     // Open the root stream
     stream.OpenLC( *iStore, iCommonId );
-    
+
     iData->InternalizeL( stream );
-    
+
     CleanupStack::PopAndDestroy();
     };
-    
+
 
 // -----------------------------------------------------------------------------
 // Default Constructor - First phase.
@@ -811,13 +811,13 @@
     {
     // Open the file store
     iStore = CPermanentFileStore::OpenL( iFileServer, aRightsStore, EFileRead|EFileWrite );
-    
+
     // Get the index
     FetchIndexL();
-    
+
     // Get the common data
     FetchCommonDataL();
-    
+
     // Get the key
     FetchKeyL();
     };
@@ -829,9 +829,9 @@
 void CDRMRightsData::ConstructL( const TFileName& aRightsStore,
                                  const TDesC8& aKey )
     {
-    
+
     // Check if the key is given or a null desc
-    if( aKey.Length() ) 
+    if( aKey.Length() )
         {
         iKey = aKey;
         iKeyExists = ETrue;
@@ -839,11 +839,11 @@
     else
         {
         iKeyExists = EFalse;
-        }    
-    
+        }
+
     // Creates the required stores and indexes
     CreateAndInitializeStoreL( aRightsStore );
     };
-    
-            
+
+
 // End of File
--- a/omadrm/drmengine/server/src/DRMRightsServer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/DRMRightsServer.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,32 +20,32 @@
 #include <e32std.h>
 #include <e32test.h>
 #include <etelmm.h>
-#include <DrmTypes.h>
+#include <DRMTypes.h>
 #include <starterclient.h>
 #include <featmgr.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DRMRightsServer.h"
-#include "DRMRightsDb.h"
+#include "drmrightsdb.h"
 #include "DRMDbSession.h"
 #include "DRMEngineClientServer.h"
-#include "DRMLog.h"
+#include "drmlog.h"
 #include "DRMNotifier.h"
 #include "DrmKeyStorage.h"
-#include "drmnotifierserver.h"
-#include "roapstorageserver.h"
+#include "DRMNotifierServer.h"
+#include "RoapStorageServer.h"
 #include "drmnotifierclientserver.h"
 #include "drmroapclientserver.h"
 #include "DRMXOma.h"
 #include "DRMBackupObserver.h"
 #include "DRMBackup.h"
 #include "flogger.h"
-#include "drmrightsparser.h"
-#include "drmrights.h"
-#include "drmhelpercommon.h"
+#include "DrmRightsParser.h"
+#include "DRMRights.h"
+#include "DRMHelperCommon.h"
 
 #include  "wmdrmclientwrapper.h"
 
@@ -65,7 +65,7 @@
 */
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES 
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 LOCAL_C const TUint KMaxHeapsize = 0x7A120;
 
@@ -159,16 +159,16 @@
 // Returns: TInt: Symbian OS error code.
 // -----------------------------------------------------------------------------
 //
-LOCAL_C TInt Startup( void ) 
+LOCAL_C TInt Startup( void )
     {
     TInt error = KErrNone;
     CTrapCleanup* trap = CTrapCleanup::New();
     CActiveScheduler* scheduler = new CActiveScheduler();
-    
+
     if ( trap && scheduler )
         {
         CActiveScheduler::Install( scheduler );
-    
+
         error = StartDBServer();
         }
     else
@@ -176,23 +176,23 @@
         error = KErrNoMemory;
         }
 
-    delete scheduler; 
+    delete scheduler;
     scheduler = NULL;
-    
+
     delete trap;
     trap = NULL;
-    
+
     if ( error )
         {
         // Something went wrong. Release the client (if any).
         SignalClient();
-        
+
         if ( error == KErrAlreadyExists )
             {
             error = KErrNone;
             }
         }
-       
+
     return error;
     }
 
@@ -216,50 +216,50 @@
 // This function starts the actual server under TRAP harness and starts
 // waiting for connections. This function returns only if there has been
 // errors during server startup or the server is stopped for some reason.
-// 
+//
 // Returns: TInt: Symbian OS error code.
 // -----------------------------------------------------------------------------
-TInt StartDBServer( void ) 
+TInt StartDBServer( void )
     {
     TInt error = KErrNone;
     CDRMRightsServer* server = NULL;
     TUint8 count = 0;
-    
+
     do
         {
         DRMLOG2( _L( "RightsServer.exe: StartDBServer: %d" ), error );
-        
+
         ++count;
-        
+
         TRAP( error, ( server = CDRMRightsServer::NewL() ) );
-        
-        if ( error ) 
+
+        if ( error )
             {
             User::After( TTimeIntervalMicroSeconds32(KWaitingTime) );
             }
-        
+
         } while( error && ( count <= KMaxStartTries ) );
-        
-    if( error ) 
+
+    if( error )
         {
         DRMLOG2( _L( "RightsServer.exe: CDRMRightsServer::NewL failed: %d " ), error );
         // Failed
         return error;
         }
-    
+
     // Release the semaphore if necessary.
     SignalClient();
-   
+
     // Start waiting for connections
     CActiveScheduler::Start();
-    
+
     // Dying...
     // Delete CDRMRigntsServer
-        
+
     DRMLOG( _L( "RightsServer.exe: DB server dying..." ) );
 
     delete server;
-    
+
     return KErrNone;
     }
 
@@ -290,7 +290,7 @@
     (reinterpret_cast<RPointerArray<S>*>(aPtr))->ResetAndDestroy();
     (reinterpret_cast<RPointerArray<S>*>(aPtr))->Close();
     }
-#endif    
+#endif
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -302,46 +302,46 @@
 CDRMRightsServer* CDRMRightsServer::NewL()
     {
     CDRMRightsServer* self = new( ELeave ) CDRMRightsServer();
-    
+
     CleanupStack::PushL( self );
-    
+
     self->ConstructL();
-    
+
     CleanupStack::Pop( self );
-    
+
     return self;
     }
 
 // -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
-CDRMRightsServer::~CDRMRightsServer() 
+CDRMRightsServer::~CDRMRightsServer()
     {
     DRMLOG( _L( "CDRMRightsServer::~" ) );
-    
+
     delete iIMEI; iIMEI = NULL;
-    
+
     delete iIMSI; iIMSI = NULL;
-    
+
     delete iDb; iDb = NULL;
-    
+
     iClock.Close();
     iCache.Close();
-    
+
     iMeteringDb.Close();
-    
+
     iFs.Close();
     iActiveCountConstraints.ResetAndDestroy();
     iActiveCountConstraints.Close();
-    
+
     delete iBackupObserver;
-    delete iBackupHandler;    
+    delete iBackupHandler;
     delete iActiveBackupClient;
     delete iDbWatcher;
 
-#if 0    
+#if 0
     // Close and delete the shared data client
-    if( iSharedDataClient ) 
+    if( iSharedDataClient )
         {
         iSharedDataClient->Close();
         delete iSharedDataClient;
@@ -353,7 +353,7 @@
         {
         delete iNotifier; iNotifier = NULL;
         }
-        
+
     //An empty semaphore
     RSemaphore semaphore;
     }
@@ -366,18 +366,18 @@
 TBool CDRMRightsServer::GetSecureTime( TTime& aTime ) const
     {
     DRMClock::ESecurityLevel secLevel = DRMClock::KInsecure;
-	
-	TInt timezone( 0 );
-	
+
+    TInt timezone( 0 );
+
     iClock.GetSecureTime( aTime, timezone, secLevel );
-	
+
     if( secLevel == DRMClock::KSecure )
         {
         DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is secure\r\n" ) );
-        return ETrue;		
-        }	
-        
-    DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is not secure\r\n" ) );    	
+        return ETrue;
+        }
+
+    DRMLOG( _L( "CDRMRightsServer::GetSecureTime: Time is not secure\r\n" ) );
 
     return EFalse;
     }
@@ -406,8 +406,8 @@
     {
     return iFs;
     }
-    
-    
+
+
 RDRMReplayCache& CDRMRightsServer::ReplayCache()
     {
     return iCache;
@@ -426,8 +426,8 @@
 //
 void CDRMRightsServer::HandleNotifyL(const TUid /*aUid*/,
                                      const TDesC& /*aKey*/,
-                                     const TDesC& /*aValue*/)  
-    {   
+                                     const TDesC& /*aValue*/)
+    {
     /* XXX Backup via Publish/Subscribe
     __ASSERT_DEBUG( iDb, User::Invariant() );
     TInt value = -1;
@@ -453,12 +453,12 @@
 
                 if( value == 1 ) // PrepareForBackup
                     {
-                    TRAPD( error, iDb->BackupDBL( KNullDesC, 
+                    TRAPD( error, iDb->BackupDBL( KNullDesC,
                                                   KNullDesC8 ) );
                     // Notify that it's done
                     User::LeaveIfError( iSharedDataClient->AssignToTemporaryFile(
                                         KSDUidSystem ) );
-                    User::LeaveIfError( iSharedDataClient->SetInt( 
+                    User::LeaveIfError( iSharedDataClient->SetInt(
                                         KDRMBackupRestoreStatus, 0 ) );
                     iSharedDataClient->Flush();
                     }
@@ -473,7 +473,7 @@
 // From CActive. Complete the request and restart the scheduler.
 // -----------------------------------------------------------------------------
 //
-TInt CDRMRightsServer::RunError( TInt aError ) 
+TInt CDRMRightsServer::RunError( TInt aError )
     {
     DRMLOG2( _L( "CDRMRightsServer::RunError: %d" ), aError );
 
@@ -482,10 +482,10 @@
         {
         Message().Complete( aError );
         }
-    
+
     // Restart the scheduler.
     ReStart();
-    
+
     // Error handled.
     return KErrNone;
     }
@@ -501,8 +501,8 @@
 
     if ( ! User::QueryVersionSupported( TVersion( DRMEngine::KServerMajorVersion,
         DRMEngine::KServerMinorVersion,
-        DRMEngine::KServerBuildVersion ), 
-        aVersion ) ) 
+        DRMEngine::KServerBuildVersion ),
+        aVersion ) )
         {
         // Sorry, no can do.
         User::Leave( KErrNotSupported );
@@ -518,40 +518,40 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CDRMRightsServer::CDRMRightsServer() : 
+CDRMRightsServer::CDRMRightsServer() :
     CServer2( EPriorityStandard ),
     iIMEI( NULL ),
-    iArmed( EFalse ),    
+    iArmed( EFalse ),
     iIMSI( NULL ),
     iGetImsi( ETrue )
     {
     // Nothing
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsServer::ConstructL
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
 //
-void CDRMRightsServer::ConstructL() 
+void CDRMRightsServer::ConstructL()
     {
     DRMLOG( _L( "CDRMRightsServer::ConstructL" ) );
 
     TDRMKey key;
     RSemaphore semaphore;
     RProcess currentprocess;
-    
+
     // Ignore errors
     User::RenameThread( KRightsServerThread );
     User::LeaveIfError( iFs.Connect() );
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     // Ignore errors
     iFs.MkDirAll( KDRMDbTempPath );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TFileName tempPath;
     TFileName tempPath2;
     TFileName tempRemovablePath;
@@ -559,15 +559,15 @@
     TChar driveLetter;
     TChar driveLetterRemovable;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	iFs.DriveToChar( driveNumber, driveLetter );
-	
-	tempPath.Format( KDbTempPath, (TUint)driveLetter );
-    
+    iFs.DriveToChar( driveNumber, driveLetter );
+
+    tempPath.Format( KDbTempPath, (TUint)driveLetter );
+
     // Ignore errors
     iFs.MkDirAll( tempPath );
-    
+
 #endif
-        
+
     DRMLOG( _L( "CDRMRightsServer::ConstructL: SharedDataClient" ) );
 
     // Create and instance of the shared data client
@@ -581,134 +581,134 @@
         KSDUidSystem, &KBackupRestoreStatus ) );
     User::LeaveIfError(iSharedDataClient->NotifyChange(
         KSDUidSystem, &KDRMBackupRestoreStatus) );
-    */  
-      
-      
+    */
+
+
     GetDbKeyL( key );
-    
-    
+
+
     DRMLOG( _L( "CDRMRightsServer::ConstructL: database" ) );
 
     GetIMEIL();
-    
+
     // Create the imsi pointer array:
     iIMSI = CDRMPointerArray<HBufC8>::NewL();
     iIMSI->SetAutoCleanup(ETrue);
-    
+
     GetIMSIL();
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     iDb = CDRMRightsDB::NewL( iFs, KRightsDir, key, *iIMEI );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     tempPath.Format( KRightsDir, (TUint)driveLetter );
-    
+
     iDb = CDRMRightsDB::NewL( iFs, tempPath, key, *iIMEI );
-    
+
 #endif
-        
+
     key.FillZ();
-        
+
     DRMLOG( _L( "CDRMRightsServer::ConstructL: DB started." ) );
 
     DRMLOG( _L( "CDRMRightsServer::ConstructL: Starting Notifier ." ) );
-        
+
     User::LeaveIfError( semaphore.CreateGlobal( KDRMEngCommonSemaphore, 0 ) );
     CleanupClosePushL( semaphore );
-    
+
     StartThreadL( DRMNotifier::KServerName, StartupNotifier, semaphore );
     DRMLOG( _L( "CDRMRightsServer::ConstructL: Notifier thread created." ) );
-    
+
     StartThreadL( Roap::KServerName, StartupRoapStorage, semaphore );
     DRMLOG( _L( "CDRMRightsServer::ConstructL: ROAP thread created." ) );
-    
+
 #ifdef __DRM_CLOCK
     StartThreadL( DRMClock::KServerName, StartupClock, semaphore );
     DRMLOG( _L( "CDRMRightsServer::ConstructL: clock thread created." ) );
 #endif
-    
+
     CleanupStack::PopAndDestroy(); // semaphore
-    
+
     iNotifier = CDRMNotifier::NewL();
-    
+
     iCache.Set( iFs );
 
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     iCache.InitL( KTimedReplayCacheFile, KPlainReplayCacheFile );
 
-#ifdef RD_DRM_METERING               
+#ifdef RD_DRM_METERING
     iMeteringDb.Set( iFs );
     iMeteringDb.InitL( KMeteringDataBaseFile );
 #endif
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     tempPath.Format( KTimedReplayCacheFile, (TUint)driveLetter );
     tempPath2.Format( KPlainReplayCacheFile, (TUint)driveLetter );
-    
+
     iCache.InitL( tempPath, tempPath2 );
-    
-#ifdef RD_DRM_METERING               
-    
+
+#ifdef RD_DRM_METERING
+
     tempPath.Format( KMeteringDataBaseFile, (TUint)driveLetter );
-    
+
     iMeteringDb.Set( iFs );
     iMeteringDb.InitL( tempPath );
 
 #endif
-    
+
 #endif
-    
+
     User::LeaveIfError( iClock.Connect() );
 
     // xoma header list creation
     iXOmaHeaders = new (ELeave) RPointerArray< CDRMXOma >();
-    
+
     // p/s
     iBackupObserver = CDRMBackupObserver::NewL( *(const_cast<CDRMRightsServer*>(this)));
     iBackupObserver->Start();
-    
+
 #ifdef USE_RO_IMPORT
     // Import any OMA DRM 1.0 RO in the import directory, ignore all errors (except
     // when checking the default removable mass storage)
     TInt r = KErrNone;
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     TRAP( r, ImportRightsObjectsL( KInternalImportDir ) );
     TRAP( r, ImportRightsObjectsL( KUserDiskImportDir ) );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     tempPath.Format( KInternalImportDir, (TUint)driveLetter );
-    
+
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber );
-	iFs.DriveToChar( driveNumber, driveLetter );
-    
-	// Default mass storage is usually eMMC
+    iFs.DriveToChar( driveNumber, driveLetter );
+
+    // Default mass storage is usually eMMC
     tempPath2.Format( KUserDiskImportDir, (TUint)driveLetter );
-    
+
     // Find out if a removable mass storage also exists
     r = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetterRemovable );
-    
-    // Import is not needed from the default removable mass storage drive if the drive 
-    // letter of the default mass storage and the default removable mass storage are 
+
+    // Import is not needed from the default removable mass storage drive if the drive
+    // letter of the default mass storage and the default removable mass storage are
     // the same or the removable mass storage is not supported
-    if ( ( driveLetter != driveLetterRemovable ) && ( r == KErrNone ) ) 
+    if ( ( driveLetter != driveLetterRemovable ) && ( r == KErrNone ) )
         {
         tempRemovablePath.Format( KUserRemovableDiskImportDir, (TUint)driveLetterRemovable );
         TRAP( r, ImportRightsObjectsL( tempRemovablePath ) );
         }
-    
+
     TRAP( r, ImportRightsObjectsL( tempPath ) );
     TRAP( r, ImportRightsObjectsL( tempPath2 ) );
-    
+
 #endif
-    
+
 #endif
 
     // Add the server to the scheduler.
@@ -717,17 +717,17 @@
     // Start watching our RDB
     iDbWatcher = CDbWatcher::NewL( *this );
     iDbWatcher->StartWatching();
-    
+
     // Start watching the helper server
     iProcWatcher = CProcWatcher::NewL( *this, _L( "*DcfRepSrv*" ), _L( "DcfRepSrv" ) );
     iProcWatcher->StartWatching();
-    
+
     // Ready to watch
     iArmed = ETrue;
 
     __UHEAP_MARK;
     TRAP( r, FeatureManager::InitializeLibL() );
-    if( !r && FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) ) 
+    if( !r && FeatureManager::FeatureSupported( KFeatureIdWindowsMediaDrm ) )
         {
         static const TInt KGateOrdinal = 1;
         RLibrary library;
@@ -748,47 +748,47 @@
                 __UHEAP_MARKEND;
                 }
             }
-        library.Close();    
+        library.Close();
         }
     FeatureManager::UnInitializeLib();
-    __UHEAP_MARKEND;  
+    __UHEAP_MARKEND;
     }
- 
-// -----------------------------------------------------------------------------   
+
+// -----------------------------------------------------------------------------
 // CDRMRightsServer::StartThreadL
 // Start a new thread.
-// -----------------------------------------------------------------------------    
+// -----------------------------------------------------------------------------
 void CDRMRightsServer::StartThreadL( const TDesC& aThreadName,
                                      TThreadFunction aFunc,
                                      RSemaphore& aSemaphore )
     {
     RThread thread;
-    
-    User::LeaveIfError( 
+
+    User::LeaveIfError(
           thread.Create( aThreadName,
-                         aFunc, 
+                         aFunc,
                          KDefaultStackSize,
-                         KMinHeapSize, 
+                         KMinHeapSize,
                          KMaxHeapsize,
                          NULL ) );
-    
+
     thread.Resume();
-    
+
     aSemaphore.Wait();
-    
+
     thread.Close();
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsServer::GetDbKeyL
-// Fetches the rights database key from Wallet or uses a constant 
+// Fetches the rights database key from Wallet or uses a constant
 // key if Wallet is not supported.
 // -----------------------------------------------------------------------------
 //
-void CDRMRightsServer::GetDbKeyL( TDRMKey& aKey  ) 
+void CDRMRightsServer::GetDbKeyL( TDRMKey& aKey  )
     {
     TInt r = KErrNone;
-    
+
     DRMLOG( _L( "CDRMRightsServer::GetDbKey" ) );
     MDrmKeyStorage* storage = DrmKeyStorageNewL();
     TRAP( r, storage->GetDeviceSpecificKeyL( aKey ) );
@@ -801,28 +801,28 @@
 // Generates the actual key based on the given key seed.
 // -----------------------------------------------------------------------------
 //
-void CDRMRightsServer::GenerateKeyL( HBufC*& aKeySeed, 
+void CDRMRightsServer::GenerateKeyL( HBufC*& aKeySeed,
                                     TDRMKey& aKey ) const
     {
-    __ASSERT_ALWAYS( aKeySeed->Size() >= KDRMKeyLength, 
+    __ASSERT_ALWAYS( aKeySeed->Size() >= KDRMKeyLength,
         User::Leave( KErrUnderflow ) );
-    
+
     TPtrC8 key( reinterpret_cast< TUint8* >( const_cast< TUint16* >( aKeySeed->Ptr() ) ),
                 KDRMKeyLength );
-    
+
     aKey = key;
     }
 
 
 // -----------------------------------------------------------------------------
 // CDRMRightsServer::XOmaHeaders()
-// return the pointer of the X-Oma headers list 
+// return the pointer of the X-Oma headers list
 // -----------------------------------------------------------------------------
 //
 RPointerArray< CDRMXOma >& CDRMRightsServer::XOmaHeaders( void )
-	{
-	return *iXOmaHeaders;
-	}
+    {
+    return *iXOmaHeaders;
+    }
 
 
 
@@ -836,19 +836,19 @@
         {
         return *iIMEI;
         }
-    
+
 #ifdef DRM_USE_SERIALNUMBER_URI
     TInt error( KErrNone );
     TInt count( 0 );
     TInt count2( 0 );
     TUint32 caps( 0 );
     TBool found (EFalse);
-    
+
     RTelServer etelServer;
     RMobilePhone phone;
-    
+
     TUint KMaxImeiTries = 5;
-    
+
     for ( TUint8 i = 0; i < KMaxImeiTries; ++i )
         {
         error = etelServer.Connect();
@@ -856,31 +856,31 @@
             {
             User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) );
             }
-        else 
+        else
             {
             break;
             }
         }
-    
+
     User::LeaveIfError( error );
     CleanupClosePushL( etelServer );
-    
-    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );  
-    
+
+    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
+
     TUnloadModule unload;
     unload.iServer = &etelServer;
     unload.iName = &KMmTsyModuleName;
-    
+
     TCleanupItem item( DoUnloadPhoneModule, &unload );
     CleanupStack::PushL( item );
     User::LeaveIfError( etelServer.EnumeratePhones( count ) );
-        
+
     for ( count2 = 0; count2 < count && !found; ++count2 )
         {
         RTelServer::TPhoneInfo phoneInfo;
         User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) );
-        
-        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )   
+
+        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )
            {
             User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) );
             User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
@@ -894,43 +894,43 @@
         // Not found.
         User::Leave( KErrNotFound );
         }
-   
+
     User::LeaveIfError( phone.GetIdentityCaps( caps ) );
     if ( caps & RMobilePhone::KCapsGetSerialNumber )
         {
         RMobilePhone::TMobilePhoneIdentityV1 id;
         TRequestStatus status;
-    
+
         phone.GetPhoneId( status, id );
-        
+
         User::WaitForRequest( status );
-        
+
         User::LeaveIfError( status.Int() );
-        
+
         iIMEI = id.iSerialNumber.AllocL();
-        
+
         CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer
-        
+
         HBufC8* buf = HBufC8::NewL( iIMEI->Size() );
         TPtr8 ptr( buf->Des() );
         ptr.Copy( *iIMEI );
-        
+
         DRMLOG(_L("IMEI:"));
         DRMLOGHEX(ptr);
         delete buf;
-    
+
         return *iIMEI;
         }
-    
+
     User::Leave( KErrNotFound );
-    
+
     // Never happens...
-    return *iIMEI; 
-    
+    return *iIMEI;
+
 #else
     _LIT( KDefaultSerialNumber, "123456789123456789" );
     iIMEI = KDefaultSerialNumber().AllocL();
-        
+
     return *iIMEI;
 #endif
     }
@@ -941,13 +941,13 @@
 //
 const CDRMPointerArray<HBufC8>& CDRMRightsServer::GetIMSIL()
     {
-    
+
     if ( !iGetImsi )
         {
         return *iIMSI;
         }
 
-#ifndef __WINS__   
+#ifndef __WINS__
     TInt error( KErrNone );
     TInt count( 0 );
     TInt count2( 0 );
@@ -955,11 +955,11 @@
     TBool found (EFalse);
     HBufC8* imsi = NULL;
     HBufC8* imsiNumber = NULL;
-    
+
     RTelServer etelServer;
     RMobilePhone phone;
-    
-    TUint KMaxImeiTries = 5;    
+
+    TUint KMaxImeiTries = 5;
     for ( TUint8 i = 0; i < KMaxImeiTries; ++i )
         {
         error = etelServer.Connect();
@@ -967,31 +967,31 @@
             {
             User::After( TTimeIntervalMicroSeconds32( KWaitingTime ) );
             }
-        else 
+        else
             {
             break;
             }
         }
-    
+
     User::LeaveIfError( error );
-    CleanupClosePushL( etelServer );     
-    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );  
-    
+    CleanupClosePushL( etelServer );
+    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
+
     TUnloadModule unload;
     unload.iServer = &etelServer;
     unload.iName = &KMmTsyModuleName;
-    
+
     TCleanupItem item( DoUnloadPhoneModule, &unload );
     CleanupStack::PushL( item );
-    
+
     User::LeaveIfError( etelServer.EnumeratePhones( count ) );
-        
+
     for ( count2 = 0; count2 < count && !found; ++count2 )
         {
         RTelServer::TPhoneInfo phoneInfo;
         User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) );
-        
-        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )   
+
+        if ( phoneInfo.iName.CompareF(KMmTsyModuleName()) == 0 )
            {
             User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) );
             User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
@@ -1005,127 +1005,127 @@
         // Not found.
         User::Leave( KErrNotFound );
         }
-   
- 
+
+
     User::LeaveIfError( phone.GetIdentityCaps( caps ) );
 
     if( caps & RMobilePhone::KCapsGetSubscriberId )
         {
-        RMobilePhone::TMobilePhoneSubscriberId imsiId;        
+        RMobilePhone::TMobilePhoneSubscriberId imsiId;
         TRequestStatus status;
-    
+
         phone.GetSubscriberId( status, imsiId );
-        
+
         User::WaitForRequest( status );
-        
+
         if( ! status.Int() )
-            {             
+            {
             imsi = HBufC8::NewMaxLC( imsiId.Length() + KImsiId().Size() );
             TPtr8 imsiPtr(const_cast<TUint8*>(imsi->Ptr()), 0, imsi->Size());
-      
+
             imsiNumber = CnvUtfConverter::ConvertFromUnicodeToUtf8L( imsiId );
             CleanupStack::PushL( imsiNumber );
-            
+
             imsiPtr.Copy( KImsiId() );
             imsiPtr.Append( *imsiNumber );
             CleanupStack::PopAndDestroy(); // imsiNumber
             }
         else
-            {            
+            {
             imsi = NULL;
             }
         }
     else
-        {         
+        {
         imsi = NULL;
-        } 
-    
-    
+        }
+
+
     // Clean up whatever is in there
     iIMSI->ResetAndDestroy();
-    
-    if( imsi ) 
-        { 
-        // if we got it we wont try again             
+
+    if( imsi )
+        {
+        // if we got it we wont try again
         iIMSI->AppendL( imsi );
         CleanupStack::Pop(); // imsi
-        iGetImsi = EFalse;            
+        iGetImsi = EFalse;
         }
 
     // Check for possible extra IMSI individual constraints
     AppendExtendedIndividualConstraintsL(&phone);
-    
+
     CleanupStack::PopAndDestroy(); // phone
     CleanupStack::PopAndDestroy(); // cleanup item
     CleanupStack::PopAndDestroy(); // etel server
 
-    return *iIMSI; 
-    
+    return *iIMSI;
+
 #else
     HBufC8* imsi = NULL;
-    
-    if( iGetImsi ) 
+
+    if( iGetImsi )
         {
         iGetImsi = EFalse;
         _LIT8( KDefaultSerialNumber, "IMSI:123456789123456789" );
         imsi = KDefaultSerialNumber().AllocLC();
         iIMSI->AppendL( imsi );
-        CleanupStack::Pop();        
+        CleanupStack::Pop();
         AppendExtendedIndividualConstraintsL();
         }
 
-        
+
     return *iIMSI;
 #endif // __WINS__
     }
 
-// -----------------------------------------------------------------------------   
+// -----------------------------------------------------------------------------
 // CDRMRightsServer::AppendExtendedIndividualConstraintsL
 // If the extension DLL exists it is loaded and used to obtain additional
 // valid individual constraints
-// -----------------------------------------------------------------------------    
+// -----------------------------------------------------------------------------
 void CDRMRightsServer::AppendExtendedIndividualConstraintsL(RMobilePhone* aMobilePhone)
-    {    	    	
+    {
     // Load the externsion DLL
     RLibrary lib;
-    
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     if (lib.LoadRomLibrary(KDRMIndividualConstraintExtensionDll,KNullDesC)==KErrNone)
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
-	iFs.DriveToChar( driveNumber, driveLetter );
-	
-	TFileName individualConstraindExtensionDll;
-	individualConstraindExtensionDll.Format( 
-	                    KIndividualConstraintExtensionDll, (TUint)driveLetter );
-    
+    iFs.DriveToChar( driveNumber, driveLetter );
+
+    TFileName individualConstraindExtensionDll;
+    individualConstraindExtensionDll.Format(
+                        KIndividualConstraintExtensionDll, (TUint)driveLetter );
+
     if ( lib.LoadRomLibrary( individualConstraindExtensionDll, KNullDesC ) == KErrNone )
-    
+
 #endif
-    
-    	{
+
+        {
         CleanupClosePushL(lib);
 
-        // Get first exported ordinal - factory method returning 
+        // Get first exported ordinal - factory method returning
         // MDRMIndividualConstraintExtension*
-        TLibraryFunction factory = lib.Lookup(1); 
+        TLibraryFunction factory = lib.Lookup(1);
 
         if (factory)
             {
             // Instantiate object
-            MDRMIndividualConstraintExtension* extendedConstraints = 
+            MDRMIndividualConstraintExtension* extendedConstraints =
                 reinterpret_cast<MDRMIndividualConstraintExtension*>(factory());
 
             if (extendedConstraints)
                 {
-			    CleanupStack::PushL(TCleanupItem(Release,extendedConstraints));
+                CleanupStack::PushL(TCleanupItem(Release,extendedConstraints));
                 extendedConstraints->AppendConstraintsL(*iIMSI,aMobilePhone);
-			    CleanupStack::PopAndDestroy(extendedConstraints); //calls Release
+                CleanupStack::PopAndDestroy(extendedConstraints); //calls Release
                 }
             }
 
@@ -1139,8 +1139,8 @@
 // -----------------------------------------------------------------------------
 void CDRMRightsServer::Release(TAny* aIndividualConstraintExtension)
     {
-    MDRMIndividualConstraintExtension* extendedConstraints = 
-    	reinterpret_cast<MDRMIndividualConstraintExtension*>(aIndividualConstraintExtension);
+    MDRMIndividualConstraintExtension* extendedConstraints =
+        reinterpret_cast<MDRMIndividualConstraintExtension*>(aIndividualConstraintExtension);
     extendedConstraints->Release(); //free resources
     }
 
@@ -1152,14 +1152,14 @@
 
 void CDRMRightsServer::HandleBackupEventL( TInt aBackupEvent )
     {
-	//RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::BackupCalled\n\r"));    
+    //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::BackupCalled\n\r"));
 
     //conn::TBURPartType eventType;
     //conn::TBackupIncType incType;
     TDriveList aDriveList;
-    
-    //RFileLogger::WriteFormat(KLogDir, KLogName, EFileLoggingModeAppend, _L8("backupevent: %d"), aBackupEvent);              
-    
+
+    //RFileLogger::WriteFormat(KLogDir, KLogName, EFileLoggingModeAppend, _L8("backupevent: %d"), aBackupEvent);
+
     // If there is no operation going or state is normal
     // Delete the client and handler
 
@@ -1169,73 +1169,73 @@
         /*
         if( aBackupEvent == conn::EBURUnset )
             {
-            	        RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Unset\n\r"));                
+                        RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Unset\n\r"));
             }
-        else 
+        else
             {
-	        RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Normal\n\r"));                
-            } 
-        */                 
+            RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Normal\n\r"));
+            }
+        */
         if( iActiveBackupClient )
             {
             delete iActiveBackupClient;
-            iActiveBackupClient = NULL;    
+            iActiveBackupClient = NULL;
             }
-        
+
         if( iBackupHandler )
             {
             delete iBackupHandler;
-            iBackupHandler = NULL;    
+            iBackupHandler = NULL;
             }
-        }  
+        }
     else if( aBackupEvent & conn::EBURBackupFull ||
              aBackupEvent & conn::EBURRestoreFull )
         {
-	    //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Full\n\r"));         
+        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Full\n\r"));
         // ab handler
         iBackupHandler = CDRMBackup::NewL( iDb, iFs );
-    
+
         // ab client
         iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler );
-        
+
         // Confirm that we have done everything if there even was anything to do
-	    //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm F \n\r"));         
-        iActiveBackupClient->ConfirmReadyForBURL( KErrNone );        
+        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm F \n\r"));
+        iActiveBackupClient->ConfirmReadyForBURL( KErrNone );
         }
     else if( aBackupEvent & conn::EBURBackupPartial ||
              aBackupEvent & conn::EBURRestorePartial )
         {
-	    //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Partial\n\r"));         
+        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Partial\n\r"));
         // ab handler
         iBackupHandler = CDRMBackup::NewL( iDb, iFs );
-    
+
         // ab client
-        iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler );                
+        iActiveBackupClient = conn::CActiveBackupClient::NewL( iBackupHandler );
 
-        if( !iActiveBackupClient->DoesPartialBURAffectMeL() ) 
+        if( !iActiveBackupClient->DoesPartialBURAffectMeL() )
             {
-	        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::NotMe\n\r"));             
+            //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::NotMe\n\r"));
             delete iActiveBackupClient;
-            iActiveBackupClient = NULL;    
+            iActiveBackupClient = NULL;
 
             delete iBackupHandler;
-            iBackupHandler = NULL;    
+            iBackupHandler = NULL;
             }
         else
             {
-	        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P \n\r"));            
+            //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P \n\r"));
             // Confirm that we have done everything if there even was anything to do
             iActiveBackupClient->ConfirmReadyForBURL( KErrNone );
-	        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P Done \n\r"));                             
-            }    
+            //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Confirm P Done \n\r"));
+            }
         }
-    else 
+    else
         {
-	    //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Argument\n\r"));         
+        //RFileLogger::Write(KLogDir, KLogName, EFileLoggingModeAppend, _L8("Handle::Argument\n\r"));
         // Unknown operation
-        User::Leave(KErrArgument);    
+        User::Leave(KErrArgument);
         }
-    };  
+    };
 
 // -----------------------------------------------------------------------------
 // CDRMRightsServer::WatchedObjectChangedL
@@ -1246,7 +1246,7 @@
     {
     DRMLOG( _L( "CDRMRightsServer::WatchedObjectChangedL ->" ) );
     DRMLOG( aObject );
-    
+
     if ( aObject.Left( KDirIdentifier().Length() ) == KDirIdentifier &&
          !iDb->Updating() && iArmed )
         {
@@ -1259,7 +1259,7 @@
         User::LeaveIfError( starter.Connect() );
         starter.Reset( RStarterSession::EDRMReset );
         starter.Close();
-#endif        
+#endif
         }
     else if ( aObject.Left( KProcIdentifier().Length() ) == KProcIdentifier && iArmed )
         {
@@ -1273,10 +1273,10 @@
         starter.Close();
 #endif
         }
-    
+
     DRMLOG( _L( "CDRMRightsServer::WatchedObjectChangedL <-" ) );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMRightsServer::HasActiveCountConstraint
 // Check ID for active count constraint
@@ -1286,7 +1286,7 @@
     {
     TInt i;
     TBool r = EFalse;
-    
+
     for ( i = 0; r == EFalse && i < iActiveCountConstraints.Count(); i++ )
         {
         if ( iActiveCountConstraints[i]->CompareF( aContentId ) == 0 )
@@ -1307,7 +1307,7 @@
     TInt i;
     TInt r = KErrNotFound;
     HBufC8* id = NULL;
-    
+
     for ( i = 0; r == KErrNotFound && i < iActiveCountConstraints.Count(); i++ )
         {
         if ( iActiveCountConstraints[i]->CompareF( aContentId ) == 0 )
@@ -1317,7 +1317,7 @@
         }
     if ( r != KErrNotFound )
         {
-        id = iActiveCountConstraints[r];	
+        id = iActiveCountConstraints[r];
         iActiveCountConstraints.Remove( r );
         delete id;
         id = NULL;
@@ -1373,7 +1373,7 @@
         &rights);
     TDRMUniqueID id;
     TTime time;
-    
+
     DRMLOG( _L( "CDRMRightsServer::ImportRightsObjectsL" ) );
     DRMLOG( aImportDir );
     __UHEAP_MARK;
@@ -1402,7 +1402,7 @@
                 CleanupStack::PushL( listCleanup );
                 CDRMPermission& permission = rights[0]->GetPermission();
                 CDRMAsset& asset = rights[0]->GetAsset();
-                
+
                 // Add RO only if no rights are available at all for this content
                 TRAP( r, k = iDb->GetDecryptionKeyL( *asset.iUid ) );
                 if (k == NULL )
@@ -1423,14 +1423,14 @@
     __UHEAP_MARKEND;
     DRMLOG( _L( "CDRMRightsServer::ImportRightsObjectsL done" ) );
     }
-#endif    
-    
+#endif
+
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
 
-TInt E32Main() 
+TInt E32Main()
     {
-    return Startup(); 
+    return Startup();
     }
 
 
--- a/omadrm/drmengine/server/src/DRMServerStarter.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This file is used only if RDRMRightsClient starts the
-*                DRM Rights Database server. 
-*
-*/
-
-// INCLUDE FILES
-#include   <e32std.h>
-#include    <e32uid.h>
-#include <f32file.h>
-
-#ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
-#endif
-
-#include "drmengineclientserver.h"
-
-// EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
-// CONSTANTS
-#ifdef __WINS__
-LOCAL_C const TUint KServerMinHeapSize =  0x1000;  
-LOCAL_C const TUint KServerMaxHeapSize = 0x300000; 
-_LIT( KRightsServerFile, "RightsServer" );
-#else
-
-#ifdef RD_MULTIPLE_DRIVE
-_LIT( KRightsServerFile, "%c:\\RightsServer.exe" );
-#else
-_LIT( KRightsServerFile, "e:\\RightsServer.exe" );
-#endif
-#endif
-
-// MACROS
-// LOCAL CONSTANTS AND MACROS
-// MODULE DATA STRUCTURES
-// LOCAL FUNCTION PROTOTYPES
-LOCAL_C TInt CreateServer( void );
-
-// FORWARD DECLARATIONS
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CreateServer launches the DRM Rights server [process (THUMB/ARMI)|thread (WINS)]. 
-// Returns: KErrNone: No errors.
-//          <KErrNone: Symbian wide error code.
-// -----------------------------------------------------------------------------
-//
-LOCAL_C TInt CreateServer( void )
-    {
-    TInt error = KErrNone;
-    
-        RProcess server;
-        
-#ifndef RD_MULTIPLE_DRIVE
-    
-        error = server.Create( KRightsServerFile, 
-                               KNullDesC );
-    
-#else //RD_MULTIPLE_DRIVE
-        
-        RFs fs;
-        TInt driveNumber( -1 );
-        TChar driveLetter;
-        DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, driveNumber );
-        
-        error = fs.Connect();
-        if( error != KErrNone )
-            {
-            fs.Close();
-            return error;
-            }
-        
-        fs.DriveToChar( driveNumber, driveLetter );
-        fs.Close();
-	
-        TFileName rightsServerFile;
-        rightsServerFile.Format( KRightsServerFile, (TUint)driveLetter );
-    
-        error = server.Create( rightsServerFile, 
-                               KNullDesC );
-    
-#endif
-        
-        if ( !error )
-            {
-            // Give some time to the process to start.
-            User::After( 1000 );
-            
-        // Kick the server up & running.
-        server.Resume();
-            
-        // Local handle not needed anymore.
-        server.Close();
-        }
-        
-    return error;
-    }
-    
-// ============================ MEMBER FUNCTIONS ===============================
-    
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-    
-// -----------------------------------------------------------------------------
-// DRMServerStarter starts the actual server.
-// Returns: KErrNone: All went OK, no errors.
-//          <KErrNone: Symbian wide error code.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt DRMServerStarter()
-    {
-    RSemaphore semaphore;
-    TFindServer server( DRMEngine::KServerName );
-    TFullName name;
-    
-    // Check if the server is already running.
-    TInt error = server.Next( name );
-    
-    if ( !error )
-        {
-        // Yep, it's already running.
-        return KErrNone;
-        }
-
-    error = semaphore.CreateGlobal( DRMEngine::KDRMSemaphore,   // name
-                                    0 ,              // count
-                                    EOwnerThread ); // owner
-    
-    if ( error == KErrAlreadyExists )
-        {
-        error = semaphore.OpenGlobal( DRMEngine::KDRMSemaphore );
-        }
-        
-    if ( !error )
-        {
-        error = CreateServer();
-        if ( !error )
-            {
-            // Wait until server has done all its things.
-            semaphore.Wait();
-            
-            // Signal the (possible) next one waiting in line. Server
-            // only signals the semaphore once but there might be several
-            // clients waiting for this semaphore, in theory.
-            semaphore.Signal();
-            }
-        
-        // Semaphore can be destroyed.
-        semaphore.Close();
-        }
-        
-    return error; 
-    }
-//  End of File
--- a/omadrm/drmengine/server/src/drmconsume.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/drmconsume.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,16 +20,16 @@
 #include "drmconsume.h"
 #include "drmenginetypedefs.h"
 #include "drmrightsdb.h"
-#include "drmrightsserver.h"
-#include "drmdbsession.h"
+#include "DRMRightsServer.h"
+#include "DRMDbSession.h"
 #include "drmlog.h"
-#include "drmeventmodify.h"
-#include "drmnotifier.h"
+#include "DRMEventModify.h"
+#include "DRMNotifier.h"
 #ifdef RD_DRM_METERING
 #include "drmmeteringdb.h"
 #include "drmmeteringdbdata.h"
-#include "roapstorageclient.h"
-#include "drmricontext.h"
+#include "RoapStorageClient.h"
+#include "DRMRIContext.h"
 #endif
 
 // EXTERNAL DATA STRUCTURES
@@ -42,17 +42,17 @@
 
 #define DB static_cast< CDRMRightsServer* >( const_cast< CServer2* >( \
            iSession.Server() ) )->Database()
-           
+
 #define SECURETIME( a ) static_cast< CDRMRightsServer* >\
            ( const_cast< CServer2* >( \
            iSession.Server() ) )->GetSecureTime( a )
-           
+
 #define SERVER static_cast< CDRMRightsServer* >( const_cast< CServer2* >( \
            iSession.Server() ) )
-           
+
 #ifdef RD_DRM_METERING
 #define METERINGDB static_cast< CDRMRightsServer* >( const_cast< CServer2* >( \
-           iSession.Server() ) )->MeteringDatabase() 
+           iSession.Server() ) )->MeteringDatabase()
 #endif
 
 #define SETBIT( a, b ) ( a ) |= ( b )
@@ -69,7 +69,7 @@
 // These keep track whether to decrease timed counters when consuming time
 // based stuff (iTimedCounts member). A used timed count bit is set to zero.
 // In the beginning all of these are set to one.
-//static const TUint8 KParentToplevelCount =     0x01;    
+//static const TUint8 KParentToplevelCount =     0x01;
 //static const TUint8 KParentPermCount     =     0x02;
 static const TUint8 KChildToplevelCount  =     0x04;
 static const TUint8 KChildPermCount      =     0x08;
@@ -96,7 +96,7 @@
         aFirst = aSecond;
         }
     }
-    
+
 // ------------------------------------------------------------------------
 // PickSmaller (overloaded)
 //
@@ -111,7 +111,7 @@
         aFirst = aSecond;
         }
     }
-    
+
 // ============================ MEMBER FUNCTIONS ==========================
 
 // ------------------------------------------------------------------------
@@ -124,13 +124,13 @@
     {
     DRMLOG( _L( "CDRMConsume::NewLC" ) );
     CDRMConsume* self = new( ELeave ) CDRMConsume( aSession );
-    
+
     CleanupStack::PushL( self );
-    
+
     self->ConstructL( aURI, aParentId );
-    
+
     DRMLOG( _L( "CDRMConsume::NewLC ok" ) );
-    return self;    
+    return self;
     }
 
 // ------------------------------------------------------------------------
@@ -141,10 +141,10 @@
     {
     DRMLOG( _L( "CDRMConsume::~" ) );
     TInt error( KErrNone );
-    
-    if( IsActive() ) 
+
+    if( IsActive() )
         {
-        Cancel();        
+        Cancel();
         }
     else
         {
@@ -156,7 +156,7 @@
     #endif
     // ignore errors
     //TRAP( error, UpdateDBL() );
-    
+
     delete iURI; iURI = NULL;
     delete iParentId; iParentId = NULL;
     delete iChild; iChild = NULL;
@@ -185,7 +185,7 @@
     iCumulativeDelayTop( 0 ),
     iCumulativeDelayChild( 0 ),
     iTotalCumulativeTime( 0 ),
-	iUsingTimedCount( 0 )
+    iUsingTimedCount( 0 )
     {
     }
 
@@ -201,7 +201,7 @@
     iURI = aURI.AllocL();
     if( aParentId )
         {
-        iParentId = aParentId->AllocL();        
+        iParentId = aParentId->AllocL();
         }
     }
 
@@ -212,11 +212,11 @@
 void CDRMConsume::HandleL( ContentAccess::TIntent aIntent )
     {
     DRMLOG( _L( "CDRMConsume::HandleL" ) );
-    
+
     TTime time;
     TBool secure( SECURETIME( time ) );
     InitializeL( aIntent, secure, time );
-    
+
     DRMLOG( _L( "CDRMConsume::HandleL ok" ) );
     }
 
@@ -227,9 +227,9 @@
 void CDRMConsume::Pause()
     {
     DRMLOG( _L( "CDRMConsume::Pause" ) );
-    
+
     Cancel();
-    
+
     DRMLOG( _L( "CDRMConsume::Pause ok" ) );
     }
 
@@ -240,15 +240,15 @@
 void CDRMConsume::ContinueL()
     {
     DRMLOG( _L( "CDRMConsume::ContinueL" ) );
-    
+
     Cancel();
-    
+
     TInt error = KErrNone;
     TUint32 reason = 0;
-                    
+
     CDRMPermission* child = NULL;
     HBufC8* parent = NULL;
-    
+
     // This got removed by Pause()
     if( iCountConstraintActive )
         {
@@ -256,48 +256,48 @@
         DoContinueL();
         return;
         }
-    
-    /* Fetch the RO again in order to manage a situation when another 
+
+    /* Fetch the RO again in order to manage a situation when another
        instance has used the same RO (content has been consumed) while the
-       other instance has not been used (player is paused) but will be 
-       used again (content consumption is to be continued). */   
+       other instance has not been used (player is paused) but will be
+       used again (content consumption is to be continued). */
     error = iSession.FindRightsObject( iIntent, *iURI, child, parent, reason );
-    
+
     /* Check if the RO found from the database matches with the one that was used
        in the original consumption of the content. If the ROs match, use the
        (possibly updated) one from the database. */
-    if ( !error && child && iChild && 
+    if ( !error && child && iChild &&
          ( iChild->iUniqueID == child->iUniqueID ) &&
          ( iChild->iOriginalInsertTime == child->iOriginalInsertTime ) )
         {
         if ( iParentId )
             {
-            delete iParentId; 
+            delete iParentId;
             iParentId = parent;
             }
-            
+
         delete iChild;
         iChild = child;
-        }      
-    else 
+        }
+    else
         {
         /* The original RO was not found. Delete temporary objects and also
            delete the iChild and iCombined because the RO is no longer valid and
-           need to be re-fetched using InitializeL method (in DoContinueL).   
-           (in DoContinueL). */  
+           need to be re-fetched using InitializeL method (in DoContinueL).
+           (in DoContinueL). */
         if ( iChild )
             {
             delete iChild;
             iChild = NULL;
             }
-        
+
         if ( iCombined )
             {
             delete iCombined;
             iCombined = NULL;
             }
-        
-        if ( child ) 
+
+        if ( child )
             {
             delete child;
             child = NULL;
@@ -307,12 +307,12 @@
             delete parent;
             parent = NULL;
             }
-        } 
-          
+        }
+
     DoContinueL();
-    
+
     //HandleL( iIntent );
-    
+
     DRMLOG( _L( "CDRMConsume::ContinueL ok" ) );
     }
 
@@ -323,16 +323,16 @@
 void CDRMConsume::Stop()
     {
     DRMLOG( _L( "CDRMConsume::Stop" ) );
-    
+
     Cancel();
-    
+
     DRMLOG( _L( "CDRMConsume::Stop ok" ) );
-    }   
+    }
 
 // ------------------------------------------------------------------------
 // CDRMConsume:: ActivateL
 //
-// Calculate the smallest end time based on interval, end time, 
+// Calculate the smallest end time based on interval, end time,
 // accumulated time & timed count.
 // ------------------------------------------------------------------------
 //
@@ -340,33 +340,33 @@
                              const TTime& aTrustedTime  )
     {
     DRMLOG( _L( "CDRMConsume::ActivateL" ) );
-    
+
     __ASSERT_DEBUG( iChild && iCombined, User::Invariant() );
     TTime endTime( Time::MaxTTime() );
     TTimeIntervalSeconds timed( KMaxTInt32 );
     TBool timeUsed( EFalse );
     TBool endTimeUsed( EFalse );
-    
+
     iCurrentDelay = 0;
-    
+
     if ( iCombined->iActiveConstraints & EConstraintTimedCounter )
         {
-        // Take this, even if timed counts have been updated. 
-        // This might cause unnecessary RunL's to be called, but it 
+        // Take this, even if timed counts have been updated.
+        // This might cause unnecessary RunL's to be called, but it
         // ensures both child & parent will be consumed when needed.
-        // If e.g. it would be checked that iTimedCounts == 0xf, 
+        // If e.g. it would be checked that iTimedCounts == 0xf,
         // either one (child or parent) might not get updated in case of
-        // "Child expired, but parent didn't -> find new child".        
+        // "Child expired, but parent didn't -> find new child".
         PickSmaller( timed, iCombined->iTimedInterval );
         timeUsed = ETrue;
         }
-    
+
     if ( iCombined->iActiveConstraints & EConstraintAccumulated )
         {
         PickSmaller( timed, iCombined->iAccumulatedTime );
         timeUsed = ETrue;
         }
-        
+
     if ( iCombined->iActiveConstraints & EConstraintInterval )
         {
         if ( iCombined->iIntervalStart != Time::NullTTime() )
@@ -378,46 +378,46 @@
         else
             {
             TInt64 tmp( iCombined->iInterval.Int() );
-            
+
             PickSmaller( timed, tmp );
             timeUsed = ETrue;
             }
         }
-     
+
     if ( iCombined->iActiveConstraints & EConstraintEndTime )
         {
         PickSmaller( endTime, iCombined->iEndTime );
         endTimeUsed = ETrue;
         }
-        
+
     // Put the "smallest time" information to "endTime".
     if ( timeUsed )
         {
         TTime current( aTrustedTime );
-        
+
         current += timed;
-        
+
         PickSmaller( endTime, current );
         endTimeUsed = ETrue;
         }
-        
+
      // Interval gets initialised immediately, and so do count constraints.
-     // Timed/accumulated won't: those are consumed after the 
+     // Timed/accumulated won't: those are consumed after the
      // interval if secure time exists.
      Consume( ETrue, ETrue, EFalse, 0,
               aSecureTime,
               aTrustedTime );
-    
+
      // In case something was modified, update the db also.
      UpdateDBL();
-              
+
      if ( endTimeUsed )
-        {     
+        {
         // Something exists.
         TTimeIntervalSeconds secs( 0 );
         TTime current( aTrustedTime );
         TInt err( KErrNone );
-        
+
         // SecondsFrom returns an error if the difference is too great.
         err = endTime.SecondsFrom( current, secs );
         if ( err )
@@ -436,45 +436,45 @@
             {
             iCurrentDelay = KConsumeDefaultTimer;
             }
-           
+
         if ( !IsAdded() )
             {
             CActiveScheduler::Add( this );
             }
-        
-        DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ), 
+
+        DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ),
                   ( TInt )iCurrentDelay );
-                  
+
         // secs -> microsecs. The method sets the AO active.
         After( TTimeIntervalMicroSeconds32( iCurrentDelay * 1000000 ) );
-        
+
         iTime = current;
-      
-        // If we see timed things here, we also have secure time.  
+
+        // If we see timed things here, we also have secure time.
         //SETBIT( iMask, KConsumeHasSecureTime );
         }
     else    // For metering we always need to have this:
         {
         iCurrentDelay = KConsumeDefaultTimer;
         iTime = aTrustedTime;
- 
+
         if ( !IsAdded() )
             {
             CActiveScheduler::Add( this );
             }
-                
-        DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ), 
+
+        DRMLOG2( _L( "CDRMConsume::ActivateL: using interval %d" ),
                   ( TInt )iCurrentDelay );
-                  
+
         // secs -> microsecs. The method sets the AO active.
-        After( TTimeIntervalMicroSeconds32( iCurrentDelay * 1000000 ) );              
-        }    
-        
-    // If we see timed things here, we also have secure time.  
+        After( TTimeIntervalMicroSeconds32( iCurrentDelay * 1000000 ) );
+        }
+
+    // If we see timed things here, we also have secure time.
     if( aTrustedTime != Time::NullTTime())
         {
-        SETBIT( iMask, KConsumeHasSecureTime );        
-        }      
+        SETBIT( iMask, KConsumeHasSecureTime );
+        }
     DRMLOG( _L( "CDRMConsume::ActivateL ok" ) );
     }
 
@@ -482,7 +482,7 @@
 // CDRMConsume:: Consume
 //
 // Consume child & parent. Whether to consume parent's explicit
-// usage permission: the information is returned earlier by 
+// usage permission: the information is returned earlier by
 // FindRightsObjectL.
 // ------------------------------------------------------------------------
 //
@@ -494,22 +494,22 @@
                            const TTime& aTrustedTime )
     {
     DRMLOG( _L( "CDRMConsume::Consume" ) );
-    
+
     __ASSERT_DEBUG( iChild && iCombined, User::Invariant() );
-    
+
     // Decrease timed counters & regular counters only once.
-    // In the beginning the bitmasks are both 0xF.     
+    // In the beginning the bitmasks are both 0xF.
     if ( iChild->TopLevelConstraint() )
         {
         if ( ConsumeConstraint( *( iChild->TopLevelConstraint() ),
-                                ( aUpdateCounter && 
+                                ( aUpdateCounter &&
                                   ISSET( iCounters, KChildToplevelCount ) ),
                                 aInitInterval,
-                                ( aUpdateTimedCount && 
-                                  ISSET( iTimedCounts, 
+                                ( aUpdateTimedCount &&
+                                  ISSET( iTimedCounts,
                                          KChildToplevelCount ) ),
                                 aElapsedTime,
-                                aSecureTime, 
+                                aSecureTime,
                                 aTrustedTime,
                                 iCumulativeDelayTop ) )
             {
@@ -524,12 +524,12 @@
                 }
             }
         }
-        
+
     if ( ConsumeConstraint( *( iChild->ConstraintForIntent( iIntent ) ),
-                            ( aUpdateCounter && 
+                            ( aUpdateCounter &&
                               ISSET( iCounters, KChildPermCount ) ),
                             aInitInterval,
-                            ( aUpdateTimedCount && 
+                            ( aUpdateTimedCount &&
                               ISSET( iTimedCounts, KChildPermCount ) ),
                             aElapsedTime,
                             aSecureTime,
@@ -546,7 +546,7 @@
             CLRBIT( iCounters, KChildPermCount );
             }
         }
-    
+
     DRMLOG( _L( "CDRMConsume::Consume ok" ) );
     }
 
@@ -557,15 +557,15 @@
 void CDRMConsume::RunL()
     {
     DRMLOG2( _L( "CDRMConsume::RunL with %d" ), iStatus.Int() );
-    
+
     switch ( iStatus.Int() )
         {
         case KErrNone:
             // Normal completition.
-            
+
         case KErrUnderflow:
             // Time already passed.
-            
+
         case KErrAbort:
             // System time changed ==> consume.
             DoContinueL();
@@ -576,7 +576,7 @@
             // Handled in RunError.
             User::Leave( iStatus.Int() );
         };
-        
+
     DRMLOG( _L( "CDRMConsume::RunL ok" ) );
     }
 
@@ -591,9 +591,9 @@
 #endif
     {
     DRMLOG2( _L( "CDRMConsume::RunError: %d" ), aError );
-     
+
     Deque();
-    
+
     DRMLOG( _L( "CDRMConsume::RunError ok" ) );
     return 0;
     }
@@ -605,10 +605,10 @@
 void CDRMConsume::DoCancel()
     {
     DRMLOG( _L( "CDRMConsume::DoCancel" ) );
-    
+
     TInt error( KErrNone );
     TRAP( error, DoCancelL() );
-    
+
     DRMLOG2( _L( "CDRMConsume::DoCancel: %d" ), error );
     }
 
@@ -619,51 +619,51 @@
 void CDRMConsume::DoCancelL()
     {
     DRMLOG( _L( "CDRMConsume::DoCancelL" ) );
-    
+
     if ( iCurrentDelay )
         {
         TTimeIntervalSeconds secs;
         TTime trustedTime;
         TBool secureTime;
-                        
+
         CTimer::DoCancel();
-                
+
         secureTime = SECURETIME( trustedTime );
         trustedTime.SecondsFrom( iTime, secs );
-        
+
         #ifdef RD_DRM_METERING
             // Update total cumulative time for content metering purposes
             iTotalCumulativeTime = iTotalCumulativeTime.Int() + secs.Int();
         #endif
-             
+
         // If the top level timed counter has not been activated yet
         // increment the counter
         if( ISSET( iTimedCounts, KChildToplevelCount ) )
             {
-            iCumulativeDelayTop = iCumulativeDelayTop.Int() + secs.Int();            
+            iCumulativeDelayTop = iCumulativeDelayTop.Int() + secs.Int();
             }
 
         // If the child timed counter has not been activated yet
-        // increment the counter            
+        // increment the counter
         if( ISSET( iTimedCounts, KChildPermCount ) )
             {
             iCumulativeDelayChild = iCumulativeDelayChild.Int() + secs.Int();
             }
-            
+
         // Always >= 0.
         ConsumeTimedItemsL( secs,
-                            secureTime, 
+                            secureTime,
                             trustedTime );
         iCurrentDelay = 0;
         }
-    
+
     UpdateDBL();
-    
+
     if ( SERVER->HasActiveCountConstraint( *iURI ) )
         {
         SERVER->RemoveActiveCountConstraint( *iURI );
         }
-    
+
     DRMLOG( _L( "CDRMConsume::DoCancel ok" ) );
     }
 
@@ -677,20 +677,20 @@
 void CDRMConsume::CombinePermissionsL()
     {
     DRMLOG( _L( "CDRMConsume::CombinePermissions" ) );
-    
+
     __ASSERT_DEBUG( iChild, User::Invariant() );
-    
+
     // Reset
     delete iCombined; iCombined = NULL;
     iCombined = CDRMConstraint::NewL();
-    
+
     if ( iChild->TopLevelConstraint() )
         {
         iCombined->Merge( *( iChild->TopLevelConstraint() ) );
         }
-        
+
     iCombined->Merge( *( iChild->ConstraintForIntent( iIntent ) ) );
-    
+
     DRMLOG( _L( "CDRMConsume::CombinePermissions ok" ) );
     }
 
@@ -704,20 +704,20 @@
     {
     DRMLOG( _L( "CDRMConsume::UpdateDBL" ) );
     // __ASSERT_DEBUG( iChild, User::Invariant() );
-        
+
     CDRMEventModify* event = NULL;
     TRequestStatus status;
-        
-    if( ISSET( iMask, KConsumeChildModified ) ) 
+
+    if( ISSET( iMask, KConsumeChildModified ) )
         {
         event = CDRMEventModify::NewL();
         }
-    CleanupStack::PushL( event );    
+    CleanupStack::PushL( event );
 
     if ( ISSET( iMask, KConsumeChildModified ) )
         {
         DRMLOG( _L( "CDRMConsume: commiting child to DB" ) );
-        
+
         if( iParentId )
             {
             DB.UpdateDBEntryL( *iParentId, *iChild );
@@ -727,30 +727,30 @@
             }
         else
             {
-            DB.UpdateDBEntryL( *iURI, *iChild );            
+            DB.UpdateDBEntryL( *iURI, *iChild );
             // Notify
             event->SetContentIDL(*iURI);
             event->SetUniqueID(iChild->iUniqueID);
-            }    
-        
+            }
+
         // Notify
         event->SetContentIDL(*iURI);
         event->SetUniqueID(iChild->iUniqueID);
-        
+
         NOTIFIER.SendEventL(*event,status);
-        User::WaitForRequest(status);           
-        
+        User::WaitForRequest(status);
+
         CLRBIT( iMask, KConsumeChildModified );
         }
-    
-    CleanupStack::PopAndDestroy();    
+
+    CleanupStack::PopAndDestroy();
     DRMLOG( _L( "CDRMConsume::UpdateDBL ok" ) );
     }
 // ------------------------------------------------------------------------
 // CDRMConsume::ConsumeConstraint
 //
 // Consume child & parent. Whether to consume parent's explicit
-// usage permission: the information is returned earlier by 
+// usage permission: the information is returned earlier by
 // FindRightsObjectL.
 // ------------------------------------------------------------------------
 //
@@ -764,18 +764,18 @@
                                       TTimeIntervalSeconds& aCumulativeTime )
     {
     DRMLOG( _L( "CDRMConsume::ConsumeConstraints" ) );
-    
+
     TBool res( EFalse );
-    
-    if ( aUpdateCounter && 
+
+    if ( aUpdateCounter &&
          ( aConstraint.iActiveConstraints & EConstraintCounter ) )
         {
         --( aConstraint.iCounter);
         res = ETrue;
         iCountConstraintActive = ETrue;
-        TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) ); 
+        TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) );
         }
-        
+
     if ( aInitInterval &&
          ( aConstraint.iActiveConstraints & EConstraintInterval ) &&
          aSecureTime &&
@@ -784,10 +784,10 @@
         aConstraint.iIntervalStart = aTrustedTime;
         res = ETrue;
         }
-        
+
     /* change to timed counter, we don't check the latest time, we check the
-    cumulated time */    
-        
+    cumulated time */
+
     if ( aUpdateTimedCount &&
          ( aConstraint.iActiveConstraints & EConstraintTimedCounter &&
            ( aCumulativeTime >= aConstraint.iTimedInterval ||
@@ -796,7 +796,7 @@
         --( aConstraint.iTimedCounter );
         res = ETrue;
         iCountConstraintActive = ETrue;
-        TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) ); 
+        TRAP_IGNORE( SERVER->AddActiveCountConstraintL( *iURI ) );
         aCumulativeTime = TTimeIntervalSeconds( 0 );
         }
     else if ( aUpdateTimedCount &&
@@ -804,26 +804,26 @@
         {
         iUsingTimedCount = ETrue;
         }
-        
-    
+
+
     if ( aElapsedTime.Int() != 0 &&
          ( aConstraint.iActiveConstraints & EConstraintAccumulated ) )
         {
         __ASSERT_DEBUG( aElapsedTime.Int() > 0, User::Invariant() );
-        
+
         if ( aConstraint.iAccumulatedTime < aElapsedTime )
             {
             aConstraint.iAccumulatedTime = 0;
             }
         else
             {
-            aConstraint.iAccumulatedTime = aConstraint.iAccumulatedTime.Int() - 
-            	aElapsedTime.Int();
+            aConstraint.iAccumulatedTime = aConstraint.iAccumulatedTime.Int() -
+                aElapsedTime.Int();
             }
-        
+
         res = ETrue;
         }
-        
+
     if ( !iCountConstraintActive && aConstraint.Expired( aTrustedTime ) )
         {
         iExpired = ETrue;
@@ -832,11 +832,11 @@
         {
         iExpired = EFalse;
         }
-    
-    DRMLOG2( 
-        _L( "CDRMConsume::ConsumeConstraints ok, returning %d" ), 
+
+    DRMLOG2(
+        _L( "CDRMConsume::ConsumeConstraints ok, returning %d" ),
         ( TInt )res );
-        
+
     return res;
     }
 
@@ -849,7 +849,7 @@
                                       const TTime& aTrustedTime )
     {
     DRMLOG( _L( "CDRMConsume::ConsumeTimedItemsL" ) );
-    
+
     // Update accumulated constraints & timed count.
     Consume( EFalse,
              ETrue,
@@ -857,7 +857,7 @@
              aDelay,
              aSecureTime,
              aTrustedTime );
-    
+
     DRMLOG( _L( "CDRMConsume::ConsumeTimedItems ok" ) );
     }
 
@@ -868,29 +868,29 @@
 void CDRMConsume::DoContinueL()
     {
     DRMLOG( _L( "CDRMConsume::DoContinueL" ) );
-    
+
     TTime time;
     TBool secureTime( EFalse );
     secureTime = SECURETIME( time );
-    
+
     if ( !iChild || !iCombined )
         {
         InitializeL( iIntent, secureTime, time );
         // User::Leave( KErrCANoRights );
         return;
         }
-   
+
     ConsumeTimedItemsL( iCurrentDelay, secureTime, time );
     UpdateDBL();
     iCurrentDelay = 0;
-    
+
     CombinePermissionsL();
-    
+
     // If the content has expired, find new permissions, unless the expired
     // constraint was a timed count. In that case, the constraint
     // did not really expire.
     if ( SecurityLevelChanged( secureTime ) ||
-         ( iCombined->Expired( time ) && 
+         ( iCombined->Expired( time ) &&
            !SERVER->HasActiveCountConstraint( *iURI ) ) )
         {
         InitializeL( iIntent, secureTime, time );
@@ -899,7 +899,7 @@
         {
         ActivateL( secureTime, time );
         }
-        
+
     DRMLOG( _L( "CDRMConsume::DoContinueL ok" ) );
     }
 
@@ -910,13 +910,13 @@
 TBool CDRMConsume::SecurityLevelChanged( TBool aSecureTime ) const
     {
     DRMLOG( _L( "CDRMConsume::SecurityLevelChanged" ) );
-    
+
     if ( ( ISSET( iMask, KConsumeHasSecureTime ) && aSecureTime ) ||
          !( ISSET( iMask, KConsumeHasSecureTime ) || aSecureTime ) )
         {
         return EFalse;
         }
-        
+
     return ETrue;
     }
 
@@ -929,73 +929,73 @@
                                const TTime& aTrustedTime )
     {
     DRMLOG( _L( "CDRMConsume::InitializeL" ) );
-    
+
     // aIntent is either EPlay, EView, EExecute or EPrint.
-    // Store the old  consumption information in case this is 
+    // Store the old  consumption information in case this is
     // called in case of "ran out of permissions, find new ones"
     CDRMPermission* child( iChild );
     TUint8 timedCounts( iTimedCounts );
     TUint8 counters( iCounters );
     TUint32 reason = 0;
-    
+
     // Reset.
     iTimedCounts = 0xf;
     iCounters = 0xf;
     iMask = 0x0;
     iCurrentDelay = 0;
-    
+
     iExpired = ETrue;
-    
+
     delete iCombined; iCombined = NULL;
-    
-    // Previous child & parent need to be stored in case the internal 
+
+    // Previous child & parent need to be stored in case the internal
     // counter states need to be restored.
     if ( child )
         {
         CleanupStack::PushL( child );
         iChild = NULL;
         }
-    
+
     // If the next call won't leave, we have permissions.
-    User::LeaveIfError( iSession.FindRightsObject( aIntent, 
+    User::LeaveIfError( iSession.FindRightsObject( aIntent,
                                                    *iURI,
                                                    iChild,
                                                    iParentId,
                                                    reason ) );
-                                
+
     User::LeaveIfError( iSession.VerifyCredentials( iURI, iChild, aIntent ) );
-                                
+
     iExpired = EFalse;
 
     // Check whether to restore the internal state.
-    if ( iIntent == aIntent ) 
+    if ( iIntent == aIntent )
         {
-        if ( child && 
+        if ( child &&
              ( child->iUniqueID == iChild->iUniqueID ) )
             {
             DRMLOG( _L( "CDRMConsume: using the previous child" ) );
-            
-            CLRBIT( iTimedCounts, 
+
+            CLRBIT( iTimedCounts,
                     ( KChildToplevelCount | KChildPermCount ) & ~timedCounts );
-                    
+
             CLRBIT( iCounters,
                     ( KChildToplevelCount | KChildPermCount ) & ~counters );
             }
         }
-    
+
     if ( child )
         {
         CleanupStack::PopAndDestroy();
         }
-    
+
     iIntent = aIntent;
-    
+
     CombinePermissionsL();
     ActivateL( aSecureTime, aTrustedTime );
 
     DRMLOG( _L( "CDRMConsume::InitializeL ok" ) );
     }
-    
+
 // ------------------------------------------------------------------------
 // CDRMConsume::CountConstraintActive
 // ------------------------------------------------------------------------
@@ -1031,65 +1031,65 @@
 //
 void CDRMConsume::UpdateMeteringDbL()
     {
-    DRMLOG( _L( "CDRMConsume::UpdateMeteringDbL" ) ); 
+    DRMLOG( _L( "CDRMConsume::UpdateMeteringDbL" ) );
     TTimeIntervalSeconds graceTime = 0;
     CDRMConstraint* constraint = NULL;
-             
+
     if ( iChild )
         {
-        constraint = iChild->ConstraintForIntent( iIntent ); 
-        if ( constraint && constraint->iDrmMeteringInfo )  
-            { 
-            
+        constraint = iChild->ConstraintForIntent( iIntent );
+        if ( constraint && constraint->iDrmMeteringInfo )
+            {
+
             graceTime = constraint->iDrmMeteringInfo->iGraceTime;
-            
-            // Grace time exceeded, increase metering count and metering 
-            // accumulated time    
-            if ( iTotalCumulativeTime >= graceTime )  
+
+            // Grace time exceeded, increase metering count and metering
+            // accumulated time
+            if ( iTotalCumulativeTime >= graceTime )
                 {
                 // Check Rights Issuer rights from Roap storage
-                if ( !CheckRiContextRightsL( iChild->iRiId ) )    
+                if ( !CheckRiContextRightsL( iChild->iRiId ) )
                     {
                     return;
                     }
-                
+
                 // Update database only if Rights Issuer Id is available
-                if ( ( iChild->iRiId.Length() > 0 ) && 
-                     ( iChild->iRiId.Length() <= KRiIdSize ) ) 
+                if ( ( iChild->iRiId.Length() > 0 ) &&
+                     ( iChild->iRiId.Length() <= KRiIdSize ) )
                     {
-                    
+
                     if ( iURI )
                         {
-                        CDrmMeteringDbData* meteringData = 
+                        CDrmMeteringDbData* meteringData =
                             CDrmMeteringDbData::NewLC();
                         meteringData->iContentId = iURI->AllocL();
-                        meteringData->iRiId = iChild->iRiId; 
-                        if( iUsingTimedCount && !iCountConstraintActive ) 
+                        meteringData->iRiId = iChild->iRiId;
+                        if( iUsingTimedCount && !iCountConstraintActive )
                             {
-                            meteringData->iCount = 0;                            
+                            meteringData->iCount = 0;
                             }
                         else
                             {
                         meteringData->iCount = 1;
                             }
-                            
+
                         meteringData->iAccumulatedTime = iTotalCumulativeTime;
-                        
-                        if ( iParentId ) 
+
+                        if ( iParentId )
                             {
                             meteringData->iParentUid = iParentId->AllocL();
                             }
-                 
+
                         METERINGDB.AddL( meteringData );
                         CleanupStack::PopAndDestroy(); // meteringData
-                        }            
+                        }
                     }
-                } 
-            }             
+                }
+            }
         }
         DRMLOG( _L( "CDRMConsume::UpdateMeteringDbL ok" ) );
     }
-    
+
 // ------------------------------------------------------------------------
 // CDRMConsume::CheckRiContextRightsL
 // ------------------------------------------------------------------------
@@ -1097,40 +1097,40 @@
 
 TBool CDRMConsume::CheckRiContextRightsL( const TDesC8& aRiId )
     {
-    
+
     DRMLOG( _L( "CDRMConsume::CheckRiContextRightsL" ) );
-    
+
     CDRMRIContext* riContext = NULL;
-    TBool haveRights = EFalse; 
-  
-    // Connect to the storage of the registered Rights Issuers 
-    
+    TBool haveRights = EFalse;
+
+    // Connect to the storage of the registered Rights Issuers
+
     if( iSession.ConnectRoapClient() == KErrNone )
         {
     riContext = iSession.RoapClient().GetRIContextL( aRiId );
-     
+
     if ( riContext == NULL )
         {
         DRMLOG( _L ( "RI not registered" ) );
         User::Leave( KErrRightsServerRiNotRegistered );
         }
-        
-    // Check (via the Rights Issuer context) whether Rights Issuer 
+
+    // Check (via the Rights Issuer context) whether Rights Issuer
     // is allowed to use metering or not
     if ( riContext->IsMeteringAllowed() )
         {
         haveRights = ETrue;
         }
-        
-    if ( riContext ) 
+
+    if ( riContext )
         {
         delete riContext;
-        riContext = NULL;    
+        riContext = NULL;
         }
         }
-        
+
     return haveRights;
-    
+
     }
 
 #endif
--- a/omadrm/drmengine/server/src/drmcrypto.c	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,687 +0,0 @@
-/*
-* Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  DRM Crypto functionality
-*
-*/
-
-
-
-/*
-
-            DRMCrypto
-            --------------------------
-
-            SW module - ANSI C
-
-Location:           -
-
-Filename:           drmcrypto.c
-
-Document code:      -
-
-/* ------------------------------------------------------------------------- */
-
-/*  1    ABSTRACT
-    1.1    Module type
-    1.2    Functional description
-    1.3    Notes
-
-    2    CONTENTS
-
-    3    GLOSSARY
-
-    4    REFERENCES
-
-    5    EXTERNAL RESOURCES
-    5.1    Mandatory include files
-    5.2    Library include files
-    5.3    Interface include files
-
-    6    LOCAL DEFINITIONS
-    6.1    Local include files
-    6.2    Local constants
-    6.3    Local macros
-    6.3.1    dummy_message_type
-    6.3.2    generate_connection_address
-    6.4    Local data types
-    6.5    Local data structures
-    6.6    Local function prototypes
-
-    7    MODULE CODE
-    7.1     DRMCrypto_Encrypt
-	7.2	    DRMCrypto_Decrypt
-	7.3		DRMCrypto_EncryptRightsDb
-	7.4		DRMCrypto_DecryptRightsVDb
-	7.5		DRMCrypto_AddPadding
-	7.6		DRMCrypto_RemovePadding
-	7.7		DRMCrypto_GenerateKey
-	7.8		DRMCrypto_GenerateIV
-
-
-
-
-
-*/
-
-
-/*  3    GLOSSARY
-		 -
-*/
-
-/*  4    REFERENCES
-
-    Specification reference
-
-    DRM Engine Crypto Interface Specification
-
-
-    Design reference
-
-    -
-
-    Module test specification reference
-
-    -
-*/
-#ifndef C_DRMCRYPTO_CFILE
-#define C_DRMCRYPTO_CFILE
-
-/*  5    EXTERNAL RESOURCES */
-
-/*  5.1    Mandatory include files */
-
-/*  5.2    Library include files */
-
-/*  5.3    Interface include files */
-#include "drmcrypto.h"
-#include "drmenv.h" /* for DRMEnv_GetRandom */
-
-/*  6    LOCAL DEFINITIONS */
-
-/*  6.1    Local include files */
-
-#include "aes_if.h"
-
-/*  6.2    Local constants */
-#define	KEYSEED_NUMBER_OF_INT32		4
-#define KEYSEED_LENGTH				16
-/*  6.3    Local macros */
-
-/*  6.4    Local data types */
-
-/*  6.5    Local data structures */
-
-/*  6.6    Local function prototypes */
-
-/*  7    MODULE CODE */
-
-
-/* ========================================================================= */
-
-/*  7.1 */
-
-/* Functional description
- *
- * Encrypt data using specified algorithm
- *
- *
- * Parameters
- *
- * Cipher type
- *
- cType
- *
- * Pointer to encryption key
- *
- pszKey
- *
- * Encryption key length in bytes
- *
- iKeyLen
- *
- * Pointer to initializer vector of encryption
- *
- pszIV
- *
- * Pointer to data to be encrypted
- *
- pszIn
- *
- * Pointer to encrypted data.
- * It can be same pointer as pszOut.
- *
- pszOut
- *
- * Length in bytes of content to be encrypted.
- *
- iInLen
- *
- * Cipher type(AES encryption modes).
- *		AES_MODE_CBC ... AES_MODE_ECB
- *
- uiParameters
- *
- * Return values
- *
- * If encryption is OK, return DRM_ENG_OK, 
- * otherwize DRM_ENG_ERROR.
- */
-
-/* ---------------------------------------------------------------------- */
-
-#ifdef	ENCRYPT_USED
-uint8 DRMCrypto_Encrypt( 
-		  CipherType				cType, 
-		  uint8*					pszKey, 
-		  uint16					iKeyLen,
-		  uint8*					pszIV,
-		  uint8*					pszIn,
-		  uint8*					pszOut,
-		  uint32					iInLen, 
-		  CipherParamType			uiParameters	)
-	{
-	/* Data structures */
-
-	/* return code
-	 */
-	uint8 ret = 0;
-
-	/* AES encryption mode
-	 */
-	uint8 iMode = 0;
-
-	/*  Code  */
-
-	/* check parameter */
-	if( !pszKey || !pszIV || !pszIn || !pszOut )
-		{
-		return DRM_ENG_INVALID_PARAM;
-		}
-
-	/* Convert uiParameters to inner interface type
-	 */
-	if( uiParameters ==  AES_MODE_CBC)
-		{
-		iMode = AES_CBC;
-		}
-	else if( uiParameters ==  AES_MODE_ECB)
-		{
-		iMode = AES_ECB;
-		}
-	else 
-		{
-		DEBUG("Crypto Error: invalid uiParameters!")
-		return DRM_ENG_ERROR;
-		}
-
-	if( cType == CIPHER_AES )
-		{
-		ret = AESEncrypt( (uint32*)pszKey, (uint16)(iKeyLen*8), (uint32*)pszIV, 
-						  (uint32*)pszIn, (uint32*)pszOut, iInLen, iMode );
-		if( ret==AES_CRYPTO_OK ) 
-			{
-			return DRM_ENG_OK;
-			}
-		else if( ret == AES_CRYPTO_ERR_MEMORY )
-			{
-			return DRM_ENG_MEM_ERROR;
-			}
-		else 
-			{
-			DEBUGD("Crypto Error: AES Encryption Error ", ret)
-			return DRM_ENG_ERROR;
-			}
-		}
-	else
-		{
-		return DRM_ENG_ERROR;
-		}
-	}
-#endif /* #ifdef	ENCRYPT_USED */
-
-
-/*  7.2 */
-
-/* Functional description
- *
- * Decrypt data using specified algorithm.
- *
- *
- * Parameters
- *
- * Cipher type
- *
- cType
- *
- * Pointer to encryption key
- *
- pszKey
- *
- * Encryption key length in bytes
- *
- iKeyLen
- *
- * Pointer to initializer vector of encryption
- *
- pszIV
- *
- * Pointer to encrypted data which is to be decrypted
- *
- pszIn
- *
- * Pointer to decrypted content.
- * It can be same pointer as pszOut.
- *
- pszOut
- *
- * Length in bytes of content to be decrypted.
- *
- iInLen
- *
- * Cipher type(AES encryption modes).
- *		AES_MODE_CBC ... AES_MODE_ECB
- *
- uiParameters
- *
- * Return values
- *
- * If decryption is OK, return DRM_ENG_OK, 
- * otherwize DRM_ENG_ERROR.
- */
-
-/* ---------------------------------------------------------------------- */
-
-
-uint8 DRMCrypto_Decrypt( 
-		  CipherType				cType,
-		  uint8*					pszKey, 
-          uint16					iKeyLen,
-		  uint8*					pszIV,
-		  uint8*					pszIn,
-		  uint8*					pszOut,
-		  uint32					iInLen,
-		  CipherParamType			uiParameters	)
-	{
-	/* Data structures */
-
-	/* return code
-	 */
-	uint8 ret = 0;
-
-	/* AES encryption mode
-	 */
-	uint8 iMode = 0;
-
-	/* Aligned buffer for Key
-	 */
-	/* uint32*			pKeyAligned=NULL; */
-
-	/* Aligned buffer for IV
-	 */
-	/* uint32*			pIVAligned=NULL; */
-
-	/* Aligned buffer for Input data
-	 */
-	/* uint32*			pInAligned=NULL; */
-
-	/* Byte stream pointer
-	 */
-	/* uint8* pBytes = NULL; */
-
-	/*  Code  */
-
-	/* check parameter */
-	if( !pszKey || !pszIV || !pszIn || !pszOut )
-		{
-		return DRM_ENG_INVALID_PARAM;
-		}
-
-	/* Convert uiParameters to inner interface type
-	 */
-	if( uiParameters ==  AES_MODE_CBC)
-		{
-		iMode = AES_CBC;
-		}
-	else if( uiParameters ==  AES_MODE_ECB)
-		{
-		iMode = AES_ECB;
-		}
-	else 
-		{
-		DEBUG("Crypto Error: invalid uiParameters !")
-		return DRM_ENG_ERROR;
-		}
-
-	if( cType == CIPHER_AES )
-		{
-			
-			ret = AESDecrypt( (uint32*)pszKey, (uint16)(iKeyLen*8), (uint32*)pszIV, 
-							  (uint32*)pszIn,  (uint32*)pszOut, iInLen, iMode );
-
-		if( ret==AES_CRYPTO_OK ) 
-			{
-			ret = DRM_ENG_OK;
-			}
-		else if( ret == AES_CRYPTO_ERR_MEMORY )
-			{
-			ret = DRM_ENG_MEM_ERROR;
-			}
-		else 
-			{
-			DEBUGD("Crypto Error: AES Decryption Error ", ret)
-			ret = DRM_ENG_ERROR;
-			}
-		}
-	else
-		{
-		ret = DRM_ENG_ERROR;
-		}
-
-	return ret;
-	}
-
-
-/*  7.5 */
-
-/* Functional description
- *
- * Adds padding bytes at the end of data.
- *
- *
- * Parameters
- *
- * Pointer to pointer to data.
- * IN: points to data before adding padding bytes.
- * OUT: points to data with added padding bytes.
- * Memory used by input data will be freed inside this function.
- * New memory will be allocated for output data.
- *
- ppData
- *
- * Pointer to data length in bytes
- * IN:  pointer to length of data with padding.
- * OUT: points to length of data without padding.
- *
- pDataLen
- *
- * Cipher block size. 
- * Max 256
- *
- CipBlockSize
- *
- * Specifies used padding method.
- *      PADDING_PKCS7
- *
- uiPaddingMethod
- *
- * Return values
- *
- * If operation is OK, return DRM_ENG_OK, 
- * otherwize DRM_ENG_ERROR.
- */
-
-/* ---------------------------------------------------------------------- */
-
-
-uint8 DRMCrypto_AddPadding(
-		  uint8**				ppData, 
-		  uint32*				pDataLen,
-		  uint8					CipBlockSize,
-		  PaddingMethodType		uiPaddingMethod	)
-	{
-	/* Data structures */
-
-	/* Number of bytes to add to data
-	 */
-	uint8	padSize=0;
-
-	/* Address of input data
-	 */
-	uint8	*pDataIn;
-
-	/* Iterator
-	 */
-	uint16	i;
-
-	/* return code */
-	uint8 ret = DRM_ENG_OK;
-
-
-	/*  Code  */
-
-	/* check parameter */
-	if( !ppData || !pDataLen )
-		{
-		return DRM_ENG_INVALID_PARAM;
-		}
-
-	if( uiPaddingMethod == PADDING_PKCS7)
-		{
-		/* calculate padding size
-		 */
-		padSize = (uint8)( CipBlockSize-( *pDataLen % CipBlockSize ) );
-	
-		/* record input data address
-		 */
-		pDataIn = *ppData;
-
-		/* allocate memory
-		 */
-		*ppData = (uint8*)DRM_BLOCK_ALLOC( *pDataLen+padSize ) ;
-		if( !(*ppData) )
-			{
-			return DRM_ENG_MEM_ERROR;
-			}
-
-		/* copy data
-		 */
-		DRM_BLOCK_COPY( *ppData, pDataIn, *pDataLen  );
-
-		/* free memory for input data
-		 */
-		DRM_BLOCK_DEALLOC( pDataIn);
-
-		/* add padding
-		 */
-		for( i=0; i<padSize; i++)
-			*( (uint8*)(*ppData) + *pDataLen +i) = padSize;
-
-		/* calculate new data length:
-		 */
-		*pDataLen = *pDataLen+padSize;
-
-		return	DRM_ENG_OK;
-		}
-	else
-		{
-		DEBUG( "Cypto Error: invalid uiPaddingMethod !" )
-		ret = DRM_ENG_ERROR;
-		}
-
-	return ret;
-	}
-
-
-
-/*  7.6 */
-
-/* Functional description
- *
- * Remove padding bytes from data.
- *
- *
- * Parameters
- *
- * Pointer to pointer to data(with padding bytes).
- * IN: points to data with padding bytes.
- * OUT: points to data without padding bytes.
- *
- ppData
- *
- * Pointer to data length in bytes
- * IN:  points to length of data with padding.
- * OUT: points to length of data without padding.
- *
- pDataLen
- *
- * Specifies used padding method.
- *      PADDING_PKCS7
- *
- uiPaddingMethod
- *
- * Return values
- *
- * If operation is OK, return DRM_ENG_OK, 
- * otherwize DRM_ENG_ERROR.
- */
-
-/* ---------------------------------------------------------------------- */
-
-
-uint8 DRMCrypto_RemovePadding(
-		  uint8**				ppData, 
-		  uint32*				pDataLen,
-		  PaddingMethodType		uiPaddingMethod	)
-	{
-	/* Data structures */
-
-	/* Number of bytes of padding data
-	 */
-	uint8	padSize=0;
-
-		/* return code */
-	uint8 ret = DRM_ENG_OK;
-
-	/*  Code  */
-
-	/* check parameter */
-	if( !ppData || !pDataLen )
-		{
-		return DRM_ENG_INVALID_PARAM;
-		}
-
-	if( uiPaddingMethod == PADDING_PKCS7)
-		{
-		/* calculate padding size
-		 * padding size is equal to last byte value of data
-		 */
-		padSize = *( (*ppData) + (*pDataLen) -1);
-
-		if( padSize<1 || padSize>CRYPTO_BLOCK_SIZE )
-			{
-			DEBUG("Padding Size wrong!")
-			return DRM_ENG_ERROR;
-			}
-
-		/* calculate new data length:
-		 */
-		*pDataLen = *pDataLen-padSize;
-
-		return	DRM_ENG_OK;
-		}
-	else
-		{
-		DEBUG( "Cypto Error: invalid uiPaddingMethod !" )
-		ret = DRM_ENG_ERROR;
-		}
-
-	return ret;
-	}
-
-
-/*  7.8 */
-
-/* Functional description
- *
- * Generates an initialization vector for cipher CBC mode. 
- *
- *
- * Parameters
- *
- * Lenght of the IV to be generated in bits. Must be a value between 1-16.
- *
- ivLen
- *
- *
- * Pointer to pointer to the generated IV.
- *
- ppIV
- *
- *
- * Return values
- *
- * If operation is OK, return DRM_ENG_OK, 
- * otherwize DRM_ENG_ERROR.
- */
-
-/* ---------------------------------------------------------------------- */
-
-uint8 DRMCrypto_GenerateIV(uint32 ivLen, uint8 **ppIV)
-	{
-	/* Data structures */
-
-	/* return code	 */
-	uint8	ret=DRM_ENG_OK;
-
-	/* seed */
-	uint8* pSeed=NULL;
-
-	/*  Code  */
-	
-	/* check parameter */
-	if( ppIV == NULL || ivLen == 0 || ivLen > 16)
-		{
-		return DRM_ENG_INVALID_PARAM;
-		}
-
-	/* allocate memory for IV */
-	*ppIV = DRM_BLOCK_ALLOC( ivLen );
-	
-	if( !(*ppIV) )
-		{
-		return DRM_ENG_MEM_ERROR;
-		}
-
-	/* generate random number as seed */
-	pSeed = DRM_BLOCK_ALLOC( KEYSEED_LENGTH );
-	if( !pSeed )
-		{
-		ret = DRM_ENG_MEM_ERROR;
-		}
-	else
-		{
-		ret = DRMEnv_GetRandom( (uint32*)pSeed, KEYSEED_NUMBER_OF_INT32 );
-		TRANSLATE_ERROR_CODE( ret );
-		}
-
-	/* generate IV by seed */
-	if( ret == DRM_ENG_OK )
-		{
-		/* Just copy the seed as IV. */
-		DRM_BLOCK_COPY(*ppIV, pSeed, ivLen<KEYSEED_LENGTH?ivLen:KEYSEED_LENGTH );
-		}
-	else /* free memory */
-		{
-		DRM_BLOCK_DEALLOC( *ppIV );
-		}
-
-	/* free memory */
-	DRM_BLOCK_DEALLOC( pSeed );
-
-	return ret;
-	}
-
-#endif /* #ifndef C_DRMCRYPTO_CFILE */
-/* End of File */
-
--- a/omadrm/drmengine/server/src/drmmeteringdb.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/drmmeteringdb.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,8 +19,8 @@
 // INCLUDE FILES
 
 #include <f32file.h>
-#include <S32FILE.H>
-#include <BAUTILS.H>
+#include <s32file.h>
+#include <bautils.h>
 #include "drmlog.h"
 #include "drmmeteringdb.h"
 #ifdef RD_DRM_METERING
@@ -651,5 +651,5 @@
     }
 
 #endif
-  
+
 // End of File
--- a/omadrm/drmengine/server/src/drmparentstorage.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/drmparentstorage.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,13 +18,13 @@
 
 // INCLUDE FILES
 #include "drmparentstorage.h"
-#include "drmpermission.h"
+#include "DrmPermission.h"
 #include "drmlog.h"
 
 
 // EXTERNAL DATA STRUCTURES
 
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
 
@@ -42,20 +42,20 @@
 
 // ============================= LOCAL FUNCTIONS ===============================
 
-    
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::CDRMParentStorage
 //
-// Default constructor 
+// Default constructor
 // -----------------------------------------------------------------------------
 //
 CDRMParentStorage::CDRMParentStorage():
 iParents( 1 )
     {
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::~CDRMParentStorage
 //
@@ -69,12 +69,12 @@
         iParentIDs->Reset();
         delete iParentIDs;
         }
-        
+
     // The lists inside are autocleaning, so deletion causes
-    // the contents to also be deleted    
+    // the contents to also be deleted
     iParents.ResetAndDestroy();
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::NewLC
 //
@@ -85,26 +85,26 @@
     {
     CDRMParentStorage* self = new( ELeave ) CDRMParentStorage;
     CleanupStack::PushL( self );
-    
+
     self->ConstructL();
-    
+
     return self;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::NewL
 //
 // Two-phase constructor
 // -----------------------------------------------------------------------------
-//    
+//
 CDRMParentStorage* CDRMParentStorage::NewL()
     {
     CDRMParentStorage* self = CDRMParentStorage::NewLC();
     CleanupStack::Pop(); // sefl
-    
+
     return self;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::ConstructL
 //
@@ -115,30 +115,30 @@
     {
     iParentIDs = new( ELeave ) CDesC8ArraySeg( KDefaultGranularity );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::NewListL
 //
 // Insert a new list to the storage, and return a handle to it.
 // -----------------------------------------------------------------------------
-//    
+//
 CDRMPermissionList& CDRMParentStorage::NewListL()
     {
     __ASSERT_DEBUG( iParents.Count() >= iParentIDs->Count(), User::Invariant() );
-        
+
     if ( iParents.Count() == iParentIDs->Count() )
         {
         // Balanced lists.
         CDRMPermissionList* newList = CDRMPermissionList::NewLC();
         newList->SetAutoCleanup( ETrue );
-        
+
         iParents.AppendL( newList );
         CleanupStack::Pop();
         }
-        
+
     return *( iParents[ iParents.Count() - 1 ] );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CDRMParentStorage::AddL
 //
@@ -162,12 +162,12 @@
 //
 // Check the count of the stored permissions for an id
 // -----------------------------------------------------------------------------
-//    
+//
 TBool CDRMParentStorage::HasPermissions( const TDesC8& aCID )
     {
     TBool r = EFalse;
     TInt pos;
-    
+
     if ( iParentIDs->FindIsq( aCID, pos ) == KErrNone )
         {
         r = ETrue;
@@ -180,13 +180,13 @@
 //
 // Operator.
 // -----------------------------------------------------------------------------
-//    
+//
 CDRMPermissionList& CDRMParentStorage::operator[]( const TDesC8& aCID )
     {
     TInt pos;
-    
+
     iParentIDs->FindIsq( aCID, pos );
     return *( iParents[ pos ] );
     }
-    
+
 // End of File
--- a/omadrm/drmengine/server/src/drmrightsdb.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/server/src/drmrightsdb.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -26,19 +26,20 @@
 #include <s32strm.h>
 #include <s32file.h>
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 #include <symmetric.h>  // AES128CBC
-#include <dcfrep.h>
+#include <DcfRep.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DRMCommon.h"  // DRM Error messages
-#include "DRMRightsDB.h"
+#include "drmrightsdb.h"
 #include "DRMRightsData.h"
 #include "DRMCommonData.h"
-#include "DRMPermission.h"
-#include "DRMConstraint.h"
+#include "DrmPermission.h"
+#include "DrmConstraint.h"
 #include "DRMRightsCleaner.h"
 #include "DRMRightsServer.h"
 #include "DrmKeyStorage.h"
@@ -46,7 +47,7 @@
 #include "drmlog.h"
 
 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL
-#include "drmclockclient.h"
+#include "DRMClockClient.h"
 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL
 
 /*
@@ -292,9 +293,9 @@
     TInt timeZone = 0;
     DRMClock::ESecurityLevel securityLevel;
 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL
-    
+
     GetRightsFileNameL( aContentID, path);
-    
+
 #ifdef RD_DRM_RIGHTS_MANAGER_REMOVAL
     // Get the secure time:
     RDRMClockClient client;
@@ -315,13 +316,13 @@
 
     // Delete expired:
     TRAP_IGNORE( deleteAllowed = DeleteExpiredL( path, time ) );
-        
-    // Check if it's possible to delete the file as well    
+
+    // Check if it's possible to delete the file as well
     if( deleteAllowed )
         {
         iFileServer.Delete( path );
         }
-    
+
     error = KErrNone;
 #endif // RD_DRM_RIGHTS_MANAGER_REMOVAL
 
@@ -419,7 +420,7 @@
         {
         User::Leave(KErrArgument);
         }
-        
+
     TBuf8<16> keyStore = aEncryptionKey;
     // TBuf8<16> authStore = aAuthenticationSeed
 
--- a/omadrm/drmengine/utils/src/Base64.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/utils/src/Base64.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,10 +19,10 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "base64.h"
+#include "Base64.h"
 
 // LOCAL CONSTANTS AND MACROS
-LOCAL_C const TUint8* const KBase64Chars = 
+LOCAL_C const TUint8* const KBase64Chars =
     _S8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     "abcdefghijklmnopqrstuvwxyz"
     "0123456789+/");
@@ -72,7 +72,7 @@
     TUint8 charArray3[3];
     TUint8 charArray4[4];
     TInt l = 0;
-    
+
     ret = HBufC8::NewL((aInput.Length() * 4 + 1) / 3);
     TPtr8 des = ret->Des();
     while (l < aInput.Length())
@@ -87,7 +87,7 @@
             charArray4[2] = static_cast<TUint8>(
                 ((charArray3[1] & 0x0f) << 2) + ((charArray3[2] & 0xc0) >> 6));
             charArray4[3] = static_cast<TUint8>(charArray3[2] & 0x3f);
-        
+
             for (i = 0; i <4; i++)
                 {
                 des.Append(KBase64Chars[charArray4[i]]);
@@ -95,32 +95,32 @@
             i = 0;
             }
         }
-    
+
     if (i != 0)
         {
         for (j = i; j < 3; j++)
             {
             charArray3[j] = '\0';
             }
-        
+
         charArray4[0] = static_cast<TUint8>((charArray3[0] & 0xfc) >> 2);
         charArray4[1] = static_cast<TUint8>(
             ((charArray3[0] & 0x03) << 4) +((charArray3[1] & 0xf0) >> 4));
         charArray4[2] = static_cast<TUint8>(
             ((charArray3[1] & 0x0f) << 2) +((charArray3[2] & 0xc0) >> 6));
         charArray4[3] = static_cast<TUint8>(charArray3[2] & 0x3f);
-        
+
         for (j = 0; j < i + 1; j++)
             {
             des.Append(KBase64Chars[charArray4[j]]);
             }
-        
+
         while ((i++ < 3))
             {
             des.Append('=');
             }
         }
-    
+
     return ret;
     }
 
@@ -141,7 +141,7 @@
     TInt in = 0;
     TUint8 charArray4[4], charArray3[3];
     HBufC8* ret;
-    
+
     ret = HBufC8::NewL((aInput.Length() * 3 + 1) / 4);
     TPtr8 des = ret->Des();
     while (len-- && aInput[in] != '=')
@@ -154,21 +154,21 @@
             {
             in++;
             }
-            
+
         if (i == 4)
             {
             for (i = 0; i < 4; i++)
                 {
                 charArray4[i] = FindBase64Char(charArray4[i]);
                 }
-            
+
             charArray3[0] = static_cast<TUint8>(
                 (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4));
             charArray3[1] = static_cast<TUint8>(
                 ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2));
             charArray3[2] = static_cast<TUint8>(
             ((charArray4[2] & 0x3) << 6) + charArray4[3]);
-            
+
             for (i = 0; i < 3; i++)
                 {
                 des.Append(charArray3[i]);
@@ -176,33 +176,33 @@
             i = 0;
             }
         }
-    
+
     if (i != 0)
         {
         for (j = i; j < 4; j++)
             {
             charArray4[j] = 0;
             }
-    
+
         for (j = 0; j < 4; j++)
             {
             charArray4[j] = FindBase64Char(charArray4[j]);
             }
-    
+
         charArray3[0] = static_cast<TUint8>(
             (charArray4[0] << 2) + ((charArray4[1] & 0x30) >> 4));
         charArray3[1] = static_cast<TUint8>(
             ((charArray4[1] & 0xf) << 4) + ((charArray4[2] & 0x3c) >> 2));
         charArray3[2] = static_cast<TUint8>(
             ((charArray4[2] & 0x3) << 6) + charArray4[3]);
-    
+
         for (j = 0; j < i - 1; j++)
             {
             des.Append(charArray3[j]);
             }
         }
-    
+
     return ret;
     }
 
-//  End of File  
+//  End of File
--- a/omadrm/drmengine/utils/src/dbwatcher.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/utils/src/dbwatcher.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 #include <sysutil.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "dbwatcher.h"
@@ -36,9 +36,9 @@
 #endif
 
 _LIT( KDomainRoDir, "DomainROs" );
-static const TChar KDirs[CDbWatcher::KNumDirs] = 
+static const TChar KDirs[CDbWatcher::KNumDirs] =
     { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
-    
+
 // ======== MEMBER FUNCTIONS ========
 
 void CDbWatcher::ConstructL( MWatcherObserver& aObserver )
@@ -47,42 +47,42 @@
     TFileName file;
 
     DRMLOG( _L( "CDbWatcher::ConstructL <-" ) );
-    
+
     User::LeaveIfError( iFs.Connect() );
     for ( i = 0; i < KNumDirs; i++ )
         {
-        
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
         // Ignore errors
         file.Copy( KRdbBaseDir );
-        
+
 #else //RD_MULTIPLE_DRIVE
-    
+
         TInt driveNumber( -1 );
         TChar driveLetter;
         DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
-	    iFs.DriveToChar( driveNumber, driveLetter );
-	
-	    TFileName dbBaseDir;
-	    dbBaseDir.Format( KRdbBaseDir, (TUint)driveLetter );
-        
+        iFs.DriveToChar( driveNumber, driveLetter );
+
+        TFileName dbBaseDir;
+        dbBaseDir.Format( KRdbBaseDir, (TUint)driveLetter );
+
         // Ignore errors
         file.Copy( dbBaseDir );
-        
+
 #endif
-        
+
         if ( i < KNumDirs - 1 )
             {
-            file.Append( KDirs[i] ); 
+            file.Append( KDirs[i] );
             }
         else
             {
-            file.Append( KDomainRoDir ); 
+            file.Append( KDomainRoDir );
             }
         iDirWatcher[i] = CDirWatcher::NewL( aObserver, iFs, file );
         }
-    
+
     DRMLOG( _L( "CDbWatcher::ConstructL ->" ) );
     }
 
@@ -102,28 +102,28 @@
 CDbWatcher::~CDbWatcher()
     {
     TInt i;
-    
+
     DRMLOG( _L( "CDbWatcher::~CDbWatcher ->" ) );
 
     for ( i = 0; i < KNumDirs; i++ )
         {
         delete iDirWatcher[i];
-        }    
+        }
     iFs.Close();
-    
+
     DRMLOG( _L( "CDbWatcher::~CDbWatcher <-" ) );
     }
 
 void CDbWatcher::StartWatching()
     {
     TInt i;
-    
+
     DRMLOG( _L( "CDbWatcher::StartWatching ->" ) );
-    
+
     for ( i = 0; i < KNumDirs; i++ )
         {
         iDirWatcher[i]->StartWatching();
-        }    
+        }
 
     DRMLOG( _L( "CDbWatcher::StartWatching <-" ) );
     }
--- a/omadrm/drmengine/utils/src/drmaescrypto.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmengine/utils/src/drmaescrypto.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -23,7 +23,7 @@
 #include <symmetric.h>
 #include <rijndael.h>
 
-#include <drmtypes.h>
+#include <DRMTypes.h>
 
 #include "drmaescrypto.h"
 
--- a/omadrm/drmhelper/BMARM/DRMHELPERDMGRWRAPPERU.DEF	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-
--- a/omadrm/drmhelper/BMARM/DRMHELPERU.DEF	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-EXPORTS
-	"_._27CDRMHelperRightsConstraints" @ 1 NONAME R3UNUSED ; CDRMHelperRightsConstraints::~CDRMHelperRightsConstraints(void)
-	CanSetAutomated__10CDRMHelperRC7TDesC16Ri @ 2 NONAME R3UNUSED ; CDRMHelper::CanSetAutomated(TDesC16 const &, int &)
-	CheckRightsAmountL__10CDRMHelperRC6TDesC8ii @ 3 NONAME ; CDRMHelper::CheckRightsAmountL(TDesC8 const &, int, int)
-	CheckRightsAmountL__10CDRMHelperRC7TDesC16ii @ 4 NONAME ; CDRMHelper::CheckRightsAmountL(TDesC16 const &, int, int)
-	CheckRightsPercentL__10CDRMHelperRC7TDesC16i @ 5 NONAME R3UNUSED ; CDRMHelper::CheckRightsPercentL(TDesC16 const &, int)
-	ShowAutomatedNote__10CDRMHelperRC6TDesC8 @ 6 NONAME R3UNUSED ; CDRMHelper::ShowAutomatedNote(TDesC8 const &)
-	ShowAutomatedNote__10CDRMHelperRC7TDesC16 @ 7 NONAME R3UNUSED ; CDRMHelper::ShowAutomatedNote(TDesC16 const &)
-	SupportedDataType__10CDRMHelperiR9TDataType @ 8 NONAME R3UNUSED ; CDRMHelper::SupportedDataType(int, TDataType &)
-	UnRegisterDataType__10CDRMHelperi @ 9 NONAME R3UNUSED ; CDRMHelper::UnRegisterDataType(int)
-	"_._10CDRMHelper" @ 10 NONAME R3UNUSED ; CDRMHelper::~CDRMHelper(void)
-	CanSetAutomated__10CDRMHelperRC6TDesC8Ri @ 11 NONAME R3UNUSED ; CDRMHelper::CanSetAutomated(TDesC8 const &, int &)
-	DataTypesCount__10CDRMHelperRi @ 12 NONAME R3UNUSED ; CDRMHelper::DataTypesCount(int &)
-	FullRights__27CDRMHelperRightsConstraints @ 13 NONAME R3UNUSED ; CDRMHelperRightsConstraints::FullRights(void)
-	GetContentURIList__10CDRMHelperRPt13RPointerArray1Z6HBufC8 @ 14 NONAME R3UNUSED ; CDRMHelper::GetContentURIList(RPointerArray<HBufC8> *&)
-	GetCountersL__27CDRMHelperRightsConstraintsRUlT1 @ 15 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetCountersL(unsigned long &, unsigned long &)
-	GetEndTimeL__27CDRMHelperRightsConstraintsR5TTime @ 16 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetEndTimeL(TTime &)
-	GetIntervalL__27CDRMHelperRightsConstraintsR20TTimeIntervalSeconds @ 17 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetIntervalL(TTimeIntervalSeconds &)
-	GetIntervalStartL__27CDRMHelperRightsConstraintsR5TTime @ 18 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetIntervalStartL(TTime &)
-	GetRightsDetailsL__10CDRMHelperRC7TDesC16UlRiT3RP21CDRMRightsConstraintsN35 @ 19 NONAME ; CDRMHelper::GetRightsDetailsL(TDesC16 const &, unsigned long, int &, int &, CDRMRightsConstraints *&, CDRMRightsConstraints *&, CDRMRightsConstraints *&, CDRMRightsConstraints *&)
-	GetRightsDetailsL__10CDRMHelperRC7TDesC16UlRiT3RP27CDRMHelperRightsConstraintsN35 @ 20 NONAME ; CDRMHelper::GetRightsDetailsL(TDesC16 const &, unsigned long, int &, int &, CDRMHelperRightsConstraints *&, CDRMHelperRightsConstraints *&, CDRMHelperRightsConstraints *&, CDRMHelperRightsConstraints *&)
-	GetStartTimeL__27CDRMHelperRightsConstraintsR5TTime @ 21 NONAME R3UNUSED ; CDRMHelperRightsConstraints::GetStartTimeL(TTime &)
-	HandleErrorL__10CDRMHelperiRC6TDesC8 @ 22 NONAME R3UNUSED ; CDRMHelper::HandleErrorL(int, TDesC8 const &)
-	HandleErrorL__10CDRMHelperiRC7TDesC16 @ 23 NONAME R3UNUSED ; CDRMHelper::HandleErrorL(int, TDesC16 const &)
-	IndicateIdle__10CDRMHelper @ 24 NONAME R3UNUSED ; CDRMHelper::IndicateIdle(void)
-	IsPreview__27CDRMHelperRightsConstraints @ 25 NONAME R3UNUSED ; CDRMHelperRightsConstraints::IsPreview(void)
-	LaunchDetailsViewEmbeddedL__10CDRMHelperPC6HBufC8 @ 26 NONAME R3UNUSED ; CDRMHelper::LaunchDetailsViewEmbeddedL(HBufC8 const *)
-	LaunchDetailsViewEmbeddedL__10CDRMHelperRC6TDesC8 @ 27 NONAME R3UNUSED ; CDRMHelper::LaunchDetailsViewEmbeddedL(TDesC8 const &)
-	LaunchDetailsViewEmbeddedL__10CDRMHelperRC7TDesC16 @ 28 NONAME R3UNUSED ; CDRMHelper::LaunchDetailsViewEmbeddedL(TDesC16 const &)
-	NewLC__10CDRMHelper @ 29 NONAME R3UNUSED ; CDRMHelper::NewLC(void)
-	NewLC__10CDRMHelperR7CCoeEnv @ 30 NONAME R3UNUSED ; CDRMHelper::NewLC(CCoeEnv &)
-	NewL__10CDRMHelper @ 31 NONAME R3UNUSED ; CDRMHelper::NewL(void)
-	NewL__10CDRMHelperR7CCoeEnv @ 32 NONAME R3UNUSED ; CDRMHelper::NewL(CCoeEnv &)
-	RegisterDataType__10CDRMHelperRC9TDataType @ 33 NONAME R3UNUSED ; CDRMHelper::RegisterDataType(TDataType const &)
-	RemoveAutomatedPassive__10CDRMHelperRC6TDesC8 @ 34 NONAME R3UNUSED ; CDRMHelper::RemoveAutomatedPassive(TDesC8 const &)
-	RemoveAutomatedPassive__10CDRMHelperRC7TDesC16 @ 35 NONAME R3UNUSED ; CDRMHelper::RemoveAutomatedPassive(TDesC16 const &)
-	RemoveAutomated__10CDRMHelperRC6TDesC8 @ 36 NONAME R3UNUSED ; CDRMHelper::RemoveAutomated(TDesC8 const &)
-	RemoveAutomated__10CDRMHelperRC7TDesC16 @ 37 NONAME R3UNUSED ; CDRMHelper::RemoveAutomated(TDesC16 const &)
-	SetAutomatedPassive__10CDRMHelperRC6TDesC8 @ 38 NONAME R3UNUSED ; CDRMHelper::SetAutomatedPassive(TDesC8 const &)
-	SetAutomatedPassive__10CDRMHelperRC7TDesC16 @ 39 NONAME R3UNUSED ; CDRMHelper::SetAutomatedPassive(TDesC16 const &)
-	SetAutomatedSilent__10CDRMHelperRC6TDesC8i @ 40 NONAME R3UNUSED ; CDRMHelper::SetAutomatedSilent(TDesC8 const &, int)
-	SetAutomatedSilent__10CDRMHelperRC7TDesC16i @ 41 NONAME R3UNUSED ; CDRMHelper::SetAutomatedSilent(TDesC16 const &, int)
-	SetAutomated__10CDRMHelperRC6TDesC8 @ 42 NONAME R3UNUSED ; CDRMHelper::SetAutomated(TDesC8 const &)
-	SetAutomated__10CDRMHelperRC7TDesC16 @ 43 NONAME R3UNUSED ; CDRMHelper::SetAutomated(TDesC16 const &)
-	SetCountLimitL__10CDRMHelperUi @ 44 NONAME R3UNUSED ; CDRMHelper::SetCountLimitL(unsigned int)
-	SetPercentageLimitL__10CDRMHelperUi @ 45 NONAME R3UNUSED ; CDRMHelper::SetPercentageLimitL(unsigned int)
-	SetTimeLimitL__10CDRMHelperUi @ 46 NONAME R3UNUSED ; CDRMHelper::SetTimeLimitL(unsigned int)
-
--- a/omadrm/drmhelper/BWINSCW/drmhelperdmgrwrapperU.DEF	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?GateFunctionDMgr@@YAPAXXZ @ 1 NONAME ; void * GateFunctionDMgr(void)
-
--- a/omadrm/drmhelper/EABI/drmhelperdmgrwrapperU.DEF	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-EXPORTS
-	_Z16GateFunctionDMgrv @ 1 NONAME
-	_ZTI21CDRMHelperDMgrWrapper @ 2 NONAME ; #<TI>#
-	_ZTV21CDRMHelperDMgrWrapper @ 3 NONAME ; #<VT>#
-
--- a/omadrm/drmhelper/drmhelperserver/src/DRMHelperServer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/drmhelperserver/src/DRMHelperServer.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,8 +18,8 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include <DRMPermission.h> // CDRMPermission
-#include <DRMConstraint.h> // CDRMConstraint
+#include <DrmPermission.h> // CDRMPermission
+#include <DrmConstraint.h> // CDRMConstraint
 #include <s32file.h>
 #include <DRMNotifier.h>
 #include <DRMEventAddRemove.h>
@@ -28,7 +28,7 @@
 #include <centralrepository.h> // link against centralrepository.lib
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "DRMEventModify.h"
--- a/omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/drmhelperserver/src/IdleObserver.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,13 +21,13 @@
 #include    <e32base.h>
 #include    <e32std.h>
 #include    <f32file.h>
-#include    <ActiveIdle2DomainPSKeys.h>
+#include    <activeidle2domainpskeys.h>
 #include    <e32property.h> //for RProperty
 #include    "IdleObserver.h"
 #include    "DRMHelperServer.h"
 
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 // MACROS
 // LOCAL CONSTANTS AND MACROS
@@ -35,24 +35,24 @@
 
 #ifdef _DRM_TESTING
 LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName )
-	{
+    {
     RFile file;
-	TInt size;
+    TInt size;
     User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) );
     CleanupClosePushL( file );
     User::LeaveIfError( file.Size( size ) );
-	User::LeaveIfError( file.Write( size, text ) );
+    User::LeaveIfError( file.Write( size, text ) );
     CleanupStack::PopAndDestroy(&file); //file
-	}
+    }
 
 LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs )
-	{
-	_LIT( KLogFile , "c:\\IOLog.txt" );
-	WriteFileL( text , aFs , KLogFile );
-	}
+    {
+    _LIT( KLogFile , "c:\\IOLog.txt" );
+    WriteFileL( text , aFs , KLogFile );
+    }
 
 LOCAL_C void CreateLogL()
-	{
+    {
     RFs fs;
     User::LeaveIfError(fs.Connect());
     CleanupClosePushL(fs);
@@ -60,47 +60,47 @@
     User::LeaveIfError( file.Replace( fs , _L("c:\\IOLog.txt") , EFileWrite ) );
     file.Close();
     CleanupStack::PopAndDestroy(&fs); //fs
-	}
+    }
 
 LOCAL_C void WriteL( const TDesC& aText )
-	{
+    {
     RFs fs;
     User::LeaveIfError( fs.Connect() );
     CleanupClosePushL(fs);
-	HBufC8* text = HBufC8::NewLC(1000);
-	TPtr8 textptr(text->Des() );
-	textptr.Append( aText );
+    HBufC8* text = HBufC8::NewLC(1000);
+    TPtr8 textptr(text->Des() );
+    textptr.Append( aText );
     textptr.Append(_L( "\r\n" ));
-	WriteLogL(textptr , fs);
+    WriteLogL(textptr , fs);
     CleanupStack::PopAndDestroy(text);
     CleanupStack::PopAndDestroy(&fs); //fs
-	}
+    }
 
 LOCAL_C void WriteCurrentTimeL()
-	{
+    {
     RFs fs;
     User::LeaveIfError( fs.Connect() );
     CleanupClosePushL(fs);
-	HBufC8* text = HBufC8::NewLC(100);
-	TPtr8 textptr(text->Des() );
+    HBufC8* text = HBufC8::NewLC(100);
+    TPtr8 textptr(text->Des() );
 // Date and Time display
     TTime time;
     time.HomeTime();
-	TBuf<256> dateString;
-	_LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3");
-	time.FormatL(dateString,KDate);
-	textptr.Append(_L( "\r\n\t\tData:\t" ) );
-	textptr.Append( dateString );
-	_LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B");
-	time.FormatL(dateString,KTime);
-	textptr.Append(_L( "\r\n\t\tTime:\t" ) );
-	textptr.Append( dateString );
-	textptr.Append(_L( "\r\n" ) );
-	textptr.Append(_L( "\r\n" ) );
-	WriteLogL(textptr , fs);
+    TBuf<256> dateString;
+    _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3");
+    time.FormatL(dateString,KDate);
+    textptr.Append(_L( "\r\n\t\tData:\t" ) );
+    textptr.Append( dateString );
+    _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B");
+    time.FormatL(dateString,KTime);
+    textptr.Append(_L( "\r\n\t\tTime:\t" ) );
+    textptr.Append( dateString );
+    textptr.Append(_L( "\r\n" ) );
+    textptr.Append(_L( "\r\n" ) );
+    WriteLogL(textptr , fs);
     CleanupStack::PopAndDestroy(text);
     CleanupStack::PopAndDestroy(&fs); //fs
-	}
+    }
 #endif
 // MODULE DATA STRUCTURES
 // LOCAL FUNCTION PROTOTYPES
@@ -136,7 +136,7 @@
 #endif
     User::LeaveIfError( iProperty.Attach( KPSUidAiInformation, KActiveIdleState ) );
     }
-                    
+
 // -----------------------------------------------------------------------------
 // CIdleObserver::NewL
 // Two-phased constructor.
@@ -145,7 +145,7 @@
 CIdleObserver* CIdleObserver::NewL(CDRMHelperServer& aServer)
     {
     CIdleObserver* self = new( ELeave ) CIdleObserver(aServer);
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop(self);
@@ -153,12 +153,12 @@
     return self;
     }
 
-    
+
 // Destructor
 CIdleObserver::~CIdleObserver()
     {
 #ifdef _DRM_TESTING
-    TRAPD( err , WriteL(_L("CIdleObserver-Destruct")) ); 
+    TRAPD( err , WriteL(_L("CIdleObserver-Destruct")) );
     TRAP( err , WriteCurrentTimeL() );
 #endif
     Cancel();
@@ -192,23 +192,23 @@
 //
 void CIdleObserver::RunL()
     {
-#ifdef _DRM_TESTING 
+#ifdef _DRM_TESTING
     //test code start
     WriteL(_L("RunL"));
     WriteCurrentTimeL();
     //test code end
 #endif
-    
+
     // Resubscribe before processing new value to prevent missing updates
     TInt idleStauts = 0;
     TInt err( iStatus.Int() );
     if (err == KErrNone)
         {
         StartL();
-        User::LeaveIfError( iProperty.Get( 
-                KPSUidAiInformation, 
+        User::LeaveIfError( iProperty.Get(
+                KPSUidAiInformation,
                 KActiveIdleState, idleStauts ) );
-        if ( idleStauts == EPSAiForeground ) 
+        if ( idleStauts == EPSAiForeground )
             {
             iServer.HandleIdleL();
             }
@@ -216,7 +216,7 @@
     else if ( err != KErrCancel )
         {
         StartL();
-        }  
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -235,4 +235,4 @@
     }
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
-//  End of File  
+//  End of File
--- a/omadrm/drmhelper/group/Drmhelper.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/group/Drmhelper.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -100,13 +100,13 @@
 
 
 #if defined(ARMCC)
-deffile ../EABI/ 
+deffile ../EABI/
 #elif defined( WINSCW )
-deffile ../bwinscw/ 
+deffile ../BWINSCW/
 #elif defined( WINS )
-deffile ../bwins/ 
+deffile ../bwins/
 #else
-deffile ../bmarm/ 
+deffile ../bmarm/
 #endif
 
 SMPSAFE
--- a/omadrm/drmhelper/group/bld.inf	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003 - 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,6 @@
 
 PRJ_MMPFILES
 
-drmhelperdmgrwrapper.mmp
 DRMHelper.mmp
 
 //  End of File
--- a/omadrm/drmhelper/group/drmhelperdmgrwrapper.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2006 - 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Project definition file for drmhelperdmgrwrapper
-*
-*/
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET         drmhelperdmgrwrapper.dll
-TARGETTYPE     dll
-UID            0x1000008D 0x102823D9
-
-CAPABILITY     CAP_GENERAL_DLL
-VENDORID       VID_DEFAULT
-
-SOURCE         ../src/DRMHelperDMgrWrapper.cpp
-
-START RESOURCE drmhelperdmgrwrapper.rss
-HEADER
-TARGETPATH RESOURCE_FILES_DIR
-LANGUAGE_IDS
-END
-
-USERINCLUDE    ../inc
-USERINCLUDE    ../../drmengine/roap/inc
-USERINCLUDE    ../../../inc   // ADo level inc dir
-
-// Default system include paths for middleware layer modules.
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY        euser.lib
-LIBRARY        centralrepository.lib       // Browser default AP
-LIBRARY        cmmanager.lib
-LIBRARY        DownloadMgr.lib
-LIBRARY        RoapHandler.lib
-LIBRARY        efsrv.lib
-LIBRARY        avkon.lib
-LIBRARY        cone.lib
-LIBRARY        commonengine.lib
-LIBRARY        aknnotify.lib
-LIBRARY        eikctl.lib
-LIBRARY        eikcdlg.lib
-
-#ifdef RD_MULTIPLE_DRIVE
-LIBRARY        platformenv.lib
-#endif
-
-DEBUGLIBRARY   flogger.lib
-
-START WINS
-END
-
-START MARM
-END
-
-#if defined(ARMCC)
-deffile ../EABI/
-#elif defined( WINSCW )
-deffile ../bwinscw/
-#elif defined( WINS )
-deffile ../bwins/
-#else
-deffile ../bmarm/
-#endif
-
-SMPSAFE
--- a/omadrm/drmhelper/group/drmhelperdmgrwrapper.rss	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Resource file for drmhelperdmgrwrapper
-*
-*/
-
-
-//  RESOURCE IDENTIFIER
-NAME    DRMD
-
-//  INCLUDES
-#include <eikon.rh>
-#include <eikon.rsg>
-#include <avkon.rh>
-#include <avkon.rsg>
-#include <avkon.loc>
-#include <avkon.mbg>
-#ifdef __DRM
-#include <drmcommon.loc>
-#endif
-
-//  CONSTANTS  
-
-//  MACROS  
-
-//  RESOURCE DEFINITIONS 
-
-RESOURCE RSS_SIGNATURE { }
-
-RESOURCE TBUF16 { buf="DRMD"; }
-
-// -----------------------------------------------------------------------------
-//   
-// r_silent_progress_note
-// String displayed while getting silent rights 
-// expired.
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_silent_progress_note
-    {
-    flags = EAknProgressNoteFlags;
-    buttons = R_AVKON_SOFTKEYS_CANCEL;
-    items =
-        {
-        DLG_LINE
-            {
-            type = EAknCtNote;
-            id = EGeneralQuery;
-            control= AVKON_NOTE 
-                { 
-                layout = EProgressLayout;
-                singular_label = qtn_drm_progress_opening;
-                imagefile = AVKON_BITMAP_FILE;
-                imageid = EMbmAvkonQgn_note_progress; 
-                imagemask = EMbmAvkonQgn_note_progress_mask; 
-                };
-          }
-        };
-   }
-   
-//End of File
-
--- a/omadrm/drmhelper/inc/ConsumeData.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/inc/ConsumeData.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <e32base.h>
 #include <caf/caf.h>
-#include <drmrightsclient.h>
+#include <DRMRightsClient.h>
 
 // DATA TYPES
 
@@ -40,56 +40,56 @@
 NONSHARABLE_CLASS( CConsumeData )  : public CBase
     {
     public:  // Constructors and destructor
-    
-		/**
+
+        /**
         * NewLC
         *
-		* Created a new instance of the CConsumeData class and leaves
-		* it into the cleanup stack
-		*
+        * Created a new instance of the CConsumeData class and leaves
+        * it into the cleanup stack
+        *
         * @param aUri: Content identifier of the content in question
-		* @return Functional CConsumeData -object
+        * @return Functional CConsumeData -object
         */
         static CConsumeData* NewLC( const TDesC8& aUri );
 
-    
-		/**
+
+        /**
         * NewL
         *
-		* Created a new instance of the CConsumeData class
-		*
+        * Created a new instance of the CConsumeData class
+        *
         * @param aUri: Content identifier of the content in question
-		* @return Functional CConsumeData -object
+        * @return Functional CConsumeData -object
         */
         static CConsumeData* NewL( const TDesC8& aUri );
-        
+
         /**
         * Destructor
         */
         ~CConsumeData();
-        
+
     public:  // New functions
-    
- 		/**
+
+        /**
         * Consume
         *
-		* Calls client consumption, if you call this with stop, the session
-		* is deleted
-		*
+        * Calls client consumption, if you call this with stop, the session
+        * is deleted
+        *
         * @param aIntent: Intent to be used for consumption
-		* @return Symbian OS error code
-        */         
+        * @return Symbian OS error code
+        */
         TInt Consume( const ContentAccess::TIntent& aIntent );
 
- 		/**
+        /**
         * CompateUri();
         *
-		* Compares the uri as if compared with string compare
-		*
+        * Compares the uri as if compared with string compare
+        *
         * @param aIntent: Intent to be used for consumption
-		* @return Symbian OS error code
-        */         
-        TInt CompareUri( const TDesC8& aUri ) const;        
+        * @return Symbian OS error code
+        */
+        TInt CompareUri( const TDesC8& aUri ) const;
 
     private:
         /**
@@ -104,16 +104,16 @@
 
         // Content uri of the content being used
         HBufC8* iContentURI8;
-        
+
         // Rights Client instance
-       	RDRMRightsClient iRdb;
-       	
-       	// Connection status
-       	TBool iConnectionStatus;
+        RDRMRightsClient iRdb;
+
+        // Connection status
+        TBool iConnectionStatus;
     };
 
 
 
-#endif      // CONSUMEDATA_H   
-            
+#endif      // CONSUMEDATA_H
+
 // End of File
--- a/omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-#ifndef CDRMHELPERDMGRWRAPPER_H
-#define CDRMHELPERDMGRWRAPPER_H
-
-#include <DownloadMgrClient.h>
-#include <aknprogressdialog.h>
-#include <eikprogi.h>
-
-/**
-* Environment gate function
-*
-* @since S60 3.1
-* @return pointer to DMgr handler
-*/
-IMPORT_C TAny* GateFunctionDMgr();
-
-class MDRMHelperDMgrWrapper
-    {
-
-public:
-    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0;
-
-    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl,
-                                                CCoeEnv& aCoeEnv ) = 0;
-
-    virtual HBufC8* GetErrorUrlL() = 0;
-
-    };
-
-/**
-*  Class for downloading ROAP triggers
-*
-*  @lib DRMHelperDMgrWrapper
-*  @since S60 v3.1
-*/
-class CDRMHelperDMgrWrapper : CBase,
-                              public MHttpDownloadMgrObserver,
-                              public MDRMHelperDMgrWrapper,
-                              public MProgressDialogCallback
-    {
-
-public:
-
-    static CDRMHelperDMgrWrapper* NewL();
-
-    static CDRMHelperDMgrWrapper* NewLC();
-
-    virtual ~CDRMHelperDMgrWrapper();
-
-    /**
-    * Download a ROAP trigger from URL and handle it
-    *
-    * @since S60 3.1
-    * @param aUrl  URL of ROAP trigger
-    */
-    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
-
-    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv );
-
-    HBufC8* GetErrorUrlL();
-
-
-// from base class MHttpDownloadMgrObserver
-
-    /**
-    * From MHttpDownloadMgrObserver.
-    * Handle download manager events
-    *
-    * @since S60 3.1
-    * @param aDownload the download
-    * @param aEvent the event
-    */
-    void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
-
-public: // Call back methods of MAknProgressDialogCallback
-
-    /**
-    * ProgressDialog call back method.
-    * Get's called when a dialog is dismissed.
-    *
-    * @since S60 3.2
-    * @param aButtonId ID of the button pressed
-    */
-    void DialogDismissedL( TInt aButtonId );
-
-protected:
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    CDRMHelperDMgrWrapper();
-
-    void ConstructL();
-
-    /**
-    * Set the browser default access point to be used
-    *
-    * @since S60 3.0
-    */
-    void SetDefaultAccessPointL();
-
-    void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
-
-    void ShowProgressNoteL( );
-
-    void RemoveProgressNoteL( );
-
-    void HandlePostResponseUrlL();
-
-
-private: // data
-
-    /**
-    * Download manager session
-    */
-    RHttpDownloadMgr iDlMgr;
-
-    /**
-    * Used to make downloads synchronous
-    */
-    CActiveSchedulerWait iWait;
-
-    /**
-    * to store information on download
-    */
-    TBool iDownloadSuccess;
-    TBool iConnectionError;
-
-    TBool iDialogDismissed;
-
-    /**
-    * Progess note dialog and progress info
-    */
-    CAknProgressDialog* iProgressNoteDialog;        // owned
-    CEikProgressInfo* iProgressInfo;                // not owned
-    TInt iCurrentProgressValue;                     // owned
-    TInt iProgressIncrement;                        // owned
-
-    /**
-    * Control environment
-    */
-    CCoeEnv* iCoeEnv;
-
-    /**
-    * Is CoeEnv given
-    */
-    TBool iUseCoeEnv;
-
-    /**
-    * Error url for ROAP temporary error
-    */
-    HBufC8* iErrorUrl;
-
-    /**
-    * Post response url for ROAP prUrl
-    */
-    HBufC8* iPostResponseUrl;
-
-    };
-
-#endif // CDRMHELPERDMGRWRAPPER_H
--- a/omadrm/drmhelper/inc/DRMHelperDMgrWrapperLogger.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Logger utility.
-*
-*/
-
-
-#ifndef DRMUILOGGER_H
-#define DRMUILOGGER_H
-
-
-// INCLUDES
-
-#include <e32std.h>
-#include <e32def.h>
-#include <eikenv.h>
-#include <flogger.h>
-
-
-#ifdef _DEBUG
-#define __TEST_DRM_LOG__
-#endif // _DEBUG
-
-
-#ifdef __TEST_DRM_LOG__
-
-// CONSTANTS
-
-// DRMUI logging directory.
-_LIT( KDRMUILogDir,                   "DRMUI" );
-// DRMUI log file name.
-_LIT( KDRMUILogFile,                  "DMgrWrapper.log" );
-// Format string: enter function.
-_LIT( KDRMUILogEnterFn,               "-> %S" );
-// Format string: leave function.
-_LIT( KDRMUILogLeaveFn,               "<- %S" );
-// Format string: time.
-_LIT( KDRMUILogTimeFormatString,      "%H:%T:%S:%*C2" );
-// Format string: timestamp.
-_LIT( KDRMUILogTimeStampFormatString, "%S %S" );
-//Banner message
-_LIT( KDRMUILogBanner,                "DRMUI 3.2");
-// Message of exit from app
-_LIT( KDRMUILogExit,                  "DRMUI: Application exit");
-
-// DEFINES
-
-// Create the log
-#define CLOG_CREATE                 { FCreate(); }
-
-// Close the log
-#define CLOG_CLOSE                  \
-    {                               \
-    RFileLogger::Write              \
-        (                           \
-        KDRMUILogDir,               \
-        KDRMUILogFile,              \
-        EFileLoggingModeAppend,     \
-        KDRMUILogExit               \
-        );                          \
-    }
-
-// Write log: enter function.
-#define CLOG_ENTERFN( a )           \
-    {                               \
-    _LIT( temp, a );                \
-    RFileLogger::WriteFormat        \
-        (                           \
-        KDRMUILogDir,               \
-        KDRMUILogFile,              \
-        EFileLoggingModeAppend,     \
-        KDRMUILogEnterFn,           \
-        &temp                       \
-        );                          \
-    }
-
-// Write log: leave function.
-#define CLOG_LEAVEFN( a )           \
-    {                               \
-    _LIT( temp, a );                \
-    RFileLogger::WriteFormat        \
-        (                           \
-        KDRMUILogDir,               \
-        KDRMUILogFile,              \
-        EFileLoggingModeAppend,     \
-        KDRMUILogLeaveFn,           \
-        &temp                       \
-        );                          \
-    }
-
-// Write log: string 'a'.
-#define CLOG_WRITE( a )             \
-    {                               \
-    _LIT( temp, a );                \
-    RFileLogger::Write              \
-        (                           \
-        KDRMUILogDir,               \
-        KDRMUILogFile,              \
-        EFileLoggingModeAppend,     \
-        temp                        \
-        );                          \
-    }
-
-// Write log: formatted.
-#define CLOG_WRITE_FORMAT( a, b )   \
-    {                               \
-    _LIT( temp, a );                \
-    RFileLogger::WriteFormat        \
-        (                           \
-        KDRMUILogDir,               \
-        KDRMUILogFile,              \
-        EFileLoggingModeAppend,     \
-        temp,                       \
-        b                           \
-        );                          \
-    }
-
-// Write log: timestamp.
-#define CLOG_WRITE_TIMESTAMP( a )                                   \
-    {                                                               \
-    _LIT( temp, a );                                                \
-    TTime time;                                                     \
-    time.HomeTime();                                                \
-    TBuf<32> timeBuf;                                               \
-    TRAPD( err, time.FormatL( timeBuf, KDRMUILogTimeFormatString ) ); \
-    if ( !err )                                                     \
-        {                                                           \
-        RFileLogger::WriteFormat                                    \
-            (                                                       \
-            KDRMUILogDir,                                           \
-            KDRMUILogFile,                                          \
-            EFileLoggingModeAppend,                                 \
-            KDRMUILogTimeStampFormatString,                         \
-            &temp,                                                  \
-            &timeBuf                                                \
-            );                                                      \
-        }                                                           \
-    }
-
-// Write formatted
-#define CLOG_WRITEF                 FPrint
-
-
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    RFileLogger::WriteFormat( KDRMUILogDir, KDRMUILogFile, 
-                              EFileLoggingModeAppend, aFmt, list );
-    }
-
-
-inline void FPrint( const TDesC& aDes )
-    {
-    RFileLogger::WriteFormat( KDRMUILogDir, KDRMUILogFile, 
-                              EFileLoggingModeAppend, aDes );
-    }
-
-
-inline void FCreate()
-    {
-    TFileName path( _L( "c:\\logs\\" ) );
-    path.Append( KDRMUILogDir );
-    path.Append( _L( "\\" ) );
-    RFs& fs = CEikonEnv::Static()->FsSession();
-    fs.MkDirAll( path );
-    RFileLogger::WriteFormat( KDRMUILogDir, KDRMUILogFile, 
-                              EFileLoggingModeOverwrite, KDRMUILogBanner );
-    }
-
-
-#else // not defined __TEST_DRM_LOG__
-
-inline void FPrint( const TRefByValue<const TDesC> /*aFmt*/, ... ) {};
-
-
-// DEFINES
-
-// Empty definition (disable log).
-#define CLOG_CREATE
-
-// Empty definition (disable log).
-#define CLOG_CLOSE
-
-// Empty definition (disable log).
-#define CLOG_ENTERFN( a )
-
-// Empty definition (disable log).
-#define CLOG_LEAVEFN( a )
-
-// Empty definition (disable log).
-#define CLOG_WRITE( a )
-
-// Empty definition (disable log).
-#define CLOG_WRITE_FORMAT( a, b )
-
-// Empty definition (disable log).
-#define CLOG_WRITE_TIMESTAMP( a )
-
-// Empty definition (disable log).
-#define CCDLGLOGGER_WRITEF   1 ? ((void)0) : FPrint
-
-#endif // __TEST_DRM_LOG__
-
-#endif // DRMUILOGGER_H
--- a/omadrm/drmhelper/inc/DRMHelperDownloadManager.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/inc/DRMHelperDownloadManager.h	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,7 @@
 #include <e32base.h>
 #include <ConeResLoader.h>
 
-class CDRMHelperDMgrWrapper;
+class CDrmUtilityDmgrWrapper;
 
 /**
  *  This class encapsulates Download manager functionality.
@@ -33,7 +33,7 @@
 NONSHARABLE_CLASS(CDrmHelperDownloadManager) : public CBase
     {
 public:
-    
+
     static CDrmHelperDownloadManager* NewL();
     virtual ~CDrmHelperDownloadManager();
 
@@ -46,12 +46,12 @@
     void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv );
 
     void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
-    
+
     HBufC8* GetErrorUrlL();
 
 
 protected:
-            
+
 private:
 
     CDrmHelperDownloadManager();
@@ -60,10 +60,10 @@
 private:
 
     /**
-	 * Download manager handler
-	 */
+     * Download manager handler
+     */
     RLibrary iDMgrDll;
-    CDRMHelperDMgrWrapper* iDMgrHandler;
+    CDrmUtilityDmgrWrapper* iDMgrHandler;
     };
 
-#endif      // CDRMHELPERDOWNLOADMANAGER_H   
+#endif      // CDRMHELPERDOWNLOADMANAGER_H
--- a/omadrm/drmhelper/inc/DRMHelperGlobalNoteWrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/inc/DRMHelperGlobalNoteWrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <StringResourceReader.h>
+#include <stringresourcereader.h>
 
 // CONSTANTS
 const TInt KDRMNoteBufferMaxSize ( 256 );
--- a/omadrm/drmhelper/inc/DRMHelperInfoNoteWrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/inc/DRMHelperInfoNoteWrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <aknglobalnote.h>
+#include <AknGlobalNote.h>
 // CONSTANTS
 
 // MACROS
@@ -44,14 +44,14 @@
 NONSHARABLE_CLASS ( CDRMHelperInfoNoteWrapper ) : public CActive
     {
     public:  // Constructors and destructor
-        
+
         /**
         * Two-phased constructor.
         */
         static CDRMHelperInfoNoteWrapper* NewL();
-        
+
         static CDRMHelperInfoNoteWrapper* NewLC();
-        
+
         /**
         * Destructor.
         */
@@ -63,31 +63,31 @@
         /**
         * Synchronous wrapper for showing global note.
         * @param aType type of Info note to be displayed
-        * @param aNoteText string containing note text       
+        * @param aNoteText string containing note text
         * @param aResource resource identifier
-        * @param aString is transferred for CoverUi string data     
+        * @param aString is transferred for CoverUi string data
         * @param aValue is transferred for CoverUi numerical data
         * @return button code
         */
-        void ShowNoteL(  TAknGlobalNoteType aType, 
+        void ShowNoteL(  TAknGlobalNoteType aType,
                          const TDesC& aNoteText,
-                         TInt aResourceId = -1, 
+                         TInt aResourceId = -1,
                          const TDesC& aString = KNullDesC,
                          TInt aValue = -1 );
 
         /**
         * Synchronous wrapper for showing global note.
         * @param[inout] aResourceId takes primary display
-        *               resource ID and returns CoverUiId     
+        *               resource ID and returns CoverUiId
         * @return       boolean if ID was valid CoverUiId
         */
         static TBool EvaluateCoverResourceId( TInt& aResourceId );
-    
+
     private: // From CActive
-    
-    	void DoCancel();
-    	void RunL();
-        
+
+        void DoCancel();
+        void RunL();
+
     private:
 
         /**
@@ -98,14 +98,14 @@
         /**
         * By default Symbian 2nd phase constructor is private.
         */
-        void ConstructL();        
-       
+        void ConstructL();
+
     private:    // Data
-        CAknGlobalNote* iNote; 
+        CAknGlobalNote* iNote;
     };
 
 
-#endif      // __DRMHELPERINFONOTEWRAPPER_H__   
-            
+#endif      // __DRMHELPERINFONOTEWRAPPER_H__
+
 // End of File
 
--- a/omadrm/drmhelper/src/ConsumeData.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/src/ConsumeData.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -18,7 +18,7 @@
 
 // INCLUDE FILES
 #include <e32std.h>
-#include "consumedata.h"
+#include "ConsumeData.h"
 
 // LOCAL CONSTANTS AND MACROS
 
@@ -32,34 +32,34 @@
 CConsumeData::CConsumeData() : CBase()
     {
     }
-    
+
 // -----------------------------------------------------------------------------
 // CConsumeData::~ConsumeData
 // C++ default destructor
 // -----------------------------------------------------------------------------
-//    
+//
 CConsumeData::~CConsumeData()
     {
     // If the connection is still open call finish
-    if( iConnectionStatus && iContentURI8 ) 
+    if( iConnectionStatus && iContentURI8 )
         {
-        iRdb.Consume( ContentAccess::EStop, *iContentURI8 );    
+        iRdb.Consume( ContentAccess::EStop, *iContentURI8 );
         }
-    
+
     // Close the connection to the server:
     iRdb.Close();
-    
+
     // Reset the connection status
     iConnectionStatus = EFalse;
-        
+
     // Delete the content id
     if( iContentURI8 )
         {
         delete iContentURI8;
-        iContentURI8 = NULL;    
+        iContentURI8 = NULL;
         }
     }
-    
+
 
 // -----------------------------------------------------------------------------
 // CConsumeData::NewLC
@@ -73,7 +73,7 @@
     self->ConstructL( aUri );
     return self;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CConsumeData::NewL
 // 2-phase constructor
@@ -83,8 +83,8 @@
     {
     CConsumeData* self = NewLC( aUri );
     CleanupStack::Pop( self );
-    return self;        
-    }    
+    return self;
+    }
 
 // -----------------------------------------------------------------------------
 // CConsumeData::Consume
@@ -93,21 +93,21 @@
 TInt CConsumeData::Consume( const ContentAccess::TIntent& aIntent )
     {
     TInt retVal = KErrNone;
-    
+
     if( !iConnectionStatus )
         {
-        return KErrNotReady;    
+        return KErrNotReady;
         }
-        
+
     retVal = iRdb.Consume( aIntent, *iContentURI8 );
 
     if( aIntent == ContentAccess::EStop )
         {
         iRdb.Close();
-        iConnectionStatus = EFalse;    
+        iConnectionStatus = EFalse;
         }
-        
-    return retVal;    
+
+    return retVal;
     }
 // -----------------------------------------------------------------------------
 // CConsumeData::CompareUri
@@ -117,9 +117,9 @@
     {
     if( !iContentURI8 )
         {
-        return KErrNotReady;    
+        return KErrNotReady;
         }
-        
+
     return iContentURI8->Des().Compare( aUri );
     }
 
@@ -135,9 +135,9 @@
 
     // Set the connection status
     iConnectionStatus = ETrue;
-    
+
     // copy the url for internal use
-    iContentURI8 = aUri.AllocL();    
+    iContentURI8 = aUri.AllocL();
     }
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
--- a/omadrm/drmhelper/src/DRMHelperClient.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,613 +0,0 @@
-/*
-* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of the Helper Client session functionality 
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32std.h>
-#include <e32math.h>
-#include <drmcommon.h>
-#include "DRMHelperCommon.h"
-#include "DRMHelperClient.h"
-
-
-// LOCAL CONSTANTS AND MACROS
-// Number of message slots to reserve for this client server session.
-// Since we only communicate synchronously here, we never have any
-// outstanding asynchronous requests.
-LOCAL_C const TUint KDefaultMessageSlots = 0;
-LOCAL_C const TUid KServerUid3 = {0x101F6DC5};
-
-#ifdef __WINS__
-LOCAL_C const TUint KServerMinHeapSize =  0x1000;  //  4K
-LOCAL_C const TUint KServerMaxHeapSize = 0x10000;  // 64K
-#endif
-
-// ============================ LOCAL FUNCTIONS ===============================
-#ifdef _DRM_TESTING
-LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs );
-LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName );
-LOCAL_C void CreateLogL();
-LOCAL_C void WriteL( const TDesC& aText );
-LOCAL_C void WriteL( const TDesC8& aText );
-LOCAL_C void WriteCurrentTimeL();
-#endif
-
-
-LOCAL_C TInt FromFileNameToUri(const TDesC16& aFileName , HBufC8*& aContentUri );
-LOCAL_C TInt CheckExpiration( const TDesC8& aUri , TTime& aEndTime , TInt& aCountLeft );
-LOCAL_C TInt StartServer();
-LOCAL_C TInt CreateServerProcess();
-
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::RDRMHelperClient
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-EXPORT_C RDRMHelperClient::RDRMHelperClient()
-:   RSessionBase()
-    {
-    // No implementation required
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::Connect
-// 
-// Connect to the server session
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::Connect()
-    {
-#ifdef _DRM_TESTING
-    TRAPD( err , CreateLogL() );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteL(_L("Connect")) );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteCurrentTimeL() );
-    if (err)
-        {
-        return err;
-        }
-#endif
-    TInt error = StartServer();
-
-    if (KErrNone == error)
-        {
-
-        error = CreateSession(KDRMHelperServerName,
-                              Version(),
-                              KDefaultMessageSlots);
-        }
-    return error;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::Version
-// 
-// return server version
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TVersion RDRMHelperClient::Version() const
-    {
-    return(TVersion(KDRMHSMajorVersionNumber,
-                    KDRMHSMinorVersionNumber,
-                    KDRMHSBuildVersionNumber));
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::SetAutomated
-// 
-// Register one content uri to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::SetAutomated( const TDesC8& aUri , const TInt& aType ) const
-    {
-    TInt temp = aType;
-    TPtrC8 descriptor(aUri);
-
-    // This call waits for the server to complete the request before 
-    // proceeding. 
-    return SendReceive(ERegister, TIpcArgs( &descriptor, temp ) );
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::SetAutomated
-// 
-// Register one file to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::SetAutomated( const TDesC16& aFileName , const TInt& aType ) const
-    {
-    TInt temp = aType;
-    TPtrC8 descriptor( NULL , 0 );
-   
-    descriptor.Set( reinterpret_cast<const TUint8*>( aFileName.Ptr() ), aFileName.Length()*2);
-
-    // This call waits for the server to complete the request before 
-    // proceeding. 
-    return SendReceive(ERegisterFile, TIpcArgs( &descriptor, temp ) );
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::RemoveAutomated
-// 
-// Register one content uri to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::RemoveAutomated( const TDesC8& aUri , const TInt& aType ) const
-    {
-    TInt temp = aType;
-    TPtrC8 descriptor(aUri);
-
-    // This call waits for the server to complete the request before 
-    // proceeding.
-    return SendReceive(ERemove, TIpcArgs( &descriptor, temp ) );
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::RemoveAutomated
-// 
-// Register one file to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::RemoveAutomated( const TDesC16& aFileName , const TInt& aType ) const
-    {
-    TInt temp = aType;
-    TPtrC8 descriptor( NULL , 0 );
-
-    descriptor.Set( reinterpret_cast<const TUint8*>( aFileName.Ptr() ), aFileName.Length()*2);
-
-    // This call waits for the server to complete the request before 
-    // proceeding. 
-    return SendReceive(ERemoveFile, TIpcArgs( &descriptor ) );
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::IndicateIdle
-// 
-// Register one file to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::IndicateIdle() const
-    {
-    return SendReceive(EIndicateIdle, TIpcArgs());
-    }
-
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::CanSetAutomated
-// 
-// Register one content uri to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::CanSetAutomated( const TDesC8& aUri , TBool& aValue ) const
-    {
-    TTime endTime;
-    TTime temp;
-    TInt countsLeft = 0;
-    TInt err = 0;
-    temp.Set( KNullDate );
-    endTime.Set( KNullDate );
-
-    err = CheckExpiration( aUri , endTime , countsLeft );
-    if ( endTime != temp )
-        {
-        aValue = ETrue;
-        }
-    else
-        {
-        aValue = EFalse;
-        }
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::CanSetAutomated
-// 
-// Register one file to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::CanSetAutomated( const TDesC16& aFileName , TBool& aValue ) const
-    {
-    HBufC8* contentUri = NULL;
-    TInt err = 0;
-    err = FromFileNameToUri( aFileName , contentUri );
-    if (err)
-        {
-        return err;
-        }
-    err = CanSetAutomated( contentUri->Des() , aValue );
-    delete contentUri;
-    return err;
-    }
-
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::IsAutomated
-// 
-// Register one content uri to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::IsAutomated( const TDesC8& aUri , TInt& aType , TBool& aIs ) 
-    {
-    TPtr8 type( reinterpret_cast< TUint8* >( &aType ),
-               0, 
-               sizeof( TInt ) );
-    TPtr8 flag( reinterpret_cast< TUint8* >( &aIs ),
-               0, 
-               sizeof( TInt ) );
-
-    TPtrC8 descriptor(aUri);
-
-    // This call waits for the server to complete the request before 
-    // proceeding. 
-    return SendReceive(EIsRegistered, TIpcArgs( &type, &descriptor, &flag ) );
-    }
-
-// -----------------------------------------------------------------------------
-// RDRMHelperClient::IsAutomated
-// 
-// Register one file to the helper server
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt RDRMHelperClient::IsAutomated( const TDesC16& aFileName , TInt& aType , TBool& aIs ) 
-    {
-    TPtr8 type( reinterpret_cast< TUint8* >( &aType ),
-               0, 
-               sizeof( TInt ) );
-    TPtr8 flag( reinterpret_cast< TUint8* >( &aIs ),
-               0, 
-               sizeof( TInt ) );
-
-    TPtrC8 descriptor( NULL , 0 );
-
-    
-    descriptor.Set( reinterpret_cast<const TUint8*>( aFileName.Ptr() ), aFileName.Length()*2);
-
-    // This call waits for the server to complete the request before 
-    // proceeding. 
-    return SendReceive(EIsRegisteredFile, TIpcArgs( &type, &descriptor, &flag ) );
-
-    }
-
-
-
-// ============================= LOCAL FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-// StartServer
-// 
-// Start the helper server
-// -----------------------------------------------------------------------------
-//
-LOCAL_C TInt StartServer()
-    {
-
-#ifdef _DRM_TESTING
-    TRAPD( err , WriteL(_L("StartServer")) );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteCurrentTimeL() );
-    if (err)
-        {
-        return err;
-        }
-#endif
-    TInt result = 0;
-
-    TFindServer findHelperServer(KDRMHelperServerName);
-    TFullName name;
-
-    result = findHelperServer.Next(name);
-    if (result == KErrNone)
-        {
-        // Server already running
-        return KErrNone;
-        }
-
-    RSemaphore semaphore;       
-    result = semaphore.CreateGlobal(KDRMHelperServerSemaphoreName, 0);
-    if (result != KErrNone)
-        {
-        return  result;
-        }
-
-    result = CreateServerProcess();
-    if (result != KErrNone)
-        {
-        semaphore.Close(); 
-        return  result;
-        }
-
-    semaphore.Wait();
-    semaphore.Close();       
-
-    return  KErrNone;
-    }
-
-LOCAL_C TInt CreateServerProcess()
-    {
-#ifdef _DRM_TESTING
-    TRAPD( err , WriteL(_L("CreateServerProcess")) );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteCurrentTimeL() );
-    if (err)
-        {
-        return err;
-        }
-#endif
-    TInt result;
-
-    const TUidType serverUid(KNullUid, KNullUid, KServerUid3);
-
-#ifdef __WINS__
-
-    RLibrary lib;
-    result = lib.Load( KDRMHSServerFileName , serverUid );
-    if (result != KErrNone)
-        {
-        return  result;
-        }
-
-#ifdef _DRM_TESTING
-    TRAP( err , WriteL(_L("library is loaded")) );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteCurrentTimeL() );
-    if (err)
-        {
-        return err;
-        }
-#endif
-
-    //  Get the WinsMain function
-    TLibraryFunction functionWinsMain = lib.Lookup(1);
-
-    //  Call it and cast the result to a thread function
-    TThreadFunction serverThreadFunction = reinterpret_cast<TThreadFunction>(functionWinsMain());
-
-    TName threadName(KDRMHelperServerName);
-
-    // Append a random number to make it unique
-    threadName.AppendNum(Math::Random(), EHex);
-
-    RThread server;
-
-    result = server.Create(threadName,   // create new server thread
-                             serverThreadFunction, // thread's main function
-                             KDefaultStackSize,
-                             NULL,
-                             &lib,
-                             NULL,
-                             KServerMinHeapSize,
-                             KServerMaxHeapSize,
-                             EOwnerProcess);
-
-
-
-    lib.Close();    // if successful, server thread has handle to library now
-
-    if (result != KErrNone)
-        {
-        return  result;
-        }
-#ifdef _DRM_TESTING
-    TRAP( err , WriteL(_L("server thread is created")) );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteCurrentTimeL() );
-    if (err)
-        {
-        return err;
-        }
-#endif
-    server.SetPriority(EPriorityMore);
-
-
-#else
-
-    RProcess server;
-    result = server.Create( KDRMHSServerFileName, KNullDesC, serverUid);
-    if (result != KErrNone)
-        {
-        return  result;
-        }
-#ifdef _DRM_TESTING
-    TRAP( err , WriteL(_L("server thread is created")) );
-    if (err)
-        {
-        return err;
-        }
-    TRAP( err , WriteCurrentTimeL() );
-    if (err)
-        {
-        return err;
-        }
-#endif
-
-#endif
-
-    server.Resume();
-    server.Close();
-
-    return  KErrNone;
-    }
-
-LOCAL_C TInt FromFileNameToUri(const TDesC16& aFileName , HBufC8*& aContentUri )
-    {
-    DRMAuthenticated* c = NULL;
-    DRMCommon::TContentProtection protection;
-    HBufC8* mimeType = NULL;
-    TUint dataLen = 0;
-    TRAPD(err , c = DRMAuthenticated::NewL());
-    if (err)
-        {
-        return err;
-        }
-    err = c->GetFileInfo(
-        aFileName,
-        protection,
-        mimeType,
-        aContentUri,
-        dataLen);
-    delete mimeType;
-    if (err)
-        {
-        delete aContentUri;
-        aContentUri = NULL;
-        }
-    return err;
-    }
-
-
-LOCAL_C TInt CheckExpiration( const TDesC8& aUri , TTime& aEndTime , TInt& aCountLeft )
-    {
-    DRMAuthenticated* c = NULL;
-    CDRMRights* right = NULL;
-    TRAPD( err  , c = DRMAuthenticated::NewL() );
-    if (err)
-        {
-        return err;
-        }
-    err = c->GetActiveRights( aUri , 
-        DRMCommon::EPlay | DRMCommon::EExecute | DRMCommon::EPrint | DRMCommon::EDisplay , 
-        right );
-    if (!err)
-        {
-        err = right->GetExpirationDetails(
-            DRMCommon::EPlay | DRMCommon::EExecute | DRMCommon::EPrint | DRMCommon::EDisplay,
-            aEndTime,
-            aCountLeft);
-        }
-    delete right;
-    delete c;
-    return err;
-    }
-
-#ifdef _DRM_TESTING
-
-LOCAL_C void WriteLogL( const TDesC8& text , RFs &aFs )
-    {
-    _LIT( KLogFile , "c:\\HSClientLog.txt" );
-    WriteFileL( text , aFs , KLogFile );
-    }
-
-LOCAL_C void WriteFileL( const TDesC8& text , RFs &aFs , const TDesC& aName )
-    {
-    RFile file;
-    TInt size;
-    User::LeaveIfError( file.Open( aFs, aName , EFileWrite ) );
-    CleanupClosePushL( file );
-    User::LeaveIfError( file.Size( size ) );
-    User::LeaveIfError( file.Write( size, text ) );
-    CleanupStack::PopAndDestroy(); //file
-    }
-
-LOCAL_C void CreateLogL()
-    {
-    RFs fs;
-    User::LeaveIfError(fs.Connect());
-    CleanupClosePushL(fs);
-    RFile file;
-    User::LeaveIfError( file.Replace( fs , _L("c:\\HSClientLog.txt") , EFileWrite ) );
-    file.Close();
-    CleanupStack::PopAndDestroy(); //fs
-    }
-
-LOCAL_C void WriteL( const TDesC& aText )
-    {
-    RFs fs;
-    User::LeaveIfError( fs.Connect() );
-    CleanupClosePushL(fs);
-    HBufC8* text = HBufC8::NewLC(1000);
-    TPtr8 textptr(text->Des() );
-    textptr.Append( aText );
-    textptr.Append( _L("\r\n") );
-    WriteLogL(textptr , fs);
-    CleanupStack::PopAndDestroy(text);
-    CleanupStack::PopAndDestroy(); //fs
-    }
-
-LOCAL_C void WriteL( const TDesC8& aText )
-    {
-    RFs fs;
-    User::LeaveIfError( fs.Connect() );
-    CleanupClosePushL(fs);
-    HBufC8* text = HBufC8::NewLC(1000);
-    TPtr8 textptr(text->Des() );
-    textptr.Append( aText );
-    textptr.Append( _L8("\r\n") );
-    WriteLogL(textptr , fs);
-    CleanupStack::PopAndDestroy(text);
-    CleanupStack::PopAndDestroy(); //fs
-    }
-
-
-LOCAL_C void WriteCurrentTimeL()
-    {
-    RFs fs;
-    User::LeaveIfError( fs.Connect() );
-    CleanupClosePushL(fs);
-    HBufC8* text = HBufC8::NewLC(100);
-    TPtr8 textptr(text->Des() );
-// Date and Time display
-    TTime time;
-    time.HomeTime();
-    TBuf<256> dateString;
-    _LIT(KDate,"%*E%*D%X%*N%*Y %1 %2 '%3");
-    time.FormatL(dateString,KDate);
-    textptr.Append(_L( "\r\n\t\tData:\t" ) );
-    textptr.Append( dateString );
-    _LIT(KTime,"%-B%:0%J%:1%T%:2%S%:3%+B");
-    time.FormatL(dateString,KTime);
-    textptr.Append(_L( "\r\n\t\tTime:\t" ) );
-    textptr.Append( dateString );
-    textptr.Append(_L( "\r\n" ) );
-    textptr.Append(_L( "\r\n" ) );
-    WriteLogL(textptr , fs);
-    CleanupStack::PopAndDestroy(text);
-    CleanupStack::PopAndDestroy(); //fs
-    }
-#endif
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-// Epoc DLL entry point, return that everything is ok
-GLDEF_C TInt E32Dll(TDllReason)
-    {
-    return KErrNone;
-    }
-
-//  End of File
--- a/omadrm/drmhelper/src/DRMHelperDMgrWrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,723 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Dynamically loadable wrapper for Download manager
-*
-*/
-
-#include <centralrepository.h>
-#include <cdblen.h>
-
-#include <cmconnectionmethod.h>
-#include <cmdestination.h>
-#include <cmconnectionmethoddef.h>
-#include <cmmanager.h>
-
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <browseruisdkcrkeys.h>
-#endif
-
-#ifdef RD_MULTIPLE_DRIVE
-#include <driveinfo.h>
-#endif
-
-#include <stringloader.h>
-#include <data_caging_path_literals.hrh>
-
-#include <coneresloader.h>
-#include <apparc.h>
-
-#include <drmhelperdmgrwrapper.rsg>
-
-#include "roapeng.h"
-#include "roapsyncwrapper.h"
-#include "roapdef.h"
-#include "drmhelperdmgrwrapper.h"
-#include "drmhelperdmgrwrapperlogger.h"
-
-// DEBUG macros
-#ifdef _DEBUG
-#define DRMDEBUGLIT( a, b ) \
-_LIT( a , b )
-#define DRMDEBUG( a ) \
-RDebug::Print( a )
-#define DRMDEBUG2( a, b ) \
-RDebug::Print( a, b )
-#else
-#define DRMDEBUGLIT( a, b )
-#define DRMDEBUG( a )
-#define DRMDEBUG2( a, b )
-#endif
-
-// CONSTANTS
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser = {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint = 0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-#endif
-
-// CONSTANTS
-#ifndef RD_MULTIPLE_DRIVE
-_LIT( KDriveZ, "z:" );
-_LIT( KHelperTriggerFilePath, "d:\\" );
-#endif
-
-_LIT( KCDRMHelperDMgrWrapperResFileName,"DRMHelperDMgrWrapper.rsc" );
-const TInt KProgressInfoFinalValue( 200 );
-const TInt KProgressInfoIncrementSmall( 5 );
-const TInt KProgressInfoIncrementMedium( 10 );
-const TInt KProgressInfoIncrementLarge( 30 );
-
-// ======== LOCAL FUNCTIONS ========
-LOCAL_C void DeleteHttpDowload( TAny* aDownload )
-    {
-    reinterpret_cast< RHttpDownload* >( aDownload )->Delete();
-    }
-
-// ---------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
-// ---------------------------------------------------------------------------
-//
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
-    RCmManager& aCmManager,
-    const TUint32 aDefaultSnap )
-    {
-    RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
-    CleanupClosePushL( dest );
-    TUint32 iapIdOfDest( 0 );
-
-    if ( dest.ConnectionMethodCount() <= 0 )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-    CleanupClosePushL( cMeth );
-
-    iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-    CleanupStack::PopAndDestroy( &cMeth );
-    CleanupStack::PopAndDestroy( &dest );
-    return iapIdOfDest;
-    }
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::CDRMHelperDMgrWrapper
-// ---------------------------------------------------------------------------
-//
-CDRMHelperDMgrWrapper::CDRMHelperDMgrWrapper() :
-    iUseCoeEnv( EFalse )
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::ConstructL()
-    {
-    CLOG_WRITE( "DMgrWrapper::ConstructL" );
-    const TInt KDrmHelperDMgrWrapperUid = 0x102823D9;
-    iDlMgr.ConnectL( TUid::Uid(KDrmHelperDMgrWrapperUid), *this, EFalse );
-    iProgressInfo = NULL;
-    iProgressNoteDialog = NULL;
-    iDialogDismissed = ETrue;
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::NewL
-// ---------------------------------------------------------------------------
-//
-CDRMHelperDMgrWrapper* CDRMHelperDMgrWrapper::NewL()
-    {
-    CLOG_WRITE( "DMgrWrapper::NewL" );
-    CDRMHelperDMgrWrapper* self( CDRMHelperDMgrWrapper::NewLC() );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::NewLC
-// ---------------------------------------------------------------------------
-//
-CDRMHelperDMgrWrapper* CDRMHelperDMgrWrapper::NewLC()
-    {
-    CLOG_WRITE( "DMgrWrapper::NewLC" );
-    CDRMHelperDMgrWrapper* self( new( ELeave ) CDRMHelperDMgrWrapper() );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::~CDRMHelperDMgrWrapper
-// ---------------------------------------------------------------------------
-//
-CDRMHelperDMgrWrapper::~CDRMHelperDMgrWrapper()
-    {
-    CLOG_WRITE( "DMgrWrapper destructor" );
-    if ( iProgressNoteDialog )
-       {
-       // deletes the dialog
-       TRAPD( err, iProgressNoteDialog->ProcessFinishedL() );
-       if ( err )
-           {
-           delete iProgressNoteDialog;
-           }
-       iProgressNoteDialog = NULL;
-       }
-    delete iErrorUrl;
-    delete iPostResponseUrl;
-
-#ifdef _DEBUG
-
-    if ( iDlMgr.Handle() )
-        {
-        iDlMgr.Close();
-        }
-
-#else
-
-    iDlMgr.Close();
-
-#endif
-
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl )
-    {
-    CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" );
-    iUseCoeEnv = EFalse;
-    DoDownloadAndHandleRoapTriggerL( aUrl );
-    HandlePostResponseUrlL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::DownloadAndHandleRoapTriggerL(
-    const HBufC8* aUrl, CCoeEnv& aCoeEnv )
-    {
-    CLOG_WRITE( "DMgrWrapper::DownloadAndHandleRoapTriggerL" );
-    iCoeEnv = &aCoeEnv;
-    iUseCoeEnv = ETrue;
-    DoDownloadAndHandleRoapTriggerL( aUrl );
-    HandlePostResponseUrlL();
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::HandlePostResponseUrlL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::HandlePostResponseUrlL()
-    {
-    if ( iPostResponseUrl )
-        {
-        DoDownloadAndHandleRoapTriggerL( iPostResponseUrl );
-        // prevent infinite post response fetches.
-        delete iPostResponseUrl;
-        iPostResponseUrl = NULL;
-
-        // Ensure progress note gets deleted.
-        // It remains open if prUrl initialted ROAP operation has PrUrl
-        // (unsupported chained metering report)
-        RemoveProgressNoteL();
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::DoDownloadAndHandleRoapTriggerL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::DoDownloadAndHandleRoapTriggerL(
-    const HBufC8* aUrl )
-    {
-    RFs fs;
-    RFile roapTrigger;
-    HBufC8* triggerBuf( NULL );
-    TBool result( EFalse );
-    TFileName triggerFileName;
-
-    CLOG_WRITE( "DMgrWrapper::DoDownloadAndHandleRoapTriggerL" );
-    User::LeaveIfError( fs.Connect() );
-    CleanupClosePushL( fs );
-    User::LeaveIfError( fs.ShareProtected() );
-
-
-#ifndef RD_MULTIPLE_DRIVE
-
-    User::LeaveIfError( roapTrigger.Temp(
-            fs, KHelperTriggerFilePath, triggerFileName, EFileWrite ) );
-
-#else //RD_MULTIPLE_DRIVE
-
-    _LIT( KDrive, "%c:\\");
-    TInt driveNumber( -1 );
-    TChar driveLetter;
-    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber );
-    fs.DriveToChar( driveNumber, driveLetter );
-
-    TFileName helperTriggerFilePath;
-
-    helperTriggerFilePath.Format( KDrive, (TUint)driveLetter );
-
-    User::LeaveIfError( roapTrigger.Temp(
-            fs, helperTriggerFilePath, triggerFileName, EFileWrite ) );
-
-#endif
-
-    TPtrC8 KNullPtr8( NULL, 0 );
-    RHttpDownload* downloadPtr( iDlMgr.FindDownload( *aUrl, KNullPtr8 ) );
-    if ( downloadPtr )
-        {
-        // Stale download found.
-        // Remove it, and re-create a new download.
-        downloadPtr->Delete();
-        downloadPtr = NULL;
-        }
-
-    // create and start download
-    RHttpDownload& download = iDlMgr.CreateDownloadL( *aUrl, result );
-    // Put download for proper cleanup.
-    TCleanupItem item( DeleteHttpDowload, &download );
-    CleanupStack::PushL( item );
-
-    CleanupClosePushL( roapTrigger );
-
-    if ( !iPostResponseUrl )
-        {
-        // No post response retieval. Note must be created.
-        ShowProgressNoteL();
-        }
-
-    if ( result )
-        {
-        const TInt KReadBufSize( 512 );
-        TInt triggerFileSize( 0 );
-
-        CLOG_WRITE(
-            "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download created" );
-        iDownloadSuccess = EFalse;
-        iConnectionError = EFalse;
-
-        SetDefaultAccessPointL();
-
-        User::LeaveIfError( download.SetFileHandleAttribute( roapTrigger ) );
-        User::LeaveIfError(
-            download.SetBoolAttribute( EDlAttrNoContentTypeCheck, ETrue ) );
-        User::LeaveIfError( download.Start() );
-
-        // wait until download is finished
-        iWait.Start();
-
-        // Check success of download
-        CLOG_WRITE(
-            "DMgrWrapper::DoDownloadAndHandleRoapTriggerL: download finished" );
-
-        CleanupStack::Pop( &roapTrigger );
-        roapTrigger.Close();
-        if ( !iDownloadSuccess )
-            {
-            RemoveProgressNoteL();
-            if ( iConnectionError )
-                {
-                User::Leave( KErrCouldNotConnect );
-                }
-            else
-                {
-                User::Leave( KErrGeneral );
-                }
-            }
-        User::LeaveIfError( roapTrigger.Open( fs,
-                                              triggerFileName,
-                                              EFileShareReadersOrWriters ) );
-        CleanupClosePushL( roapTrigger );
-
-        // Get filehandle of ROAP trigger
-        // Read file to buffer
-        User::LeaveIfError( roapTrigger.Size( triggerFileSize ) );
-        triggerBuf = HBufC8::NewLC( triggerFileSize );
-
-        RBuf8 readBuf;
-        readBuf.CleanupClosePushL();
-        readBuf.CreateL( KReadBufSize );
-
-        User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) );
-        triggerBuf->Des().Copy( readBuf );
-        while ( readBuf.Length() == KReadBufSize )
-            {
-            User::LeaveIfError( roapTrigger.Read( readBuf, KReadBufSize ) );
-            triggerBuf->Des().Append( readBuf );
-            }
-
-        CleanupStack::PopAndDestroy( &readBuf );
-
-        if ( iUseCoeEnv && iProgressInfo )
-            {
-            iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium );
-            }
-
-        // And let ROAP handle it...
-        CRoapSyncWrapper* roapWrapper( CRoapSyncWrapper::NewL() );
-        CleanupStack::PushL( roapWrapper );
-        TRAPD( err, roapWrapper->HandleTriggerL( *triggerBuf ) );
-        if ( err )
-            {
-            TInt errorType( 0 );
-            TRAPD( err2, iErrorUrl =
-                roapWrapper->GetErrorUrlL( err, errorType ) );
-            if ( err2 )
-                {
-                RemoveProgressNoteL();
-                delete iErrorUrl;
-                iErrorUrl = NULL;
-                User::Leave( err2 );
-                }
-            else if ( errorType != KErrRoapTemporary )
-                {
-                RemoveProgressNoteL();
-                delete iErrorUrl;
-                iErrorUrl = NULL;
-                User::Leave( err );
-                }
-            else
-                {
-                RemoveProgressNoteL();
-                User::Leave( err );
-                }
-            }
-        if ( iPostResponseUrl )
-            {
-            delete iPostResponseUrl;
-            iPostResponseUrl = NULL;
-            }
-        iPostResponseUrl = roapWrapper->GetPostResponseUrlL();
-        CleanupStack::PopAndDestroy( 2, triggerBuf );
-
-        if ( iUseCoeEnv && iProgressInfo && !iPostResponseUrl )
-            {
-            // No PrUrl found. Progess is complete.
-            iProgressInfo->SetAndDraw( KProgressInfoFinalValue );
-            }
-        }
-
-    // Trick to keep note open long enough during prUrl retrieval
-    if ( !iPostResponseUrl )
-        {
-        RemoveProgressNoteL();
-        }
-    else
-        {
-        if ( iUseCoeEnv && iProgressInfo )
-            {
-            iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium );
-            }
-        }
-
-    CleanupStack::PopAndDestroy( &roapTrigger );
-    CleanupStack::PopAndDestroy( &download );
-
-    fs.Delete(triggerFileName);
-    CleanupStack::PopAndDestroy(&fs);
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::SetDefaultAccessPointL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::SetDefaultAccessPointL()
-    {
-    const TInt KDestinationSelectionMode( 2 );
-    CRepository* repository( NULL );
-    TInt ap( 0 );
-    TInt alwaysAsk( 0 );
-    TUint32 iapd32( 0 );
-    TInt defaultSnap( 0 );
-    TInt err( KErrNone );
-
-    CLOG_WRITE( "DMgrWrapper::SetDefaultAccessPointL" );
-    repository = CRepository::NewL( KCRUidBrowser );
-    CleanupStack::PushL( repository );
-    repository->Get( KBrowserDefaultAccessPoint, ap );
-    repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-    repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-
-    if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
-        {
-        alwaysAsk = ETrue;
-        }
-    else
-        {
-        RCmManager cmManager;
-        cmManager.OpenLC();
-        if ( !alwaysAsk )
-            {
-            TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL(
-                    ap, CMManager::ECmIapId ) );
-            }
-        else if ( alwaysAsk == KDestinationSelectionMode )
-            {
-            TRAP( err, iapd32 =
-                IapIdOfDefaultSnapL( cmManager, defaultSnap ) );
-            }
-        CleanupStack::PopAndDestroy( &cmManager );
-        }
-    if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) )
-        {
-        err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 );
-        }
-    CleanupStack::PopAndDestroy( repository );
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::GetErrorUrlL
-// ---------------------------------------------------------------------------
-//
-HBufC8* CDRMHelperDMgrWrapper::GetErrorUrlL()
-    {
-    if( iErrorUrl )
-        {
-        return iErrorUrl->AllocL();
-        }
-    return NULL;
-    }
-
-
-// ---------------------------------------------------------------------------
-// From class MHttpDownloadMgrObserver
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::HandleDMgrEventL(
-    RHttpDownload& aDownload,
-    THttpDownloadEvent aEvent )
-    {
-    _LIT8( KDRMHelperMimeTypeROAPTrigger,
-        "application/vnd.oma.drm.roap-trigger+xml" );
-
-    CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL" );
-    CLOG_WRITE_FORMAT( "iDownLoadState = %d", aEvent.iDownloadState );
-    CLOG_WRITE_FORMAT( "iProgressState = %d", aEvent.iProgressState );
-
-    if ( aEvent.iProgressState == EHttpContentTypeReceived )
-        {
-        // check received mimetype
-        RBuf8 contentType;
-        contentType.CleanupClosePushL();
-        contentType.CreateL( KMaxContentTypeLength );
-        User::LeaveIfError(
-            aDownload.GetStringAttribute( EDlAttrContentType, contentType ) );
-        if ( !contentType.FindF( KDRMHelperMimeTypeROAPTrigger ) )
-            {
-            // ROAP trigger found, continue download
-            User::LeaveIfError( aDownload.Start() );
-            }
-        else
-            {
-            // wrong MIME type, so stop download
-            iDownloadSuccess = EFalse;
-            User::LeaveIfError( aDownload.Delete() );
-            }
-        CleanupStack::PopAndDestroy( &contentType );
-        }
-
-    if ( aEvent.iDownloadState == EHttpDlCreated )
-        {
-        CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCreated" );
-        if ( iUseCoeEnv )
-            {
-        iProgressInfo->IncrementAndDraw( KProgressInfoIncrementMedium );
-            }
-        }
-    else if ( aEvent.iProgressState == EHttpProgDisconnected )
-        {
-        CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpProgDisconnected" );
-        // store failure
-        iDownloadSuccess = EFalse;
-        iConnectionError = ETrue;
-        // finished
-        iWait.AsyncStop();
-        }
-    else if ( aEvent.iDownloadState == EHttpDlInprogress )
-        {
-        CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlInprogress" );
-        if ( iUseCoeEnv )
-            {
-        iProgressInfo->IncrementAndDraw( KProgressInfoIncrementSmall );
-            }
-        }
-    else if ( aEvent.iDownloadState == EHttpDlCompleted )
-        {
-        // store success
-        CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlCompleted" );
-        iDownloadSuccess = ETrue;
-        if ( iUseCoeEnv )
-            {
-        iProgressInfo->IncrementAndDraw( KProgressInfoIncrementLarge );
-            }
-        // finished
-        iWait.AsyncStop();
-        }
-    else if ( aEvent.iDownloadState == EHttpDlFailed )
-        {
-        TInt32 err( KErrNone );
-
-        CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EHttpDlFailed" );
-        // store failure
-        iDownloadSuccess = EFalse;
-        User::LeaveIfError( aDownload.GetIntAttribute( EDlAttrErrorId, err ) );
-        CLOG_WRITE_FORMAT( "EDlAttrErrorId = %d", err );
-
-        if ( err == EConnectionFailed ||
-             err == ETransactionFailed)
-            {
-            CLOG_WRITE( "DMgrWrapper::HandleDMgrEventL: EConnectionFailed" );
-            iConnectionError = ETrue;
-            }
-
-        // finished
-        iWait.AsyncStop();
-        }
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::ShowProgressNoteL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::ShowProgressNoteL( )
-    {
-    TFileName resFileName;
-
-    CLOG_WRITE( "DMgrWrapper::ShowProgressNoteL" );
-    if ( iUseCoeEnv )
-        {
-        // Initialize the progress note dialog, it's values,
-        // and execute it
-
-#ifndef RD_MULTIPLE_DRIVE
-
-        resFileName.Copy( KDriveZ );
-
-#else //RD_MULTIPLE_DRIVE
-
-        _LIT( KDrive, "%c:");
-        TInt driveNumber( -1 );
-        TChar driveLetter;
-        DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
-
-        iCoeEnv->FsSession().DriveToChar( driveNumber, driveLetter );
-
-        resFileName.Format( KDrive, (TUint)driveLetter );
-
-#endif
-
-        resFileName.Append( KDC_RESOURCE_FILES_DIR );
-        resFileName.Append( KCDRMHelperDMgrWrapperResFileName );
-        RConeResourceLoader loader( *iCoeEnv );
-        loader.OpenL( resFileName );
-
-        iProgressNoteDialog = new (ELeave) CAknProgressDialog(
-            reinterpret_cast< CEikDialog** >( &iProgressNoteDialog ) );
-        iProgressNoteDialog->PrepareLC( R_SILENT_PROGRESS_NOTE );
-        iProgressNoteDialog->SetCallback( this );
-        iProgressInfo = iProgressNoteDialog->GetProgressInfoL();
-        iProgressInfo->SetFinalValue( KProgressInfoFinalValue );
-        iDialogDismissed = EFalse;
-        iProgressNoteDialog->RunLD();
-
-        loader.Close();
-        }
-
-    }
-
-
-// ---------------------------------------------------------------------------
-// CDRMHelperDMgrWrapper::RemoveProgressNoteL
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::RemoveProgressNoteL( )
-    {
-
-    if ( iUseCoeEnv )
-        {
-        if (iProgressNoteDialog && !iDialogDismissed)
-            {
-            // deletes the dialog
-            TRAPD(err, iProgressNoteDialog->ProcessFinishedL());
-            if (err != KErrNone)
-                {
-                delete iProgressNoteDialog;
-                }
-            iProgressNoteDialog = NULL;
-            }
-        }
-
-    }
-
-
-// ---------------------------------------------------------------------------
-// From class MAknProgressDialogCallback
-// ---------------------------------------------------------------------------
-//
-void CDRMHelperDMgrWrapper::DialogDismissedL( TInt /*aButtonId*/ )
-    {
-    iDialogDismissed = ETrue;
-
-    // Already freed, just set to NULL
-    iProgressNoteDialog = NULL;
-    iProgressInfo = NULL;
-
-    if( iWait.IsStarted() )
-        {
-        iWait.AsyncStop();
-        }
-
-    }
-
-
-// ======== GLOBAL FUNCTIONS ========
-
-//------------------------------------------------------------------------------
-// GateFunctionDRM
-// DRM gate function
-//------------------------------------------------------------------------------
-EXPORT_C TAny* GateFunctionDMgr()
-    {
-    CDRMHelperDMgrWrapper* launcher = NULL;
-    TRAPD( err, launcher = CDRMHelperDMgrWrapper::NewL() );
-    if( err != KErrNone )
-        {
-        return NULL;
-        }
-
-    return launcher;
-    }
-
--- a/omadrm/drmhelper/src/DRMHelperDownloadManager.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/src/DRMHelperDownloadManager.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -18,10 +18,10 @@
 
 // INCLUDE FILES
 #include "DRMHelperDownloadManager.h"
-#include "drmhelperdmgrwrapper.h"
+#include "DrmUtilityDmgrWrapper.h"
 
 // CONSTANTS
-_LIT( KDRMHelperDMgrHandlerName, "\\system\\libs\\drmhelperdmgrwrapper.dll" );
+_LIT( KDrmUtilityDmgrHandlerName, "DrmUtilityDmgrWrapper.dll" );
 
 typedef TAny* (*NewDMgrL)();
 
@@ -35,20 +35,20 @@
 
 void CDrmHelperDownloadManager::ConstructL()
     {
-    User::LeaveIfError( iDMgrDll.Load( KDRMHelperDMgrHandlerName ) );
+    User::LeaveIfError( iDMgrDll.Load( KDrmUtilityDmgrHandlerName ) );
     NewDMgrL createDMgr = (NewDMgrL) iDMgrDll.Lookup( KFirstFunction );
     if ( !createDMgr )
         {
         User::Leave( KErrGeneral );
         }
     // Create the class, leaves in case of failure
-    iDMgrHandler = (CDRMHelperDMgrWrapper*) (*createDMgr)();
+    iDMgrHandler = reinterpret_cast<CDrmUtilityDmgrWrapper*>( (*createDMgr)() );
     }
 
 CDrmHelperDownloadManager* CDrmHelperDownloadManager::NewL()
     {
     CDrmHelperDownloadManager* self = new( ELeave ) CDrmHelperDownloadManager();
-    
+
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop();
@@ -61,7 +61,7 @@
     delete iDMgrHandler;
     iDMgrDll.Close();
     }
-    
+
 void CDrmHelperDownloadManager::DownloadAndHandleRoapTriggerL(
     const HBufC8* aUrl, CCoeEnv& aCoeEnv )
     {
--- a/omadrm/drmhelper/src/DRMHelperGlobalNoteWrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/src/DRMHelperGlobalNoteWrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -21,13 +21,13 @@
 #include "DRMHelperGlobalNoteWrapper.h"
 #include "DRMHelperInfoNoteWrapper.h"
 
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <AknGlobalConfirmationQuery.h>
 #include <avkon.hrh> // EAknSoftkeyNo
 
 #include <SecondaryDisplay/DRMHelperSecondaryDisplay.h>
-#include <aknmediatorfacade.h>
-#include <aknsddata.h>
+#include <AknMediatorFacade.h>
+#include <aknSDData.h>
 #include <featmgr.h>
 
 // EXTERNAL DATA STRUCTURES
--- a/omadrm/drmhelper/src/DRMHelperInfoNoteWrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/src/DRMHelperInfoNoteWrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,17 +20,17 @@
 // INCLUDE FILES
 #include "DRMHelperInfoNoteWrapper.h"
 
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <AknGlobalConfirmationQuery.h>
 #include <avkon.hrh> // EAknSoftkeyNo
-#include <aknglobalnote.h>
+#include <AknGlobalNote.h>
 
 #include <SecondaryDisplay/DRMHelperSecondaryDisplay.h>
-#include <aknmediatorfacade.h>
+#include <AknMediatorFacade.h>
 #include <featmgr.h>
-#include <aknsddata.h>
-#include <DrmHelper.h>
-#include <DrmHelper.rsg>
+#include <aknSDData.h>
+#include <DRMHelper.h>
+#include <Drmhelper.rsg>
 
 // EXTERNAL DATA STRUCTURES
 
--- a/omadrm/drmhelper/src/RDRMHelper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/src/RDRMHelper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,10 +19,10 @@
 // INCLUDE FILES
 #include <e32std.h>
 #include <e32math.h>
-#include <drmcommon.h>
-#include "drmhelpercommon.h"
-#include "drmhelperserver.h"
-#include "RDRMHelper.h"
+#include <DRMCommon.h>
+#include "DRMHelperCommon.h"
+#include "DRMHelperServer.h"
+#include "rdrmhelper.h"
 
 // LOCAL CONSTANTS AND MACROS
 
--- a/omadrm/drmhelper/src/drmhelper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmhelper/src/drmhelper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2003-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -25,51 +25,51 @@
 #include "DcfCommon.h"
 #include "DRMHelperDownloadManager.h"
 
-#include <SaCls.h>
-#include <DRMHelper.rsg>
+#include <Drmhelper.rsg>
 #include <AknQueryDialog.h>
 #include <DRMCommon.h>
 
-#include <StarterClient.h>
+#include <starterclient.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include <StringLoader.h>
 #include <eikproc.h> //CEikProcess
 #include <eikdoc.h> //CEikDocument
-#include <documenthandler.h> // KDRMErr*
+#include <DocumentHandler.h> // KDRMErr*
 #include <aknnotewrappers.h> // information note
-#include <aknglobalnote.h> // global info note
-
-#include <drmconstraint.h>
+#include <AknGlobalNote.h> // global info note
+
+#include <DrmConstraint.h>
 
 #include <stringresourcereader.h>
 #include <apgcli.h>
 #include <data_caging_path_literals.hrh>
 
 #include <AiwGenericParam.h>
-#include <dcfrep.h>
+#include <DcfRep.h>
 #include <DcfEntry.h>
 
 #include <caf/caf.h>
+#include <caf/cafplatform.h>
 
 #include <AknLaunchAppService.h> // for launching RMUI embedded
 
 #include <utf.h>
 
-#include <schemehandler.h> // for handling URLs
-#include "drmhelperserver.h"
-#include "consumedata.h"
-#include "drmtypes.h"
-#include "drmclockclient.h"
+#include <SchemeHandler.h> // for handling URLs
+#include "DRMHelperServer.h"
+#include "ConsumeData.h"
+#include "DRMTypes.h"
+#include "DRMClockClient.h"
 #include "DRMPointerArray.h"
 
 #include <SecondaryDisplay/DRMHelperSecondaryDisplay.h> // for secondary display support
-#include <aknmediatorfacade.h>
-#include <mediatoreventprovider.h>
-#include <mediatordomainuids.h>
+#include <AknMediatorFacade.h>
+#include <MediatorEventProvider.h>
+#include <MediatorDomainUIDs.h>
 #include <featmgr.h>
 
 #include "RoapStorageClient.h"
@@ -82,25 +82,15 @@
 #include "DRMRIContext.h"
 #include "DRMDomainContext.h"
 
-#include <cmconnectionmethod.h>
-#include <cmdestination.h>
-#include <cmconnectionmethoddef.h>
-#include <cmmanager.h>
-
 // publish & subrscibe
-#include <E32Property.h>
-#include <PsVariables.h>
-
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <browseruisdkcrkeys.h>
-#endif
-
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser   = {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint =  0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-#endif
-
+#include <e32property.h>
+#include <PSVariables.h>
+
+
+//connectivity logic
+#include <cmconnectionmethod.h> // RCmConnectionMethod
+#include <cmdestination.h> // RCmDestination
+#include <cmmanager.h> // RCmManager
 
 // EXTERNAL DATA STRUCTURES
 
@@ -168,32 +158,65 @@
     };
 
 // ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
+// -----------------------------------------------------------------------------
+// HasDefaultConnectionL
+// Finds default IAP id
+// @return Etrue: valid AP found
+//         EFalse: valid AP not found
+// @leave system wide error codes
 // -----------------------------------------------------------------------------
 //
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
-    RCmManager& aCmManager,
-    const TUint32 aDefaultSnap )
-    {
-    RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
-    CleanupClosePushL( dest );
-    TUint32 iapIdOfDest( 0 );
-
-    if ( dest.ConnectionMethodCount() <= 0 )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-    CleanupClosePushL( cMeth );
-
-    iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-    CleanupStack::PopAndDestroy( &cMeth );
-    CleanupStack::PopAndDestroy( &dest );
-    return iapIdOfDest;
+LOCAL_C TBool HasDefaultConnectionL()
+    {
+    TBool hasDefault(EFalse);
+    TCmDefConnValue defConn;
+    RCmManager cmManager;
+    cmManager.OpenLC();
+    cmManager.ReadDefConnL(defConn);
+    if (defConn.iType == ECmDefConnConnectionMethod)
+        {
+        cmManager.GetConnectionMethodInfoIntL(defConn.iId,
+                CMManager::ECmIapId);
+        hasDefault = ETrue;
+        }
+    else if (defConn.iType == ECmDefConnDestination)
+        {
+        RCmDestination dest(cmManager.DestinationL(defConn.iId));
+        CleanupClosePushL(dest);
+
+        if (dest.ConnectionMethodCount() <= 0)
+            {
+            User::Leave(KErrNotFound);
+            }
+
+        RCmConnectionMethod cMeth(dest.ConnectionMethodL(0));
+        CleanupClosePushL(cMeth);
+
+        cMeth.GetIntAttributeL(CMManager::ECmIapId);
+        CleanupStack::PopAndDestroy(&cMeth);
+        CleanupStack::PopAndDestroy(&dest);
+        hasDefault = ETrue;
+        }
+    CleanupStack::PopAndDestroy(&cmManager);
+    return hasDefault;
+    }
+
+// -----------------------------------------------------------------------------
+// HasAccessPointsL
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TBool HasAccessPointsL()
+    {
+    TInt apCount(0);
+    RCmManager cmManager;
+    CleanupClosePushL(cmManager);
+    cmManager.OpenL();
+    RArray<TUint32> aps;
+    CleanupClosePushL(aps);
+    cmManager.ConnectionMethodL(aps, EFalse, EFalse, ETrue);
+    apCount = aps.Count();
+    CleanupStack::PopAndDestroy(2, &cmManager); //aps, cmManager
+    return apCount > 0;
     }
 
 // -----------------------------------------------------------------------------
@@ -2338,13 +2361,7 @@
     if ( buttonCode == EAknSoftkeyYes )
         {
         // check if there are any APs defined
-        RCmManager cmManager;
-        cmManager.OpenLC();
-        RArray<TUint32> aps;
-        CleanupClosePushL( aps );
-        cmManager.ConnectionMethodL( aps, EFalse, EFalse, ETrue );
-        TUint32 APs( aps.Count() );
-        CleanupStack::PopAndDestroy( 2, &cmManager ); //aps, cmManager
+        TBool APs( HasAccessPointsL() );
         if ( !APs )
             {
             // No AP defined
@@ -2429,43 +2446,17 @@
     }
 
 
+// -----------------------------------------------------------------------------
+// CDRMHelper::CheckRightsPercentL
+// Note: obsolete function name kept only
+// to avoid SC break on Helper selection logic
+// -----------------------------------------------------------------------------
+//
 TBool CDRMHelper::BrowserAPDefinedL()
     {
-    const TInt KDestinationSelectionMode( 2 );
-    TInt err( KErrNone );
-    TInt ap( 0 );
-    TInt alwaysAsk( 0 );
-    TInt defaultSnap( 0 );
-
-    CRepository* repository( CRepository::NewL( KCRUidBrowser ) );
-    repository->Get( KBrowserDefaultAccessPoint, ap );
-    repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-    repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-    delete repository;
-    if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
-        {
-        alwaysAsk = ETrue;
-        }
-    else
-        {
-        RCmManager cmManager;
-        cmManager.OpenLC();
-        if ( !alwaysAsk )
-            {
-            TRAP( err, cmManager.GetConnectionMethodInfoIntL(
-                    ap, CMManager::ECmIapId ) );
-            }
-        else if ( alwaysAsk == KDestinationSelectionMode )
-            {
-            TRAP( err, IapIdOfDefaultSnapL( cmManager, defaultSnap ) );
-            }
-        CleanupStack::PopAndDestroy( &cmManager );
-        if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) )
-            {
-            return ETrue;
-            }
-        }
-    return EFalse;
+    TBool apFound( EFalse );
+    TRAP_IGNORE( apFound = HasDefaultConnectionL() );
+    return apFound;
     }
 
 
@@ -3587,16 +3578,16 @@
     {
     TInt index;
 
-    // MaxInt will fit into 10 characters
-    HBufC* b( HBufC::NewLC( 10 ) );
+    // MaxInt will fit into 11 characters
+    HBufC* b( HBufC::NewLC( 11 ) );
     b->Des().NumUC( aLocalId );
     HBufC* localIDBuf( b->ReAllocL( b->Des().Length() ) );
     CleanupStack::Pop( b );
     b = NULL;
     CleanupStack::PushL( localIDBuf );
 
-    // length of startparam is always 1 and 2 spaces are needed
-    TInt length = 1 + aUrl->Length() + localIDBuf->Des().Length() + 2;
+    // length of startparam is always 1 and some markers are needed
+    TInt length = 1 + aUrl->Length() + localIDBuf->Des().Length() + 3;
 
     aLaunchParam = HBufC::NewMaxL( length );
 
@@ -3604,7 +3595,7 @@
     ptr.SetLength( 0 );
     _LIT( KOne, "1" );
     _LIT( KTwo, "2" );
-    _LIT( KSpace, " " );
+    _LIT( KMarker, "\x00" );
 
     // start param is 1 for embedded launch and 2 for launching details view
     // standalone
@@ -3616,9 +3607,9 @@
         {
         ptr.Append( KTwo() );
         }
-    ptr.Append( KSpace() );
+    ptr.Append( KMarker() );
     ptr.Append( localIDBuf->Des() );
-    ptr.Append( KSpace() );
+    ptr.Append( KMarker() );
 
     index = ptr.Length();
     ptr.SetLength( length );
@@ -3627,6 +3618,8 @@
         ptr[index++] = ( unsigned char ) (*aUrl)[i];
         }
 
+    ptr[index] = ( unsigned char ) KMarker()[0];
+
     CleanupStack::PopAndDestroy( localIDBuf );
     }
 
@@ -5604,7 +5597,7 @@
 
         CAknLaunchAppService* launchAppService =
             CAknLaunchAppService::NewL( KUidDRMUI, this, paramList );
-        
+
         CleanupStack::PushL( launchAppService );
         iWait.Start();
 
--- a/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmlicensemanager/group/DRMLicenseChecker.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -29,7 +29,7 @@
 SYSTEMINCLUDE   /epoc32/include/libc
 
 USERINCLUDE     ../inc
-USERINCLUDE	    ../../../inc   // ADo level inc dir
+USERINCLUDE         ../../../inc   // ADo level inc dir
 
 SOURCEPATH      ../src
 SOURCE          DRMLicenseChecker.cpp
@@ -46,13 +46,13 @@
 LIBRARY         DRMCommon.lib
 
 #if defined(ARMCC)
-deffile ../eabi/ 
+deffile ../eabi/
 #elif defined( WINSCW )
-deffile ../bwinscw/ 
+deffile ../BWINSCW/
 #elif defined( WINS )
-deffile ../bwins/ 
+deffile ../bwins/
 #else
-deffile ../bmarm/ 
+deffile ../bmarm/
 #endif
 
 SMPSAFE
--- a/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmlicensemanager/group/DRMLicenseManager.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -52,7 +52,7 @@
 #if defined(ARMCC)
 deffile ../eabi/
 #elif defined( WINSCW )
-deffile ../bwinscw/
+deffile ../BWINSCW/
 #elif defined( WINS )
 deffile ../bwins/
 #else
--- a/omadrm/drmlicensemanager/src/DRMLicenseManager.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmlicensemanager/src/DRMLicenseManager.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -26,13 +26,13 @@
 #include <s32buf.h>
 #include <s32crypt.h>
 #include <utf.h>
-#include <DrmRights.h>
-#include <DrmCommon.h>
+#include <DRMRights.h>
+#include <DRMCommon.h>
 #include <Oma1DcfCreator.h>
-#include <SysUtil.h>     // Disk space checking
+#include <sysutil.h>     // Disk space checking
 
-#include "ZipFile.h"
-#include "ZipFileMemberIterator.h"
+#include "zipfile.h"
+#include "zipfilememberiterator.h"
 #include "DRMLicenseManager.h"
 
 // LOCAL CONSTANTS AND MACROS
@@ -491,9 +491,9 @@
 
     members = iZipFile->GetMembersL();
     CleanupStack::PushL(members);
-    
+
     member = members->NextL();
-    
+
     while (member && !sisFile)
         {
         if (member->Name()->Right(4).CompareF(KSISSuffix) == 0)
@@ -511,14 +511,14 @@
             member = members->NextL();
             }
         }
-    
+
     CleanupStack::PopAndDestroy(members);
 
     if(!sisFile)
         {
         User::Leave(KErrNotFound);
         }
-    
+
     return sisFile;
     }
 
--- a/omadrm/drmlicensemanager/src/LMSecurity.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Encryption/Decryption support functions
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32std.h>
-#include <e32base.h>
-#include <e32math.h>
-#include <s32buf.h>
-#include <s32crypt.h>
-
-#include "LMSecurity.h"
-#include "LMSecurityEncrypt.h"
-#include "LMSecurityDecrypt.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::NewEncryptL
-// Return a new encryptor
-// -----------------------------------------------------------------------------
-//
-CSecurityEncryptBase* CLMSecurity::NewEncryptL(
-    const TDesC8& init) const
-    {
-    return new CLMSecurityEncrypt(init);
-    };
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::NewDecryptL
-// Return a new decryptor
-// -----------------------------------------------------------------------------
-//
-CSecurityDecryptBase* CLMSecurity::NewDecryptL(
-    const TDesC8& init) const
-    {
-    return new CLMSecurityDecrypt(init);
-    };
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::SetL
-// Password functions not supported (handled via the encrypt/decrypt classes)
-// -----------------------------------------------------------------------------
-//
-void CLMSecurity::SetL(
-    const TDesC& /* aOldPassword */,
-    const TDesC& /* aNewPassword */)
-    {
-    };
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::SecurityData
-// Password functions not supported (handled via the encrypt/decrypt classes)
-// -----------------------------------------------------------------------------
-//
-TPtrC8 CLMSecurity::SecurityData() const
-    {
-    return TPtrC8(0, 0);
-    };
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::PrepareL
-// Password functions not supported (handled via the encrypt/decrypt classes)
-// -----------------------------------------------------------------------------
-//
-void CLMSecurity::PrepareL(
-    const TDesC& /* aPassword */)
-    {
-    };
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::IsEnabled
-// Password functions not supported (handled via the encrypt/decrypt classes)
-// -----------------------------------------------------------------------------
-//
-TInt CLMSecurity::IsEnabled() const
-    {
-    return ETrue;
-    };
-
-// -----------------------------------------------------------------------------
-// CLMSecurity::SetEnabledL
-// Password functions not supported (handled via the encrypt/decrypt classes)
-// -----------------------------------------------------------------------------
-//
-void CLMSecurity::SetEnabledL(
-    const TDesC& /* aPassword */,
-    TBool /* aIsEnabled */)
-    {
-    };
--- a/omadrm/drmlicensemanager/src/LMSecurityDecrypt.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Encryption/Decryption support functions
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32std.h>
-#include <e32base.h>
-#include <e32math.h>
-#include <s32buf.h>
-#include <s32crypt.h>
-
-#include "LMSecurity.h"
-#include "LMSecurityDecrypt.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// ?classname::?member_function
-// ?implementation_description
-// -----------------------------------------------------------------------------
-//
-CLMSecurityDecrypt::CLMSecurityDecrypt(
-    const TDesC8& init)
-    {
-    TPckg<TUint> p(0);
-
-    p.Copy(init);
-    iKey = p();
-    Math::Rand(iKey);
-    }
-
-// -----------------------------------------------------------------------------
-// ?classname::?member_function
-// ?implementation_description
-// -----------------------------------------------------------------------------
-//
-TInt CLMSecurityDecrypt::DecryptL(
-    TDes8& aOutput,
-    const TDesC8& aInput)
-    {
-    TInt i;
-    TUint8* ptr;
-
-    ptr = const_cast<TUint8*>(aOutput.Ptr());
-    for (i = 0; i < aInput.Size(); i++)
-        {
-        ptr[i] = static_cast<TUint8>(aInput[i] ^ Math::Rand(iKey));
-        }
-    aOutput.SetLength(aInput.Size());
-    return aInput.Size();
-    }
--- a/omadrm/drmlicensemanager/src/LMSecurityEncrypt.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Encryption/Decryption support functions
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32std.h>
-#include <e32base.h>
-#include <e32math.h>
-#include <s32buf.h>
-#include <s32crypt.h>
-
-#include "LMSecurity.h"
-#include "LMSecurityEncrypt.h"
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CLMSecurityEncrypt::CLMSecurityEncrypt
-// Initialize the random key stream from a constant
-// -----------------------------------------------------------------------------
-//
-CLMSecurityEncrypt::CLMSecurityEncrypt(
-    const TDesC8& init)
-    {
-    TPckg<TUint> p(0);
-
-    p.Copy(init);
-    iKey = p();
-    Math::Rand(iKey);
-    }
-
-// -----------------------------------------------------------------------------
-// CLMSecurityEncrypt::EncryptL
-// Encrypt using the key stream
-// -----------------------------------------------------------------------------
-//
-TInt CLMSecurityEncrypt::EncryptL(
-    TDes8& aOutput,
-    const TDesC8& aInput)
-    {
-    TInt i;
-    TUint8* ptr;
-
-    ptr = const_cast<TUint8*>(aOutput.Ptr());
-    for (i = 0; i < aInput.Size(); i++)
-        {
-        ptr[i] = static_cast<TUint8>(aInput[i] ^ Math::Rand(iKey));
-        }
-    aOutput.SetLength(aInput.Size());
-    return aInput.Size();
-    }
-
-// -----------------------------------------------------------------------------
-// CLMSecurityEncrypt::CompleteL
-// Final encryption
-// -----------------------------------------------------------------------------
-//
-TInt CLMSecurityEncrypt::CompleteL(
-    TDes8& aOutput,
-    const TDesC8& aInput)
-    {
-    return EncryptL(aOutput, aInput);
-    }
--- a/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRM.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRM.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,9 +22,9 @@
 #include <http/rhttpsession.h>
 #include <http/cecomfilter.h>
 #include <http/framework/httplogger.h>
-#include <drmcommon.h>
+#include <DRMCommon.h>
 
-#include "httpfilterdrmdatasupplier.h"
+#include "HTTPFilterDRMDataSupplier.h"
 
 #ifndef DEBUG_LOGGING
 #undef _LOGGING
--- a/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRMDataSupplier.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmfilter/inc/HTTPFilterDRMDataSupplier.h	Wed Jun 23 17:42:58 2010 +0100
@@ -21,7 +21,7 @@
 
 #include <s32mem.h>
 #include <http/mhttpdatasupplier.h>
-#include <oma1dcfcreator.h>
+#include <Oma1DcfCreator.h>
 //-----------------------------------------------------------------------------
 
 class CDRMMessageParser;
@@ -46,7 +46,7 @@
  * HeapArray8 - the helper class for memory re-allocation
  *
  * @lib DRMFilter.lib
- * @since 2.6 
+ * @since 2.6
  */
 class HeapArray8
     {
@@ -77,7 +77,7 @@
  * TDRMMemBuf - the helper class for memory re-allocation
  *
  * @lib DRMFilter.lib
- * @since 2.6 
+ * @since 2.6
  */
 class TDRMMemBuf : public TMemBuf
     {
@@ -102,7 +102,7 @@
  * a data supplier used for replace the default supplier in response data
  *
  * @lib DRMFilter.lib
- * @since 2.6 
+ * @since 2.6
  */
 class CHTTPFilterDRMDataSupplier : public CBase,
     public MHTTPDataSupplier,
@@ -113,7 +113,7 @@
     static CHTTPFilterDRMDataSupplier* NewL( TInt,
         MHTTPDataSupplier* iDataBody, CHTTPFilterDRM* aOwner );
     /** Support for Hutchinson's content protection scheme, CFM
-     *  
+     *
      */
     static CHTTPFilterDRMDataSupplier* NewL( TInt,
         MHTTPDataSupplier* iDataBody, TProcessedContentType aType,
@@ -150,7 +150,7 @@
 
     void ConstructL( TInt aSize );
     /** Support for Hutchinson's content protection scheme, CFM
-     *  
+     *
      */
     void ConstructL( TInt aSize, TProcessedContentType /*aType*/);
     /**
@@ -164,6 +164,7 @@
     TPtr8 iBufPtr;
     MHTTPDataSupplier *iPHData; // data supplier from protocol handler
     TBool iSendReady; // ready for sending?
+    TBool iLastPart; // should last part info be sent
 
     CDRMMessageParser* iDRMMessageParser;
     TInt iPrevPos;
@@ -187,4 +188,4 @@
     //-------------------------------------------------------------------------
     };
 //-----------------------------------------------------------------------------
-#endif // !_HTTPFILTERDRMDATASUPPLIER_H_ 
+#endif // !_HTTPFILTERDRMDATASUPPLIER_H_
--- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRM.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
  * All rights reserved.
  * This component and the accompanying materials are made available
  * under the terms of "Eclipse Public License v1.0"
@@ -21,9 +21,9 @@
 #include <httpstringconstants.h>
 #include <httperr.h>
 #include <bautils.h>
-#include <drmmessageparser.h>
+#include <DRMMessageParser.h>
 
-#include "httpfilterdrm.h"
+#include "HTTPFilterDRM.h"
 
 // LOCAL CONSTANTS
 _LIT8( KDRMString1, "application/vnd.oma.drm.message" );
@@ -217,7 +217,7 @@
 
 //------------------------------------------------------------------------
 // CHTTPFilterDRM::MHFRunL
-// See MHTTPFilterBase::MHFRunL 
+// See MHTTPFilterBase::MHFRunL
 //------------------------------------------------------------------------
 //
 void CHTTPFilterDRM::MHFRunL( RHTTPTransaction aTransaction,
@@ -320,7 +320,7 @@
         case KErrCANoRights:
         case KErrCorrupt:
             {
-            error = NW_STAT_FAILURE; //Unable to perform operation   
+            error = NW_STAT_FAILURE; //Unable to perform operation
             }
             break;
         case KErrArgument:
@@ -461,10 +461,10 @@
 // CHTTPFilterDRM::CheckHeadersL
 // Check HTTP headers and extract MIME type
 //------------------------------------------------------------------------
-// 
+//
 void CHTTPFilterDRM::CheckHeadersL( const RHTTPTransaction& aTrans )
     {
-    // read the header data and check the MIME type here	
+    // read the header data and check the MIME type here
     // check the status and body
     RHTTPResponse response = aTrans.Response();
     TInt status = response.StatusCode();
@@ -512,7 +512,7 @@
                 drmData = CHTTPFilterDRMDataSupplier::NewL( aTrans.Id(),
                     response.Body(), const_cast<CHTTPFilterDRM*> ( this ) );
                 /** Support for Hutchinson's content protection scheme, CFM
-                 *  
+                 *
                  */
                 drmData->SetProcessedContentType( EStandardDRMContent );
                 /**
@@ -630,7 +630,7 @@
         // Do not encrypt JAD files:
         if ( headers.GetField( fieldNameStr, 0, fieldVal ) == KErrNone )
             {
-            // If it is a JAD always ignore any of the above:	
+            // If it is a JAD always ignore any of the above:
             const TBuf8<sizeof( KJADString )> JADStringBuf( KJADString );
             RStringF JADValue = strP.OpenFStringL( JADStringBuf );
             CleanupClosePushL( JADValue );
@@ -665,7 +665,7 @@
             iDataSups.Append( drmData );
             response.SetBody( *drmData );
 
-            ///			
+            ///
             RStringF DRMValue1 = strP.OpenFStringL( DRMStringBuf1 );
             CleanupClosePushL( DRMValue1 );
 
--- a/omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmfilter/src/HTTPFilterDRMDataSupplier.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,15 +17,16 @@
 
 #include <http/rhttptransaction.h>
 #include <barsc.h>
-#include <drmcommon.h>
+#include <DRMCommon.h>
 #include <f32file.h>
 #include <s32buf.h>
-#include <drmmessageparser.h>
+#include <DRMMessageParser.h>
 #include <caf/caf.h>
-#include <oma2agent.h>
+#include <caf/cafplatform.h>
+#include <Oma2Agent.h>
 
-#include "httpfilterdrmdatasupplier.h"
-#include "httpfilterdrm.h"
+#include "HTTPFilterDRMDataSupplier.h"
+#include "HTTPFilterDRM.h"
 
 //------------------------------------------------------------------------
 
@@ -57,7 +58,7 @@
 // CHTTPFilterDRMDataSupplier::NewL
 // Two-phase constructor, CFM
 // -----------------------------------------------------------------------------
-//	
+//
 CHTTPFilterDRMDataSupplier* CHTTPFilterDRMDataSupplier::NewL( TInt aTransId,
     MHTTPDataSupplier* iDataBody, TProcessedContentType aType,
     CHTTPFilterDRM* aOwner )
@@ -79,7 +80,7 @@
 CHTTPFilterDRMDataSupplier::CHTTPFilterDRMDataSupplier( TInt aTransId,
     MHTTPDataSupplier* iDataBody, CHTTPFilterDRM* aOwner ) :
     iTransId( aTransId ), iBufPtr( 0, 0 ), iPHData( iDataBody ), iSendReady(
-        EFalse ), iOwner( aOwner )
+        EFalse ), iLastPart( EFalse ), iOwner( aOwner )
     {
     iDRMMessageParser = 0;
     iPrevPos = 0;
@@ -269,9 +270,9 @@
         permission->iAvailableRights = ERightsPlay | ERightsDisplay
             | ERightsExecute | ERightsPrint;
 
-        permission->iRightsObjectVersion.iVersionMain = 1; // major version for Oma 1 Rights Objects		
+        permission->iRightsObjectVersion.iVersionMain = 1; // major version for Oma 1 Rights Objects
 
-        // "ringtone=no" present 
+        // "ringtone=no" present
         permission->iInfoBits = ENoRingingTone;
 
         // Set the permission to the rights class, it will duplicate the permission
@@ -350,17 +351,29 @@
 TBool CHTTPFilterDRMDataSupplier::GetNextDataPart( TPtrC8& aDataPart )
     {
 
+    // First call after releasedata
     if ( iDataPartSize == KWholeDataPart )
         {
         aDataPart.Set( iMemBuf->iBuf->GetPtr() );
         iDataPartSize = aDataPart.Length();
+        if( iSendReady )
+            {
+            iLastPart = ETrue;
+            }
         }
-    else
+    else // Consecutive calls so that we always return the same part
+         // and same amount of data
         {
         aDataPart.Set( iMemBuf->iBuf->GetPtr().Left( iDataPartSize ) );
         }
 
-    return ( iDataPartSize == KWholeDataPart ) ? iSendReady : EFalse;
+    // this check did not work, as in this phase the iDataPartSize is never
+    // KWholeDataPart
+    //return ( iDataPartSize == KWholeDataPart ) ? iSendReady : EFalse;
+
+    // Always return info if this is the last part, this is only true
+    // if iSendReady has been true when ReleaseData() has been called
+    return iLastPart;
     }
 
 // -----------------------------------------------------------------------------
@@ -370,7 +383,8 @@
 //
 void CHTTPFilterDRMDataSupplier::ReleaseData()
     {
-    if ( iDataPartSize == KWholeDataPart )
+    if ( iDataPartSize == KWholeDataPart ||
+         ( iLastPart && iSendReady ) )
         {
         TRAP_IGNORE( Sink()->SeekL( MStreamBuf::EWrite, TStreamPos(0) ) );
         if ( iSendReady )
@@ -388,6 +402,13 @@
         CleanupStack::PopAndDestroy( b );
         // Update data part size to available data.
         iDataPartSize = KWholeDataPart;
+
+        // if we are ready processing, make sure the client knows this
+        // is the last part
+        if( iSendReady )
+            {
+            iLastPart = ETrue;
+            }
         }
     }
 
@@ -550,7 +571,7 @@
             }
         }
     CleanupStack::Pop( manager );
-    CleanupStack::PopAndDestroy( &agents );        
+    CleanupStack::PopAndDestroy( &agents );
     return manager;
     }
 
--- a/omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmrecognizer/src/RecDRM.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -22,7 +22,7 @@
 #include <ecom/ecom.h>
 #include <ecom/implementationproxy.h>
 
-#include "recdrm.h"
+#include "RecDRM.h"
 
 #define RECOGNIZE_KEY_CHAIN
 
@@ -47,14 +47,14 @@
 
 _LIT8(KFTypPrefix, "ftyp");
 _LIT8(KODFPrefix, "odcf");
-_LIT8(KRoapTriggerElement, "roap-trigger:roapTrigger"); // before OMA spec CR, ROAP Trigger namespace prefix was roap-trigger 
+_LIT8(KRoapTriggerElement, "roap-trigger:roapTrigger"); // before OMA spec CR, ROAP Trigger namespace prefix was roap-trigger
 _LIT8(KRoapTriggerElement2, "roap:roapTrigger");
 _LIT8(KRoapTriggerType, "application/vnd.oma.drm.roap-trigger+xml");
 
-const TImplementationProxy ImplementationTable[] = 
-	    {
-	    IMPLEMENTATION_PROXY_ENTRY(0x101F6DB8, CApaDRMRecognizer::CreateRecognizerL)
-	    };
+const TImplementationProxy ImplementationTable[] =
+        {
+        IMPLEMENTATION_PROXY_ENTRY(0x101F6DB8, CApaDRMRecognizer::CreateRecognizerL)
+        };
 
 #ifdef DRM_OMA2_ENABLED
 TUint32 ReadUint32FromBlock(const TDesC8& aBlock, TInt aOffset)
@@ -80,11 +80,11 @@
 #endif
 
 CApaDRMRecognizer::CApaDRMRecognizer():
-	CApaDataRecognizerType( KUidDRMRecognizer,CApaDataRecognizerType::ENormal )
+    CApaDataRecognizerType( KUidDRMRecognizer,CApaDataRecognizerType::ENormal )
 {
-	
-	iCountDataTypes = 0;
-	return;
+
+    iCountDataTypes = 0;
+    return;
 }
 
 CApaDRMRecognizer::~CApaDRMRecognizer()
@@ -94,13 +94,13 @@
 
 CApaDataRecognizerType* CApaDRMRecognizer::CreateRecognizerL()
 {
-	return new (ELeave) CApaDRMRecognizer ();
+    return new (ELeave) CApaDRMRecognizer ();
 }
-	
+
 
 TUint CApaDRMRecognizer::PreferredBufSize()
 {
-	return KMaxBufferLength;
+    return KMaxBufferLength;
 }
 
 #ifdef _DEBUG
@@ -110,68 +110,68 @@
 #endif
 {
 __ASSERT_DEBUG( aIndex >= 0 && aIndex < iCountDataTypes, User::Invariant() );
-	return TDataType( _L8("application/vdn.omd.drm.content") ); // this should never be run
+    return TDataType( _L8("application/vdn.omd.drm.content") ); // this should never be run
 }
 
 void CApaDRMRecognizer::DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer )
 {
-	if ( aBuffer.Size() < 3) 
+    if ( aBuffer.Size() < 3)
         {
         return;
         }
-	
-#ifdef RECOGNIZE_KEY_CHAIN	
-	// Recognize device key chain
-	if ( aName.Length() > 3 && aName.Right(4).CompareF(_L(".dkc")) == 0)
+
+#ifdef RECOGNIZE_KEY_CHAIN
+    // Recognize device key chain
+    if ( aName.Length() > 3 && aName.Right(4).CompareF(_L(".dkc")) == 0)
         {
         iConfidence = ECertain;
         iDataType = TDataType( _L8("application/x-device-key-chain") );
         return;
         }
-#endif        
-	
+#endif
+
 #ifdef DRM_OMA2_ENABLED
-	// Recognize ROAP Trigger
-	if ( RecognizeRoapTrigger( aBuffer ) )
+    // Recognize ROAP Trigger
+    if ( RecognizeRoapTrigger( aBuffer ) )
+        {
+        return;
+        }
+
+    // Recognize DCFv2
+    if ( RecognizeODF( aBuffer ) )
         {
         return;
         }
-	
-	// Recognize DCFv2    
-	if ( RecognizeODF( aBuffer ) )
-        {
+#endif
+    // Recognize DCFv1
+    TUint8 version = aBuffer[0];
+    TUint8 contentTypeLen = aBuffer[1];
+    TUint8 contentURILen = aBuffer[2];
+
+    if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 )
+    {
         return;
-        }   
-#endif	
-	// Recognize DCFv1
-	TUint8 version = aBuffer[0];
-	TUint8 contentTypeLen = aBuffer[1];
-	TUint8 contentURILen = aBuffer[2];
+    }
+    if ( version != KDCFVersionSupported )
+    {
+        return;
+    }
 
-	if ( contentTypeLen < KMinContentTypeLen || contentURILen == 0 ) 
-	{
-		return;
-	}
-	if ( version != KDCFVersionSupported ) 
-	{
-		return;
-	}
+    // Too little data received
+    if ( aBuffer.Size() < ( contentTypeLen + KDCFHeaderLength ) )
+    {
+        return;
+    }
 
-	// Too little data received
-	if ( aBuffer.Size() < ( contentTypeLen + KDCFHeaderLength ) ) 
-	{
-		return;
-	}
+    TPtrC8 mimeType = aBuffer.Mid( KDCFHeaderLength, contentTypeLen );
+    if ( mimeType.Locate( '/' ) != KErrNotFound )
+    {
+        iConfidence = ECertain;
+        iDataType=TDataType( mimeType );
+    }
 
-	TPtrC8 mimeType = aBuffer.Mid( KDCFHeaderLength, contentTypeLen );
-	if ( mimeType.Locate( '/' ) != KErrNotFound )
-	{
-		iConfidence = ECertain;
-		iDataType=TDataType( mimeType );	
-	}
-	
-	
-	return;
+
+    return;
 }
 
 #ifdef DRM_OMA2_ENABLED
@@ -184,59 +184,59 @@
             iDataType=TDataType( KRoapTriggerType() );
             return ETrue;
         }
-	return EFalse;
+    return EFalse;
 }
 
 TBool CApaDRMRecognizer::RecognizeODF( const TDesC8& aBuffer )
 {
-	if ( aBuffer.Size() < 24 ) return EFalse;
-	TPtrC8 ftypPrefix = aBuffer.Mid( 4, KFTypPrefix().Length() );
-	if ( KFTypPrefix().CompareF( ftypPrefix ) == KErrNone )
-	{
-		TPtrC8 odfPrefix = aBuffer.Mid( 8, KODFPrefix().Length() );
-		if ( KODFPrefix().CompareF( odfPrefix ) == KErrNone )
-		{
-			TBuf8<4> buffer;
-    		TUint32 size;
-    		TPtr8 ptr(NULL, 0);
-    		TUint32 offset(20);
-    
-    		// ODRM box header
-    		buffer.Zero();
-    		buffer.Copy( aBuffer.Mid( offset, 4 ));
-    		size = ReadUint32FromBlock( buffer, 0 );
-    		offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags;
-    		
-    		if (size == 1)
-        	{
-        		offset += KLengthBoxSize64;
-        	}
-    		if ( aBuffer.Size() < offset+4 ) return EFalse;
-    		
-    		// Discrete headers box header
-    		buffer.Zero();
-    		buffer.Copy( aBuffer.Mid( offset, 4 ));
-    		size = ReadUint32FromBlock( buffer, 0 );
-    		offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags;
-    		if ( size == 1 )
-        	{
-        		offset += KLengthBoxSize64;
-        	}
-    		if ( aBuffer.Size() < offset+1 ) return EFalse;
-    		
-    		// Content type
-    		buffer.Zero();
-    		buffer.Copy( aBuffer.Mid( offset, 1 ));
-    		if ( aBuffer.Size() < offset + 1 + buffer[0] ) return EFalse;
-    		TPtrC8 mimeType = aBuffer.Mid( offset+1, buffer[0] );
-   			
-   			iConfidence = ECertain;
-			iDataType=TDataType( mimeType );
-			return ETrue;
-		}
-		
-	}
-	return EFalse;
+    if ( aBuffer.Size() < 24 ) return EFalse;
+    TPtrC8 ftypPrefix = aBuffer.Mid( 4, KFTypPrefix().Length() );
+    if ( KFTypPrefix().CompareF( ftypPrefix ) == KErrNone )
+    {
+        TPtrC8 odfPrefix = aBuffer.Mid( 8, KODFPrefix().Length() );
+        if ( KODFPrefix().CompareF( odfPrefix ) == KErrNone )
+        {
+            TBuf8<4> buffer;
+            TUint32 size;
+            TPtr8 ptr(NULL, 0);
+            TUint32 offset(20);
+
+            // ODRM box header
+            buffer.Zero();
+            buffer.Copy( aBuffer.Mid( offset, 4 ));
+            size = ReadUint32FromBlock( buffer, 0 );
+            offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags;
+
+            if (size == 1)
+            {
+                offset += KLengthBoxSize64;
+            }
+            if ( aBuffer.Size() < offset+4 ) return EFalse;
+
+            // Discrete headers box header
+            buffer.Zero();
+            buffer.Copy( aBuffer.Mid( offset, 4 ));
+            size = ReadUint32FromBlock( buffer, 0 );
+            offset += KLengthBoxSize + KLengthBoxType + KLengthVersion + KLengthFlags;
+            if ( size == 1 )
+            {
+                offset += KLengthBoxSize64;
+            }
+            if ( aBuffer.Size() < offset+1 ) return EFalse;
+
+            // Content type
+            buffer.Zero();
+            buffer.Copy( aBuffer.Mid( offset, 1 ));
+            if ( aBuffer.Size() < offset + 1 + buffer[0] ) return EFalse;
+            TPtrC8 mimeType = aBuffer.Mid( offset+1, buffer[0] );
+
+            iConfidence = ECertain;
+            iDataType=TDataType( mimeType );
+            return ETrue;
+        }
+
+    }
+    return EFalse;
 }
 #endif
 
--- a/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmrohandler/inc/rohandlerdmgrwrapper.h	Wed Jun 23 17:42:58 2010 +0100
@@ -30,14 +30,8 @@
 
 class MRoHandlerDMgrWrapper
     {
-
 public:
     virtual void HandleRoapTriggerL( const TDesC8& aTrigger ) = 0;
-
-    virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0;
-
-    virtual void DownloadAndHandleRoapTriggerFromPrUrlL( const HBufC8* aUrl ) = 0;
-
     };
 
 /**
@@ -78,10 +72,6 @@
     */
     void HandleRoapTriggerL( const TDesC8& aTrigger );
 
-    void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
-
-    void DownloadAndHandleRoapTriggerFromPrUrlL( const HBufC8* aUrl );
-
 
 // from base class MHttpDownloadMgrObserver
 
--- a/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmrohandler/src/CRoHandler.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -18,19 +18,19 @@
 
 // INCLUDE FILES
 #include <txtrich.h>                    // for CRichText
-#include <drmmessageparser.h>           // for CDrmMessageParser
-#include <drmrights.h>                  // for CDRMRights
+#include <DRMMessageParser.h>           // for CDrmMessageParser
+#include <DRMRights.h>                  // for CDRMRights
 #include <ecom/implementationproxy.h>   // for TImplementationProxy
 #include <push/cpushhandlerbase.h>      // for CPushHandlerBase
 #include <push/pluginkiller.h>          // for CPluginKiller
 #include <push/pushmessage.h>           // for CPushMessage
-#include <roapeng.h>                    // for CRoapEng
-#include <roapengbase.h>
-#include <roapobserver.h>
+#include <RoapEng.h>                    // for CRoapEng
+#include <RoapEngBase.h>
+#include <RoapObserver.h>
 #include <centralrepository.h>          // link against centralrepository.lib
 #include <msvuids.h>
 #include <msvids.h>
-#include <downloadmgrclient.h>
+#include <DownloadMgrClient.h>
 
 #ifdef RD_MULTIPLE_DRIVE
 #include <driveinfo.h>
@@ -39,15 +39,14 @@
 #include <uri16.h>                          // TUriParser16
 #include <data_caging_path_literals.hrh>    // KDC_MTM_RESOURCE_DIR
 #include <uriutils.h>                       // UriUtils and so on
-#include <pushmtmui.rsg>                    // for R_PUSHMISC_UNK_SENDER
-#include <rohandler.rsg>                    // for R_QTN_DRM_MGR_INB_TITLE
+#include <RoHandler.rsg>                    // for R_QTN_DRM_MGR_INB_TITLE
 #include <sysutil.h>                        // Disk space checking
 
-#include "crohandler.h"
-#include "romtmcli.h"                       // for CRightsObjectMtmClient
-#include "roapsyncwrapper.h"
+#include "CRoHandler.h"
+#include "RoMtmCli.h"                       // for CRightsObjectMtmClient
+#include "RoapSyncWrapper.h"
 
-#include "stringresourcereader.h"
+#include "StringResourceReader.h"
 #include "rohandlerdmgrwrapper.h"
 #include "rohandlerinternalcrkeys.h"
 
@@ -115,6 +114,8 @@
 _LIT( KRoAcquisitionPrefix, "ROA:" );
 _LIT( KTriggerPrefix, "TRI:" );
 
+_LIT( KEmpty, " " );
+
 // MODULE DATA STRUCTURES
 
 // Helper class for deleting file with given filename on cleanupstack
@@ -715,6 +716,7 @@
     HBufC16 *number( NULL );
     HBufC16 *messageContent( NULL );
     HBufC16* buffer( NULL );
+    _LIT( KMarker, "\x00" );
 
     TInt ret( 0 );
     if ( iMessageBodyPtr.Size() == 0 )
@@ -771,12 +773,14 @@
         TPtr ptr( number->Des() );
         ptr.AppendNum( localId, EDecimal );
 
-        messageContent = HBufC16::NewL( ptr.Length() + uri16.Length() + 4 );
+        messageContent = HBufC16::NewL( ptr.Length() + uri16.Length() + 5 );
         TPtr ptrToMz( messageContent->Des() );
-        ptrToMz.Append( _L( "1 " ) );
+        ptrToMz.Append( _L( "1" ) );
+        ptrToMz.Append( KMarker );
         ptrToMz.Append( ptr ); // add localID
-        ptrToMz.Append( _L( " " ) ); // add space
+        ptrToMz.Append( KMarker );
         ptrToMz.Append( uri16 ); //add uri16
+        ptrToMz.Append( KMarker );
 
         CleanupStack::PopAndDestroy( number );
         CleanupStack::PopAndDestroy( buffer );
@@ -1216,28 +1220,7 @@
     // First line in Inbox: TMsvEntry::iDetails.
     if ( !flag || srvAddress.Length() == 0 )
         {
-        // Read from resource.
-
-#ifndef RD_MULTIPLE_DRIVE
-
-        TFileName resourceFile( KDriveZ );
-
-#else //RD_MULTIPLE_DRIVE
-
-        _LIT( KDriveRoot, "%c:" );
-        TInt driveNumber( -1 );
-        TChar driveLetter;
-        DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
-        iFs.DriveToChar( driveNumber, driveLetter );
-
-        TFileName resourceFile;
-        resourceFile.Format( KDriveRoot, (TUint )driveLetter );
-
-#endif
-
-        resourceFile.Append( KDC_MTM_RESOURCE_DIR );
-        resourceFile.Append( KPushMtmRes );
-        ReadFromResourceLC( resourceFile, R_PUSHMISC_UNK_SENDER, result );
+        result = KEmpty().AllocL();
         }
     else
         {
--- a/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmrohandler/src/rohandlerdmgrwrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 - 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008 - 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,10 +21,6 @@
 #include <centralrepository.h>
 #include <cdblen.h>
 
-#ifdef __SERIES60_NATIVE_BROWSER
-#include <browseruisdkcrkeys.h>
-#endif
-
 #include <cmconnectionmethod.h>
 #include <cmdestination.h>
 #include <cmconnectionmethoddef.h>
@@ -36,16 +32,18 @@
 
 #include <data_caging_path_literals.hrh>
 
-#include <downloadmgrclient.h>
+#include <DownloadMgrClient.h>
 
 #include <es_enum.h> // tconnectioninfo
 #include <es_sock.h> // rconnection rsocket
-#include <roapeng.h>
-#include <roapdef.h>
-#include <roapobserver.h>
-#include "roapsyncwrapper.h"
+#include <RoapEng.h>
+#include <RoapDef.h>
+#include <RoapObserver.h>
+#include "RoapSyncWrapper.h"
 
 #include "rohandlerdmgrwrapper.h"
+#include "cleanupresetanddestroy.h"
+#include "buffercontainers.h"
 
 #ifdef _DEBUG
 #define DRMDEBUG( a ) RDebug::Print( a )
@@ -93,9 +91,6 @@
     _LIT( KMethConstructL, "ConstructL" );
     _LIT( KMethNewL, "NewL" );
     _LIT( KMethNewLC, "NewLC" );
-    _LIT( KMethDownloadAndHandleRoapTriggerL, "DownloadAndHandleRoapTriggerL" );
-    _LIT( KMethDownloadAndHandleRoapTriggerFromPrUrlL,
-        "DownloadAndHandleRoapTriggerFromPrUrlL" );
     _LIT( KMethDoDownloadAndHandleRoapTriggerL,
         "DoDownloadAndHandleRoapTriggerL" );
     _LIT( KFormatDoDlHdlRoapTrigL, "DoDownloadAndHandleRoapTriggerL: %S" );
@@ -103,7 +98,6 @@
     _LIT( KStrDlFinished, "download finished" );
 
     _LIT( KMethSetDefaultAccessPointL, "SetDefaultAccessPointL" );
-    _LIT( KMiIapId, "iIapId" );
 
     _LIT( KMethHandleDMgrEventL, "HandleDMgrEventL" );
     _LIT( KFormatMethHandleDMgrEventL, "HandleDMgrEventL %S" );
@@ -135,14 +129,6 @@
 //#define LOG2( a, b )
 #endif
 
-#ifndef __SERIES60_NATIVE_BROWSER
-const TUid KCRUidBrowser =
-    {0x10008D39};
-const TUint32 KBrowserDefaultAccessPoint = 0x0000000E;
-const TUint32 KBrowserAccessPointSelectionMode = 0x0000001E;
-const TUint32 KBrowserNGDefaultSnapId = 0x00000053;
-#endif
-
 // CONSTANTS
 #ifndef RD_MULTIPLE_DRIVE
 _LIT( KHelperTriggerFilePath, "d:\\" );
@@ -151,18 +137,6 @@
 // ============================== LOCAL FUNCTIONS ==============================
 
 // ---------------------------------------------------------------------------
-// DoResetAndDestroy
-// Does RPointerArray< typename >->ResetAndDestroy() for the given array aPtr.
-// ---------------------------------------------------------------------------
-//
-template< typename elemType >
-LOCAL_C void DoResetAndDestroy( TAny* aPtr )
-    {
-    ( reinterpret_cast< RPointerArray< elemType >* >( aPtr ) )->
-        ResetAndDestroy();
-    }
-
-// ---------------------------------------------------------------------------
 // DeleteHttpDowload
 // ---------------------------------------------------------------------------
 //
@@ -189,34 +163,6 @@
         }
     }
 
-// ---------------------------------------------------------------------------
-// IapIdOfDefaultSnapL
-// for trapping purposes only
-// ---------------------------------------------------------------------------
-//
-LOCAL_C TUint32 IapIdOfDefaultSnapL(
-    RCmManager& aCmManager,
-    const TUint32 aDefaultSnap )
-    {
-    RCmDestination dest( aCmManager.DestinationL( aDefaultSnap ) );
-    CleanupClosePushL( dest );
-    TUint32 iapIdOfDest( 0 );
-
-    if ( dest.ConnectionMethodCount() <= 0 )
-        {
-        User::Leave( KErrNotFound );
-        }
-
-    RCmConnectionMethod cMeth( dest.ConnectionMethodL( 0 ) );
-    CleanupClosePushL( cMeth );
-
-    iapIdOfDest = cMeth.GetIntAttributeL( CMManager::ECmIapId );
-    CleanupStack::PopAndDestroy( &cMeth );
-    CleanupStack::PopAndDestroy( &dest );
-    return iapIdOfDest;
-    }
-
-
 // ============================= MEMBER FUNCTIONS ==============================
 
 // ---------------------------------------------------------------------------
@@ -301,7 +247,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL
+// CRoHandlerDMgrWrapper::HandleRoapTriggerL
 // ---------------------------------------------------------------------------
 //
 void CRoHandlerDMgrWrapper::HandleRoapTriggerL( const TDesC8& aTrigger )
@@ -317,42 +263,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL
-// ---------------------------------------------------------------------------
-//
-void CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerL( const HBufC8* aUrl )
-    {
-    DRMDEBUGMETHOD(
-        RoHdlrDMgrWrDebugLiterals::KMethDownloadAndHandleRoapTriggerL() );
-    if ( iState != EInit || iWait.IsStarted() )
-        {
-        User::Leave( KErrNotReady );
-        }
-
-    UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, *aUrl );
-    Continue( EGetMeteringTrigger, KErrNone );
-    iWait.Start();
-    }
-
-// ---------------------------------------------------------------------------
-// CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerFromPrUrlL
-// ---------------------------------------------------------------------------
-//
-void CRoHandlerDMgrWrapper::DownloadAndHandleRoapTriggerFromPrUrlL(
-        const HBufC8* aUrl )
-    {
-    DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDownloadAndHandleRoapTriggerFromPrUrlL() );
-    if ( iState != EInit || iWait.IsStarted() )
-        {
-        User::Leave( KErrNotReady );
-        }
-
-    UpdateBufferL< HBufC8, TDesC8 >( iTriggerUrl, *aUrl );
-    Continue( EGetPrUrlTrigger, KErrNone );
-    iWait.Start();
-    }
-
-// ---------------------------------------------------------------------------
 // CRoHandlerDMgrWrapper::DoDownloadRoapTriggerL
 // ---------------------------------------------------------------------------
 //
@@ -360,7 +270,7 @@
     {
     RFile roapTrigger;
     TBool result( EFalse );
-    TFileName triggerFileName;
+    DRM::CFileNameContainer* triggerFileName(NULL);
 
     DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethDoDownloadAndHandleRoapTriggerL() );
     // If no Trigger URL then nothing to download. So finish transaction
@@ -370,10 +280,11 @@
         return;
         }
 
+    triggerFileName=DRM::CFileNameContainer::NewLC();
 #ifndef RD_MULTIPLE_DRIVE
 
     User::LeaveIfError( roapTrigger.Temp(
-            iFs, KHelperTriggerFilePath, triggerFileName, EFileWrite ) );
+            iFs, KHelperTriggerFilePath, triggerFileName->iBuffer, EFileWrite ) );
 
 #else //RD_MULTIPLE_DRIVE
     _LIT( KDrive, "%c:\\" );
@@ -382,15 +293,20 @@
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRam, driveNumber );
     iFs.DriveToChar( driveNumber, driveLetter );
 
-    TFileName helperTriggerFilePath;
+    DRM::CFileNameContainer*
+        helperTriggerFilePath( DRM::CFileNameContainer::NewLC() );
+
+    helperTriggerFilePath->iBuffer.Format( KDrive, ( TUint )driveLetter );
 
-    helperTriggerFilePath.Format( KDrive, ( TUint )driveLetter );
-
-    User::LeaveIfError( roapTrigger.Temp( iFs, helperTriggerFilePath,
-            triggerFileName, EFileWrite ) );
+    User::LeaveIfError( roapTrigger.Temp( iFs, helperTriggerFilePath->iBuffer,
+                triggerFileName->iBuffer, EFileWrite ) );
+    CleanupStack::PopAndDestroy( helperTriggerFilePath );
+    helperTriggerFilePath=NULL;
 
 #endif
-    UpdateBufferL< HBufC, TFileName >( iFileName, triggerFileName );
+    UpdateBufferL< HBufC, TFileName >( iFileName, triggerFileName->iBuffer );
+    CleanupStack::PopAndDestroy( triggerFileName );
+    triggerFileName=NULL;
 
     // create and start download
     RHttpDownload& download = iDlMgr.CreateDownloadL( *iTriggerUrl, result );
@@ -504,9 +420,7 @@
     Roap::TDomainOperation domainOperation;
 
     RPointerArray< HBufC8 > contentIds;
-
-    TCleanupItem cleanup( DoResetAndDestroy< HBufC8 >, &contentIds );
-    CleanupStack::PushL( cleanup );
+    CleanupResetAndDestroyPushL( contentIds );
 
     iRoapEng = Roap::CRoapEng::NewL();
 
@@ -535,55 +449,11 @@
 //
 void CRoHandlerDMgrWrapper::SetDefaultAccessPointL()
     {
-    const TInt KDestinationSelectionMode( 2 );
-    CRepository* repository( NULL );
-    TInt ap( 0 );
-    TInt alwaysAsk( 0 );
-    TUint32 iapd32( 0 );
-    TInt defaultSnap( 0 );
-    TInt err( KErrNone );
-
     DRMDEBUGMETHOD( RoHdlrDMgrWrDebugLiterals::KMethSetDefaultAccessPointL() );
 
-    if ( !iIapId )
+    if ( iIapId )
         {
-        repository = CRepository::NewL( KCRUidBrowser );
-        CleanupStack::PushL( repository );
-        repository->Get( KBrowserDefaultAccessPoint, ap );
-        repository->Get( KBrowserAccessPointSelectionMode, alwaysAsk );
-        repository->Get( KBrowserNGDefaultSnapId, defaultSnap );
-        if ( ap <= KErrNotFound && defaultSnap <= KErrNotFound )
-            {
-            alwaysAsk = ETrue;
-            }
-        else
-            {
-            RCmManager cmManager;
-            cmManager.OpenLC();
-            if ( !alwaysAsk )
-                {
-                TRAP( err, iapd32 = cmManager.GetConnectionMethodInfoIntL(
-                        ap, CMManager::ECmIapId ) );
-                }
-            else if ( alwaysAsk == KDestinationSelectionMode )
-                {
-                TRAP( err, iapd32 = IapIdOfDefaultSnapL(
-                        cmManager, defaultSnap ) );
-                }
-            CleanupStack::PopAndDestroy( &cmManager );
-            }
-        if ( !err && ( !alwaysAsk || alwaysAsk == KDestinationSelectionMode ) )
-            {
-            iIapId = iapd32;
-            DRMDEBUG3( RoHdlrDMgrWrDebugLiterals::KFormatMembValInt(),
-                &RoHdlrDMgrWrDebugLiterals::KMiIapId(), iIapId );
-            err = iDlMgr.SetIntAttribute( EDlMgrIap, iapd32 );
-            }
-        CleanupStack::PopAndDestroy( repository );
-        }
-    else
-        {
-        err = iDlMgr.SetIntAttribute( EDlMgrIap, iIapId );
+        iDlMgr.SetIntAttribute( EDlMgrIap, iIapId );
         }
     }
 
--- a/omadrm/drmplugins/drmromtm/client/src/RoMtmCli.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/client/src/RoMtmCli.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -31,9 +31,9 @@
 #include <msvuids.h>     // kuidmsvmessageentry
 #include <sysutil.h>     // disk space checking
 
-#include    "romtmcli.h"
-#include    "romtmcc.h"
-#include    "romtmcommon.h"
+#include    "RoMtmCli.h"
+#include    "RoMTMCC.h"
+#include    "RoMTMCommon.h"
 GLREF_C void Panic( TRoMtmCliPanic aPanic );
 
 // EXTERNAL DATA STRUCTURES
--- a/omadrm/drmplugins/drmromtm/group/RoMtmDat.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/group/RoMtmDat.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -46,7 +46,7 @@
 USERINCLUDE     ../../../../inc   // ADo level inc dir
 
 // Default system include paths for middleware layer modules.
-APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY   euser.lib
 LIBRARY   mtur.lib
--- a/omadrm/drmplugins/drmromtm/server/inc/RoMtmSer.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/server/inc/RoMtmSer.h	Wed Jun 23 17:42:58 2010 +0100
@@ -23,9 +23,9 @@
 #include <e32base.h>
 #include <mtclbase.h>
 #include <mtsr.h>
-#include <MSVSTORE.H>
-#include <MSVUIDS.H>
-#include <MSVIDS.H>
+#include <msvstore.h>
+#include <msvuids.h>
+#include <msvids.h>
 
 
 
@@ -40,180 +40,180 @@
 
 // CLASS DECLARATION
 /**
-*	CRightsObjectServerMtm
-*  
+*   CRightsObjectServerMtm
+*
 *  @lib RoMtmSer.lib
 *  @since 2.5
 */
 
 
 //
-//	CRightsObjectServerMtm: The Server-side MTM implementation
+//  CRightsObjectServerMtm: The Server-side MTM implementation
 //
 class CRightsObjectServerMtm : public CBaseServerMtm
-	{
-	public:
+    {
+    public:
 
 
 
-	// Constructor, initialisation, and destructor 
+    // Constructor, initialisation, and destructor
 
         /**
         * Two-phased constructor.
         */
-		IMPORT_C static CRightsObjectServerMtm* NewL( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry );
-	
+        IMPORT_C static CRightsObjectServerMtm* NewL( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry );
+
         /**
         * Destructor.
-        */		
-		~CRightsObjectServerMtm();
+        */
+        ~CRightsObjectServerMtm();
 
-		/*************************************
-		*
-		*		from CBaseMtm
-		*
-		**************************************/
-		// Copy and move 
-		
-		/**
+        /*************************************
+        *
+        *       from CBaseMtm
+        *
+        **************************************/
+        // Copy and move
+
+        /**
         * CopyToLocalL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void CopyToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
+        void CopyToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
 
-		/**
+        /**
         * CopyFromLocalL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void CopyFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
+        void CopyFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
 
-		/**
+        /**
         * CopyToLocalL
         * @since 2.5
-        * 
-		* Not Supported
-		*
-        */		
-		void CopyWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
-		
-		/**
+        *
+        * Not Supported
+        *
+        */
+        void CopyWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
+
+        /**
         * MoveToLocalL
         * @since 2.5
-        * 
-		* Not Supported
-		*
-        */		
-		void MoveToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
-		
-		/**
+        *
+        * Not Supported
+        *
+        */
+        void MoveToLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
+
+        /**
         * MoveFromLocalL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void MoveFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
-		
-		/**
+        void MoveFromLocalL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
+
+        /**
         * MoveWithinServiceL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void MoveWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
+        void MoveWithinServiceL( const CMsvEntrySelection& aSelection , TMsvId aDestination , TRequestStatus& aStatus );
 
-		// Create, change, delete 
-		
-		/**
+        // Create, change, delete
+
+        /**
         * DeleteAllL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void DeleteAllL( const CMsvEntrySelection& aSelection , TRequestStatus& aStatus );
-		
-		/**
+        void DeleteAllL( const CMsvEntrySelection& aSelection , TRequestStatus& aStatus );
+
+        /**
         * CreateL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void CreateL( TMsvEntry aNewEntry , TRequestStatus& aStatus );
-		
-		/**
+        void CreateL( TMsvEntry aNewEntry , TRequestStatus& aStatus );
+
+        /**
         * ChangeL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void ChangeL( TMsvEntry aNewEntry , TRequestStatus& aStatus );
+        void ChangeL( TMsvEntry aNewEntry , TRequestStatus& aStatus );
 
-		// Command and progress
-		
-		/**
+        // Command and progress
+
+        /**
         * StartCommandL
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		void StartCommandL( CMsvEntrySelection& aSelection , TInt aCommand , 
-			const TDesC8& aParameter , TRequestStatus& aStatus );
-		
-		/**
+        void StartCommandL( CMsvEntrySelection& aSelection , TInt aCommand ,
+            const TDesC8& aParameter , TRequestStatus& aStatus );
+
+        /**
         * CommandExpected
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		TBool CommandExpected();
-		
-		
-		/**
+        TBool CommandExpected();
+
+
+        /**
         * Progress
         * @since 2.5
-        * 
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		const TDesC8& Progress();
+        const TDesC8& Progress();
+
+        // void RunL()
+        // void SetInitialEntry(CMsvServerEntry* aEntry)=0;
+    protected:
 
-		// void RunL()
-		// void SetInitialEntry(CMsvServerEntry* aEntry)=0;
-	protected:
-  
-		/*************************************
-		*
-		*		from CActive
-		*
-		**************************************/
-		void DoCancel();
-		/*************************************
-		*
-		*		from CBaseMtm
-		*
-		**************************************/
-		void DoRunL();
-		void DoComplete(TInt aError);
+        /*************************************
+        *
+        *       from CActive
+        *
+        **************************************/
+        void DoCancel();
+        /*************************************
+        *
+        *       from CBaseMtm
+        *
+        **************************************/
+        void DoRunL();
+        void DoComplete(TInt aError);
 
-	private:
-		CRightsObjectServerMtm( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry );
-		void ConstructL();
+    private:
+        CRightsObjectServerMtm( CRegisteredMtmDll& aRegisteredMtmDll , CMsvServerEntry* aInitialEntry );
+        void ConstructL();
 
-	private:
-	};
+    private:
+    };
 
 #endif      // RIGHTSOBJECTSERVERMTM_H
-            
+
 // End of File
--- a/omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/ui/inc/RoMtmUi.h	Wed Jun 23 17:42:58 2010 +0100
@@ -22,8 +22,8 @@
 //  INCLUDES
 #include <e32base.h>
 #include <mtmuibas.h>
-#include <aknserverapp.h>
- 
+#include <AknServerApp.h>
+
 // CONSTANTS
 // MACRightsObjectS
 // DATA TYPES
@@ -43,8 +43,8 @@
 
 // CLASS DECLARATION
 /**
-*	CRightsObjectMtmUi
-*  
+*   CRightsObjectMtmUi
+*
 *  @lib romtmui.lib
 *  @since 2.5
 */
@@ -52,169 +52,169 @@
 // CRightsObjectMtmUi: User Interface MTM
 //
 class CRightsObjectMtmUi : public CBaseMtmUi , public MAknServerAppExitObserver , public MApaServerAppExitObserver
-	{
-	public:
-		// Construction
+    {
+    public:
+        // Construction
         /**
         * Two-phased constructor.
         */
-		static CRightsObjectMtmUi* NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll );
+        static CRightsObjectMtmUi* NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll );
 
-		// Destruction
+        // Destruction
 
         /**
         * Destructor.
         */
-		~CRightsObjectMtmUi();
+        ~CRightsObjectMtmUi();
 
-		/*************************************
-		*
-		*		from CBaseMtmUi
-		*
-		**************************************/
+        /*************************************
+        *
+        *       from CBaseMtmUi
+        *
+        **************************************/
 
 
         /**
         * CancelL.
         * @since 2.5
-		*
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		CMsvOperation* CancelL( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection );
+        CMsvOperation* CancelL( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection );
 
-		// Context-specific
+        // Context-specific
         /**
         * OpenL.
         * @since 2.5
-		*
-		* @param aStatus The request status to be completed when the operation has finished
-		* @return If successful, this is an asynchronously completing open operation. 
-		*         If failed, this is a completed operation, with status set to the relevant error code.
+        *
+        * @param aStatus The request status to be completed when the operation has finished
+        * @return If successful, this is an asynchronously completing open operation.
+        *         If failed, this is a completed operation, with status set to the relevant error code.
         */
-		CMsvOperation* OpenL( TRequestStatus& aStatus ); 
-		
+        CMsvOperation* OpenL( TRequestStatus& aStatus );
+
         /**
         * OpenL.
         * @since 2.5
-		*
-		* @param aStatus The request status to be completed when the operation has finished
-		* @param aSelection Selection of message entries 
-		* @return If successful, this is an asynchronously completing open operation. 
-		*         If failed, this is a completed operation, with status set to the relevant error code.
+        *
+        * @param aStatus The request status to be completed when the operation has finished
+        * @param aSelection Selection of message entries
+        * @return If successful, this is an asynchronously completing open operation.
+        *         If failed, this is a completed operation, with status set to the relevant error code.
         */
-		CMsvOperation* OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ); 
+        CMsvOperation* OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection );
+
+        /**
+        * CloseL.
+        * @since 2.5
+        *
+        * Not Supported
+        *
+        */
+        CMsvOperation* CloseL( TRequestStatus& aStatus );
 
         /**
         * CloseL.
         * @since 2.5
-		*
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		CMsvOperation* CloseL( TRequestStatus& aStatus ); 
-		
-		/**
-        * CloseL.
-        * @since 2.5
-		*
-		* Not Supported
-		*
-        */
-		CMsvOperation* CloseL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection );
+        CMsvOperation* CloseL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection );
 
-		// Launches editor/settings dialog as appropriate  
-		/**
+        // Launches editor/settings dialog as appropriate
+        /**
         * EditL.
         * @since 2.5
-		*
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		CMsvOperation* EditL( TRequestStatus& aStatus );
-		
-		/**
+        CMsvOperation* EditL( TRequestStatus& aStatus );
+
+        /**
         * EditL.
         * @since 2.5
-		*
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		CMsvOperation* EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) ;
+        CMsvOperation* EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) ;
 
-		// Launches viewer/settings dialog as appropriate  
+        // Launches viewer/settings dialog as appropriate
         /**
         * ViewL.
         * @since 2.5
-		*
-		* @param aStatus The request status to be completed when the operation has finished
-		* @return If successful, this is an asynchronously completing open operation. 
-		*         If failed, this is a completed operation, with status set to the relevant error code.
+        *
+        * @param aStatus The request status to be completed when the operation has finished
+        * @return If successful, this is an asynchronously completing open operation.
+        *         If failed, this is a completed operation, with status set to the relevant error code.
         */
-		CMsvOperation* ViewL( TRequestStatus& aStatus );
-		
+        CMsvOperation* ViewL( TRequestStatus& aStatus );
+
         /**
         * ViewL.
         * @since 2.5
-		*
-		* @param aStatus The request status to be completed when the operation has finished
-		* @param aSelection Selection of message entries 
-		* @return If successful, this is an asynchronously completing open operation. 
-		*         If failed, this is a completed operation, with status set to the relevant error code.
-        */		
-		CMsvOperation* ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection );
+        *
+        * @param aStatus The request status to be completed when the operation has finished
+        * @param aSelection Selection of message entries
+        * @return If successful, this is an asynchronously completing open operation.
+        *         If failed, this is a completed operation, with status set to the relevant error code.
+        */
+        CMsvOperation* ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection );
 
-		// Reply/forward
-		/**
+        // Reply/forward
+        /**
         * ReplyL.
         * @since 2.5
-		*
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		CMsvOperation* ReplyL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus );
-		
-		/**
+        CMsvOperation* ReplyL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus );
+
+        /**
         * ForwardL.
         * @since 2.5
-		*
-		* Not Supported
-		*
+        *
+        * Not Supported
+        *
         */
-		CMsvOperation* ForwardL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus );
+        CMsvOperation* ForwardL( TMsvId aDestination , TMsvPartList aPartList , TRequestStatus& aCompletionStatus );
 
 
-	public:
-		void HandleServerAppExit(TInt aReason);
+    public:
+        void HandleServerAppExit(TInt aReason);
 
 
-	protected: 
-		/*************************************
-		*
-		*		from CBaseMtm
-		*
-		**************************************/
-		void GetResourceFileName( TFileName& aFileName ) const;
+    protected:
+        /*************************************
+        *
+        *       from CBaseMtm
+        *
+        **************************************/
+        void GetResourceFileName( TFileName& aFileName ) const;
 
-	protected:
-		CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll );
-		void ConstructL();
+    protected:
+        CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll );
+        void ConstructL();
 
-	private:
-		void CheckMessageTypeL();
-		CMsvOperation* LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId aId , TBool aReadOnly );
-		void SetProgressSuccess( TPckgBuf<TMsvLocalOperationProgress>& aProgress , TMsvId aId );
-		CMsvOperation* CompletedOperationL( TRequestStatus& aObserverStatus );
+    private:
+        void CheckMessageTypeL();
+        CMsvOperation* LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId aId , TBool aReadOnly );
+        void SetProgressSuccess( TPckgBuf<TMsvLocalOperationProgress>& aProgress , TMsvId aId );
+        CMsvOperation* CompletedOperationL( TRequestStatus& aObserverStatus );
         TBool ShowQueryL( TDesC16& aFile );
         TInt CheckTriggerTypeL( TDesC16& aFile );
-	private:
-		TMessageType iType;
-		CDocumentHandler* iDocHandler;
-		RFs iFs;
-		CEikProcess* iHostProcess;
+    private:
+        TMessageType iType;
+        CDocumentHandler* iDocHandler;
+        RFs iFs;
+        CEikProcess* iHostProcess;
     CAknLaunchAppService* iOpenService;
-	};
+    };
 
 #endif      // RIGHTSOBJECTMTMUI_H
-            
+
 // End of File
--- a/omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,7 +19,7 @@
 // INCLUDE FILES
 
 #include <txtrich.h>//CRichText
-#include <eikrted.h> //	CEikRichTextEditor
+#include <eikrted.h> // CEikRichTextEditor
 #include <eikenv.h>//CEikonEnv
 
 #include <AiwGenericParam.h>
@@ -27,18 +27,18 @@
 
 #include <eikon.rsg>
 // Messaging includes
-#include <MSVUIDS.H>
+#include <msvuids.h>
 #include <msvids.h>
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include <eikproc.h>
 #include <eikdoc.h>
-#include <akndialog.h>
+#include <AknDialog.h>
 #include "RoMtmUi.h"
-#include "RoMtmUiC.h"
+#include "RoMTMUiC.h"
 
 
 #include <DocumentHandler.h> // document handler
@@ -48,10 +48,10 @@
 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
 #include <AknQueryDialog.h> // CAknQueryDialog
 #include <StringLoader.h> //StringLoader
-#include <coneresloader.h> //rconeresloader
+#include <ConeResLoader.h> //rconeresloader
 #include <RoMtmUi.rsg> // test
 // EXTERNAL DATA STRUCTURES
-// EXTERNAL FUNCTION PROTOTYPES  
+// EXTERNAL FUNCTION PROTOTYPES
 // CONSTANTS
 _LIT(KRoAcquisitionPrefix, "ROA:");
 _LIT(KTriggerPrefix, "TRI:");
@@ -59,7 +59,7 @@
 #ifndef RD_MULTIPLE_DRIVE
 _LIT( KDriveZ, "z:" );
 #endif
-                                      
+
 _LIT( KRoMtmUiResFileName,"RoMtmUi.rsc" );
 // MACROS
 // LOCAL CONSTANTS AND MACROS
@@ -145,7 +145,7 @@
     CleanupStack::PopAndDestroy(); //fs
     WriteCurrentTimeL();
     }
-    
+
 LOCAL_C void WriteL( const TDesC8& aText , TInt aErr )
     {
     _LIT8(KErr,": %d");
@@ -158,7 +158,7 @@
     WriteL(textptr);
     CleanupStack::PopAndDestroy(text);
     }
-    
+
 LOCAL_C void WriteL( const TDesC& aText , TInt aErr )
     {
     _LIT8(KErr,": %d");
@@ -200,15 +200,15 @@
 #endif
 /*************************************
 *
-*		Global function declarations
+*       Global function declarations
 *
 **************************************/
 
 EXPORT_C CBaseMtmUi* NewMtmUiL( CBaseMtm& aMtm , CRegisteredMtmDll& aRegisteredDll )
 // Factory function
-	{
-	return CRightsObjectMtmUi::NewL( aMtm , aRegisteredDll );
-	}
+    {
+    return CRightsObjectMtmUi::NewL( aMtm , aRegisteredDll );
+    }
 //
 // CRightsObjectMtmUi: User Interface MTM
 //
@@ -217,7 +217,7 @@
 
 /*************************************
 *
-*		Construction and destruction 
+*       Construction and destruction
 *
 **************************************/
 
@@ -228,13 +228,13 @@
 // -----------------------------------------------------------------------------
 //
 CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll )
-	:	CBaseMtmUi( aBaseMtm , aRegisteredMtmDll )
-	{
-	iOpenService = NULL;
-	iDocHandler = NULL;
-	iHostProcess = NULL;
-	iType = ERo;
-	}
+    :   CBaseMtmUi( aBaseMtm , aRegisteredMtmDll )
+    {
+    iOpenService = NULL;
+    iDocHandler = NULL;
+    iHostProcess = NULL;
+    iType = ERo;
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::ConstructL
@@ -242,14 +242,14 @@
 // -----------------------------------------------------------------------------
 //
 void CRightsObjectMtmUi::ConstructL()
-	{
+    {
 #ifdef _DRM_TESTING
-	CreateLogL();
-	WriteL(_L8("ConstructL"));
+    CreateLogL();
+    WriteL(_L8("ConstructL"));
 #endif
-	CBaseMtmUi::ConstructL();
-	User::LeaveIfError(iFs.Connect());
-	}
+    CBaseMtmUi::ConstructL();
+    User::LeaveIfError(iFs.Connect());
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::NewL
@@ -257,32 +257,32 @@
 // -----------------------------------------------------------------------------
 //
 CRightsObjectMtmUi* CRightsObjectMtmUi::NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll )
-	{
-	CRightsObjectMtmUi* self=new ( ELeave ) CRightsObjectMtmUi( aBaseMtm , aRegisteredMtmDll );
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	CleanupStack::Pop();
-	return self;
-	}
+    {
+    CRightsObjectMtmUi* self=new ( ELeave ) CRightsObjectMtmUi( aBaseMtm , aRegisteredMtmDll );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
 
 // Destructor
 CRightsObjectMtmUi::~CRightsObjectMtmUi()
-	{
+    {
 #ifdef _DRM_TESTING
-	TRAP(err,WriteL(_L8("~CRightsObjectMtmUi")));
+    TRAP(err,WriteL(_L8("~CRightsObjectMtmUi")));
 #endif
-	iFs.Close();
+    iFs.Close();
 
   delete iOpenService;
-	delete iDocHandler;
-	}
+    delete iDocHandler;
+    }
 
 
 
 
 /*************************************
 *
-*		from CBaseMtm
+*       from CBaseMtm
 *
 **************************************/
 
@@ -294,56 +294,56 @@
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::CancelL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ )
-	{
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("CancelL"));
+    WriteL(_L8("CancelL"));
 #endif
-	
-	User::Leave( KErrNotSupported ); // no cancelling
-	return NULL;
-	}
+
+    User::Leave( KErrNotSupported ); // no cancelling
+    return NULL;
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::GetResourceFileName
 //
-// Implementations provide this function to set the full path 
-// and name of the resource file associated with the User Interface MTM. 
+// Implementations provide this function to set the full path
+// and name of the resource file associated with the User Interface MTM.
 //
 // -----------------------------------------------------------------------------
 //
 void CRightsObjectMtmUi::GetResourceFileName( TFileName& aFileName ) const
-// Resource file loading 
-	{ 
+// Resource file loading
+    {
 #ifdef _DRM_TESTING
-	TRAPD(err,WriteL(_L8("GetResourceFileName")));
-#endif	
-	aFileName = KRoMtmResourceFile; 
-	}
+    TRAPD(err,WriteL(_L8("GetResourceFileName")));
+#endif
+    aFileName = KRoMtmResourceFile;
+    }
 
 //
-//	Entry manipulation 
+//  Entry manipulation
 //
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::OpenL
 //
-// Opens an entry. 
+// Opens an entry.
 //
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus )
-// Open 
-	{
+// Open
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("OpenL(1)"));
-#endif	
+    WriteL(_L8("OpenL(1)"));
+#endif
 
     TMsvEntry tEntry = BaseMtm().Entry().Entry();
     TMsvEntry newEntry( tEntry );
 
-	const TUid type( tEntry.iType );
-    CMsvOperation* operation = NULL;	
-	if ( type == KUidMsvMessageEntry )
+    const TUid type( tEntry.iType );
+    CMsvOperation* operation = NULL;
+    if ( type == KUidMsvMessageEntry )
         {
         operation = ViewL( aStatus );
         newEntry.SetUnread( EFalse );
@@ -353,25 +353,25 @@
         {
         User::Leave( KErrNotSupported );
         }
-	return operation;
-	}
+    return operation;
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::OpenL
 //
-// Opens the first entry in the selections. 
+// Opens the first entry in the selections.
 //
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection )
 // Open selection
-	{
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("OpenL(2)"));
-#endif	
+    WriteL(_L8("OpenL(2)"));
+#endif
     BaseMtm().SwitchCurrentEntryL( aSelection.At( 0 ) );
     return OpenL( aStatus );
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::CloseL
@@ -381,14 +381,14 @@
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ )
-	{
-// Close 
+    {
+// Close
 #ifdef _DRM_TESTING
-	WriteL(_L8("CloseL(1)"));
-#endif	
+    WriteL(_L8("CloseL(1)"));
+#endif
     User::Leave( KErrNotSupported );
     return NULL;
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::CloseL
@@ -398,15 +398,15 @@
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ )
-	{
+    {
 // Close selection
 #ifdef _DRM_TESTING
-	WriteL(_L8("CloseL(2)"));
-#endif	
+    WriteL(_L8("CloseL(2)"));
+#endif
 
     User::Leave( KErrNotSupported );
     return NULL;
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::EditL
@@ -416,14 +416,14 @@
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& /*aStatus*/ )
-// Edit 
-	{
+// Edit
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("EditL(1)"));
-#endif		
-    User::Leave( KErrNotSupported );	
-	return NULL;
-	}
+    WriteL(_L8("EditL(1)"));
+#endif
+    User::Leave( KErrNotSupported );
+    return NULL;
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::EditL
@@ -434,13 +434,13 @@
 //
 CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection )
 // Edit selection
-	{
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("EditL(2)"));
-#endif	
-	iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) );
-	return EditL( aStatus );
-	}
+    WriteL(_L8("EditL(2)"));
+#endif
+    iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) );
+    return EditL( aStatus );
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::ViewL
@@ -451,14 +451,14 @@
 //
 CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus )
 // View
-	{
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ViewL(1)"));
+    WriteL(_L8("ViewL(1)"));
 #endif
-	
-    CheckMessageTypeL();                                       
-	return LaunchEditorApplicationL( aStatus , iBaseMtm.Entry().Entry().Id() , ETrue );
-	}
+
+    CheckMessageTypeL();
+    return LaunchEditorApplicationL( aStatus , iBaseMtm.Entry().Entry().Id() , ETrue );
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::ViewL
@@ -469,18 +469,18 @@
 //
 CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection )
 // View selection
-	{
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ViewL(2)"));
+    WriteL(_L8("ViewL(2)"));
 #endif
-	
-	iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) );
-	return ViewL( aStatus );
-	}
+
+    iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) );
+    return ViewL( aStatus );
+    }
 
 
 //
-//	Message responding
+//  Message responding
 //
 
 // -----------------------------------------------------------------------------
@@ -492,10 +492,10 @@
 //
 CMsvOperation* CRightsObjectMtmUi::ReplyL( TMsvId /*aDestination*/ , TMsvPartList /*aPartlist*/ , TRequestStatus& /*aCompletionStatus*/ )
 // Reply to message - no UI support
-	{
-	User::Leave( KErrNotSupported );
-	return NULL;
-	}
+    {
+    User::Leave( KErrNotSupported );
+    return NULL;
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::ForwardL
@@ -506,10 +506,10 @@
 //
 CMsvOperation* CRightsObjectMtmUi::ForwardL( TMsvId /*aDestination*/ , TMsvPartList /*aPartlist*/ , TRequestStatus& /*aCompletionStatus*/ )
 // Forwarded message - no UI support
-	{
-	User::Leave( KErrNotSupported );
-	return NULL;
-	}
+    {
+    User::Leave( KErrNotSupported );
+    return NULL;
+    }
 
 
 //
@@ -525,31 +525,31 @@
 // -----------------------------------------------------------------------------
 //
 void CRightsObjectMtmUi::CheckMessageTypeL()
-	{
+    {
 #ifdef _DRM_TESTING
-		WriteL(_L8("CheckMessageTypeL"));
-#endif	
-	BaseMtm().LoadMessageL(); 
-	CRichText& body = BaseMtm().Body();
-	TPtrC ptr16( body.Read(0) );
+        WriteL(_L8("CheckMessageTypeL"));
+#endif
+    BaseMtm().LoadMessageL();
+    CRichText& body = BaseMtm().Body();
+    TPtrC ptr16( body.Read(0) );
 
 #ifdef _DRM_TESTING
-		WriteL(ptr16);
-#endif		
-	if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KRoAcquisitionPrefix())==0 )
-		{
-		iType = ERoapTriggerRoAcquisition;
-		}
-	else if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KTriggerPrefix())==0 )
-		{
-		iType = ERoapTrigger;
-		}
-	else
-		{
-		iType = ERo;	
-		}
-		
-	}
+        WriteL(ptr16);
+#endif
+    if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KRoAcquisitionPrefix())==0 )
+        {
+        iType = ERoapTriggerRoAcquisition;
+        }
+    else if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KTriggerPrefix())==0 )
+        {
+        iType = ERoapTrigger;
+        }
+    else
+        {
+        iType = ERo;
+        }
+
+    }
 
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::LaunchEditorApplicationL
@@ -558,123 +558,123 @@
 //
 // -----------------------------------------------------------------------------
 //
-CMsvOperation* CRightsObjectMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId /*aId*/ , 
-													TBool /*aReadOnly*/ )
-	{
+CMsvOperation* CRightsObjectMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId /*aId*/ ,
+                                                    TBool /*aReadOnly*/ )
+    {
 #ifdef _DRM_TESTING
-	WriteL(_L8("LaunchEditorApplicationL-Start"));
-#endif	
-	// get message context
-	BaseMtm().LoadMessageL(); 
-	CRichText& body = BaseMtm().Body();
-	TPtrC ptr16( body.Read(0) );
+    WriteL(_L8("LaunchEditorApplicationL-Start"));
+#endif
+    // get message context
+    BaseMtm().LoadMessageL();
+    CRichText& body = BaseMtm().Body();
+    TPtrC ptr16( body.Read(0) );
     const TUid KUidDRMUI = { 0x101f85c7 };
 
-	if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition )
-		{
-		
+    if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition )
+        {
+
 #ifdef _DRM_TESTING
-		WriteL(_L8("LaunchEditorApplicationL-iDocHandler"));
+        WriteL(_L8("LaunchEditorApplicationL-iDocHandler"));
 #endif
-        
+
         _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" );
         TDataType type = TDataType( KRoapTriggerMimeType );
         HBufC* filename = NULL;
-		TPtr ptr(NULL,0);
-		TBool show;
-		filename = HBufC::NewLC(ptr16.Length()-4);
-		ptr.Set(filename->Des());
-		ptr.Append(ptr16.Right(ptr16.Length()-4));
-		
-		show = ShowQueryL(ptr);
-		if (!show)
-		    {
-		    CleanupStack::PopAndDestroy(filename);
-		    return CompletedOperationL( aStatus );
-		    }
-		
-#ifdef _DRM_TESTING
-		WriteL(ptr,ptr.Length());
-#endif		
-		if (iDocHandler)
-			{
-			delete iDocHandler;
-			iDocHandler = NULL;
-			}
-#ifdef _DRM_TESTING
-		WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL"));
-#endif			
-		iDocHandler = CDocumentHandler::NewL();
-#ifdef _DRM_TESTING
-		WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver"));
-#endif		
-		iDocHandler->SetExitObserver(this);
-#ifdef _DRM_TESTING
-		WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL"));
-#endif			
-		iDocHandler->OpenFileEmbeddedL(ptr,type);
-		CleanupStack::PopAndDestroy(filename);
-#ifdef _DRM_TESTING
-		WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End"));
-#endif		
-		}
-	else
-		{
-	    if ( iOpenService )
-	        {
-	        delete iOpenService;
-	        iOpenService = NULL;
-	        }
-#ifdef _DRM_TESTING
-		WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL"));
-#endif           
+        TPtr ptr(NULL,0);
+        TBool show;
+        filename = HBufC::NewLC(ptr16.Length()-4);
+        ptr.Set(filename->Des());
+        ptr.Append(ptr16.Right(ptr16.Length()-4));
 
-		CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
-		TAiwVariant variantObject( ptr16 );
-		TAiwGenericParam param( EGenericParamFile, variantObject );
-		paramList->AppendL( param );
-		
-    	TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) );
-    	if (err != KErrNone)
-    		{
-    		// just return to Inbox
-    		}
-
-		CleanupStack::PopAndDestroy( paramList ); // paramList			
-		}	
+        show = ShowQueryL(ptr);
+        if (!show)
+            {
+            CleanupStack::PopAndDestroy(filename);
+            return CompletedOperationL( aStatus );
+            }
 
 #ifdef _DRM_TESTING
-	WriteL(_L8("LaunchEditorApplicationL-End"));
-#endif    
+        WriteL(ptr,ptr.Length());
+#endif
+        if (iDocHandler)
+            {
+            delete iDocHandler;
+            iDocHandler = NULL;
+            }
+#ifdef _DRM_TESTING
+        WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL"));
+#endif
+        iDocHandler = CDocumentHandler::NewL();
+#ifdef _DRM_TESTING
+        WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver"));
+#endif
+        iDocHandler->SetExitObserver(this);
+#ifdef _DRM_TESTING
+        WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL"));
+#endif
+        iDocHandler->OpenFileEmbeddedL(ptr,type);
+        CleanupStack::PopAndDestroy(filename);
+#ifdef _DRM_TESTING
+        WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End"));
+#endif
+        }
+    else
+        {
+        if ( iOpenService )
+            {
+            delete iOpenService;
+            iOpenService = NULL;
+            }
+#ifdef _DRM_TESTING
+        WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL"));
+#endif
+
+        CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
+        TAiwVariant variantObject( ptr16 );
+        TAiwGenericParam param( EGenericParamFile, variantObject );
+        paramList->AppendL( param );
+
+        TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) );
+        if (err != KErrNone)
+            {
+            // just return to Inbox
+            }
+
+        CleanupStack::PopAndDestroy( paramList ); // paramList
+        }
+
+#ifdef _DRM_TESTING
+    WriteL(_L8("LaunchEditorApplicationL-End"));
+#endif
     return CompletedOperationL( aStatus );
-	}
+    }
 
 
 void CRightsObjectMtmUi::HandleServerAppExit(TInt aReason)
-	{
+    {
 #ifdef _DRM_TESTING
-	TRAP(err,WriteL(_L8("HandleServerAppExit")));
-#endif	
-	MAknServerAppExitObserver::HandleServerAppExit(aReason);
-	}
-	
+    TRAP(err,WriteL(_L8("HandleServerAppExit")));
+#endif
+    MAknServerAppExitObserver::HandleServerAppExit(aReason);
+    }
+
 // -----------------------------------------------------------------------------
 // CRightsObjectMtmUi::CompletedOperationL
 //
-// return completed operation to UI  
+// return completed operation to UI
 //
 // -----------------------------------------------------------------------------
 //
 CMsvOperation* CRightsObjectMtmUi::CompletedOperationL( TRequestStatus& aObserverStatus )
     {
 #ifdef _DRM_TESTING
-	WriteL(_L8("CompletedOperationL"));
-#endif      
-	//return completed operation pointer
+    WriteL(_L8("CompletedOperationL"));
+#endif
+    //return completed operation pointer
     TPckgBuf<TMsvLocalOperationProgress> progress;
     SetProgressSuccess( progress, BaseMtm().Entry().Entry().Id() );
-    CMsvCompletedOperation* operation = 
-        CMsvCompletedOperation::NewL( Session() , Type() , progress , 
+    CMsvCompletedOperation* operation =
+        CMsvCompletedOperation::NewL( Session() , Type() , progress ,
         KMsvLocalServiceIndexEntryId , aObserverStatus );
     return operation;
     }
@@ -690,31 +690,31 @@
 TBool CRightsObjectMtmUi::ShowQueryL( TDesC16& aFile )
     {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL"));
-#endif       
+    WriteL(_L8("ShowQueryL"));
+#endif
     TBool show = ETrue;
     TInt type = 0;
     HBufC* msgText = NULL;
-    type = CheckTriggerTypeL(aFile);    
-    
+    type = CheckTriggerTypeL(aFile);
+
 #ifndef RD_MULTIPLE_DRIVE
-    
+
     TFileName fileName( KDriveZ );
-    
+
 #else //RD_MULTIPLE_DRIVE
-    
+
     _LIT( KDrive, "%c:");
     TInt driveNumber( -1 );
     TChar driveLetter;
     DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber );
-	iFs.DriveToChar( driveNumber, driveLetter );
-	
-	TFileName fileName;
-	
+    iFs.DriveToChar( driveNumber, driveLetter );
+
+    TFileName fileName;
+
     fileName.Format( KDrive, (TUint)driveLetter );
-    
+
 #endif
-    
+
     fileName.Append( KDC_MTM_RESOURCE_DIR );
     fileName.Append( KRoMtmUiResFileName );
     RConeResourceLoader loader( *iCoeEnv );
@@ -724,60 +724,60 @@
         case Roap::ERegistrationTrigger:
             {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL->ERegistrationTrigger"));
-#endif             
+    WriteL(_L8("ShowQueryL->ERegistrationTrigger"));
+#endif
             loader.Close();
-            return ETrue;              
+            return ETrue;
             }
         case Roap::ERoAcquisitionTrigger:
             {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL->ERoAcquisitionTrigger"));
+    WriteL(_L8("ShowQueryL->ERoAcquisitionTrigger"));
 #endif
-            msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_RIGHTS_ACQ_MSG , iCoeEnv ); 
+            msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_RIGHTS_ACQ_MSG , iCoeEnv );
             }break;
         case Roap::EJoinDomainTrigger:
             {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL->EJoinDomainTrigger"));
-#endif            
-            msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_JOIN_DOMAIN_MSG , iCoeEnv ); 
+    WriteL(_L8("ShowQueryL->EJoinDomainTrigger"));
+#endif
+            msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_JOIN_DOMAIN_MSG , iCoeEnv );
             }break;
         case Roap::ELeaveDomainTrigger:
             {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL->ELeaveDomainTrigger"));
-#endif            
-            msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_LEAVE_DOMAIN_MSG , iCoeEnv ); 
+    WriteL(_L8("ShowQueryL->ELeaveDomainTrigger"));
+#endif
+            msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_LEAVE_DOMAIN_MSG , iCoeEnv );
             }break;
         default:
             {
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL->default"));
-#endif            
+    WriteL(_L8("ShowQueryL->default"));
+#endif
             loader.Close();
-            return EFalse;    
+            return EFalse;
             }
         }
 #ifdef _DRM_TESTING
-	WriteL(*msgText);
-#endif           
+    WriteL(*msgText);
+#endif
     loader.Close();
     CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( *msgText,
         CAknQueryDialog::ENoTone );
-    show = dlg->ExecuteLD( R_ROMTMUI_TRIGGER_CONFIRMATION_QUERY ); 
+    show = dlg->ExecuteLD( R_ROMTMUI_TRIGGER_CONFIRMATION_QUERY );
     CleanupStack::PopAndDestroy( msgText );
 #ifdef _DRM_TESTING
-	WriteL(_L8("ShowQueryL->End"),show);
-#endif   
+    WriteL(_L8("ShowQueryL->End"),show);
+#endif
     return show;
     }
 
 TInt CRightsObjectMtmUi::CheckTriggerTypeL( TDesC16& aFile )
     {
 #ifdef _DRM_TESTING
-	WriteL(_L8("CheckTriggerTypeL"));
-#endif    
+    WriteL(_L8("CheckTriggerTypeL"));
+#endif
     Roap::CRoapEng* roap = NULL;
     RFile file;
     TInt size = 0;
@@ -785,7 +785,7 @@
     Roap::TRiContextStatus status;
     Roap::TDomainOperation op;
     RPointerArray<HBufC8> array;
-    
+
     HBufC8* buf =NULL;
     TPtr8 ptr(NULL,0);
     User::LeaveIfError(file.Open(iFs, aFile, EFileShareReadersOrWriters));
@@ -804,13 +804,13 @@
     array.Close();
     CleanupStack::PopAndDestroy(roap);
     CleanupStack::PopAndDestroy(buf);
-    
+
 #ifdef _DRM_TESTING
-	WriteL(_L8("CheckTriggerTypeL-End"),type);
-#endif     
+    WriteL(_L8("CheckTriggerTypeL-End"),type);
+#endif
     return type;
     }
-    
 
 
 
+
--- a/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmCommands.hrh	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmCommands.hrh	Wed Jun 23 17:42:58 2010 +0100
@@ -22,8 +22,6 @@
 
 // INCLUDE FILES
 
-#include <MtmExtendedCapabilities.hrh>
-
 /**
 * The following enum constants define those Ro MTM specific commands that 
 * are supported by the client or the UI MTM components.
--- a/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmDat.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/uiData/inc/RoMtmDat.h	Wed Jun 23 17:42:58 2010 +0100
@@ -25,7 +25,7 @@
 #endif
 
 #if !defined(__MTUDBAS_H__)
-#include <MTUDCBAS.H>
+#include <mtudcbas.h>
 #endif
 
 // CONSTANTS
@@ -38,34 +38,34 @@
 
 // CLASS DECLARATION
 /**
-*	CRightsObjectMtmUiDataSessionObserver
-*  
+*   CRightsObjectMtmUiDataSessionObserver
+*
 *   CMsvSession Observer
 *
 *  @lib RoMtmDat.lib
 *  @since 2.5
 */
 class CRightsObjectMtmUiDataSessionObserver : public CBase, public MMsvSessionObserver
-	{
-	public:
+    {
+    public:
 
         /**
-		* Two-phased constructor.
-		*/
-		static CRightsObjectMtmUiDataSessionObserver* NewL();
+        * Two-phased constructor.
+        */
+        static CRightsObjectMtmUiDataSessionObserver* NewL();
 
-		/**
-		* Destructor.
-		*/
-		~CRightsObjectMtmUiDataSessionObserver();
+        /**
+        * Destructor.
+        */
+        ~CRightsObjectMtmUiDataSessionObserver();
 
         /**
         * From MMsvSessionObserver
         */
-        void HandleSessionEventL( 
-            TMsvSessionEvent aEvent, 
-            TAny* aArg1, 
-            TAny* aArg2, 
+        void HandleSessionEventL(
+            TMsvSessionEvent aEvent,
+            TAny* aArg1,
+            TAny* aArg2,
             TAny* aArg3 );
 
     private:
@@ -76,210 +76,210 @@
 
 // CLASS DECLARATION
 /**
-*	CRightsObjectMtmUiData
-*  
+*   CRightsObjectMtmUiData
+*
 *  @lib RoMtmDat.lib
 *  @since 2.5
 */
 class CRightsObjectMtmUiData : public CBaseMtmUiData
-	{
-	public:
-	// Construction, initialisation, and destruction 
-	
-		/**
-		* Two-phased constructor.
-		*/
-		static CRightsObjectMtmUiData* NewL( CRegisteredMtmDll& aRegisteredDll );
+    {
+    public:
+    // Construction, initialisation, and destruction
+
+        /**
+        * Two-phased constructor.
+        */
+        static CRightsObjectMtmUiData* NewL( CRegisteredMtmDll& aRegisteredDll );
 
-		/**
-		* Destructor.
-		*/
-		~CRightsObjectMtmUiData();
+        /**
+        * Destructor.
+        */
+        ~CRightsObjectMtmUiData();
 
-		/*************************************
-		*
-		*		from CBaseMtm
-		*
-		**************************************/	
+        /*************************************
+        *
+        *       from CBaseMtm
+        *
+        **************************************/
 
-		// Context-specific information 
+        // Context-specific information
 
-		/**
+        /**
         * CanEditEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
+        *
+        * Not supported
+        *
         */
-		TBool CanEditEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        TBool CanEditEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanViewEntryL
         * @since 2.5
-        * 
-		* @param aContext  The entry to which the operation applies. 
- 		* @param aReasonResourceId  On return, a resource string ID or 0. 
- 		*   
-		* @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry. 
-        */		
-		TBool CanViewEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * @param aContext  The entry to which the operation applies.
+        * @param aReasonResourceId  On return, a resource string ID or 0.
+        *
+        * @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.
+        */
+        TBool CanViewEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanOpenEntryL
         * @since 2.5
-        * 
-		* @param aContext  The entry to which the operation applies. 
- 		* @param aReasonResourceId  On return, a resource string ID or 0. 
- 		*   
-		* @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry. 
-	    */		
-		TBool CanOpenEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * @param aContext  The entry to which the operation applies.
+        * @param aReasonResourceId  On return, a resource string ID or 0.
+        *
+        * @return KErrNone: the operation is appropriate on the entry. KErrNotSupported: the operation is not appropriate on the entry.
+        */
+        TBool CanOpenEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanCloseEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanCloseEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanCloseEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanDeleteFromEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanDeleteFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanDeleteFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanCopyMoveToEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanCopyMoveToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanCopyMoveToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanCopyMoveFromEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanCopyMoveFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanCopyMoveFromEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanReplyToEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanReplyToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanReplyToEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanForwardEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanForwardEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanForwardEntryL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+
+        /**
         * CanCreateEntryL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanCreateEntryL( const TMsvEntry& aContext , TMsvEntry& aNewEntry , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanCreateEntryL( const TMsvEntry& aContext , TMsvEntry& aNewEntry , TInt& aReasonResourceId ) const;
+
+        /**
         * CanDeleteServiceL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanDeleteServiceL( const TMsvEntry& aService , TInt& aReasonResourceId ) const;
-		
-		/**
+        *
+        * Not supported
+        *
+        */
+        TBool CanDeleteServiceL( const TMsvEntry& aService , TInt& aReasonResourceId ) const;
+
+        /**
         * CanCancelL
         * @since 2.5
-        * 
-		* Not supported
-		*
-        */		
-		TBool CanCancelL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
+        *
+        * Not supported
+        *
+        */
+        TBool CanCancelL( const TMsvEntry& aContext , TInt& aReasonResourceId ) const;
 
-	// Context-specific icons 
+    // Context-specific icons
 
-		/**
+        /**
         * ContextIcon
         * @since 2.5
-        * 
-		* @param aContext  Context entry to return the icons for. 
-  		* @param aStateFlags  Flasgs indicating the user interface state of the entry. 
-  		*   
-		* @return Bitmap array for the given context.. 
-	    */	
-		const CBitmapArray& ContextIcon( const TMsvEntry& aContext , TInt aStateFlags ) const;
+        *
+        * @param aContext  Context entry to return the icons for.
+        * @param aStateFlags  Flasgs indicating the user interface state of the entry.
+        *
+        * @return Bitmap array for the given context..
+        */
+        const CBitmapArray& ContextIcon( const TMsvEntry& aContext , TInt aStateFlags ) const;
 
-		/**
+        /**
         * GetResourceFileName
         * @since 2.5
-        * 
-		* @param aFileName Filename buffer to be filled with the resource file path and name 
-	    */	
-		void GetResourceFileName( TFileName& aFileName ) const;	
-		
-		/**
+        *
+        * @param aFileName Filename buffer to be filled with the resource file path and name
+        */
+        void GetResourceFileName( TFileName& aFileName ) const;
+
+        /**
         * PopulateArraysL
         * @since 2.5
-        * 
-	    */			
-		void PopulateArraysL();
+        *
+        */
+        void PopulateArraysL();
 
-		
-		/**
+
+        /**
         * StatusTextL
         * @since 2.5
-        * 
-		* Not supported
-		*
-		*/			
-		HBufC* StatusTextL( const TMsvEntry& aContext ) const;
+        *
+        * Not supported
+        *
+        */
+        HBufC* StatusTextL( const TMsvEntry& aContext ) const;
 
 
-	// MTM-specific functionality 
+    // MTM-specific functionality
 
-		/**
+        /**
         * OperationSupportedL
         * @since 2.5
-        * 
-		* Not supported
-		*
-		*/	
-		TInt OperationSupportedL( 
-            TInt aOperationId , 
+        *
+        * Not supported
+        *
+        */
+        TInt OperationSupportedL(
+            TInt aOperationId ,
             const TMsvEntry& aContext ) const;
-		
-		/**
+
+        /**
         * QueryCapability
         * @since 2.5
-        * 
-		* @param aCapability UID of capability to be queried 
-		* @param aResponse Response value. The format of the response varies 
+        *
+        * @param aCapability UID of capability to be queried
+        * @param aResponse Response value. The format of the response varies
         * according to the capability
-		*
-		* @return KErrNone if aCapability is a recognised value and a response is 
-        * returned KErrNotSupported if aCapability is not a recognised value 
-        */			
-		TInt QueryCapability( TUid aCapability , TInt& aResponse ) const;
+        *
+        * @return KErrNone if aCapability is a recognised value and a response is
+        * returned KErrNotSupported if aCapability is not a recognised value
+        */
+        TInt QueryCapability( TUid aCapability , TInt& aResponse ) const;
 
 
     protected:
@@ -291,27 +291,27 @@
         */
         void CreateSkinnedBitmapsL( TInt aNumZoomStates );
 
-	private:
+    private:
         void ConstructL();
 
-		CRightsObjectMtmUiData( CRegisteredMtmDll& aRegisteredDll );
+        CRightsObjectMtmUiData( CRegisteredMtmDll& aRegisteredDll );
 
         void SetDescriptionL( const TMsvEntry& aContext ) const;
-        
+
 
-	public:     // Data
+    public:     // Data
     protected:  // Data
     private:    // Data
 
         CRightsObjectMtmUiDataSessionObserver*  iObserver;
         CMsvSession*                            iSession;
-        
+
     public:     // Friend classes
     protected:  // Friend classes
     private:    // Friend classes
 
-	};
+    };
 
 #endif      // RIGHTSOBJECTMTMUIDATA_H
-            
+
 // End of File
--- a/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/uiData/src/RoMtmDat.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -40,24 +40,23 @@
 
 #include <msvapi.h>
 #include <RoMtmUi.rsg>
-#include <muiu.mbg>
 #include <mtmuids.h>
-#include <MTMUIDEF.HRH>
-#include <StringResourceReader.h>
+#include <mtmuidef.hrh>
+#include <stringresourcereader.h>
 #include <avkon.rsg>
 #include <data_caging_path_literals.hrh>
 
-#include <stringloader.h>
-#include <aknsutils.h>
-#include <aknsconstants.h>//skinned icon ids
+#include <StringLoader.h>
+#include <AknsUtils.h>
+#include <AknsConstants.h>//skinned icon ids
 
 #ifdef RD_MULTIPLE_DRIVE
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #endif
 
 #include "RoMtmDat.h"
-#include "RoMtmDaC.h"
-#include "RoMtmCommon.h"
+#include "RoMTMDaC.h"
+#include "RoMTMCommon.h"
 
 // EXTERNAL DATA STRUCTURES
 // EXTERNAL FUNCTION PROTOTYPES  
@@ -572,14 +571,6 @@
     
     id.Set( KAknsIIDQgnPropMcePushUnread );
 
-    AknsUtils::CreateIconL( skins, id, bitmap,
-        bitmapMask, tp.FullName(), EMbmMuiuQgn_prop_mce_push_unread,
-        EMbmMuiuQgn_prop_mce_push_unread_mask );
-             
-    array->AppendL( bitmap );
-    bitmap = 0;
-    array->AppendL( bitmapMask );
-    bitmapMask = 0;
     iIconArrays->AppendL( array );
     CleanupStack::Pop(); //array
     
@@ -588,14 +579,6 @@
     
     id.Set( KAknsIIDQgnPropMcePushRead );
 
-    AknsUtils::CreateIconL( skins, id, bitmap,
-        bitmapMask, tp.FullName(), EMbmMuiuQgn_prop_mce_push_read,
-        EMbmMuiuQgn_prop_mce_push_read_mask );
-             
-    array->AppendL( bitmap );
-    bitmap = 0;
-    array->AppendL( bitmapMask );
-    bitmapMask = 0;
     iIconArrays->AppendL( array );
     CleanupStack::Pop(); //array
     }
--- a/omadrm/drmplugins/drmromtm/uiData/src/RoMtmUi.rss	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/drmplugins/drmromtm/uiData/src/RoMtmUi.rss	Wed Jun 23 17:42:58 2010 +0100
@@ -29,8 +29,6 @@
 #include <avkon.rsg>
 #include <avkon.loc>
 #include <mtud.rh>
-#include <MtmExtendedCapabilities.hrh>
-#include <muiu.mbg>
 #include <data_caging_paths_strings.hrh>
 
 #include "RoMtmCommands.hrh"
@@ -55,17 +53,6 @@
 RESOURCE TBUF80 r_roud_not_supported  {buf="This action is not supported";}
 
 
-RESOURCE AKN_ICON_ARRAY r_ronsm_icons
-    {
-    bmpfile = APP_BITMAP_DIR"\\Muiu.mbm";
-
-    icons =
-        {
-        AKN_ICON { iconId = EMbmMuiuQgn_prop_mce_push_unread;
-                   maskId = EMbmMuiuQgn_prop_mce_push_unread_mask; }
-        };
-    }
-
 // -----------------------------------------------------------------------------
 //
 // r_romtmui_trigger_confirmation_query
--- a/omadrm/drmplugins/drmudtmodule/bwinscw/DrmUdtModuleU.DEF	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-EXPORTS
-	??1CDrmUdtHandler@@UAE@XZ @ 1 NONAME ; CDrmUdtHandler::~CDrmUdtHandler(void)
-	?DoUserDataTransferL@CDrmUdtHandler@@QAEXABVTDesC8@@0PAVMDrmUdtObserver@@AAVTRequestStatus@@@Z @ 2 NONAME ; void CDrmUdtHandler::DoUserDataTransferL(class TDesC8 const &, class TDesC8 const &, class MDrmUdtObserver *, class TRequestStatus &)
-	?NewL@CDrmUdtHandler@@SAPAV1@XZ @ 3 NONAME ; class CDrmUdtHandler * CDrmUdtHandler::NewL(void)
-	?SetPreferredIap@CDrmUdtHandler@@QAEXK@Z @ 4 NONAME ; void CDrmUdtHandler::SetPreferredIap(unsigned long)
-
--- a/omadrm/drmplugins/drmudtmodule/eabi/DrmUdtModuleU.DEF	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-EXPORTS
-	_ZN14CDrmUdtHandler15SetPreferredIapEm @ 1 NONAME
-	_ZN14CDrmUdtHandler19DoUserDataTransferLERK6TDesC8S2_P15MDrmUdtObserverR14TRequestStatus @ 2 NONAME
-	_ZN14CDrmUdtHandler4NewLEv @ 3 NONAME
-	_ZTI11CDrmUdtConn @ 4 NONAME ; #<TI>#
-	_ZTI14CDrmUdtHandler @ 5 NONAME ; #<TI>#
-	_ZTV11CDrmUdtConn @ 6 NONAME ; #<VT>#
-	_ZTV14CDrmUdtHandler @ 7 NONAME ; #<VT>#
-
--- a/omadrm/drmplugins/drmudtmodule/group/DrmUdtModule.mmp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ?Description
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET      DrmUdtModule.dll
-TARGETTYPE  DLL
-UID         0x1000008D 0x10205CAB
-CAPABILITY  CAP_GENERAL_DLL DRM
-VENDORID    VID_DEFAULT
-
-SOURCEPATH  ../src 
-SOURCE      DrmUdtHandler.cpp
-SOURCE      DrmUdtConn.cpp
-
-USERINCLUDE     ../inc
-USERINCLUDE     ../../../../omadrm/drmengine/RoapStorage/inc
-USERINCLUDE     ../../../../omadrm/drmengine/Utils/inc
-USERINCLUDE	    ../../../../inc   // ADo level inc dir
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/http
-SYSTEMINCLUDE /epoc32/include/ecom
-
-LIBRARY     euser.lib
-LIBRARY     estor.lib
-LIBRARY     efsrv.lib    
-LIBRARY     commdb.lib
-LIBRARY     bafl.lib 
-LIBRARY     esock.lib
-LIBRARY     http.lib     
-LIBRARY     inetprotutil.lib
-LIBRARY	    apmime.lib
-LIBRARY     random.lib
-LIBRARY     hash.lib
-LIBRARY     etel.lib
-LIBRARY	    etelmm.lib
-LIBRARY     flogger.lib
-LIBRARY     DrmServerInterfaces.lib
-
-#if defined(ARMCC)
-deffile ../eabi/ 
-#elif defined( WINSCW )
-deffile ../bwinscw/ 
-#elif defined( WINS )
-deffile ../bwins/ 
-#else
-deffile ../bmarm/ 
-#endif
-
-SMPSAFE
--- a/omadrm/drmplugins/drmudtmodule/inc/DrmUdtConn.h	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ?Description
-*
-*/
-
-
-#ifndef DRM_UDT_CONN_H
-#define DRM_UDT_CONN_H
-
-// INCLUDES
-
-#include <e32base.h>
-#include <es_sock.h>
-#include <CommDbConnPref.h>
-
-
-// FORWARD DECLARATIONS
-class MDrmUdtObserver;
-
-// CLASS DECLARATION
-
-class CDrmUdtConn : public CActive
-    {
-    public:     // Constructors and destructor.
-
-        static CDrmUdtConn* NewL();
-
-        CDrmUdtConn();
-
-        ~CDrmUdtConn();
-
-    public:     // new methods
-
-        void ConnectL( TUint32 aIap,
-                       MDrmUdtObserver* aObserver,
-                       TRequestStatus* aStatus );
-
-        void Close();
-
-        TBool IsConnected( TUint32& aIap );
-
-        RSocketServ& SocketServ();
-
-        RConnection& Conn();
-
-    private:
-
-        enum TState
-            {
-            EInit,
-            EConnecting,
-            EConnected
-            };
-
-    private:    // Constructors and destructor.
-
-        void ConstructL();
-
-    private:  // from CActive
-
-        virtual void DoCancel();
-
-        virtual void RunL();
-
-        virtual TInt RunError( TInt aError );
-
-    private:    // new methods
-
-        void DoClose();
-
-        void Done();
-
-    private:    // data
-
-        RSocketServ iSocketServ;
-        RConnection iConnection;
-        TState iState;
-        TRequestStatus* iParentStatus;
-        TCommDbConnPref iConnPref;
-        MDrmUdtObserver* iObserver;
-    };
-
-#endif /* def CONNECTION_H */
--- a/omadrm/drmplugins/drmudtmodule/src/DrmUdtConn.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*
-* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ?Description
-*
-*/
-
-
-// INCLUDE FILES
-
-#include "DrmUdtConn.h"
-#include "DrmUdtObserver.h"
-
-#include <CommDbConnPref.h>
-#include <commdb.h>
-#include <cdblen.h>
-#include <es_enum.h>
-
-// #include <ApSelect.h> // for checking APs
-
-#ifdef _DEBUG
-#define LOGGING
-#endif
-
-#define LOGGING
-
-#ifdef LOGGING
-_LIT(KLogDir, "DRM");
-_LIT(KLogName, "UDT.log");
-#include "flogger.h"
-#define LOG(string) \
-	RFileLogger::Write(KLogDir, KLogName, \
-		EFileLoggingModeAppend, string);
-#define LOGHEX(buffer) \
-	RFileLogger::HexDump(KLogDir, KLogName, \
-		EFileLoggingModeAppend, _S(""), _S(""), \
-		buffer.Ptr(), buffer.Length());
-#else
-#define LOG
-#define LOGHEX        
-#endif
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CDrmUdtConn::NewL()
-// ---------------------------------------------------------
-//
-CDrmUdtConn* CDrmUdtConn::NewL()
-    {
-    LOG( _L("CDrmUdtConn::NewL") );
-    CDrmUdtConn* conn = new (ELeave) CDrmUdtConn();
-    CleanupStack::PushL( conn );
-    conn->ConstructL();
-    CleanupStack::Pop( conn );
-    return conn;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::~CDrmUdtConn()
-// ---------------------------------------------------------
-//
-CDrmUdtConn::~CDrmUdtConn()
-    {
-    LOG( _L("CDrmUdtConn::~CDrmUdtConn") );
-    Cancel();
-    iConnection.Close();
-    iSocketServ.Close();
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::ConnectL()
-// ---------------------------------------------------------
-//
-void CDrmUdtConn::ConnectL( TUint32 aIap,
-                            MDrmUdtObserver* aObserver,
-                            TRequestStatus* aStatus )
-    { 
-    LOG( _L("CDrmUdtConn::ConnectL") );
-    
-    iObserver = aObserver;
-    
-    if ( iState == EInit )
-        {
-        // Not connected. Attach to existing connection, or create new one if
-        // allowed.
-        iStatus = KErrGeneral;
-
-        // Make this part atomic by pushing closes on the stack.
-        User::LeaveIfError( iSocketServ.Connect() );
-        CleanupClosePushL<RSocketServ>( iSocketServ );
-        User::LeaveIfError( iConnection.Open( iSocketServ ) );
-        CleanupClosePushL<RConnection>( iConnection );
-                
-        TConnectionInfoBuf connInfo;
-        TUint count;
-        User::LeaveIfError( iConnection.EnumerateConnections( count ) );
-        TUint i;
-        if ( count )
-            {
-            // Select from existing connections. Try to make AP match.
-            for ( i = count; i; i-- )
-                {
-                // Note: GetConnectionInfo expects 1-based index.
-                User::LeaveIfError( iConnection.GetConnectionInfo( i, connInfo ) );
-                if ( aIap == 0 || connInfo().iIapId == aIap )
-                    {
-                    // "Accept any" or AP match. Attach to this one.
-                    break;
-                    }
-                }
-            if ( !i )
-                {
-                // No AP match, select AP with largest index.
-                User::LeaveIfError
-                    ( iConnection.GetConnectionInfo( count, connInfo ) );
-                }
-            User::LeaveIfError
-                ( iConnection.Attach( connInfo, RConnection::EAttachTypeNormal ) );
-            iState = EConnected;
-            iStatus = KErrNone;
-            }
-        else
-            {
-            // No existing connections, create new one.
-#ifdef __WINS__
-            // WINS connection creation does not work if preferences are given.
-            // Defaults are to be used always.
-            iConnection.Start( iStatus );
-#else
-            // Note: the TCommDbConnPref must NOT be stack variable.
-            // It must persist until completion of RConnection::Start().
-            iConnPref.SetDirection( ECommDbConnectionDirectionOutgoing );
-            iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt );
-            iConnPref.SetBearerSet( ECommDbBearerCSD | ECommDbBearerWcdma );
-            // New connection is always created with user-selected AP;
-            // so 0 is used instead of aIap.
-            iConnPref.SetIapId( 0 );
-            iConnection.Start( iConnPref, iStatus );
-#endif
-            if ( iObserver )
-                {
-                iObserver->ConnectionStartedL();
-                }
-
-            iState = EConnecting;
-            SetActive();    // The only path with a real async request.
-            }
-        CleanupStack::Pop( 2 ); // closing iConn and iSockServ
-        // End of atomic part.
-        }
-    else
-        {
-        // Not expecting this to be called in other states.
-        }
-
-    iParentStatus = aStatus;
-    *iParentStatus = KRequestPending;
-
-    if ( !IsActive() )
-        {
-        // Unless we have an outstanding connect request (iConn.Start),
-        // we are done.
-        User::RequestComplete( iParentStatus, iStatus.Int() );
-        iParentStatus = NULL;
-        }
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::Close()
-// ---------------------------------------------------------
-//
-void CDrmUdtConn::Close()
-    {
-    LOG( _L("CDrmUdtConn::Close") );
-    Cancel();
-    iConnection.Close();
-    iSocketServ.Close();
-    iState = EInit;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::IsConnected()
-// ---------------------------------------------------------
-//
-TBool CDrmUdtConn::IsConnected( TUint32& aIap )
-    {
-    LOG( _L("CDrmUdtConn::IsConnected") );
-    TBool connected( EFalse );
-    if( iState == EConnected )
-        {
-        TBuf<KCommsDbSvrMaxColumnNameLength * 2 + 1> iapId;
-        _LIT( KFormatIapId, "%S\\%S" );
-        TPtrC iap( IAP );
-        TPtrC id( COMMDB_ID );
-        iapId.Format( KFormatIapId, &iap, &id );
-        TInt err = iConnection.GetIntSetting( iapId, aIap );
-        connected = err ? EFalse : ETrue;
-        }
-    return connected;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::CConnection()
-// ---------------------------------------------------------
-//
-CDrmUdtConn::CDrmUdtConn()
-: CActive( CActive::EPriorityStandard ),
-  iState( EInit )
-    {
-    LOG( _L("CDrmUdtConn::CDrmUdtConn") );
-    CActiveScheduler::Add( this );
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::ConstructL()
-// ---------------------------------------------------------
-//
-void CDrmUdtConn::ConstructL()
-    {
-    LOG( _L("CDrmUdtConn::ConstructL") );
-    /*
-    TUint32 APs( 0 );
-    CCommsDatabase* commsdb = CCommsDatabase::NewL( EDatabaseTypeIAP );
-    CleanupStack::PushL( commsdb );
-    CApSelect* apSel = CApSelect::NewLC (
-        *commsdb,
-        KEApIspTypeAll,
-        EApBearerTypeAll,
-        KEApSortUidAscending );
-    APs = apSel->Count();
-    CleanupStack::PopAndDestroy( 2 );
-    if ( !APs )
-        {
-        // No AP defined
-        User::Leave( KErrRoapGeneral );
-        }
-     */
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::DoCancel()
-// ---------------------------------------------------------
-//
-void CDrmUdtConn::DoCancel()
-    {
-    LOG( _L("CDrmUdtConn::DoCancel") );
-    iConnection.Close();
-    iSocketServ.Close();
-    User::RequestComplete( iParentStatus, KErrCancel );
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::RunL()
-// ---------------------------------------------------------
-//
-void CDrmUdtConn::RunL()
-    {
-    LOG( _L("CDrmUdtConn::RunL") );
-    User::LeaveIfError( iStatus.Int() );    // Handle errors in RunError().
-
-    iState = EConnected;
-    User::RequestComplete( iParentStatus, iStatus.Int() );
-    iParentStatus = NULL;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtConn::RunError()
-// ---------------------------------------------------------
-//
-TInt CDrmUdtConn::RunError( TInt  /*aError*/ )
-    {
-    LOG( _L("CDrmUdtConn::RunError") );
-    iConnection.Close();
-    iSocketServ.Close();
-    iState = EInit;
-    User::RequestComplete( iParentStatus, iStatus.Int() );
-    iParentStatus = NULL;
-    return KErrNone;
-    }
-
-// ---------------------------------------------------------
-// CRoapConnection::Conn()
-// ---------------------------------------------------------
-//
-RSocketServ& CDrmUdtConn::SocketServ()
-    {
-    LOG( _L("CDrmUdtConn::SocketServ") );
-    return iSocketServ;
-    }
-
-// ---------------------------------------------------------
-// CRoapConnection::Conn()
-// ---------------------------------------------------------
-//
-RConnection& CDrmUdtConn::Conn()
-    {
-    LOG( _L("CDrmUdtConn::Conn") );
-    return iConnection;
-    }
-
--- a/omadrm/drmplugins/drmudtmodule/src/DrmUdtHandler.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1228 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of the User Data Transfer module
-*
-*/
-
-
-// INCLUDE FILES
-#include "DrmUdtHandler.h"
-#include "DrmUdtConn.h"
-#include "RoapStorageClient.h"
-#include "DrmRightsClient.h"
-#include "DrmUdtObserver.h"
-
-#include <hash.h>
-#include <stringpool.h>
-#include <http/thttphdrval.h>
-#include <etelmm.h> 
-#include <mmtsy_names.h>
-
-#ifdef _DEBUG
-#define LOGGING
-#endif
-
-#define LOGGING
-
-#ifdef LOGGING
-_LIT(KLogDir, "DRM");
-_LIT(KLogName, "UDT.log");
-#include "flogger.h"
-#define LOG(string) \
-	RFileLogger::Write(KLogDir, KLogName, \
-		EFileLoggingModeAppend, string);
-#define LOGINT(string, val) \
-	RFileLogger::WriteFormat(KLogDir, KLogName, \
-		EFileLoggingModeAppend, string, val);
-#define LOGHEX(buffer) \
-	RFileLogger::HexDump(KLogDir, KLogName, \
-		EFileLoggingModeAppend, _S(""), _S(""), \
-		buffer.Ptr(), buffer.Length());
-#else
-#define LOG
-#define LOGHEX        
-#endif
-
-using namespace Roap;
-
-// ================= CONSTANTS ======================
-
-// The time out value in HTTP, 30 sec
-LOCAL_D const TInt KUdtTimeoutValue = 30000000;
-
-LOCAL_D const TInt KMaxSerNumLength = 64;
-LOCAL_D const TInt KRdbKeyLength = 256;
-LOCAL_D const TInt KVersionSize = 1;
-LOCAL_D const TInt KMessageIdSize = 1;
-LOCAL_D const TInt KLengthSize = 4;
-LOCAL_D const TInt KSignatureLength = 128;
-
-LOCAL_D const TInt KVersion = 0;
-
-LOCAL_D const TInt KPadding255 = 1;
-
-_LIT8( KUdtContentType, "application/binary" );
-
-// UDT message identifiers
-LOCAL_D const TUint8 KUdtRequestId = 0;
-LOCAL_D const TUint8 KUdtResponseId = 1;
-LOCAL_D const TUint8 KStatusResponseId = 3;
-LOCAL_D const TUint8 KErrorResponseId = 4;
-LOCAL_D const TUint8 KServerErrorValue = 0;
-LOCAL_D const TUint8 KClientErrorValue = 1;
-
-
-LOCAL_D const TInt KUdtResponseSize = 129;
-
-NONSHARABLE_STRUCT( TUnloadModule )
-    {
-    RTelServer* iServer;
-    const TDesC* iName;
-    };
-
-// ================= LOCAL FUNCTIONS =========================
-
-LOCAL_C void WriteIntToBlock( TInt aValue, TDes8& aBlock, TInt aOffset )
-    {
-    aBlock.SetLength(4);
-    aBlock[aOffset] =     (aValue & 0xff000000) >> 24;
-    aBlock[aOffset + 1] = (aValue & 0x00ff0000) >> 16;
-    aBlock[aOffset + 2] = (aValue & 0x0000ff00) >> 8;
-    aBlock[aOffset + 3] = (aValue & 0x000000ff);
-    }
-
-template<class S>
-void PointerArrayResetDestroyAndClose(TAny* aPtr)
-    {
-    (reinterpret_cast<RPointerArray<S>*>(aPtr))->ResetAndDestroy();
-    (reinterpret_cast<RPointerArray<S>*>(aPtr))->Close();
-    }
-    
-LOCAL_C void DoUnloadPhoneModule( TAny* aAny )
-    {
-    __ASSERT_DEBUG( aAny, User::Invariant() );
-    TUnloadModule* module = ( TUnloadModule* ) aAny;
-    module->iServer->UnloadPhoneModule( *( module->iName ) );
-    } 
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::NewL()
-// ---------------------------------------------------------
-//
-EXPORT_C CDrmUdtHandler* CDrmUdtHandler::NewL( )
-    {
-    LOG( _L("CDrmUdtHandler:NewL:") );
-    CDrmUdtHandler* handler = new( ELeave ) CDrmUdtHandler();
-    CleanupStack::PushL( handler );
-    handler->ConstructL();
-    CleanupStack::Pop( handler );
-    return handler;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::~CDrmUdtModule()
-// ---------------------------------------------------------
-//
-CDrmUdtHandler::~CDrmUdtHandler()
-    {
-    LOG( _L("CDrmUdtHandler::~CDrmUdtHandler") );
-    Cancel();
-	iSession.Close();
-	delete iConnection;
-	delete iUri;
-	delete iTimeout;
-    delete iOneTimePassword;
-    delete iUdtRequest;
-    delete iUdtResponse;
-    }
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::ConstructL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::ConstructL() 
-    {
-    LOG( _L("CDrmUdtHandler::ConstructL") );
-    iConnection = CDrmUdtConn::NewL();
-    iTimeout = CPeriodic::NewL( CActive::EPriorityUserInput );
-    iRequestType = EUdtRequest;
-    iUdtError = EUdtOk;
-    iStateInfo.iState = TUdtStateInfo::EUdtNotStarted;
-    iStateInfo.iProgress = 0;
-    iStateInfo.iError = EUdtOk;
-    }
-    
-// -----------------------------------------------------------------------------
-// CDrmUdtHandler::DoUserDataTransferL()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CDrmUdtHandler::DoUserDataTransferL( const TDesC8& aOneTimePassword,
-                                                   const TDesC8& aServiceUrl,
-                                                   MDrmUdtObserver* aObserver,
-                                                   TRequestStatus& aStatus )
-    {
-    LOG( _L("CDrmUdtHandler::DoUserDataTransferL") );
-    __ASSERT_ALWAYS( iState == EInit, User::Invariant() );
-    
-    /*
-    1. fetch original RDB data from the rights client (serial number and key)
-    2. create UDT package with the original RDB data, the one time password,
-       our serial number and our certificate
-    3. open a connection to the service URL
-    4. do a POST to the service URL, sending our UDT package
-    5. receive the anwser with the re-encrypted RDB key
-    6. tell the rights client to do a restore, using the re-encrypted RDB key
-    7. do a POST to the service URL, sendind a success or error notification
-    */
-
-    iOneTimePassword = aOneTimePassword.AllocLC();
-    iUri = aServiceUrl.AllocL();
-    iObserver = aObserver;
-    
-    LOG( _L8("Password: ") );
-    LOG( aOneTimePassword );
-    LOG( _L8("URL: ") );
-    LOG( aServiceUrl );
-    
-    iParentStatus = &aStatus;    
-    *iParentStatus = KRequestPending;
-    iState = EStart;
-    TRequestStatus* ownStatus = &iStatus;    
-    *ownStatus = KRequestPending;
-    iRequestType = EUdtRequest;
-    
-    SetActive();
-    User::RequestComplete( ownStatus, KErrNone );      
-    CleanupStack::Pop(); // iOneTimePassword    
-    }
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::SetPreferredIap()
-// ---------------------------------------------------------
-EXPORT_C void CDrmUdtHandler::SetPreferredIap( TUint32 aPreferredIap )
-    {
-    LOG( _L("CDrmUdtHandler::SetPreferredIap") );
-    iPreferredIap = aPreferredIap;
-    }    
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::DoCancel()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::DoCancel()
-    {
-    LOG( _L("CDrmUdtHandler::DoCancel") );
-    switch ( iState )
-        {
-        case EStart:
-        case EConnect:
-            {
-            iConnection->Cancel();
-            break;
-            }
-        case EResponseReceived:
-            {
-            iTransaction.Close();
-            SelfComplete( iError );
-            break;
-            }
-        default:
-            {
-            break;
-            }
-        }
-	iError = KErrCancel;
-	Complete();
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::RunL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::RunL()
-    {
-    LOG( _L("CDrmUdtHandler::RunL") );
-    User::LeaveIfError( iStatus.Int() );
-
-    switch ( iState )
-        {
-        case EStart:
-            {
-            ConnectL();
-            break;
-            }        
-        case EConnect:
-            {
-            CreateSessionL();
-            break;
-            }
-        case ESendMessage:
-            {
-            SendUdtMessageL();
-            break;
-            }
-        case EResponseReceived:
-            {
-            ResponseReceivedL();
-            break;
-            }
-        case EComplete:
-            {
-            iState = EInit;
-    		Complete();
-            break;
-            }
-        case EInit:
-        default:
-            {
-            break;
-            }
-        }
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::RunError()
-// ---------------------------------------------------------
-//
-TInt CDrmUdtHandler::RunError( TInt aError )
-    {
-    LOG( _L("CDrmUdtHandler::RunError") );
-    iError = aError;
-    iState = EInit;
-    Complete();
-    return KErrNone;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::ConnectL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::ConnectL()
-    {
-    LOG( _L("CDrmUdtHandler::ConnectL") );
-    __ASSERT_ALWAYS( iState == EStart, User::Invariant() );
-    
-    iConnection->ConnectL( iPreferredIap, iObserver, &iStatus );
-    iState = EConnect;
-    iError = EUdtOk;
-    SetActive();
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::CreateSessionL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::CreateSessionL()
-    {
-    LOG( _L("CDrmUdtHandler::CreateSessionL") );
-    __ASSERT_ALWAYS( iState == EConnect, User::Invariant() );
-    
-    TUint32 ap;
-
-    if( !iConnection->IsConnected( ap ) )
-        {
-        User::Leave( KErrGeneral );
-        }
-    
-    iSession.Close();
-    iSession.OpenL();
-
-    RStringPool strPool = iSession.StringPool();
-
-    // Remove first session properties just in case.
-    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
-    
-    // Clear RConnection and Socket Server instances
-    connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketServ,RHTTPSession::GetTable()));
-    connInfo.RemoveProperty(strPool.StringF(HTTP::EHttpSocketConnection,RHTTPSession::GetTable()));
-    
-#ifdef __WINS__    
-    // Clear the proxy settings
-    RStringF proxy;
-    proxy = strPool.OpenFStringL(_L8("172.22.168.15"));
-    connInfo.SetPropertyL
-        ( 
-        strPool.StringF( HTTP::EProxyAddress, RHTTPSession::GetTable() ), 
-        THTTPHdrVal( proxy ) 
-        );
-    proxy.Close();
-    connInfo.SetPropertyL
-        ( 
-        strPool.StringF( HTTP::EProxyUsage, RHTTPSession::GetTable() ), 
-        THTTPHdrVal( strPool.StringF(HTTP::EUseProxy, RHTTPSession::GetTable() ) )
-        );
-
-#else
-    THTTPHdrVal proxyUsage(strPool.StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
-    connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()));
-    connInfo.RemoveProperty(strPool.StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()));
-#endif
-
-    connInfo.SetPropertyL
-        (
-        strPool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ),
-        THTTPHdrVal( iConnection->SocketServ().Handle() )
-        );
-
-    connInfo.SetPropertyL
-        ( 
-        strPool.StringF( HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), 
-        THTTPHdrVal( REINTERPRET_CAST( TInt, &iConnection->Conn() ) )
-        );
-
-    InstallHttpFiltersL();
-
-    // Complete requests
-    TRequestStatus* ownStatus = &iStatus;    
-    *ownStatus = KRequestPending;
-    iState = ESendMessage;
-    SetActive();
-    User::RequestComplete( ownStatus, KErrNone );
-    }
-
-
-// ---------------------------------------------------------
-// CDrmUdtModule::InstallHttpFilters()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::InstallHttpFiltersL()
-    {
-    LOG( _L("CDrmUdtHandler::InstallHttpFiltersL") );
- // CHttpUAProfFilterInterface::InstallFilterL( iSession );
- // CHttpCookieFilter::InstallFilterL( iSession );
- // InstallAuthenticationL( iSession );
- // CHttpFilterProxyInterface::InstallFilterL( iSession );
-    }
-
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::SendUdtMessageL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::SendUdtMessageL()
-    {
-    LOG( _L("CDrmUdtHandler::SendUdtMessageL") );
-    __ASSERT_ALWAYS( iState == ESendMessage, User::Invariant() );
-    
-    TUriParser8 uri;
-    
-    if ( iRequestType == EUdtRequest )
-        {
-        CreateUdtRequestL();
-        }
-    else if( iRequestType == EStatusNotification )
-        {
-        CreateStatusNotificationL();
-        }
-    
-    User::LeaveIfError( uri.Parse( *iUri ) );
-    RStringF POST;
-    POST = iSession.StringPool().StringF( HTTP::EPOST, RHTTPSession::GetTable() );
-    iTransaction = iSession.OpenTransactionL( uri, *this, POST );
-
-    // Set required headers
-    RHTTPHeaders hdrs = iTransaction.Request().GetHeaderCollection();
-    
-    SetHeaderL(hdrs, HTTP::EAccept, KUdtContentType() );
-    
-    SetHeaderL(hdrs, HTTP::EContentType, KUdtContentType() );
-    
-    // Add request body
-    MHTTPDataSupplier* ds = this;
-    iTransaction.Request().SetBody(*ds);
-    
-    iTransaction.SubmitL();
-
-    iState = EResponseReceived;
-    iStatus = KRequestPending;
-    SetActive();
-
-    iTimeout->Cancel();
-    iTimeout->Start( KUdtTimeoutValue,
-    				 KUdtTimeoutValue,
-    				 TCallBack( StaticTimeOut,this ) );
-    }
-    
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::CreateUdtRequestL()
-// ---------------------------------------------------------
-//    
-void CDrmUdtHandler::CreateUdtRequestL()
-    {
-    RRoapStorageClient client;
-    RPointerArray< HBufC8 > certChain;
-    TCleanupItem listCleanup( PointerArrayResetDestroyAndClose< HBufC8 >,
-        &certChain );
-    HBufC8* certBlock;
-    TInt i;
-    TInt n;
-    TPtr8 ptr( NULL, 0 );
-    TBuf8< sizeof ( TUint32 ) > intBuf;
-    TBuf8< KMaxSerNumLength > targetSer;
-    TBuf8< KRdbKeyLength > rdb_data;
-    TBuf8< KSignatureLength > hash;
-    HBufC8* signature = NULL;
-    TInt udtVersion;
-    CSHA1* hasher = NULL;
-    
-    LOG( _L("CDrmUdtHandler::CreateUdtRequestL") );
-    delete iUdtRequest;
-    
-    if ( iObserver )
-        {
-        iStateInfo.iState = TUdtStateInfo::EUdtReguest;
-        iStateInfo.iProgress = 0;
-        iObserver->UdtProgressInfoL( iStateInfo );
-        }
-    
-    hasher = CSHA1::NewL();
-    CleanupStack::PushL( hasher );
-    User::LeaveIfError( client.Connect() );
-    CleanupClosePushL( client );
-    client.SelectTrustedRootL( KNullDesC8 );
-
-    LOG( _L("  Getting cert chain") );
-    User::LeaveIfError( client.GetDeviceCertificateChainL( certChain ) );
-    CleanupStack::PushL( listCleanup );
-
-    LOG( _L("  Getting UDT data") );
-    ReadUdtDataL( targetSer, udtVersion, rdb_data );
-
-    LOG(_L8("RDB data:"));    
-    LOGHEX(rdb_data)
-    
-    n = 0;
-    for ( i = 0; i < certChain.Count(); i++ )
-        {
-        n = n + KLengthSize + certChain[i]->Size();
-        }
-    certBlock = HBufC8::NewL( n );
-    CleanupStack::PushL( certBlock );
-    ptr.Set( certBlock->Des() );
-    for ( i = 0; i < certChain.Count(); i++ )
-        {
-        WriteIntToBlock( certChain[i]->Size(), intBuf, 0 );
-        ptr.Append( intBuf );
-        ptr.Append( *certChain[i] );
-        }
-
-    n = KVersionSize + 
-        KMessageIdSize + 
-        KLengthSize + 
-        iOneTimePassword->Size() + 
-        KLengthSize +
-        certBlock->Size() + 
-        KLengthSize +
-        targetSer.Size() +
-        rdb_data.Size() + 
-        KLengthSize + 
-        KSignatureLength;
-        
-    iUdtRequest = HBufC8::NewL( n );
-    ptr.Set( iUdtRequest->Des() );
-    WriteIntToBlock( n - (KVersionSize + KMessageIdSize + 
-                     KLengthSize + KSignatureLength), intBuf, 0 );
-    
-    ptr.Append( KVersion );             // 1. version
-    ptr.Append( KUdtRequestId );        // 2. request id
-    ptr.Append( intBuf );               // 3. request length
-    ptr.Append( *iOneTimePassword );    // 4. password
-    WriteIntToBlock( certBlock->Size(), intBuf, 0 );
-    ptr.Append( intBuf );               // 5. ceritificate block length
-    ptr.Append( *certBlock );           // 6. ceritificate block
-    WriteIntToBlock( targetSer.Size(), intBuf, 0 );
-    ptr.Append( intBuf );               // 7. serial number length
-    ptr.Append( targetSer );            // 8. original serial number
-    ptr.Append( rdb_data );             // 9. RDB data
-    WriteIntToBlock( udtVersion, intBuf, 0 );
-    ptr.Append( intBuf );               // 10. UDT key version
-    
-    hasher->Update( ptr );
-    hash.Append( 0 );
-    hash.Append( KPadding255 );
-    for ( i = 2; i < KSignatureLength - SHA1_HASH - 1; i++ )
-        {
-        hash.Append( 255 );
-        }
-    hash.Append( 0 );
-    hash.Append( hasher->Final() );
-    LOG(_L8("Hash:"));
-    LOGHEX(hash);
-    client.RsaSignL( hash, signature );
-    CleanupStack::PushL(signature);
-    ptr.Append( *signature );           // 11. signature
-    LOG(_L8("Signature:"));
-    LOGHEX((*signature));
-    
-    CleanupStack::PopAndDestroy( 5 );   // certBlock, listCleanup,
-                                        // client, hasher, signature
-    if ( iObserver )
-        {
-        iStateInfo.iState = TUdtStateInfo::EUdtReguest;
-        iStateInfo.iProgress += 20;
-        iObserver->UdtProgressInfoL( iStateInfo );
-        }
-        
-    LOG(_L8("Request:"));
-    LOGHEX((*iUdtRequest));
-    }
-    
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::CreateStatusNotificationL()
-// ---------------------------------------------------------
-//    
-void CDrmUdtHandler::CreateStatusNotificationL()
-    {
-    LOG( _L("CDrmUdtHandler::CreateStatusNotificationL") );
-    
-    if ( iObserver )
-        {
-        iStateInfo.iState = TUdtStateInfo::EUdtStatusNotification;
-        iStateInfo.iProgress += 20;
-        iObserver->UdtProgressInfoL( iStateInfo );
-        }
-    
-    delete iUdtRequest;
-    iUdtRequest = NULL;
-    iUdtRequest = HBufC8::NewL(64);
-    TPtr8 ptr = iUdtRequest->Des();
-    ptr.Append(0);
-    ptr.Append(2);
-    ptr.Append(*iOneTimePassword);
-    iUdtError == EUdtOk ? ptr.Append(1) : ptr.Append(0);
-    }
-    
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::ResponseReceivedL()
-// ---------------------------------------------------------
-//    
-void CDrmUdtHandler::ResponseReceivedL()
-    {
-    LOG( _L("CDrmUdtHandler::ResponseReceivedL") );
-    __ASSERT_ALWAYS( iState == EResponseReceived, User::Invariant() );
-    __ASSERT_ALWAYS( iUdtResponse, User::Invariant() );
-    
-    TPtrC8 udtRespPtr( *iUdtResponse );
-    HBufC8* origDBKey = NULL;
-    TPtrC8 origDBKeyPtr( KNullDesC8 );
-    RDRMRightsClient rightsClient;
-    TInt error = EUdtOk;
-        
-    LOGHEX((*iUdtResponse));
-    
-    // check response type
-    switch ( udtRespPtr[1] )
-        {
-        case KUdtResponseId:
-            {
-            if ( iObserver )
-                {
-                iStateInfo.iState = TUdtStateInfo::EUdtKeyRestore;
-                iStateInfo.iProgress += 20;
-                iObserver->UdtProgressInfoL( iStateInfo );
-                }
-            
-            if ( udtRespPtr.Length() < KUdtResponseSize )
-                {
-                User::Leave( KErrCorrupt );
-                }
-            origDBKeyPtr.Set( udtRespPtr.Mid( 2 ) );
-            origDBKey = origDBKeyPtr.AllocLC();
-            
-            iUdtError = rightsClient.Connect();
-            CleanupClosePushL( rightsClient );
-            
-            if ( !iUdtError )
-                {
-                iUdtError = rightsClient.InitiateUdt( origDBKeyPtr );
-                }
-         
-            CleanupStack::PopAndDestroy( 2 ); // origDBKey, rightsClient
-            
-            iRequestType = EStatusNotification;
-            iState = ESendMessage;
-            iStatus = KRequestPending;
-            SetActive();
-            SelfComplete( KErrNone );
-            break;
-            }
-        case KStatusResponseId:
-            {
-            if ( iObserver )
-                {
-                iStateInfo.iState = TUdtStateInfo::EUdtStatusNotification;
-                iStateInfo.iProgress += 20;
-                iObserver->UdtProgressInfoL( iStateInfo );
-                }
-            
-            iState = EComplete;
-            iStatus = KRequestPending;
-            SetActive();
-            
-            if ( iUdtError )
-                {
-                error = EUdtKeyRestoreFailed;
-                iUdtError = EUdtOk;
-                }
-            SelfComplete( error );
-            break;
-            }
-        case KErrorResponseId:
-            {
-            if ( udtRespPtr.Length() >= 3 && udtRespPtr[2] == KClientErrorValue )
-                {
-                error = EUdtClientError;
-                }
-            else
-                {
-                error = EUdtServerError;
-                }
-            
-            iState = EComplete;
-            iStatus = KRequestPending;            
-            SetActive();
-            SelfComplete( error );
-            break;
-            }
-        default:
-            {
-            User::Leave( KErrNotSupported );
-            }
-        }  
-    }
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::SetHeaderL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue)
-	{
-    LOG( _L("CDrmUdtHandler::SetHeaderL") );
-    RStringF valStr = iSession.StringPool().OpenFStringL(aHdrValue);
-    THTTPHdrVal val(valStr);
-    aHeaders.SetFieldL(iSession.StringPool().StringF(aHdrField,RHTTPSession::GetTable()), val);
-    valStr.Close();
-	}
-    
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::Complete()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::Complete()
-    {
-    LOG( _L("CDrmUdtHandler::Complete") );
-    
-    delete iUri;
-    iUri = NULL;
-    delete iUdtResponse;
-    iUdtResponse = NULL;
-    delete iUdtRequest;
-    iUdtRequest = NULL;
-    delete iOneTimePassword;
-    iOneTimePassword = NULL;
-    
-    if( iTimeout )
-    	{
-    	iTimeout->Cancel();
-    	}
-    	
-    if ( iObserver )
-        {
-        iStateInfo.iState = TUdtStateInfo::EUdtComplete;
-        iStateInfo.iProgress = 100;
-        iStateInfo.iError = iError;
-        TRAPD(ignore, iObserver->UdtProgressInfoL( iStateInfo ));
-        }  
-    
-    User::RequestComplete( iParentStatus, iError );
-    iParentStatus = NULL;
-    }
-
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::CDrmUdtModule()
-// ---------------------------------------------------------
-//
-CDrmUdtHandler::CDrmUdtHandler(): CActive( CActive::EPriorityStandard )
-    {
-    LOG( _L("CDrmUdtHandler::CDrmUdtHandler") );
-    CActiveScheduler::Add( this );
-    }
-
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::SelfComplete()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::SelfComplete( TInt aResult )
-    {
-    LOG( _L("CDrmUdtHandler::SelfComplete") );
-    if ( iStatus == KRequestPending )
-        {
-        TRequestStatus* ownStatus = &iStatus;
-        User::RequestComplete( ownStatus, aResult );
-        }
-    else
-        {
-        if ( aResult != KErrNone )
-            {
-            iStatus = aResult;
-            }
-        }
-    }
-
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::MHFRunL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::MHFRunL( RHTTPTransaction  /*aTransaction */, 
-								const THTTPEvent& aEvent )
-    {
-    LOGINT( _L("CDrmUdtHandler::MHFRunL: %d"), aEvent.iStatus );
-    iTimeout->Cancel();
-    iTimeout->Start( KUdtTimeoutValue,
-    				 KUdtTimeoutValue, 
-    				 TCallBack( StaticTimeOut,this ) );    				 
-
-    switch ( aEvent.iStatus )
-        {
-        case THTTPEvent::EGotResponseHeaders:
-            {
-            HandleResponseHeadersL( iTransaction.Response() );
-            break;
-            }
-
-        case THTTPEvent::EGotResponseBodyData:
-            {
-            TInt ret( KErrNone );
-            MHTTPDataSupplier* body = iTransaction.Response().Body();
-            TPtrC8 ptr;
-            body->GetNextDataPart( ptr );
-			ret = AppendResponseData( ptr );
-            body->ReleaseData();
-            User::LeaveIfError( ret );
-            break;
-            }
-
-        case THTTPEvent::EFailed:
-            {
-            if ( iError == KErrNone )
-                {
-                iError = EUdtServerError;
-                }
-        	iTransaction.Close();
-            SelfComplete( iError );
-            break;
-            }
-
-        case THTTPEvent::ESucceeded:
-            {        
-            iTransaction.Close();
-            SelfComplete( iError );
-            break;
-            }
-
-        case THTTPEvent::ERedirectRequiresConfirmation:
-            {
-            iTransaction.SubmitL();
-            }
-
-        default:
-            {
-            if( aEvent.iStatus == KErrHttpRedirectUseProxy )
-                {
-                }
-            else
-                {                
-                User::LeaveIfError( aEvent.iStatus );
-                }
-            break;
-            }
-        }
-
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::MHFRunError()
-// ---------------------------------------------------------
-//
-TInt CDrmUdtHandler::MHFRunError (
-        TInt aError,
-        RHTTPTransaction /* aTransaction */,
-        const THTTPEvent& /* aEvent */
-        )
-    {
-    LOG( _L("CDrmUdtHandler::MHFRunError") );
-    iTransaction.Close();
-    iError = aError;
-    SelfComplete( iError );
-    return KErrNone;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::HandleResponseHeadersL()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::HandleResponseHeadersL( RHTTPResponse aHttpResponse )
-    {
-    LOG( _L("CDrmUdtHandler::HandleResponseHeadersL") );
-    RHTTPHeaders headers = aHttpResponse.GetHeaderCollection();
-    
-    TInt httpCode = aHttpResponse.StatusCode();
-    TBool status;
-    
-    status = CheckHttpCode( httpCode );
-    
-    if ( status )
-    	{
-        RStringF contentTypeStr;
-        THTTPHdrVal contentTypeVal;
-        TPtrC8 ptrContentType(KNullDesC8);
-		RStringPool srtPool;
-		srtPool = iSession.StringPool();
-        
-        contentTypeStr = srtPool.StringF( HTTP::EContentType, RHTTPSession::GetTable() );										
-    	User::LeaveIfError( headers.GetField( contentTypeStr, 0, contentTypeVal ) );
-    	
-    	if ( contentTypeVal.StrF().DesC().CompareF( KUdtContentType() ) != KErrNone )
-    	    {
-			User::Leave( KErrNotSupported );
-    	    }
-       
-    	}
-    if ( aHttpResponse.HasBody() )
-        {
-        TInt dataSize = aHttpResponse.Body()->OverallDataSize();
-        if ( dataSize >= 0 )
-            {
-            HBufC8* buf = HBufC8::NewL( dataSize );
-            delete iUdtResponse;
-            iUdtResponse = buf;
-            }
-        }
-    }
-     
-// ---------------------------------------------------------
-// CDrmUdtHandler::CheckHttpCode()
-// ---------------------------------------------------------
-//
-TBool CDrmUdtHandler::CheckHttpCode( TInt aHttpStatus )
-	{
-	LOGINT(_L("CDrmUdtHandler::CheckHttpCode: %d"), aHttpStatus);
-    if ( HTTPStatus::IsInformational( aHttpStatus ) )
-        {
-        // 1xx
-        // Informational messages.
-        iError = EUdtServerError;
-        return EFalse;  
-        }
-    else if ( aHttpStatus == HTTPStatus::EOk ||
-              aHttpStatus == HTTPStatus::ENonAuthoritativeInfo )
-        {
-        // 200 OK
-        // 203 Non-Authoritative Information
-        iError = EUdtOk;
-        return ETrue;        
-        }
-    else if ( HTTPStatus::IsSuccessful( aHttpStatus ) )
-        {
-        // 2xx
-        // Success codes without an usable body.
-        iError = EUdtServerError;
-        return EFalse; 
-        }
-    else if ( aHttpStatus == HTTPStatus::EUnauthorized ||
-              aHttpStatus == HTTPStatus::EProxyAuthenticationRequired )
-        {
-        // 401 Unauthorized
-        // 407 Proxy authentication required
-        iError = EUdtInvalidServerAddress;
-        return EFalse; 
-        }
-    else if ( aHttpStatus == HTTPStatus::ENotFound ||
-              aHttpStatus == HTTPStatus::EGone )
-        {
-        // 404 Not found
-        // 410 Gone
-        iError = EUdtInvalidServerAddress;
-        return EFalse; 
-        }
-    else if ( HTTPStatus::IsClientError( aHttpStatus ) )
-        {
-        // 4xx
-        iError = EUdtInvalidServerAddress;
-        return EFalse; 
-        }
-    else if ( aHttpStatus == HTTPStatus::EHTTPVersionNotSupported )
-        {
-        // 505 HTTP Version Not Supported
-        iError = EUdtServerError;
-        return EFalse; 
-        }
-    else if ( HTTPStatus::IsServerError( aHttpStatus ) )
-        {
-        // 5xx
-        iError = EUdtServerError;
-        return EFalse; 
-        }
-    else 
-        {
-        // Everything else.
-        iError = EUdtServerError;
-        }
-    return EFalse; 
-	}
-
-
-// ---------------------------------------------------------
-// CDrmUdtModule::AppendResponseData()
-// ---------------------------------------------------------
-//
-TInt CDrmUdtHandler::AppendResponseData( const TDesC8& aDataChunk )
-    {
-    LOG( _L("CDrmUdtHandler::AppendResponseData") );
-    TInt needed = iUdtResponse->Des().Length() + aDataChunk.Length();
-    if ( iUdtResponse->Des().MaxLength() < needed )
-        {
-        HBufC8* buf = iUdtResponse->ReAlloc( needed );
-        if ( buf )
-            {
-            iUdtResponse = buf;
-            }
-        else
-            {
-            return KErrNoMemory;
-            }
-        }
-    iUdtResponse->Des().Append( aDataChunk );
-    return KErrNone;
-    }
-    
-// -----------------------------------------------------------------------------
-// CDrmUdtHandler::StaticTimeOut()
-// -----------------------------------------------------------------------------
-//
-TInt CDrmUdtHandler::StaticTimeOut( TAny* aPointer )
-    {  
-    LOG( _L("CDrmUdtHandler::StaticTimeOut") );
-    CDrmUdtHandler* itself = STATIC_CAST(CDrmUdtHandler*, aPointer);
-    if(itself)
-        {
-        itself->TimeOut();
-        }
-    return KErrNone;
-    }
- 
-    
-// -----------------------------------------------------------------------------
-// CDrmUdtHandler::TimeOut()
-// -----------------------------------------------------------------------------
-//
-void CDrmUdtHandler::TimeOut()
-    {
-    LOG( _L("CDrmUdtHandler::TimeOut") );
-    iTransaction.Close();
-    iError = KErrTimedOut;
-    SelfComplete( iError );
-    }
-
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::GetNextDataPart()
-// ---------------------------------------------------------
-//
-TBool CDrmUdtHandler::GetNextDataPart( TPtrC8& aDataPart )
-    {
-    LOG( _L("CDrmUdtHandler::GetNextDataPart") );
-    aDataPart.Set( iUdtRequest->Des() );
-    return ETrue;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::ReleaseData()
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::ReleaseData()
-    {
-    LOG( _L("CDrmUdtHandler::ReleaseData") );
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::OverallDataSize()
-// ---------------------------------------------------------
-//
-TInt CDrmUdtHandler::OverallDataSize()
-    {
-    LOG( _L("CDrmUdtHandler::OverallDataSize") );
-    return iUdtRequest->Des().Size();
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::Reset()
-// ---------------------------------------------------------
-//
-TInt CDrmUdtHandler::Reset()
-    {
-    LOG( _L("CDrmUdtHandler::Reset") );
-    return KErrNone;
-    }
-
-// ---------------------------------------------------------
-// CDrmUdtHandler::ReadUdtDataL
-//
-// ---------------------------------------------------------
-//
-void CDrmUdtHandler::ReadUdtDataL(
-    TDes8& aTargetSerialNumber,
-    TInt& aUdtKeyVersion,
-    TDes8& aEncryptedRdbData )
-    {
-    RDRMRightsClient rightsClient;
-    HBufC* serialNum = NULL;
-
-    LOG( _L("CDrmUdtHandler::ReadUdtDataL") );
-    User::LeaveIfError( rightsClient.Connect() );
-    CleanupClosePushL( rightsClient );
-    serialNum = SerialNumberL();
-    
-    aTargetSerialNumber.Copy( *serialNum );
-
-    aUdtKeyVersion = 0;
-    User::LeaveIfError( rightsClient.GetUdtData( aEncryptedRdbData ) );
-    if( !aEncryptedRdbData.Length() )
-        {
-        User::Leave( KErrNotFound );
-        }
-    CleanupStack::PopAndDestroy(); // rightsClient
-    }
-    
-// ---------------------------------------------------------
-// CDrmUdtHandler::ReadUdtDataL
-//
-// ---------------------------------------------------------
-//    
-HBufC* CDrmUdtHandler::SerialNumberL()
-    {
-    TInt error( KErrNone );
-    TInt count( 0 );
-    TInt count2( 0 );
-    TUint32 caps( 0 );
-    HBufC* imei = NULL;
-
-#ifndef __WINS__
-    LOG( _L("CDrmUdtHandler::SerialNumberL") );
-
-    RTelServer etelServer;
-    RMobilePhone phone;
-    
-    for ( TUint8 i = 0; i < 3; ++i )
-        {
-        error = etelServer.Connect();
-        if ( error )
-            {
-            User::After( TTimeIntervalMicroSeconds32( 100000 ) );
-            }
-        }
-    
-    User::LeaveIfError( error );
-    CleanupClosePushL( etelServer );
-
-    LOG( _L("  Connected to ETEL") );
-    
-    User::LeaveIfError( etelServer.LoadPhoneModule( KMmTsyModuleName ) );
-    
-    LOG( _L("  Phone Module loaded") );
-
-    TUnloadModule unload;
-    unload.iServer = &etelServer;
-    unload.iName = &KMmTsyModuleName;
-    
-    TCleanupItem item( DoUnloadPhoneModule, &unload );
-    CleanupStack::PushL( item );
-    
-    User::LeaveIfError( etelServer.EnumeratePhones( count ) );
-    
-    LOG( _L("  Phones enumerated") );
-
-    for ( count2 = 0; count2 < count; ++count2 )
-        {
-        RTelServer::TPhoneInfo phoneInfo;
-        User::LeaveIfError( etelServer.GetTsyName( count2, phoneInfo.iName ) );
-        
-        LOG( _L("    Got TSY module") );
-        LOG( phoneInfo.iName );
-        if ( phoneInfo.iName.CompareF( KMmTsyModuleName ) == 0 )
-            {
-            User::LeaveIfError( etelServer.GetPhoneInfo( count2, phoneInfo ) );
-            LOG( _L("    Got phone info") );
-            User::LeaveIfError( phone.Open( etelServer, phoneInfo.iName ) );
-            LOG( _L("    Opened phone") );
-            CleanupClosePushL( phone );
-            break;
-            }
-        }
-        
-    if ( count2 == count )
-        {
-        // Not found.
-        LOG( _L("  No phone found") );
-        User::Leave( KErrNotFound );
-        }
-    
-    LOG( _L("  Got phone") );
-
-    User::LeaveIfError( phone.GetIdentityCaps( caps ) );
-
-    LOG( _L("  Got Caps") );
-
-    if ( caps & RMobilePhone::KCapsGetSerialNumber )
-        {
-        RMobilePhone::TMobilePhoneIdentityV1 id;
-        TRequestStatus status;
-        
-        phone.GetPhoneId( status, id );
-        User::WaitForRequest( status );
-        
-        User::LeaveIfError( status.Int() );
-        
-        imei = id.iSerialNumber.AllocL();
-        
-        LOG( _L("  Got serial number") );
-
-        CleanupStack::PopAndDestroy( 3 ); // phone, item, etelServer
-        
-        return imei;
-        }
-    
-    User::Leave( KErrNotFound );
-    
-    // Never happens...
-    return imei;
-
-#else
-    _LIT( KDefaultSerialNumber, "123456789123456789" );
-    imei = KDefaultSerialNumber().AllocL();
-        
-    return imei;
-#endif
-    }
- 
-
Binary file omadrm/foundationcerts/data/devicekey1024.der has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadrm/foundationcerts/data/dummycert.cnf	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,40 @@
+# Copyright (c) 2010 Symbian Foundation Ltd.
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation - Initial contribution
+# 
+# Description:
+# Config file for generating the dummy certificate
+
+
+# Steps to generate using OpenSSL
+#
+# 1. Generate key
+#
+# openssl genrsa -out devicekey1024.pem 1024
+# openssl rsa -inform pem -in devicekey1024.pem -outform der -out devicekey1024.der
+#
+# 2. Generate self-signed X509 certificate
+#
+# openssl req -new -x509 -keyform der -key devicekey1024.der -outform der -out dummycert.der -config dummycert.cnf
+#
+#
+ 
+
+distinguished_name = Symbian Foundation
+prompt = no
+
+[Symbian Foundation]
+ C                      = GB
+ ST                     = Test State or Province
+ L                      = Test Locality
+ O                      = Organization Name
+ OU                     = Organizational Unit Name
+ CN                     = Common Name
+ emailAddress           = noreply@symbian.org
+
Binary file omadrm/foundationcerts/data/dummycert.der has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadrm/foundationcerts/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2010 Symbian Foundation Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Symbian Foundation - Initial contribution
+* 
+* Description:
+* Component to install dummy key & certificate to keep DRM engine alive
+*/
+
+PRJ_EXPORTS
+
+/*
+ * 96b7db19a4d05a4bc8e3a51c885088e679354469 - this directory name should be the SHA1 checksum
+ * of the active part of the certificate public key (see CDrmStdKeyStorage::ImportDataL), but
+ * hasn't been recalculated for this certificate 
+ */
+ 
+../data/devicekey1024.der  z:/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der
+../data/dummycert.der      z:/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der
+../data/dummycert.der      z:/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der
+
+#ifdef __DRM_USER_DATA_TRANSFER
+../data/dummycert.der      z:/private/101F51F2/PKI/UdtCertificate.der
+#endif
--- a/omadrm/group/bld.inf	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -15,8 +15,6 @@
 *
 */
 
-#include <platform_paths.hrh>
-
 PRJ_PLATFORMS
 DEFAULT
 
@@ -31,7 +29,7 @@
 ../conf/drmutility_20022D51.crml        MW_LAYER_CRML(drmutility_20022D51.crml)
 ../drmengine/group/CryptoPrep.flm       /epoc32/tools/makefile_templates/s60/CryptoPrep.flm
 ../drmengine/group/CryptoPrep.xml       /epoc32/tools/makefile_templates/s60/CryptoPrep.xml
-../drmengine/server/data/101F51F2.exc		/epoc32/data/Z/private/102073ea/excludes/101F51F2.exc
+../drmengine/server/data/101F51F2.exc   /epoc32/data/Z/private/102073ea/excludes/101F51F2.exc
 
 //Loc files
 // Ro Handler (only used if OMA DRM 1.0 Full is enabled)
@@ -41,37 +39,6 @@
 ../drmplugins/drmromtm/loc/RoMtmUi.loc MW_LAYER_LOC_EXPORT_PATH( romtmui.loc )
 
 
-// CMLA RnD keys
-../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der
-../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der
-../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der
-../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/winscw/c/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der
-
-../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der
-../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der
-../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der
-../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der
-
-../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der
-../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der
-../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der
-../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der
-
-../drmengine/keystorage/data/CMLA/DevicePrivateKey.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DevicePrivateKey.der
-../drmengine/keystorage/data/CMLA/DeviceCert.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/DeviceCert.der
-../drmengine/keystorage/data/CMLA/SigningCert00.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert00.der
-../drmengine/keystorage/data/CMLA/SigningCert01.der /epoc32/data/z/private/101F51F2/PKI/96b7db19a4d05a4bc8e3a51c885088e679354469/SigningCert01.der
-
-// Default UDT Key
-#ifdef __DRM_USER_DATA_TRANSFER
-../drmengine/keystorage/data/UdtCertificate.der /epoc32/winscw/c/private/101F51F2/PKI/UdtCertificate.der
-
-../drmengine/keystorage/data/UdtCertificate.der /epoc32/release/winscw/udeb/z/private/101F51F2/PKI/UdtCertificate.der
-../drmengine/keystorage/data/UdtCertificate.der /epoc32/release/winscw/urel/z/private/101F51F2/PKI/UdtCertificate.der
-
-../drmengine/keystorage/data/UdtCertificate.der /epoc32/data/z/private/101F51F2/PKI/UdtCertificate.der
-#endif
-
 // backup_registration.xml
 ../drmengine/group/backup_registration.xml /epoc32/winscw/c/private/101F51F2/backup_registration.xml
 ../drmengine/group/backup_registration.xml /epoc32/data/z/private/101F51F2/backup_registration.xml
@@ -127,10 +94,6 @@
 ../drmengine/group/DcfRepSrv.mmp
 ../drmengine/group/ROAPHandler.mmp
 
-#ifdef __DRM_USER_DATA_TRANSFER
-../drmplugins/drmudtmodule/group/DrmUdtModule.mmp
-#endif
-
 
 // DRMService API
 ../drmengine/group/DrmServiceAPI.mmp
@@ -156,7 +119,6 @@
 
 // DRMHelper
 ../drmhelper/group/Drmhelper.mmp
-../drmhelper/group/drmhelperdmgrwrapper.mmp
 
 #ifdef SBSV2
 PRJ_EXTENSIONS
--- a/omadrm/rom/DRM5.iby	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/rom/DRM5.iby	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -57,17 +57,12 @@
 file=ABI_DIR\BUILD_DIR\DrmServerInterfaces.DLL      SHARED_LIB_DIR\DrmServerInterfaces.DLL
 file=ABI_DIR\BUILD_DIR\DrmParsers.DLL               SHARED_LIB_DIR\DrmParsers.DLL
 
-// DRM Rights server 
+// DRM Rights server
 file=ABI_DIR\BUILD_DIR\RightsServer.EXE             PROGRAMS_DIR\RightsServer.EXE
 
 // DRM Service API
 file=ABI_DIR\BUILD_DIR\DrmServiceAPI.dll            SHARED_LIB_DIR\DrmServiceAPI.dll
 
-// DRM UDT Module
-#ifdef __DRM_USER_DATA_TRANSFER
-file=ABI_DIR\BUILD_DIR\DRMUDTMODULE.DLL                SHARED_LIB_DIR\DRMUDTMODULE.DLL
-#endif
-
 // DRM recognizer for protected contents
 #ifdef __DRM
 //S60_INTEGRATION file=ABI_DIR\BUILD_DIR\RECDRM.DLL         RECOGNISERS_DIR\RECDRM.DLL
@@ -76,7 +71,7 @@
 ECOM_PLUGIN(RECDRM.DLL,101F51F4.RSC)
 
 // RFS exclude list
-data=DATAZ_\private\102073ea\excludes\101F51F2.exc	private\102073ea\excludes\101F51F2.exc
+data=DATAZ_\private\102073ea\excludes\101F51F2.exc      private\102073ea\excludes\101F51F2.exc
 
 #endif
 
@@ -142,23 +137,11 @@
 // #include <DRMEncryptor.iby>
 // #include <DRMEncryptorResources.iby>
 
-// Default CMLA RnD Test Keys
-
-data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DevicePrivateKey.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DevicePrivateKey.der
-data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DeviceCert.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\DeviceCert.der
-data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert00.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert00.der
-data=ZPRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert01.der PRIVATE\101F51F2\PKI\96b7db19a4d05a4bc8e3a51c885088e679354469\SigningCert01.der
+// Backup registration
+data=ZPRIVATE\101F51F2\backup_registration.xml  PRIVATE\101F51F2\backup_registration.xml
 
-// Default UDT key
-#ifdef __DRM_USER_DATA_TRANSFER
-data=ZPRIVATE\101F51F2\PKI\UdtCertificate.der	PRIVATE\101F51F2\PKI\UdtCertificate.der
-#endif
-
-// Backup registration
-data=ZPRIVATE\101F51F2\backup_registration.xml	PRIVATE\101F51F2\backup_registration.xml
-
-// SIS stub for agent upgrades	
-data=ZSYSTEM\Install\OmaDrm_Stub.SIS			\system\install\OmaDrm_Stub.SIS
+// SIS stub for agent upgrades
+data=ZSYSTEM\Install\OmaDrm_Stub.SIS                    \system\install\OmaDrm_Stub.SIS
 
 #endif // DRM
 #endif // __DRM5_IBY__
--- a/omadrm/rom/DRMHelper.iby	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/rom/DRMHelper.iby	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,7 +19,6 @@
 #ifndef __DRMHELPER_IBY__
 #define __DRMHELPER_IBY__
 
-file=ABI_DIR\BUILD_DIR\DRMHelperDMgrWrapper.dll SHARED_LIB_DIR\DRMHelperDMgrWrapper.dll
 file=ABI_DIR\BUILD_DIR\DRMHelper.dll            SHARED_LIB_DIR\DRMHelper.dll
 
 #endif
--- a/omadrm/rom/DRMHelperResources.iby	Fri Feb 12 14:30:27 2010 +0000
+++ b/omadrm/rom/DRMHelperResources.iby	Wed Jun 23 17:42:58 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -19,7 +19,6 @@
 #ifndef __DRMHELPER_RESOURCES_IBY__
 #define __DRMHELPER_RESOURCES_IBY__
 
-data=DATAZ_\RESOURCE_FILES_DIR\drmhelper.rsc		        RESOURCE_FILES_DIR\drmhelper.rsc
-data=DATAZ_\RESOURCE_FILES_DIR\drmhelperdmgrwrapper.rsc		RESOURCE_FILES_DIR\drmhelperdmgrwrapper.rsc
+data=DATAZ_\RESOURCE_FILES_DIR\drmhelper.rsc  RESOURCE_FILES_DIR\drmhelper.rsc
 
-#endif
\ No newline at end of file
+#endif
--- a/package_definition.xml	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
-  <package id="drm" name="DRM" levels="plugin framework server generic specific">
-    <collection id="commondrm" name="Common DRM" level="generic">
-      <component id="drmencryptor" filter="s60" name="DRM Encryptor">
-		<!-- this should have its own bld.inf or be removed as a component -->
-      </component>
-      <component id="drmsettingsplugin" filter="s60" name="DRM Settings Plugin" class="plugin">
-		<!-- this should have its own bld.inf or be removed as a component -->
-      </component>
-      <component id="drmrightsmanagerui" filter="s60" name="DRM Rights Manager UI">
-        <unit bldFile="commondrm/drmrightsmanagerui/help/group"/>
-      </component>
-      <component id="drmutility" filter="s60" name="DRM Utility">
-        <unit bldFile="commondrm/drmutility/group"/>
-      </component>
-      <component id="drmserviceapiwrapper" filter="s60" name="DRM Service API Wrapper">
-        <unit bldFile="commondrm/drmserviceapiwrapper/group"/>
-      </component>
-      <component id="drmrightsstoringlocation" filter="s60" name="DRM Rights Storing Location">
-        <unit bldFile="commondrm/drmrightsstoringlocation/group"/>
-      </component>
-      <component id="commondrm_build" filter="s60" name="Common DRM Build">
-		<!-- should be split into the above files, or them collapsed into a single component -->
-        <unit bldFile="commondrm/group"/>
-      </component>
-    </collection>
-    <collection id="omadrm" name="OMA DRM" level="server">
-      <component id="drmroapwbxmlparser" filter="s60" name="DRM ROAP WBXML Parser">
-        <!-- <unit bldFile="omadrm/drmroapwbxmlparser/group"/> -->
-      </component>
-      <component id="drmplugins" filter="s60" name="DRM Plugins" class="plugin">
-		<!-- should have a single bld.inf -->
-        <!-- <unit bldFile="omadrm/drmplugins/drmfilter/group"/> -->
-        <!-- <unit bldFile="omadrm/drmplugins/drmrecognizer/group"/> -->
-        <!-- <unit bldFile="omadrm/drmplugins/drmrohandler/group"/> -->
-        <!-- <unit bldFile="omadrm/drmplugins/drmromtm/group"/> -->
-      </component>
-      <component id="drmengine" filter="s60" name="DRM Engine">
-		<!-- this should have its own bld.inf or be removed as a component -->
-      </component>
-      <component id="drmhelper" filter="s60" name="DRM Helper">
-        <!-- <unit bldFile="omadrm/drmhelper/group"/> -->
-		<!-- should drmhelperserver be #included in the above? -->
-        <!-- <unit bldFile="omadrm/drmhelper/drmhelperserver/group"/> -->
-      </component>
-      <component id="drmlicensemanager" filter="s60" name="DRM License Manager">
-        <!-- <unit bldFile="omadrm/drmlicensemanager/group"/> -->
-      </component>
-      <component id="omadrm_build" filter="s60" name="OMA DRM Build">
-		<!-- should be split into the above files, or them collapsed into a single component -->
-        <unit bldFile="omadrm/group"/>
-      </component>
-    </collection>
-    <collection id="wmdrm" name="Windows Media DRM" level="framework">
-      <component id="wmdrmengine" filter="s60" name="WM DRM Engine">
-		<!-- should have a single bld.inf -->
-        <!-- <unit bldFile="wmdrm/wmdrmengine/wmdrmagent/group"/> -->
-        <!-- <unit bldFile="wmdrm/wmdrmengine/wmdrmfileserver/client/group"/> -->
-        <!-- <unit bldFile="wmdrm/wmdrmengine/wmdrmfileserver/server/group"/> -->
-        <!-- <unit bldFile="wmdrm/wmdrmengine/wmdrmserver/client/group"/> -->
-        <!-- <unit bldFile="wmdrm/wmdrmengine/wmdrmserver/clientwrapper/group"/> -->
-        <!-- <unit bldFile="wmdrm/wmdrmengine/wmdrmserver/server/group"/> -->
-      </component>
-      <component id="camese" filter="s60" name="Camese">
-		<!-- should have a single bld.inf -->
-        <!-- <unit bldFile="wmdrm/camese/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/cameseutility/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/httpfiltercamese/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/wmdrmdla/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/wmdrmdlaapp/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/wmdrmdladefaulthttpplugin/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/wmdrmdladefaultuiplugin/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/wmdrmdlautils/group"/> -->
-        <!-- <unit bldFile="wmdrm/camese/wmdrmdlawrapper/group"/> -->
-      </component>
-      <component id="wmdrm_build" filter="s60" name="WM DRM Build">
-		<!-- should be split into the above files, or them collapsed into a single component -->
-        <unit bldFile="wmdrm/group"/>
-      </component>
-    </collection>
-    <collection id="drm_info" name="DRM Info" level="specific">
-      <component id="drm_pub" filter="s60" name="DRM Public Interfaces" class="api">
-        <unit bldFile="drm_pub/group"/>
-		<!-- do the following need to be #included ? -->
-        <!-- <unit bldFile="drm_pub/drm_helper_api/tsrc/group"/> -->
-        <!-- <unit bldFile="drm_pub/drm_license_checker_api/tsrc/group"/> -->
-        <!-- <unit bldFile="drm_pub/oma_drm_caf_agent_api/tsrc/bc/group"/> -->
-      </component>
-      <component id="drm_plat" filter="s60" name="DRM Platform Interfaces" class="api">
-        <unit bldFile="drm_plat/group"/>
-		<!-- do the following need to be #included ? -->
-        <!-- <unit bldFile="drm_plat/drm_common_api/tsrc/group"/> -->
-        <!-- <unit bldFile="drm_plat/drm_rights_api/tsrc/group"/> -->
-        <!-- <unit bldFile="drm_plat/roap_api/tsrc/group"/> -->
-      </component>
-      <component id="drm_build" filter="s60" name="DRM Build">
-		<!-- is this needed ? -->
-        <unit bldFile="group"/>
-      </component>
-    </collection>
-  </package>
-</SystemDefinition>
--- a/sysdef_1_4_0.dtd	Fri Feb 12 14:30:27 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
- <!ELEMENT SystemDefinition (systemModel?, build?)>
- <!ATTLIST SystemDefinition
-  name CDATA #REQUIRED
-  schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (logicalset* | module*)*>
- <!ATTLIST layer
-  name CDATA #REQUIRED
-  levels CDATA #IMPLIED
-  span CDATA #IMPLIED>
- <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalset name CDATA #REQUIRED>
- <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalsubset name CDATA #REQUIRED>
- <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
- <!ATTLIST module
-  name CDATA #REQUIRED
-  level CDATA #IMPLIED>
- <!ELEMENT component (unit* | package* | prebuilt*)*>
- <!ATTLIST component name CDATA #REQUIRED>
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
-  unitID ID #REQUIRED
-  name CDATA #REQUIRED
-  mrp CDATA #REQUIRED
-  filter CDATA #IMPLIED
-  bldFile CDATA #REQUIRED
-  priority CDATA #IMPLIED
-  contract CDATA #IMPLIED>
- <!ELEMENT package EMPTY>
- <!ATTLIST package
-  name CDATA #REQUIRED
-  mrp CDATA #REQUIRED
-  filter CDATA #IMPLIED
-  contract CDATA #IMPLIED>
- <!ELEMENT prebuilt EMPTY>
- <!ATTLIST prebuilt
-  name CDATA #REQUIRED
-  version CDATA #REQUIRED
-  late (Y|N) #IMPLIED
-  filter CDATA #IMPLIED
-  contract CDATA #IMPLIED>
- <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
- <!ELEMENT unitList (unitRef+)>
- <!ATTLIST unitList
-  name ID #REQUIRED
-  description CDATA #REQUIRED>
- <!ELEMENT unitRef EMPTY>
- <!ATTLIST unitRef unit IDREF #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
-  name ID #REQUIRED
-  description CDATA #REQUIRED
-  target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
-  name ID #REQUIRED
-  abldTarget CDATA #REQUIRED
-  description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
-  name ID #REQUIRED
-  abldOption CDATA #REQUIRED
-  description CDATA #REQUIRED
-  enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
- <!ATTLIST configuration
-  name ID #REQUIRED
-  description CDATA #REQUIRED
-  filter CDATA #REQUIRED>
- <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
- <!ELEMENT unitListRef EMPTY>
- <!ATTLIST unitListRef unitList IDREF #REQUIRED>
- <!ELEMENT layerRef EMPTY>
- <!ATTLIST layerRef layerName CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
-  command CDATA #REQUIRED
-  targetList IDREFS #IMPLIED
-  unitParallel (Y | N | y | n) #REQUIRED
-  targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
-  name CDATA #REQUIRED
-  cwd CDATA #REQUIRED
-  command CDATA #REQUIRED>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED
+  proFile CDATA #IMPLIED
+  qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>  
--- a/wmdrm/camese/inc/cameselog.inl	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/inc/cameselog.inl	Wed Jun 23 17:42:58 2010 +0100
@@ -17,7 +17,7 @@
 
 
 // INCLUDE FILES
-#include <E32SVR.H>
+#include <e32svr.h>
 
 // ----------------------------------------------------------------------------
 // Write a string to the log - 16 bit version
@@ -35,7 +35,7 @@
             EFileLoggingModeAppend, msgPtr.Left(100));
         offSet += 100;  //set to 100
         };
-    RDebug::Print(aFmt);        
+    RDebug::Print(aFmt);
     }
 
 // ----------------------------------------------------------------------------
@@ -71,11 +71,11 @@
             EFileLoggingModeAppend, msgPtr.Left(100));
         offSet += 100;  //set to 100
         };
-    
+
     HBufC* buf16 = HBufC::NewLC(aFmt.Length());
     buf16->Des().Copy(aFmt);
     RDebug::Print(*buf16);
-    CleanupStack::PopAndDestroy(buf16);    
+    CleanupStack::PopAndDestroy(buf16);
     }
 
 // ----------------------------------------------------------------------------
--- a/wmdrm/camese/wmdrmdlaapp/data/wmdrmdlaapp_reg.rss	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/data/wmdrmdlaapp_reg.rss	Wed Jun 23 17:42:58 2010 +0100
@@ -26,7 +26,6 @@
 RESOURCE APP_REGISTRATION_INFO
     {
     app_file = "wmdrmdlaapp";
-    localisable_resource_file = APP_RESOURCE_DIR"\\wmdrmdlaapp";
     hidden = KAppIsHidden;
     embeddability = KAppEmbeddableOnly;
     service_list =
--- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappdocument.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappdocument.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,7 +20,7 @@
 #define C_WMDRMDLAAPPDOCUMENT_H
 
 // INCLUDES
-#include <akndoc.h>
+#include <AknDoc.h>
 
 class CWmDrmDlaAppDocument : public CAknDocument
     {
@@ -46,7 +46,7 @@
         * @return Pointer to App Ui.
         */
         CEikAppUi* CreateAppUiL();
-    
+
     public: // Constructors
 
         /**
--- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappserver.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappserver.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,15 +20,15 @@
 #define C_WMDRMDLAAPPSERVER_H
 
 // INCLUDES
-#include <aknserverapp.h>
+#include <AknServerApp.h>
 
 class CWmDrmDlaAppServer : public CAknAppServer
     {
-    
+
     public: // from CAknAppServer
-        
+
         CApaAppServiceBase* CreateServiceL( TUid aServiceType ) const;
-    
+
     };
 
 #endif // C_WMDRMDLAAPPSERVER_H
--- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappservicesession.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappservicesession.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,29 +20,29 @@
 #define C_WMDRMDLAAPPSERVICESESSION_H
 
 // INCLUDES
-#include <aknserverapp.h>
+#include <AknServerApp.h>
 #include "wmdrmdlaappui.h"
 #include "wmdrmdlabrowserview.h"
 
 /**
 * WMDRM DLA Application.
 */
-class CWmDrmDlaAppServiceSession : public CAknAppServiceBase, 
+class CWmDrmDlaAppServiceSession : public CAknAppServiceBase,
                                    public MBrowserViewLicenseReceivedCallback
     {
-    
+
     public:
-    
+
         CWmDrmDlaAppServiceSession();
         virtual ~CWmDrmDlaAppServiceSession();
-    
+
     public: // from MBrowserViewLicenseReceivedCallback
-        
+
         /**
          * Called when license is received
          */
         void LicenseReceived();
-    
+
     protected: // from CSession2
 
         /**
@@ -53,18 +53,18 @@
         void ServiceL( const RMessage2& aMessage );
 
     private:
-        
+
         void SetIapL( const RMessage2& aMessage );
         void PostL( const RMessage2& aMessage );
         void LicenseResponseSizeL( const RMessage2& aMessage );
         void LicenseResponseL( const RMessage2& aMessage );
         void CompleteMessage( const RMessage2& aMessage, TInt aError );
         CWmDrmDlaBrowserView* BrowserView();
-    
+
     private: //data
-        
+
         CActiveSchedulerWait* iWait;
-        
+
     };
 
 #endif // C_WMDRMDLAAPPSERVICESESSION_H
--- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappui.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlaappui.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,8 +20,8 @@
 #define C_WMDRMDLAAPPUI_H
 
 // INCLUDES
-#include <aknviewappui.h>
-#include <aknserverapp.h>
+#include <aknViewAppUi.h>
+#include <AknServerApp.h>
 
 class CWmDrmDlaBrowserView;
 
@@ -32,19 +32,19 @@
 
         /**
         * Constructor.
-        */      
+        */
         CWmDrmDlaAppUi();
-        
+
         /**
         * Second phase constructor. Leaves on failure.
-        */      
+        */
         void ConstructL();
 
         /**
         * Destructor.
-        */      
+        */
         virtual ~CWmDrmDlaAppUi();
-        
+
         /**
          * Get browser view
          */
@@ -56,13 +56,13 @@
          * From CEikAppUi, takes care of command handling.
          * @param aCommand command to be handled
          */
-        void HandleCommandL( TInt aCommand );    
-        
+        void HandleCommandL( TInt aCommand );
+
     private:    // data
 
         //Not owned
         CWmDrmDlaBrowserView* iBrowserView;
-        
+
     };
 
 #endif // C_WMDRMDLAAPPUI_H
--- a/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowserview.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/inc/wmdrmdlabrowserview.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,7 +20,7 @@
 #define C_WMDRMDLABROWSERVIEW_H
 
 #include <aknview.h>
-#include <brctlspecialloadobserver.h>
+#include <BrCtlSpecialLoadObserver.h>
 
 class CWmDrmDlaBrowserContainer;
 class CInternetConnectionManager;
@@ -30,13 +30,13 @@
  */
 class MBrowserViewLicenseReceivedCallback
     {
-    public: 
-        
+    public:
+
         virtual void LicenseReceived() = 0;
 
     };
 
-class CWmDrmDlaBrowserView : public CAknView, 
+class CWmDrmDlaBrowserView : public CAknView,
                              public MBrCtlSpecialLoadObserver
     {
 
@@ -49,16 +49,16 @@
          * Destructor.
          */
         virtual ~CWmDrmDlaBrowserView();
-        
+
         /**
          * Set the IAP that is used in network connection
-         * @param aIap - IAP to be used 
+         * @param aIap - IAP to be used
          */
         void SetIAP( TInt aIap );
-        
+
         /**
          * Make a POST-request
-         * @param aCallback - Callback used to inform when license 
+         * @param aCallback - Callback used to inform when license
          *                    response is received
          * @param aPostUrl - Post URL
          * @param aPostContentType - Post content type
@@ -70,7 +70,7 @@
                     const TDesC8& aPostContentType,
                     const TDesC8& aPostData,
                     const TDesC8& aPostContentBoundary );
-        
+
         /**
          * Get the license response
          * @return License response or NULL
@@ -89,7 +89,7 @@
         */
         void HandleCommandL( TInt aCommand );
 
-        /** 
+        /**
         * @see CAknView
         */
         void DoActivateL( const TVwsViewId& aPrevViewId,
@@ -103,26 +103,26 @@
         /**
         * @see CAknView
         */
-        void HandleClientRectChange();    
-    
+        void HandleClientRectChange();
+
     public: // From MBrCtlSpecialLoadObserver
 
-        void NetworkConnectionNeededL( TInt* aConnectionPtr, 
-                                       TInt* aSockSvrHandle, 
-                                       TBool* aNewConn, 
+        void NetworkConnectionNeededL( TInt* aConnectionPtr,
+                                       TInt* aSockSvrHandle,
+                                       TBool* aNewConn,
                                        TApBearerType* aBearerType );
 
-        TBool HandleRequestL( RArray<TUint>* aTypeArray, 
+        TBool HandleRequestL( RArray<TUint>* aTypeArray,
                               CDesCArrayFlat* aDesArray );
 
-        TBool HandleDownloadL( RArray<TUint>* aTypeArray, 
-                               CDesCArrayFlat* aDesArray );    
-        
+        TBool HandleDownloadL( RArray<TUint>* aTypeArray,
+                               CDesCArrayFlat* aDesArray );
+
     private:
 
         CWmDrmDlaBrowserView();
         void ConstructL();
-        
+
         void CreateContainerL();
         void RemoveContainer();
         void BrCtlHandleCommandL( TInt aCommand );
@@ -131,7 +131,7 @@
 
         //Not Owned
         MBrowserViewLicenseReceivedCallback* iCallback;
-        
+
         CWmDrmDlaBrowserContainer* iContainer;
         HBufC8* iLicenseResponse;
         CInternetConnectionManager* iConMgr;
--- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowsercontainer.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -17,7 +17,7 @@
 
 
 // INCLUDE FILES
-#include <akndef.h>
+#include <AknDef.h>
 #include <aknview.h>
 #include <brctlinterface.h>
 #include "wmdrmdlabrowserview.h"
@@ -34,7 +34,6 @@
     {
     CreateWindowL();
     SetRect( iView->ClientRect() );
-    ActivateL();
     
     iBrCtlInterface = CreateBrowserControlL(
             this,                                      // parent control
@@ -53,12 +52,13 @@
             NULL                                       // Download observer
             );
 
-    iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, 
-                                         ETrue );    
-    iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled, 
+    iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages,
+                                         ETrue );
+    iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsCookiesEnabled,
                                          ETrue );
-    iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, 
+    iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded,
                                          ETrue );
+    ActivateL();
     }
 
 // ---------------------------------------------------------------------------
@@ -78,7 +78,7 @@
     CAknView* aView,
     MBrCtlSpecialLoadObserver* aObserver )
     {
-    CWmDrmDlaBrowserContainer* self 
+    CWmDrmDlaBrowserContainer* self
         = CWmDrmDlaBrowserContainer::NewLC( aView, aObserver );
     CleanupStack::Pop( self );
     return self;
@@ -89,11 +89,11 @@
 // CWmDrmDlaBrowserContainer::NewLC
 // ---------------------------------------------------------------------------
 //
-CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC( 
+CWmDrmDlaBrowserContainer* CWmDrmDlaBrowserContainer::NewLC(
     CAknView* aView,
     MBrCtlSpecialLoadObserver* aObserver )
     {
-    CWmDrmDlaBrowserContainer* self 
+    CWmDrmDlaBrowserContainer* self
         = new( ELeave ) CWmDrmDlaBrowserContainer( aView );
     CleanupStack::PushL( self );
     self->ConstructL( aObserver );
@@ -139,7 +139,7 @@
 void CWmDrmDlaBrowserContainer::SizeChanged()
     {
     if ( iBrCtlInterface )
-        {            
+        {
         iBrCtlInterface->SetRect( Rect() );
         }
     }
@@ -152,20 +152,20 @@
     TInt aIndex ) const
     {
     switch ( aIndex )
-        {            
+        {
         case 0:
             return iBrCtlInterface;
-        
+
         default:
             return NULL;
         }
     }
-    
+
 // ---------------------------------------------------------------------------
 // CWmDrmDlaBrowserContainer::OfferKeyEventL
 // ---------------------------------------------------------------------------
 //
-TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL( 
+TKeyResponse CWmDrmDlaBrowserContainer::OfferKeyEventL(
     const TKeyEvent& aKeyEvent,
     TEventCode aType )
     {
@@ -180,7 +180,7 @@
 // CWmDrmDlaBrowserContainer::FocusChanged
 // ---------------------------------------------------------------------------
 //
-void CWmDrmDlaBrowserContainer::FocusChanged( 
+void CWmDrmDlaBrowserContainer::FocusChanged(
     TDrawNow aDrawNow )
     {
     iBrCtlInterface->SetFocus( IsFocused() );
--- a/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlaapp/src/wmdrmdlabrowserview.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -19,11 +19,11 @@
 // INCLUDE FILES
 #include <f32file.h>
 #include <bautils.h>
-#include <aknviewappui.h>
+#include <aknViewAppUi.h>
 #include <coeaui.h>
 #include <coecntrl.h>
 #include <brctlinterface.h>
-#include <internetconnectionmanager.h>
+#include <InternetConnectionManager.h>
 #include <wmdrmdlaapp.rsg>
 #include "wmdrmdlabrowserview.h"
 #include "wmdrmdlabrowsercontainer.h"
@@ -112,10 +112,10 @@
     const TDesC8& aPostContentBoundary )
     {
     iCallback = aCallback;
-    iContainer->BrCtlInterface()->PostUrlL( aPostUrl, 
-                                            aPostContentType, 
-                                            aPostData, 
-                                            &aPostContentBoundary, 
+    iContainer->BrCtlInterface()->PostUrlL( aPostUrl,
+                                            aPostContentType,
+                                            aPostData,
+                                            &aPostContentBoundary,
                                             (TAny*)iContainer );
     iContainer->BrCtlInterface()->SetFocus( ETrue, EDrawNow );
     }
@@ -146,9 +146,9 @@
 void CWmDrmDlaBrowserView::HandleCommandL(
     TInt aCommand )
     {
-    if ( aCommand >= TBrCtlDefs::ECommandIdBase + 
+    if ( aCommand >= TBrCtlDefs::ECommandIdBase +
                      TBrCtlDefs::ECommandIdWMLBase &&
-         aCommand <= TBrCtlDefs::ECommandIdBase + 
+         aCommand <= TBrCtlDefs::ECommandIdBase +
                      TBrCtlDefs::ECommandIdRange )
         {
         BrCtlHandleCommandL( aCommand );
@@ -167,7 +167,7 @@
     const TVwsViewId& /*aPrevViewId*/,
     TUid /*aCustomMessageId*/,
     const TDesC8& /*aCustomMessage*/ )
-    {  
+    {
     CreateContainerL();
     AppUi()->AddToStackL( *this, iContainer );
     HandleClientRectChange();
@@ -202,7 +202,7 @@
     {
     RemoveContainer();
     iContainer = CWmDrmDlaBrowserContainer::NewL( this, this );
-    iContainer->SetMopParent( this );    
+    iContainer->SetMopParent( this );
     }
 
 // ---------------------------------------------------------------------------
@@ -232,10 +232,10 @@
 // CWmDrmDlaBrowserView::NetworkConnectionNeededL
 // ---------------------------------------------------------------------------
 //
-void CWmDrmDlaBrowserView::NetworkConnectionNeededL( 
-    TInt* aConnectionPtr, 
-    TInt* aSockSvrHandle, 
-    TBool* aNewConn, 
+void CWmDrmDlaBrowserView::NetworkConnectionNeededL(
+    TInt* aConnectionPtr,
+    TInt* aSockSvrHandle,
+    TBool* aNewConn,
     TApBearerType* aBearerType )
     {
     TInt ret( 0 );
@@ -245,7 +245,7 @@
         iConMgr->SetRequestedAP( iIap );
         ret = iConMgr->StartConnectionL( ETrue );
         }
-    
+
     // If connected, return needed info to framework
     if ( !ret )
         {
@@ -254,7 +254,7 @@
         *aNewConn = EFalse;
         *aBearerType = EApBearerTypeAllBearers;
         }
-    else 
+    else
         {
         User::Leave( KErrCancel );
         }
@@ -264,8 +264,8 @@
 // CWmDrmDlaBrowserView::HandleRequestL
 // ---------------------------------------------------------------------------
 //
-TBool CWmDrmDlaBrowserView::HandleRequestL( 
-    RArray<TUint>* /*aTypeArray*/, 
+TBool CWmDrmDlaBrowserView::HandleRequestL(
+    RArray<TUint>* /*aTypeArray*/,
     CDesCArrayFlat* /*aDesArray*/ )
     {
     return EFalse;
@@ -275,16 +275,16 @@
 // CWmDrmDlaBrowserView::HandleDownloadL
 // ---------------------------------------------------------------------------
 //
-TBool CWmDrmDlaBrowserView::HandleDownloadL( 
-    RArray<TUint>* aTypeArray, 
+TBool CWmDrmDlaBrowserView::HandleDownloadL(
+    RArray<TUint>* aTypeArray,
     CDesCArrayFlat* aDesArray )
     {
     //Check that content type and local file name exists
-    //There must be both, because download manager downloads POST-content 
+    //There must be both, because download manager downloads POST-content
     //in advance calling this function
-    TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) ); 
+    TInt contentTypeIndex( aTypeArray->Find( EParamReceivedContentType ) );
     TInt fileNameIndex( aTypeArray->Find( EParamLocalFileName ) );
-    if ( contentTypeIndex != KErrNotFound &&  
+    if ( contentTypeIndex != KErrNotFound &&
          fileNameIndex != KErrNotFound &&
          contentTypeIndex < aDesArray->Count() &&
          fileNameIndex < aDesArray->Count() )
@@ -294,7 +294,7 @@
         if ( dataTypePtr.CompareF( KDataTypeLicenseResponse ) == 0 )
             {
             //Get the path to the license response,
-            //read the response, delete the file and 
+            //read the response, delete the file and
             //make a license received - callback
             TPtrC16 filePathPtr( (*aDesArray)[fileNameIndex] );
             RFs fs;
--- a/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdladefaulthttpplugin/src/wmdrmdladefaulthttpmanager.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -660,9 +660,9 @@
     if ( (iState == EOpen) && iKeepAlive )
         {
         TConnectionInfo connectionInfo;
-        GetConnectionInfoL(connectionInfo);
-        if ( connectionInfo.iIapId != iIapNumber &&
-             iIapNumber != 0 && connectionInfo.iIapId != 0 )
+        TRAPD(err, GetConnectionInfoL(connectionInfo) );
+        if ( err || ( connectionInfo.iIapId != iIapNumber &&
+             iIapNumber != 0 && connectionInfo.iIapId != 0 ) )
             {
             CleanupConnection();
             iState = EStart;
--- a/wmdrm/camese/wmdrmdlautils/data/wmdrmdlautils.rss	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlautils/data/wmdrmdlautils.rss	Wed Jun 23 17:42:58 2010 +0100
@@ -25,7 +25,7 @@
 #include <avkon.rsg>
 #include <avkon.rh>
 #include <avkon.mbg>
-#include <eikcore.rsg>
+#include <EIKCORE.rsg>
 #include <eikon.rsg>
 #include <appinfo.rh>
 #include <avkon.loc>
@@ -39,7 +39,7 @@
 
 RESOURCE TBUF { buf = ""; }
 
-// RESOURCE DEFINITIONS 
+// RESOURCE DEFINITIONS
 
 // -----------------------------------------------------------------------------
 // r_wmdrmdla_list_query
@@ -77,7 +77,7 @@
 // r_wmdrmdla_wait_note_acquiring_license
 // Note displayed when the license is being acquired for a song
 // ---------------------------------------------------------------------------
-// 
+//
 RESOURCE TBUF r_wmdrmdla_wait_note_acquiring_license
     {
     buf = qtn_drm_wait_getting_key;
@@ -87,7 +87,7 @@
 // r_wmdrmdla_wait_note_metering
 // Note displayed when the metering is being done
 // ---------------------------------------------------------------------------
-// 
+//
 RESOURCE TBUF r_wmdrmdla_wait_note_metering
     {
     buf = qtn_drm_wait_getting_key;
--- a/wmdrm/camese/wmdrmdlautils/inc/wmdrmdlaappclient.h	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlautils/inc/wmdrmdlaappclient.h	Wed Jun 23 17:42:58 2010 +0100
@@ -20,7 +20,7 @@
 #define R_WMDRMDLAAPPCLIENT_H
 
 #include <e32base.h>
-#include <aknserverapp.h>
+#include <AknServerApp.h>
 
 /**
  *  WMDRM DLA App Client Interface
@@ -34,7 +34,7 @@
     public:
 
         virtual ~RWmDrmDlaAppClient();
-        
+
         /**
          * Sets IAP to browser view
          *
@@ -42,7 +42,7 @@
          * @return Error code
          */
         TInt SetIAP( TInt aIap );
-        
+
         /**
          * Makes a POST request to browser view
          *
@@ -56,7 +56,7 @@
                    const TDesC8& aPostContentType,
                    const TDesC8& aPostData,
                    const TDesC8& aPostContentBoundary );
-        
+
         /**
          * Gets the license response from the browser view
          *
@@ -65,9 +65,9 @@
          * @return Error code
          */
         TInt LicenseResponse( HBufC8*& aLicenseResponse );
-        
+
     private: // from RApaAppServiceBase
-    
+
         TUid ServiceUid() const;
 
     private: // data
--- a/wmdrm/camese/wmdrmdlautils/src/wmdrmdlaui.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/camese/wmdrmdlautils/src/wmdrmdlaui.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -27,9 +27,9 @@
 #include <eikfrlbd.h>
 #include <coemain.h>
 #include <bautils.h>
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <aknnotewrappers.h>
-#include <aknglobalnote.h>
+#include <AknGlobalNote.h>
 #include <aknlistquerydialog.h>
 #include <badesca.h>
 #include <gulicon.h>
@@ -46,7 +46,7 @@
 #ifndef RD_MULTIPLE_DRIVE
 _LIT( KDriveZ, "z:" );
 #else
-_LIT( KRomDriveFormatter, "%c:" );                                      
+_LIT( KRomDriveFormatter, "%c:" );
 #endif
 
 _LIT( KWmdrmDlaUtilsResFileName, "wmdrmdlautils.rsc" );
@@ -67,7 +67,7 @@
         {
         User::Leave( KErrNotSupported );
         }
-    
+
     //Create resource file path
     TPtr wmdrmDlaUtilsResourcePtr( NULL, 0 );
     iWmdrmDlaUtilsResourceFile = HBufC::NewL( KMaxFileName );
@@ -83,14 +83,14 @@
     TInt driveNumber( -1 );
     TChar driveLetter;
     //Get rom drive number
-    User::LeaveIfError( 
-            DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, 
+    User::LeaveIfError(
+            DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom,
                                         driveNumber ) );
     //Get drive letter from the drive number
-    User::LeaveIfError( 
-            iCoeEnv->FsSession().DriveToChar( driveNumber, 
+    User::LeaveIfError(
+            iCoeEnv->FsSession().DriveToChar( driveNumber,
                                               driveLetter ) );
-    wmdrmDlaUtilsResourcePtr.AppendFormat( KRomDriveFormatter, 
+    wmdrmDlaUtilsResourcePtr.AppendFormat( KRomDriveFormatter,
                                            (TUint)driveLetter );
 
 #endif
@@ -103,13 +103,13 @@
     TFileName resourceFile;
     resourceFile = *iWmdrmDlaUtilsResourceFile;
     //Find the correct language file for the resource
-    BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), 
+    BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(),
                                     resourceFile );
-    //Add resource file to the CCoeEnv. 
+    //Add resource file to the CCoeEnv.
     //Resource file must be removed from the CCoeEnv when we are done
-    iWmdrmDlaUtilsResourceFileOffset 
+    iWmdrmDlaUtilsResourceFileOffset
         = iCoeEnv->AddResourceFileL( resourceFile );
-    
+
     iGlobalNote = CAknGlobalNote::NewL();
     }
 
@@ -168,7 +168,7 @@
 // CWmDrmDlaUi::ShowErrorNoteL
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CWmDrmDlaUi::ShowErrorNoteL( 
+EXPORT_C void CWmDrmDlaUi::ShowErrorNoteL(
     TInt aTextResourceId )
     {
     LOGFN( "CWmDrmDlaUi::ShowErrorNoteL" );
@@ -182,7 +182,7 @@
 // CWmDrmDlaUi::ShowWaitNoteL
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CWmDrmDlaUi::ShowWaitNoteL( 
+EXPORT_C void CWmDrmDlaUi::ShowWaitNoteL(
     TInt aTextResourceId,
     MWmDrmDlaWaitNoteCallback* aCallback )
     {
@@ -192,8 +192,8 @@
         User::Leave( KErrInUse );
         }
     iGlobalNoteText = StringLoader::LoadL( aTextResourceId, iCoeEnv );
-    iGlobalNoteId = iGlobalNote->ShowNoteL( iStatus, 
-                                            EAknGlobalWaitNote, 
+    iGlobalNoteId = iGlobalNote->ShowNoteL( iStatus,
+                                            EAknGlobalWaitNote,
                                             *iGlobalNoteText );
     iCallback = aCallback;
     SetActive();
@@ -213,30 +213,30 @@
 // CWmDrmDlaUi::ShowListQueryL
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TInt CWmDrmDlaUi::ShowListQueryL( 
+EXPORT_C TInt CWmDrmDlaUi::ShowListQueryL(
     MDesCArray* aItems,
     CArrayPtr<CGulIcon>* aIcons )
     {
     LOGFN( "CWmDrmDlaUi::ShowListQueryL" );
-    
+
     //This method takes the ownership of the input parameters
     //Push the input parameters to the cleanupstack to make sure we won't leak
     //memory
     CleanupStack::PushL( aIcons );
     CleanupStack::PushL( aItems );
-    
+
     //Check that both inputs really exist.
     if ( !aItems || !aIcons )
         {
         User::Leave( KErrArgument );
         }
-    
+
     //Create the query with index parameter
     //Query will take the ownership of the items and icons
     TInt index( 0 );
     CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &index );
     dlg->PrepareLC( R_WMDRMDLA_LIST_QUERY );
-    
+
     //Arrange cleanupstack in a way that query can take the ownership of the
     //items and icons
     CleanupStack::Pop( 2, aItems ); //dlg, aItems
@@ -248,13 +248,13 @@
     dlg->SetIconArrayL( aIcons );
     CleanupStack::Pop( 2, aIcons ); //dlg, aIcons
     CleanupStack::PushL( dlg );
-    
+
     //Enable marquee scrolling for the text items
-    CEikFormattedCellListBox* listbox( 
+    CEikFormattedCellListBox* listbox(
             static_cast<CEikFormattedCellListBox*>( dlg->ListBox() ) /* ,
             EAknListBoxItemSpecificMenuDisabled */ );
     listbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
-    
+
     //Launch the query
     TInt key( dlg->RunLD() );
     LOG2( "key: %d", key );
@@ -290,7 +290,7 @@
         {
         iCallback->UserWaitNoteCancellation();
         }
-    }    
+    }
 
 // ---------------------------------------------------------------------------
 // CWmDrmDlaUi::RunError
@@ -301,7 +301,7 @@
     return KErrNone;
     }
 
-    
+
 // ---------------------------------------------------------------------------
 // CWmDrmDlaUi::CancelWaitNote
 // ---------------------------------------------------------------------------
--- a/wmdrm/group/bld.inf	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -69,3 +69,5 @@
 #endif // __WINDOWS_MEDIA_DRM
 
 #include "../wmdrmengine/wmdrmaccess/group/bld.inf"
+
+#include "../wmdrmengine/wmdrmotaaccess/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wmdrm/wmdrmengine/wmdrmotaaccess/bwins/wmdrmotaaccessu.def	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+	??1CWmDrmOtaAccess@@UAE@XZ @ 1 NONAME ; CWmDrmOtaAccess::~CWmDrmOtaAccess(void)
+	?NewL@CWmDrmOtaAccess@@SAPAV1@XZ @ 2 NONAME ; class CWmDrmOtaAccess * CWmDrmOtaAccess::NewL(void)
+	?NewLC@CWmDrmOtaAccess@@SAPAV1@XZ @ 3 NONAME ; class CWmDrmOtaAccess * CWmDrmOtaAccess::NewLC(void)
+	?HandleLicenseResponseL@CWmDrmOtaAccess@@QAEXABVTDesC8@@@Z @ 4 NONAME ; void CWmDrmOtaAccess::HandleLicenseResponseL(class TDesC8 const &)
+	?GetLicenseChallengeL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAPAVHBufC8@@AAVTRequestStatus@@@Z @ 5 NONAME ; void CWmDrmOtaAccess::GetLicenseChallengeL(class TDesC8 const &, class HBufC8 * &, class TRequestStatus &)
+	?HandleLicenseResponseL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAVTRequestStatus@@@Z @ 6 NONAME ; void CWmDrmOtaAccess::HandleLicenseResponseL(class TDesC8 const &, class TRequestStatus &)
+	?GetLicenseChallengeL@CWmDrmOtaAccess@@QAEXABVTDesC8@@AAPAVHBufC8@@@Z @ 7 NONAME ; void CWmDrmOtaAccess::GetLicenseChallengeL(class TDesC8 const &, class HBufC8 * &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wmdrm/wmdrmengine/wmdrmotaaccess/eabi/wmdrmotaaccessu.def	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,11 @@
+EXPORTS
+	_ZN15CWmDrmOtaAccess4NewLEv @ 1 NONAME
+	_ZN15CWmDrmOtaAccess5NewLCEv @ 2 NONAME
+	_ZN15CWmDrmOtaAccessD0Ev @ 3 NONAME
+	_ZN15CWmDrmOtaAccessD1Ev @ 4 NONAME
+	_ZN15CWmDrmOtaAccessD2Ev @ 5 NONAME
+	_ZN15CWmDrmOtaAccess20GetLicenseChallengeLERK6TDesC8RP6HBufC8 @ 6 NONAME
+	_ZN15CWmDrmOtaAccess20GetLicenseChallengeLERK6TDesC8RP6HBufC8R14TRequestStatus @ 7 NONAME
+	_ZN15CWmDrmOtaAccess22HandleLicenseResponseLERK6TDesC8 @ 8 NONAME
+	_ZN15CWmDrmOtaAccess22HandleLicenseResponseLERK6TDesC8R14TRequestStatus @ 9 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wmdrm/wmdrmengine/wmdrmotaaccess/group/bld.inf	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  bld.inf
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+../rom/wmdrmotaaccess.iby      CORE_MW_LAYER_IBY_EXPORT_PATH( wmdrmotaaccess.iby )
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+wmdrmotaaccess.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wmdrm/wmdrmengine/wmdrmotaaccess/group/wmdrmotaaccess.mmp	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  wmdrmotaaccess.mmp
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          wmdrmotaaccess.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x2002E680
+
+CAPABILITY      ALL -TCB
+
+DEFFILE         wmdrmotaaccess.def
+
+SOURCEPATH      ../src
+SOURCE          wmdrmotaaccess.cpp
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+
+LANG            SC
+
+SMPSAFE
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wmdrm/wmdrmengine/wmdrmotaaccess/rom/wmdrmotaaccess.iby	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  wmdrmotaaccess.iby
+*
+*/
+
+#ifndef _WMDRMOTAACCESS_IBY_
+#define _WMDRMOTAACCESS_IBY_
+#include <data_caging_paths_for_iby.hrh>
+
+#if (defined __WINDOWS_MEDIA_DRM)
+file=ABI_DIR\BUILD_DIR\wmdrmotaaccess.dll          PROGRAMS_DIR\wmdrmotaaccess.dll
+#endif // __WINDOWS_MEDIA_DRM
+
+#endif // _WMDRMACCESS_IBY_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wmdrm/wmdrmengine/wmdrmotaaccess/src/wmdrmotaaccess.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*  wmdrmotaaccess.cpp
+*
+*/
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+
+#include <wmdrmotaaccess.h>
+#include <wmdrmotaaccessecominterface.h>
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::NewL
+// ---------------------------------------------------------------------------
+EXPORT_C CWmDrmOtaAccess* CWmDrmOtaAccess::NewL()
+    {
+    CWmDrmOtaAccess* self(CWmDrmOtaAccess::NewLC());
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::NewLC
+// ---------------------------------------------------------------------------
+EXPORT_C CWmDrmOtaAccess* CWmDrmOtaAccess::NewLC()
+    {
+    CWmDrmOtaAccess* self(new (ELeave) CWmDrmOtaAccess);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::ConstructL
+// ---------------------------------------------------------------------------
+void CWmDrmOtaAccess::ConstructL()
+    {
+    iWmDrmOtaAccessEcomInterface = CWmDrmOtaAccessEcomInterface::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::CWmDrmOtaAccess
+// ---------------------------------------------------------------------------
+CWmDrmOtaAccess::CWmDrmOtaAccess()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::~CWmDrmOtaAccess
+// ---------------------------------------------------------------------------
+EXPORT_C CWmDrmOtaAccess::~CWmDrmOtaAccess()
+    {
+    if (iWmDrmOtaAccessEcomInterface)
+        {
+        delete iWmDrmOtaAccessEcomInterface;
+        }
+    REComSession::FinalClose();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::GetLicenseChallengeL
+// ---------------------------------------------------------------------------
+EXPORT_C void CWmDrmOtaAccess::GetLicenseChallengeL( const TDesC8& aDrmHeader, 
+                                                     HBufC8*& aChallenge )
+    {
+    // Ecom interface not available    
+    if( !iWmDrmOtaAccessEcomInterface )
+        {
+        User::Leave( KErrNotReady );    
+        }   
+    
+    iWmDrmOtaAccessEcomInterface->GetLicenseChallengeL( aDrmHeader, 
+                                                        aChallenge );                                 
+    }
+
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::GetLicenseChallengeL
+// ---------------------------------------------------------------------------
+EXPORT_C void CWmDrmOtaAccess::GetLicenseChallengeL( const TDesC8& aDrmHeader, 
+                                                     HBufC8*& aChallenge, 
+                                                     TRequestStatus& aStatus )
+    {
+    // Ecom interface not available    
+    if( !iWmDrmOtaAccessEcomInterface )
+        {
+        User::Leave( KErrNotReady );    
+        }   
+    
+    iWmDrmOtaAccessEcomInterface->GetLicenseChallengeL( aDrmHeader, 
+                                                        aChallenge,
+                                                        aStatus );                                 
+    }                                                     
+    
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::HandleLicenseResponseL
+// ---------------------------------------------------------------------------
+EXPORT_C void CWmDrmOtaAccess::HandleLicenseResponseL( const TDesC8& aResponse )
+    {
+    // Ecom interface not available    
+    if( !iWmDrmOtaAccessEcomInterface )
+        {
+        User::Leave( KErrNotReady );    
+        }   
+    
+    iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse );                                
+    }    
+// ---------------------------------------------------------------------------
+// CWmDrmOtaAccess::HandleLicenseResponseL
+// ---------------------------------------------------------------------------
+EXPORT_C void CWmDrmOtaAccess::HandleLicenseResponseL( const TDesC8& aResponse, 
+                                                       TRequestStatus& aStatus )
+    {
+    // Ecom interface not available    
+    if( !iWmDrmOtaAccessEcomInterface )
+        {
+        User::Leave( KErrNotReady );    
+        }   
+    
+    iWmDrmOtaAccessEcomInterface->HandleLicenseResponseL( aResponse,
+                                                          aStatus );                                 
+    }                                                           
+
+
+
+    
+// End of file
--- a/wmdrm/wmdrmengine/wmdrmserver/clientwrapper/src/wmdrmclientwrapper.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/wmdrmengine/wmdrmserver/clientwrapper/src/wmdrmclientwrapper.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -16,7 +16,7 @@
 */
 
 
-#include "WmDrmClientWrapper.h"
+#include "wmdrmclientwrapper.h"
 
 // CONSTANTS
 
@@ -57,7 +57,7 @@
 //
 CWmDrmClientWrapper* CWmDrmClientWrapper::NewLC()
     {
-	CWmDrmClientWrapper* self = new( ELeave ) CWmDrmClientWrapper();
+    CWmDrmClientWrapper* self = new( ELeave ) CWmDrmClientWrapper();
     CleanupStack::PushL( self );
     self->ConstructL();
     return self;
@@ -90,14 +90,14 @@
 // DRM gate function
 //------------------------------------------------------------------------------
 EXPORT_C TAny* GateFunctionWmDrmClientWrapper()
-	{
-	CWmDrmClientWrapper* launcher = NULL;
-	TRAPD( err, launcher = CWmDrmClientWrapper::NewL() );
-	if( err != KErrNone )
-	    {
-	    return NULL;
-	    }
+    {
+    CWmDrmClientWrapper* launcher = NULL;
+    TRAPD( err, launcher = CWmDrmClientWrapper::NewL() );
+    if( err != KErrNone )
+        {
+        return NULL;
+        }
 
-	return launcher;
-	}
+    return launcher;
+    }
 
--- a/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmdatastore.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmdatastore.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -20,10 +20,10 @@
 #include <e32math.h>
 #include <symmetric.h>
 #include <bacntf.h>
-#include <centralrepository.h> 
+#include <centralrepository.h>
 
 #include "wmdrmdatastore.h"
-#include "wmdrmprivatecrkeys.h"
+#include "WMDRMPrivateCRKeys.h"
 #include "wmdrmkeystorage.h"
 #include "slotdatacache.h"
 #include "wmdrmdb.h"
@@ -56,7 +56,7 @@
     return self;
     }
 
-CWmDrmDataStore::CWmDrmDataStore( CWmDrmServer* aServer ) 
+CWmDrmDataStore::CWmDrmDataStore( CWmDrmServer* aServer )
     : iServer( aServer ), iMinFreeSpace2( 0 )
     {
     LOGFN( "CWmDrmDataStore::CWmDrmDataStore" );
@@ -67,23 +67,23 @@
     TDrmScheme drmScheme( EDrmSchemeWmDrm );
     TFileName tempFile, tempFile2;
     TChar driveLetter;
-    
+
     LOGFN( "CWmDrmDataStore::ConstructL" );
-    
+
     // Check which drive is configured in the Central Repository Key
     // for the desired storing location of WM DRM rights (license store).
-	iWmDrmRightsConfigFound = DrmRightsStoringLocation::CheckDrmRightsStorageDriveL(
-	    iServer->Fs(), drmScheme, driveLetter );
-    
-    // If the storing location is configured to other drive than the default 
-	// system drive, prepare utility files for that drive, too.
+    iWmDrmRightsConfigFound = DrmRightsStoringLocation::CheckDrmRightsStorageDriveL(
+        iServer->Fs(), drmScheme, driveLetter );
+
+    // If the storing location is configured to other drive than the default
+    // system drive, prepare utility files for that drive, too.
     if ( iWmDrmRightsConfigFound )
         {
         PrepareInfoFilesL( ETrue, driveLetter, iDummyDb2 );
         }
-    
+
     // Prepare the utility files for the default system drive
-    PrepareInfoFilesL( EFalse, (TUint)iServer->Fs().GetSystemDriveChar(), 
+    PrepareInfoFilesL( EFalse, (TUint)iServer->Fs().GetSystemDriveChar(),
         iDummyDb );
     }
 
@@ -111,53 +111,53 @@
     CAESDecryptor* aesDecryptor = NULL;
     CPaddingPKCS7* padding = NULL;
     TInt size = 0;
-    
+
     LOGFN( "CWmDrmDataStore::ReadInitialFreeSpaceL" );
     User::LeaveIfError( file.Open( iServer->Fs(), aFileName, EFileRead ) );
     CleanupClosePushL( file );
-    
+
     User::LeaveIfError( file.Size( size ) );
-	    
-	if( size != ( 2 * KAESKeyLength ) )
-	    {
-	    User::Leave(KErrCorrupt);
-	    }
+
+    if( size != ( 2 * KAESKeyLength ) )
+        {
+        User::Leave(KErrCorrupt);
+        }
 
     User::LeaveIfError( file.Read( iv ) );
-	User::LeaveIfError( file.Read( encryptedData ) );
+    User::LeaveIfError( file.Read( encryptedData ) );
 #if defined(FF_PLATFORM_SIMULATOR) || defined(__WINSCW__)
-	key.Copy( KDummyKey );
+    key.Copy( KDummyKey );
 #else
-	iServer->Cache()->iKeyStorage->GetDeviceSpecificKeyL( key );
+    iServer->Cache()->iKeyStorage->GetDeviceSpecificKeyL( key );
 #endif
-	aesDecryptor = CAESDecryptor::NewL( key );
+    aesDecryptor = CAESDecryptor::NewL( key );
     CleanupStack::PushL( aesDecryptor );
-    
+
     cbcDecryptor = CModeCBCDecryptor::NewL( aesDecryptor, iv );
     CleanupStack::Pop( aesDecryptor );
     CleanupStack::PushL( cbcDecryptor );
-    
+
     padding = CPaddingPKCS7::NewL( KAESKeyLength );
     CleanupStack::PushL( padding );
-    
+
     decryptor = CBufferedDecryptor::NewL( cbcDecryptor, padding );
     CleanupStack::Pop( 2, cbcDecryptor ); //padding, cbcDecryptor
     CleanupStack::PushL( decryptor );
-	
-	decryptor->ProcessFinalL( encryptedData, decryptedData );
-	CleanupStack::PopAndDestroy( 2, &file ); //decryptor, file
-	TLex8 lex( decryptedData );
-	
-	if ( aConfiguredDrive )
-	    {
-	    User::LeaveIfError( lex.Val( iInitialFreeSpace2 ) );
-	    }
-	else 
-	    {
-	    User::LeaveIfError( lex.Val( iInitialFreeSpace ) );
-	    }    
+
+    decryptor->ProcessFinalL( encryptedData, decryptedData );
+    CleanupStack::PopAndDestroy( 2, &file ); //decryptor, file
+    TLex8 lex( decryptedData );
+
+    if ( aConfiguredDrive )
+        {
+        User::LeaveIfError( lex.Val( iInitialFreeSpace2 ) );
+        }
+    else
+        {
+        User::LeaveIfError( lex.Val( iInitialFreeSpace ) );
+        }
     }
-        
+
 void CWmDrmDataStore::WriteInitialFreeSpaceL( const TDesC& aFileName,
     TBool& aConfiguredDrive )
     {
@@ -170,7 +170,7 @@
     CModeCBCEncryptor* cbcEncryptor = NULL;
     CAESEncryptor* aesEncryptor = NULL;
     CPaddingPKCS7* padding = NULL;
-    
+
     LOGFN( "CWmDrmDataStore::WriteInitialFreeSpaceL" );
     User::LeaveIfError( file.Create( iServer->Fs(), aFileName, EFileWrite ) );
     CleanupClosePushL( file );
@@ -181,7 +181,7 @@
     else
         {
         iInitialFreeSpace = iServer->FreeSpaceL( aConfiguredDrive );
-        }    
+        }
     iv.SetLength( KAESKeyLength );
     TRandom::RandomL( iv );
 #if defined(FF_PLATFORM_SIMULATOR) || defined(__WINSCW__)
@@ -191,18 +191,18 @@
 #endif
     aesEncryptor = CAESEncryptor::NewL( key );
     CleanupStack::PushL( aesEncryptor );
-    
+
     cbcEncryptor = CModeCBCEncryptor::NewL( aesEncryptor, iv );
     CleanupStack::Pop( aesEncryptor );
     CleanupStack::PushL( cbcEncryptor );
-    
+
     padding = CPaddingPKCS7::NewL( KAESKeyLength );
     CleanupStack::PushL( padding );
-    
+
     encryptor = CBufferedEncryptor::NewL( cbcEncryptor, padding );
     CleanupStack::Pop( 2, cbcEncryptor ); //padding, cbcEncryptor
     CleanupStack::PushL( encryptor );
-    
+
     if ( aConfiguredDrive )
         {
         decryptedData.AppendNum( iInitialFreeSpace2 );
@@ -210,8 +210,8 @@
     else
         {
         decryptedData.AppendNum( iInitialFreeSpace );
-        }    
-            
+        }
+
     encryptor->ProcessFinalL( decryptedData, encryptedData );
     User::LeaveIfError( file.Write( iv ) );
     User::LeaveIfError( file.Write( encryptedData ) );
@@ -228,25 +228,25 @@
     TInt ratio( 0 );
     TInt ratio2( 0 );
     TBool internalMassDriveNotFull( ETrue );
-    
+
     LOGFN( "CWmDrmDataStore::DataStoreStateL" );
     freeSpace = iServer->FreeSpaceL( EFalse );
-    
+
     if ( iWmDrmRightsConfigFound )
         {
         // Check free space from the configured drive, too.
         freeSpace2 = iServer->FreeSpaceL( ETrue );
-        
-        if ( freeSpace2 < iMinFreeSpace2 ) 
+
+        if ( freeSpace2 < iMinFreeSpace2 )
             {
             internalMassDriveNotFull = EFalse;
             }
-            
+
         dummyDbSize = DummyDBSizeL( ETrue );
         dataStoreSize = DataStoreSizeL( ETrue );
         ratio2 = dataStoreSize * 100 / iInitialFreeSpace2;
         freeSpace2 += dummyDbSize;
-#ifdef _LOGGING        
+#ifdef _LOGGING
         TBuf<KMaxTInt64BufLength> free2;
         LOG1( "CWmDrmDataStore::DataStoreStateL: Free space (2): ");
         free2.AppendNumUC( freeSpace2, EDecimal );
@@ -255,15 +255,15 @@
         LOG1( "CWmDrmDataStore::DataStoreStateL: Minimum free space (2): ");
         free2Min.AppendNumUC( iMinFreeSpace2, EDecimal );
         LOG( free2Min );
-#endif             
+#endif
         }
-    
-    // Check the system drive storage space next.   
+
+    // Check the system drive storage space next.
     dummyDbSize = DummyDBSizeL( EFalse );
     dataStoreSize = DataStoreSizeL( EFalse );
     ratio = dataStoreSize * 100 / iInitialFreeSpace;
     freeSpace += dummyDbSize;
-#ifdef _LOGGING        
+#ifdef _LOGGING
     TBuf<KMaxTInt64BufLength> free;
     LOG1( "CWmDrmDataStore::DataStoreStateL: Free space: ");
     free.AppendNumUC( freeSpace, EDecimal );
@@ -272,21 +272,21 @@
     LOG1( "CWmDrmDataStore::DataStoreStateL: Minimum free space: ");
     freeMin.AppendNumUC( iMinFreeSpace, EDecimal );
     LOG( freeMin );
-#endif      
-    
-    // Select the state of the storage space.      
-    if ( ( freeSpace > iMinFreeSpace ) && internalMassDriveNotFull ) 
+#endif
+
+    // Select the state of the storage space.
+    if ( ( freeSpace > iMinFreeSpace ) && internalMassDriveNotFull )
         {
         LOG1( "CWmDrmDataStore::DataStoreStateL: Store space Ok" );
         state = EStoreSpaceOK;
         }
     else
         {
-        // The configured drive is running out of space. The system drive 
+        // The configured drive is running out of space. The system drive
         // may also be running out of storage space, but calculate
         // the ratio of database size to initial free drive space and the
         // state of the drive storage space from the configured drive because
-        // it is likely to fill up faster since the media files may be synced to it. 
+        // it is likely to fill up faster since the media files may be synced to it.
         if ( !internalMassDriveNotFull )
             {
             LOG2( "Ratio (2): %d", ratio2 );
@@ -302,7 +302,7 @@
                 }
             }
         else
-            // Only the system drive is running out of storage space. 
+            // Only the system drive is running out of storage space.
             {
             LOG2( "Ratio: %d", ratio );
             if ( ratio <= iMaxSpaceRatio )
@@ -315,9 +315,9 @@
                 LOG1( "CWmDrmDataStore::DataStoreStateL Store space full" );
                 state = EStoreSpaceFull;
                 }
-            }    
+            }
         }
-        
+
     LOG2( "DataStoreState: %d", state );
     return state;
     }
@@ -326,13 +326,13 @@
     RFile& aDummyDb, TBool& aConfiguredDrive )
     {
     TInt r( KErrNone );
-    
+
     LOGFN( "CWmDrmDataStore::InitializeDummyDbFileL" );
-    
+
     r = aDummyDb.Create( iServer->Fs(), aFileName, EFileWrite );
     if ( r == KErrAlreadyExists )
         {
-        User::LeaveIfError( 
+        User::LeaveIfError(
             aDummyDb.Open( iServer->Fs(), aFileName, EFileWrite ) );
         }
     else if( !r )
@@ -342,7 +342,7 @@
             {
             if ( dataStoreSize <= iDummyDbInitialSize2 )
                 {
-                User::LeaveIfError( 
+                User::LeaveIfError(
                     aDummyDb.SetSize( iDummyDbInitialSize2 - dataStoreSize ) );
                 }
             else
@@ -350,18 +350,18 @@
                 User::LeaveIfError( aDummyDb.SetSize( 0 ) );
                 }
             }
-        else 
+        else
             {
             if ( dataStoreSize <= iDummyDbInitialSize )
                 {
-                User::LeaveIfError( 
+                User::LeaveIfError(
                     aDummyDb.SetSize( iDummyDbInitialSize - dataStoreSize ) );
                 }
             else
                 {
                 User::LeaveIfError( aDummyDb.SetSize( 0 ) );
                 }
-            } 
+            }
         }
     else
         {
@@ -379,26 +379,26 @@
         LOG2( "dummyDbSize: %d", dummyDbSize );
         if ( aSize <= dummyDbSize )
             {
-            if ( aConfiguredDrive ) 
+            if ( aConfiguredDrive )
                 {
-            	User::LeaveIfError( iDummyDb2.SetSize( dummyDbSize - aSize ) );
-            	}
+                User::LeaveIfError( iDummyDb2.SetSize( dummyDbSize - aSize ) );
+                }
             else
-            	{	
-            	User::LeaveIfError( iDummyDb.SetSize( dummyDbSize - aSize ) );
-            	}
-           	} 		
+                {
+                User::LeaveIfError( iDummyDb.SetSize( dummyDbSize - aSize ) );
+                }
+            }
         else
             {
             if ( aConfiguredDrive )
-            	{
-            	User::LeaveIfError( iDummyDb2.SetSize( 0 ) );
-            	}
-            else 
-            	{
-            	User::LeaveIfError( iDummyDb.SetSize( 0 ) );	
-          		}
-          	}		
+                {
+                User::LeaveIfError( iDummyDb2.SetSize( 0 ) );
+                }
+            else
+                {
+                User::LeaveIfError( iDummyDb.SetSize( 0 ) );
+                }
+            }
         }
     else
         {
@@ -408,27 +408,27 @@
             {
             if ( dataStoreSize <= iDummyDbInitialSize2 )
                 {
-                User::LeaveIfError( 
+                User::LeaveIfError(
                     iDummyDb2.SetSize( iDummyDbInitialSize2 - dataStoreSize ) );
-            	}
-            else 
-            	{
-            	User::LeaveIfError( iDummyDb2.SetSize( 0 ) );
-            	}
+                }
+            else
+                {
+                User::LeaveIfError( iDummyDb2.SetSize( 0 ) );
+                }
             }
-        else 
+        else
             {
             if ( dataStoreSize <= iDummyDbInitialSize )
                 {
-                User::LeaveIfError( 
+                User::LeaveIfError(
                     iDummyDb.SetSize( iDummyDbInitialSize - dataStoreSize ) );
-            	}
-            else 
-            	{
-            	User::LeaveIfError( iDummyDb.SetSize( 0 ) );
-            	}
+                }
+            else
+                {
+                User::LeaveIfError( iDummyDb.SetSize( 0 ) );
+                }
             }
-        } 
+        }
     }
 
 TInt CWmDrmDataStore::DataStoreSizeL( TBool aConfiguredDrive )
@@ -448,35 +448,35 @@
     else
         {
         User::LeaveIfError( iDummyDb.Size( dummyDbSize ) );
-        }    
+        }
     return dummyDbSize;
     }
 
-void CWmDrmDataStore::PrepareInfoFilesL( TBool aConfiguredDrive, 
+void CWmDrmDataStore::PrepareInfoFilesL( TBool aConfiguredDrive,
     TChar aDriveLetter, RFile& aDummyDb )
     {
     LOGFN( "CWmDrmDataStore::PrepareInfoFilesL" );
     CRepository* repository( NULL );
     TInt r( KErrNone );
-    TFileName dummyDbFile; 
+    TFileName dummyDbFile;
     TFileName initialFreeSpaceFile;
-    
+
     initialFreeSpaceFile.Format( KPrivateDir, (TUint)aDriveLetter );
     iServer->Fs().MkDirAll( initialFreeSpaceFile );
     initialFreeSpaceFile.Format( KInitialFreeSpaceFile, (TUint)aDriveLetter );
     dummyDbFile.Format( KDummyDbFile, (TUint)aDriveLetter );
-    	
-    TRAP( r, WriteInitialFreeSpaceL( initialFreeSpaceFile, 
+
+    TRAP( r, WriteInitialFreeSpaceL( initialFreeSpaceFile,
         aConfiguredDrive ) );
     if ( r )
         {
         r = KErrNone;
-        
+
         // catch the read error
-        TRAP( r, ReadInitialFreeSpaceL( initialFreeSpaceFile, 
+        TRAP( r, ReadInitialFreeSpaceL( initialFreeSpaceFile,
             aConfiguredDrive ) );
-        
-        // if an error occurs, this means that we are unable to read the info, 
+
+        // if an error occurs, this means that we are unable to read the info,
         // thus we need to delete the file and run write again.
         // hopefully this being a temporary error, but if we fail again we fail
         // until next ConstructL
@@ -484,60 +484,60 @@
             {
             // delete the file:
             iServer->Fs().Delete( initialFreeSpaceFile );
-            
+
             // Calc & Write the new info
             WriteInitialFreeSpaceL( initialFreeSpaceFile, aConfiguredDrive );
             }
         }
-    
+
     if ( aConfiguredDrive )
         {
-#ifdef _LOGGING        
+#ifdef _LOGGING
         TBuf<KMaxTInt64BufLength> freeSpace2;
         LOG1( "CWmDrmDataStore::DataStoreStateL: Initial free space (2): ");
         freeSpace2.AppendNumUC( iInitialFreeSpace2, EDecimal );
         LOG( freeSpace2 );
-#endif          
+#endif
         if ( iInitialFreeSpace2 <= 0 )
             {
             User::Leave( KErrNotReady );
             }
         }
-    else 
+    else
         {
-#ifdef _LOGGING        
+#ifdef _LOGGING
         TBuf<KMaxTInt64BufLength> freeSpace;
         LOG1( "CWmDrmDataStore::DataStoreStateL: Initial free space: ");
         freeSpace.AppendNumUC( iInitialFreeSpace, EDecimal );
         LOG( freeSpace );
-#endif          
+#endif
         if ( iInitialFreeSpace <= 0 )
             {
             User::Leave( KErrNotReady );
             }
         }
-    
+
     //LOG1( "CWmDrmDataStore::PrepareInfoFilesL Check Cenrep" );
-    
+
     TRAP( r, repository = CRepository::NewL( KCRUidWMDRM ) );
     if ( repository )
         {
         TInt rate( 0 );
-        
+
         // Check the cenrep key parameters either for the default system drive
         // or for the internal mass drive depending whether the WMDRM rights
         // are configured to be partially stored to the internal mass drive or
-        // not. 
+        // not.
         if ( !aConfiguredDrive )
-            { 
+            {
             r = repository->Get( KWMDRMLicStoreLowMem, rate );
             if ( r )
                 {
-                iMinFreeSpace = KMegaByte;      
+                iMinFreeSpace = KMegaByte;
                 }
             else
                 {
-                iMinFreeSpace = rate * KMegaByte;   
+                iMinFreeSpace = rate * KMegaByte;
                 }
             r = repository->Get( KWMDRMLicStoreSizeRatio, iMaxSpaceRatio );
             if ( r )
@@ -547,19 +547,19 @@
             r = repository->Get( KWMDRMLicStoreReservedSpace, rate );
             if ( r )
                 {
-                iDummyDbInitialSize = KDummyDbInitialSize;   
+                iDummyDbInitialSize = KDummyDbInitialSize;
                 }
             else
                 {
-                iDummyDbInitialSize = rate * KMegaByte;     
+                iDummyDbInitialSize = rate * KMegaByte;
                 }
             }
-        else 
+        else
             {
             r = repository->Get( KWMDRM2LicStoreLowMem, rate );
             if ( r )
                 {
-                iMinFreeSpace2 = KTwoHundredMegaBytes;      
+                iMinFreeSpace2 = KTwoHundredMegaBytes;
                 }
             else
                 {
@@ -573,31 +573,31 @@
             r = repository->Get( KWMDRM2LicStoreReservedSpace, rate );
             if ( r )
                 {
-                iDummyDbInitialSize2 = KDummyDbInitialSize;   
+                iDummyDbInitialSize2 = KDummyDbInitialSize;
                 }
             else
                 {
-                iDummyDbInitialSize2 = rate * KMegaByte;     
+                iDummyDbInitialSize2 = rate * KMegaByte;
                 }
-            }          
+            }
         delete repository;
         }
     else
         {
         if ( !aConfiguredDrive )
             {
-            iMinFreeSpace = KMegaByte; 
+            iMinFreeSpace = KMegaByte;
             iMaxSpaceRatio = KMaxSpaceRatio;
             iDummyDbInitialSize = KDummyDbInitialSize;
             }
-        else 
+        else
             {
-            iMinFreeSpace2 = KTwoHundredMegaBytes; 
+            iMinFreeSpace2 = KTwoHundredMegaBytes;
             iMaxSpaceRatio2 = KMaxSpaceRatio2;
-            iDummyDbInitialSize2 = KDummyDbInitialSize;            
+            iDummyDbInitialSize2 = KDummyDbInitialSize;
             }
         }
-     
+
     InitializeDummyDbFileL( dummyDbFile, aDummyDb, aConfiguredDrive );
-    
+
     }
--- a/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmserver.cpp	Fri Feb 12 14:30:27 2010 +0000
+++ b/wmdrm/wmdrmengine/wmdrmserver/server/src/wmdrmserver.cpp	Wed Jun 23 17:42:58 2010 +0100
@@ -16,7 +16,7 @@
 */
 
 #include <bacntf.h>
-#include <DriveInfo.h>
+#include <driveinfo.h>
 #include "wmdrmsession.h"
 #include "wmdrmserver.h"
 #include "clock.h"
@@ -32,23 +32,23 @@
 #include "logfn.h"
 
 CWmDrmServer::CWmDrmServer():
-	CServer2( CActive::EPriorityStandard,  ESharableSessions ),
-	iCache( NULL ), iDriveNumber( -1 ), iWmDrmRightsConfigFound( EFalse )
-	{
-	}
+    CServer2( CActive::EPriorityStandard,  ESharableSessions ),
+    iCache( NULL ), iDriveNumber( -1 ), iWmDrmRightsConfigFound( EFalse )
+    {
+    }
 
 CServer2* CWmDrmServer::NewLC()
-	{
-	LOGFN( "CWmDrmServer::NewLC" );
-	CWmDrmServer* self = new( ELeave ) CWmDrmServer;
-	CleanupStack::PushL( self );
-	self->ConstructL();
-	return self;
-	}
+    {
+    LOGFN( "CWmDrmServer::NewLC" );
+    CWmDrmServer* self = new( ELeave ) CWmDrmServer;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
 
 CWmDrmServer::~CWmDrmServer()
     {
-	LOGFN( "CWmDrmServer::~CWmDrmServer" );
+    LOGFN( "CWmDrmServer::~CWmDrmServer" );
     delete iCache;
     delete iEnumeratorCache;
     delete iClock;
@@ -58,34 +58,34 @@
     }
 
 void CWmDrmServer::ConstructL()
-	{
-	LOGFN( "CWmDrmServer::ConstructL" );
-	TDrmScheme drmScheme( EDrmSchemeWmDrm );
-	TChar driveLetter;
-	
-	StartL( KWmDrmServerName );
-	User::LeaveIfError( iFs.Connect() );
+    {
+    LOGFN( "CWmDrmServer::ConstructL" );
+    TDrmScheme drmScheme( EDrmSchemeWmDrm );
+    TChar driveLetter;
+
+    StartL( KWmDrmServerName );
+    User::LeaveIfError( iFs.Connect() );
     iCache = NULL;
-	iEnumeratorCache = NULL;
-	ResetCacheL();
-	iClock = CClock::NewL( this );
-	iClock->Start();
-	
+    iEnumeratorCache = NULL;
+    ResetCacheL();
+    iClock = CClock::NewL( this );
+    iClock->Start();
+
     // Check which drive is configured in the Central Repository Key
-    // for the desired storing location of license and sync stores. 
-	// Convert the drive letter to drive number and store it.
-	iWmDrmRightsConfigFound = 
-	    DrmRightsStoringLocation::CheckDrmRightsStorageDriveL( iFs,
-	        drmScheme, driveLetter );
-	
-	// Check also the system drive
-	DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, iSystemDriveNumber );
-	    
+    // for the desired storing location of license and sync stores.
+    // Convert the drive letter to drive number and store it.
+    iWmDrmRightsConfigFound =
+        DrmRightsStoringLocation::CheckDrmRightsStorageDriveL( iFs,
+            drmScheme, driveLetter );
+
+    // Check also the system drive
+    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, iSystemDriveNumber );
+
     iFs.CharToDrive( driveLetter, iDriveNumber );
-	
-	iDb = CWmDrmDb::NewL( this );
-	iDataStore = CWmDrmDataStore::NewL( this );
-	}
+
+    iDb = CWmDrmDb::NewL( this );
+    iDataStore = CWmDrmDataStore::NewL( this );
+    }
 
 void CWmDrmServer::ResetCacheL()
     {
@@ -94,43 +94,43 @@
         {
         delete iCache;
         iCache = NULL;
-	    }
+        }
     iCache = CSlotDataCache::NewL( this );
-	if ( iEnumeratorCache )
-	    {
-	    delete iEnumeratorCache;
-	    iEnumeratorCache = NULL;
-	    }
-	iEnumeratorCache = CSlotEnumeratorCache::NewL( this );
+    if ( iEnumeratorCache )
+        {
+        delete iEnumeratorCache;
+        iEnumeratorCache = NULL;
+        }
+    iEnumeratorCache = CSlotEnumeratorCache::NewL( this );
     }
 
 CSession2* CWmDrmServer::NewSessionL(
     const TVersion& /*aVersion*/,
     const RMessage2& /*aMessage*/ ) const
-	{
-	LOGFN( "CWmDrmServer::NewSessionL" );
-	return new( ELeave ) CWmDrmSession();
-	}
+    {
+    LOGFN( "CWmDrmServer::NewSessionL" );
+    return new( ELeave ) CWmDrmSession();
+    }
 
 CSlotDataCache* CWmDrmServer::Cache()
-	{
-	return iCache;
-	}
+    {
+    return iCache;
+    }
 
 CSlotEnumeratorCache* CWmDrmServer::EnumeratorCache()
-	{
+    {
     return iEnumeratorCache;
-	}
+    }
 
 CClock* CWmDrmServer::Clock()
-	{
-	return iClock;
-	}
+    {
+    return iClock;
+    }
 
 RFs& CWmDrmServer::Fs()
-	{
-	return iFs;
-	}
+    {
+    return iFs;
+    }
 
 CWmDrmDataStore* CWmDrmServer::DataStore()
     {
@@ -150,38 +150,38 @@
         // Check the disk space from the configured drive
         User::LeaveIfError( iFs.Volume( info, iDriveNumber ) );
         }
-    else 
+    else
         {
         // Check the disk space from the system drive
-        User::LeaveIfError( iFs.Volume( info, iSystemDriveNumber ) );   
+        User::LeaveIfError( iFs.Volume( info, iSystemDriveNumber ) );
         }
-    return info.iFree;    
-    } 
+    return info.iFree;
+    }
 
 static void RunServerL()
-	{
-	LOGFN( "RunServerL" );
+    {
+    LOGFN( "RunServerL" );
 
-	User::LeaveIfError( RThread::RenameMe( KWmDrmServerName ) );
-	CActiveScheduler* s = new( ELeave ) CActiveScheduler;
-	CleanupStack::PushL( s );
-	CActiveScheduler::Install( s );
+    User::LeaveIfError( RThread::RenameMe( KWmDrmServerName ) );
+    CActiveScheduler* s = new( ELeave ) CActiveScheduler;
+    CleanupStack::PushL( s );
+    CActiveScheduler::Install( s );
     CWmDrmServer::NewLC();
-	RProcess::Rendezvous( KErrNone );
-	CActiveScheduler::Start();
-	CleanupStack::PopAndDestroy( 2 ); // server, s
-	}
+    RProcess::Rendezvous( KErrNone );
+    CActiveScheduler::Start();
+    CleanupStack::PopAndDestroy( 2 ); // server, s
+    }
 
 TInt E32Main()
-	{
-	__UHEAP_MARK;
-	CTrapCleanup* cleanup = CTrapCleanup::New();
-	TInt r = KErrNoMemory;
-	if ( cleanup )
-		{
-		TRAP( r, RunServerL() );
-		delete cleanup;
-		}
-	__UHEAP_MARKEND;
-	return r;
-	}
+    {
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    TInt r = KErrNoMemory;
+    if ( cleanup )
+        {
+        TRAP( r, RunServerL() );
+        delete cleanup;
+        }
+    __UHEAP_MARKEND;
+    return r;
+    }