menucontentsrv/srvsrc/mcsdrmhandler.cpp
branchRCL_3
changeset 118 8baec10861af
parent 0 79c6a41cd166
child 122 6cadd6867c17
--- a/menucontentsrv/srvsrc/mcsdrmhandler.cpp	Wed Sep 01 12:22:09 2010 +0100
+++ b/menucontentsrv/srvsrc/mcsdrmhandler.cpp	Tue Sep 14 21:55:16 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:  Used for receive SIM Application name, icon or 
+* Description:  Used for receive SIM Application name, icon or
 *                visibility information.
 *
 */
@@ -41,12 +41,12 @@
 // -----------------------------------------------------------------------------
 //
 
-CMcsDrmHandler* CMcsDrmHandler::NewL( 
+CMcsDrmHandler* CMcsDrmHandler::NewL(
     CMenuSrvEng& aSrvEng,
     CMenuSrvEngUtils& aUtils,
     CMcsCacheHandler& aCacheHandler )
     {
-    CMcsDrmHandler* self = new( ELeave ) 
+    CMcsDrmHandler* self = new( ELeave )
             CMcsDrmHandler( aSrvEng, aUtils, aCacheHandler );
     CleanupStack::PushL( self );
     self->ConstructL();
@@ -54,7 +54,7 @@
     return self;
     }
 
-// -----------------------------------------------------------------------------    
+// -----------------------------------------------------------------------------
 // Destructor
 // -----------------------------------------------------------------------------
 CMcsDrmHandler::~CMcsDrmHandler()
@@ -70,10 +70,10 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CMcsDrmHandler::CMcsDrmHandler( 
+CMcsDrmHandler::CMcsDrmHandler(
     CMenuSrvEng& aSrvEng,
     CMenuSrvEngUtils& aUtils,
-    CMcsCacheHandler& aCacheHandler ): 
+    CMcsCacheHandler& aCacheHandler ):
     iObserversManager( aUtils ), iSrvEng( aSrvEng ),
     iUtils( aUtils ), iCacheHandler( aCacheHandler )
     {
@@ -87,47 +87,48 @@
 void CMcsDrmHandler::ConstructL()
     {
     iScanner = CMcsDrmScanner::NewL( *this, iSrvEng, iUtils );
-	iInstallNotifier = CMcsInstallNotifier::NewL(*this, KPSUidJavaLatestInstallation);
+	iInstallNotifier = CMcsInstallNotifier::NewL(
+	        *this, CMcsInstallNotifier::EJavaInstallNotification );
 
     }
 
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
-//    
+//
 TInt CMcsDrmHandler::AppFolderIdL( TUid aUid )
     {
-    RArray<TMenuItem> mcsItems; 
+    RArray<TMenuItem> mcsItems;
     CleanupClosePushL( mcsItems );
-    
+
     TInt root;
     iSrvEng.Engine().RootFolderL( root );
     TMenuSrvTypeAttrFilter appFilter;
-    appFilter.SetType( KMenuTypeApp() );   
-    
+    appFilter.SetType( KMenuTypeApp() );
+
     TBuf<KUidChars> uidString;
     MenuSrvUtil::UidToStringL( aUid.iUid, uidString, 0, EHex );
-    
+
     appFilter.SetAttr( KMenuAttrUid(), uidString );
     iSrvEng.Engine().GetItemsL( mcsItems, root, &appFilter, ETrue );
-    
+
     TInt folderId = KErrNotFound;
     if (mcsItems.Count())
         {
         folderId = mcsItems[0].Parent();
         iCacheHandler.HandleRemoveAttribute(mcsItems[0].Id(), KMenuAttrDrmProtection);
         }
-    
+
     CleanupStack::PopAndDestroy( &mcsItems );
     return folderId;
     }
 
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
-//     
+//
 void CMcsDrmHandler::HandleDrmEvent( TUid aUid )
     {
     TRAP_IGNORE(
-    		iSrvEng.Engine().AppendNotifyL( AppFolderIdL( aUid ), 
+    		iSrvEng.Engine().AppendNotifyL( AppFolderIdL( aUid ),
     				RMenuNotifier::EItemAttributeChanged );
     		iScanner->RemoveObserverAndScanL( aUid );
 				);
@@ -135,100 +136,69 @@
 
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
-//     
+//
 void CMcsDrmHandler::HandleDrmAppEvent()
     {
     TRAP_IGNORE( AddRemoveObserversL(
-        iScanner->DrmProtectedAppArray() ) );     
+        iScanner->DrmProtectedAppArray() ) );
     }
 
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
-//     
-void CMcsDrmHandler::AddRemoveObserversL( 
+//
+void CMcsDrmHandler::AddRemoveObserversL(
 	const RArray<TUid>& aDrmProtectedArray )
     {
-    iObserversManager.RemoveMissingObservers( aDrmProtectedArray );    
+    iObserversManager.RemoveMissingObservers( aDrmProtectedArray );
     iObserversManager.CreateObserversL( aDrmProtectedArray, *this );
-    }    
+    }
 
 // -----------------------------------------------------------------------------
 // -----------------------------------------------------------------------------
-//        
+//
 void CMcsDrmHandler::EngineEvents( TInt /*aFolder*/, TInt aEvents )
     {
     if ( aEvents & RMenuNotifier::EItemsAddedRemoved )
         {
         iScanner->Scan();
-        }    
+        }
     }
 
 // ---------------------------------------------------------
-// CMcsDrmHandler::HandleInstallNotifyL
+//
 // ---------------------------------------------------------
 //
-void CMcsDrmHandler::HandleInstallNotifyL( TInt aPackageUid )
+void CMcsDrmHandler::HandleInstallNotifyL( TUid aPackageUid,
+		CMcsInstallNotifier::TNotificationType aNotificationType )
 	{
-	RArray<TUid> uids;
-	CleanupClosePushL( uids );
-
-	Java::CJavaRegistry* javaRegistry;
-	javaRegistry = Java::CJavaRegistry::NewLC();
-
-	Java::CJavaRegistryEntry* regEntry = 
-		javaRegistry->RegistryEntryL( TUid::Uid(aPackageUid) );
-
-	if( regEntry )
-		{
-	CleanupStack::PushL( regEntry );
-
-	Java::TJavaRegistryEntryType entryType = regEntry->Type();
-	
-	if ( ( entryType >= Java::EGeneralPackage ) && 
-			(entryType < Java::EGeneralApplication) )
-		{
-		//package entry
-		Java::CJavaRegistryPackageEntry* regPackageEntry = 
-					static_cast<Java::CJavaRegistryPackageEntry*>( regEntry );
-			regPackageEntry->GetEmbeddedEntries( uids );
-			}
-		else 
-			{
-			//application entry
-			uids.AppendL( regEntry->Uid() );
-			}
-		
-		CleanupStack::PopAndDestroy( regEntry );
-	    for ( TInt i = 0; i< uids.Count(); i++ )
-	        {
-	        if ( ( iScanner->DrmExpiredAppArray()).Find(uids[i]) != KErrNotFound )
-	            {
-	            HandleDrmEvent( uids[i] );
-	            }
-	        else
-	            {
-	            iObserversManager.RefreshObserverL( iScanner->DrmProtectedAppArray(), 
-	                    uids[i], *this );
-	            }
-	        }
+    if( aPackageUid != TUid::Null() )
+        {
+        if ( ( iScanner->DrmExpiredAppArray()).Find( aPackageUid )
+                != KErrNotFound )
+            {
+            HandleDrmEvent( aPackageUid );
+            }
+        else
+            {
+            iObserversManager.RefreshObserverL(
+                    iScanner->DrmProtectedAppArray(), aPackageUid, *this );
+            }
 		}
 	else
 	    {
 	    for ( TInt i = 0; i< iScanner->DrmProtectedAppArray().Count(); i++ )
 	        {
-            iObserversManager.RefreshObserverL( iScanner->DrmProtectedAppArray(), 
-        		   iScanner->DrmProtectedAppArray()[i], *this );
+            iObserversManager.RefreshObserverL(
+                    iScanner->DrmProtectedAppArray(),
+                    iScanner->DrmProtectedAppArray()[i],
+                    *this );
 	        }
 	    for ( TInt i = 0; i< iScanner->DrmExpiredAppArray().Count(); i++ )
 	        {
 	        HandleDrmEvent( iScanner->DrmExpiredAppArray()[i] );
-	        }	    
+	        }
 	    }
-	
-	
-	CleanupStack::PopAndDestroy( javaRegistry );
-	CleanupStack::PopAndDestroy( &uids );
     }
 
 
-//  End of File  
+//  End of File