Revision: 201009 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 15 Mar 2010 12:41:53 +0200
branchRCL_3
changeset 12 502e5d91ad42
parent 11 bd874ee5e5e2
child 13 c2817bb2a55c
child 14 15e4dd19031c
Revision: 201009 Kit: 201010
contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h
contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserveractionmanager.h
contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp
contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp
contentpublishingsrv/contentpublishingserver/cpserver/src/cpserveractionmanager.cpp
contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp
contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpliwmap.h
contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpliwmap.cpp
group/bld.inf
homescreenpluginsrv/hspsdom/bwins/hspsdomdocumentu.def
homescreenpluginsrv/hspsdom/eabi/hspsdomdocumentu.def
homescreenpluginsrv/hspsdom/src/hspsdomattribute.cpp
homescreenpluginsrv/hspsdom/src/hspsdomdocument.cpp
homescreenpluginsrv/hspsdom/src/hspsdomnode.cpp
homescreenpluginsrv/hspsdom/src/hspsdomstringpool.cpp
homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h
homescreenpluginsrv/hspsmanager/inc/hspsrominstaller.h
homescreenpluginsrv/hspsmanager/inc/hspsserverutil.h
homescreenpluginsrv/hspsmanager/inc/hspsthemeserver.h
homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp
homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp
homescreenpluginsrv/hspsmanager/src/hspsrominstaller.cpp
homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp
homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp
homescreenpluginsrv/hspsodt/src/hspsodt.cpp
homescreenpluginsrv/hspspluginregistry/src/hspsdefinitionrepository.cpp
homescreenpluginsrv/hspsresource/src/hspsresource.cpp
homescreenpluginsrv/inc/hspsdomattribute.h
homescreenpluginsrv/inc/hspsdomnode.h
homescreenpluginsrv/inc/hspsdomstringpool.h
homescreenpluginsrv/inc/hspsodt.h
homescreenpluginsrv/inc/hspsresource.h
homescreensrv_plat/ai_variation_api/inc/activeidle2domaincrkeys.h
homescreensrv_plat/group/bld.inf
homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahpapplauncher.cpp
homescreensrv_plat/sapi_homescreenplugin/src/hspsconfigurationif.cpp
homescreensrv_plat/sapi_homescreenplugin/tsrc/common/src/mt_hspsteststep.cpp
homescreensrv_plat/sapi_homescreenplugin/tsrc/group/updatetests.cmd
homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hsps_restoreactiveappconf_1.h
homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hsps_restoreactiveappconf_2.h
homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hspsconfigurationif.h
homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp
idlefw/conf/activeidle2.confml
idlefw/conf/activeidle2_10275102.crml
idlefw/plugins/mcsplugin/publisher/inc/mcsplugindata.h
idlefw/plugins/mcsplugin/publisher/inc/mcspluginengine.h
idlefw/plugins/mcsplugin/publisher/src/mcsplugin.cpp
idlefw/plugins/mcsplugin/publisher/src/mcsplugindata.cpp
idlefw/plugins/mcsplugin/publisher/src/mcspluginengine.cpp
idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp
idlefw/plugins/sapidataplugin/group/sapidataplugin.mmp
idlefw/plugins/sapidataplugin/inc/sapidata.h
idlefw/plugins/sapidataplugin/inc/sapidataobserver.h
idlefw/plugins/sapidataplugin/inc/sapidataplugin.h
idlefw/plugins/sapidataplugin/src/sapidata.cpp
idlefw/plugins/sapidataplugin/src/sapidataobserver.cpp
idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp
layers.sysdef.xml
menucontentsrv/group/mcsmenuhandler.mmp
menucontentsrv/handlerinc/menuuninstalloperation.h
menucontentsrv/handlersrc/menuuninstalloperation.cpp
menucontentsrv/srvsrc/menusrvmain.cpp
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h	Mon Mar 15 12:41:53 2010 +0200
@@ -117,7 +117,7 @@
      * @param aFilter filter to compare with
      * @return ETrue if argument matches filter
      */
-    TBool IsProperForFilterL( const CLiwDefaultMap& aMap, 
+    TBool IsProperForFilterL( const CLiwMap& aMap, 
     		const CCPLiwMap& aFilter );
 
     /**
@@ -127,7 +127,7 @@
      * @param aProperty Key of parameter to extract
      * @param aResult Target for value
      */
-    void GetPropertyL( const CLiwDefaultMap& aMap, const TDesC8& aProperty,
+    void GetPropertyL( const CLiwMap& aMap, const TDesC8& aProperty,
         RBuf& aResult );
     
     /**
@@ -137,7 +137,7 @@
      * @param aFilter filter to compare with
      * @return ETrue if ID are identical
      */
-    TBool CheckIdL( const CLiwDefaultMap& aMap, const CCPLiwMap& aFilter );
+    TBool CheckIdL( const CLiwMap& aMap, const CCPLiwMap& aFilter );
     
     /**
      * Checks if Properties like publisher,content type 
@@ -147,7 +147,7 @@
      * @param aFilter filter to compare with
      * @return ETrue if Parameters are identical
      */
-    TBool CheckPropertiesL( const CLiwDefaultMap& aMap, 
+    TBool CheckPropertiesL( const CLiwMap& aMap, 
     		const CCPLiwMap& aFilter );
     
     /**
@@ -157,7 +157,7 @@
      * @param aFilter filter to compare with
      * @return ETrue if operation types are the same
      */
-    TBool CheckOperationTypeL( const CLiwDefaultMap& aMap, 
+    TBool CheckOperationTypeL( const CLiwMap& aMap, 
     		const CCPLiwMap& aFilter );
     
     /**
@@ -167,7 +167,7 @@
      * @param aFilter filter to compare with
      * @return ETrue if registry types are the same
      */ 
-    TBool CheckRegistryTypeL( const CLiwDefaultMap& aMap,
+    TBool CheckRegistryTypeL( const CLiwMap& aMap,
     		const CCPLiwMap& aFilter );
 
 private:
--- a/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserveractionmanager.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/inc/cpserveractionmanager.h	Mon Mar 15 12:41:53 2010 +0200
@@ -26,7 +26,7 @@
 #endif
 class CLiwServiceHandler;
 class MLiwInterface;
-class CLiwDefaultMap;
+class CLiwMap;
 
 /**
  *  Used to execute action using Action Handler Service
@@ -88,10 +88,10 @@
     /**
      * Extracts and adds attributes from aMap to aTarget.
      * @since Series 60 3.2
-     * @param aMap CLiwDefaultMap with action.
+     * @param aMap CLiwMap with action.
      * @param aTarget CLiwGenericParamList with Uid and Map.
      */
-    void ExtractUidAndMapL( const CLiwDefaultMap& aMap,
+    void ExtractUidAndMapL( const CLiwMap& aMap,
         CLiwGenericParamList& aTarget );
 
 private:
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpnotificationhandler.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -26,6 +26,7 @@
 #include "cpglobals.h"
 #include "cpserverdef.h"
 
+using namespace LIW;
 // ======== MEMBER FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
@@ -182,7 +183,7 @@
 // 
 // -----------------------------------------------------------------------------
 //
-TBool CCPNotificationHandler::IsProperForFilterL( const CLiwDefaultMap& aMap, 
+TBool CCPNotificationHandler::IsProperForFilterL( const CLiwMap& aMap, 
 		const CCPLiwMap& aFilter )
     {
     CP_DEBUG( _L8("CCPNotificationHandler::IsProperForFilter()") );
@@ -298,21 +299,25 @@
         {
         
         CLiwDefaultList* listOfMatchingMaps = CLiwDefaultList::NewLC( );
-
+        TInt count = aListOfMaps->Count( );
         //for every item in the input list
-		for ( TInt j = 0; j < aListOfMaps->Count( ); j++ )
+		for ( TInt j = 0; j < count; j++ )
 			{
-			CLiwDefaultMap* map = CLiwDefaultMap::NewLC( );
 	        TLiwVariant variant;
 	        variant.PushL( );
 			aListOfMaps->AtL( j, variant );
-			variant.Get( *map );
-			if ( IsProperForFilterL( *map, **filter ) )
-				{
-				listOfMatchingMaps->AppendL( TLiwVariant( map ) );
-				}
-			CleanupStack::PopAndDestroy( &variant );
-			CleanupStack::PopAndDestroy( map );
+            if ( variant.TypeId() == EVariantTypeMap )
+                {
+                if ( IsProperForFilterL( *variant.AsMap(), **filter ) )
+                    {
+                    listOfMatchingMaps->AppendL( variant );
+                    }
+                else 
+                    {
+                    variant.Reset();
+                    }
+                }
+			CleanupStack::Pop( &variant );
 			}
 		if ( listOfMatchingMaps->Count( ) )
 			{
@@ -339,7 +344,7 @@
 //
 // ----------------------------------------------------------------------------
 //
-void CCPNotificationHandler::GetPropertyL( const CLiwDefaultMap& aMap,
+void CCPNotificationHandler::GetPropertyL( const CLiwMap& aMap,
     const TDesC8& aProperty, RBuf& aResult )
     {
     TLiwVariant value;
@@ -357,7 +362,7 @@
 //
 // ----------------------------------------------------------------------------
 //
-TBool CCPNotificationHandler::CheckIdL( const CLiwDefaultMap& aMap, 
+TBool CCPNotificationHandler::CheckIdL( const CLiwMap& aMap, 
 		const CCPLiwMap& aFilter )
     {
     TBool result = EFalse;
@@ -386,7 +391,7 @@
 //
 // ----------------------------------------------------------------------------
 //
-TBool CCPNotificationHandler::CheckPropertiesL( const CLiwDefaultMap& aMap,
+TBool CCPNotificationHandler::CheckPropertiesL( const CLiwMap& aMap,
 		const CCPLiwMap& aFilter )
     {
     TBool result( EFalse );
@@ -459,7 +464,7 @@
 //
 // ----------------------------------------------------------------------------
 //
-TBool CCPNotificationHandler::CheckOperationTypeL( const CLiwDefaultMap& aMap,
+TBool CCPNotificationHandler::CheckOperationTypeL( const CLiwMap& aMap,
 		const CCPLiwMap& aFilter )
     {
     TBool result = ETrue;
@@ -491,7 +496,7 @@
 //
 // ----------------------------------------------------------------------------
 //
-TBool CCPNotificationHandler::CheckRegistryTypeL( const CLiwDefaultMap& aMap,
+TBool CCPNotificationHandler::CheckRegistryTypeL( const CLiwMap& aMap,
 		const CCPLiwMap& aFilter )
     {
     TBool result = ETrue;
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserver.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -15,7 +15,7 @@
 *
 */
 
-#include <mw/memorymanager.h>
+#include <mw/MemoryManager.h>
 #include <liwcommon.h>
 #include <ecom/ecom.h>
 #include <fbs.h>
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserveractionmanager.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserveractionmanager.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -155,10 +155,7 @@
     param = aList.FindFirst( pos, KListMap, EVariantTypeMap );
     if ( param && pos !=KErrNotFound )
         {
-        CLiwDefaultMap* map = CLiwDefaultMap::NewLC( );
-        param->Value().Get( *map );
-        ExtractUidAndMapL( *map, aTarget );
-        CleanupStack::PopAndDestroy( map );
+        ExtractUidAndMapL( *param->Value().AsMap(), aTarget );
         }
     else
         {
@@ -170,7 +167,7 @@
 // CCPActionManager::ExtractUidAndMapL
 // --------------- --------------------------------------------------------------
 //
-void CCPActionManager::ExtractUidAndMapL( const CLiwDefaultMap& aMap,
+void CCPActionManager::ExtractUidAndMapL( const CLiwMap& aMap,
     CLiwGenericParamList& aTarget )
     {
     CP_DEBUG( _L8("CCPActionManager::ExtractUidAndMapL()") );
@@ -178,21 +175,23 @@
     variant.PushL( );
     if ( aMap.FindL( KActionMap, variant ) )
         {
-        CLiwDefaultMap* map = CLiwDefaultMap::NewLC( );
-        variant.Get( *map );
-        if ( map->FindL( KDataForActionHandler, variant ) )
-            {
-            TLiwGenericParam param( KDataForActionHandler, variant);
-            aTarget.AppendL( param );
-            }
-        if ( map->FindL( KPluginUid, variant ) )
-            {
-            TLiwGenericParam param( KPluginUid, variant);
-            aTarget.AppendL( param );
-            }
-        CleanupStack::PopAndDestroy( map );
+        TLiwVariant valueVariant;
+        valueVariant.PushL( );
+        if ( variant.TypeId() == EVariantTypeMap )
+        	{
+        	if ( variant.AsMap()->FindL( KDataForActionHandler, valueVariant ) )
+        		{
+        		TLiwGenericParam param( KDataForActionHandler, valueVariant);
+        		aTarget.AppendL( param );
+        		}
+        	if ( variant.AsMap()->FindL( KPluginUid, valueVariant ) )
+        		{
+        		TLiwGenericParam param( KPluginUid, valueVariant);
+        		aTarget.AppendL( param );
+        		}
+        	}
+        CleanupStack::PopAndDestroy( &valueVariant );
         }
-
     CleanupStack::PopAndDestroy( &variant );
     }
 
--- a/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -374,15 +374,14 @@
 void CCPDataManager::ExtractActionL( const TLiwGenericParam* aParam, RBuf8& aAction )
     {
     CP_DEBUG( _L8("CCPDataManager::ExtractActionL()") );
-	CLiwDefaultMap* map = CLiwDefaultMap::NewLC( );
-	if ( !aParam->Value().Get( *map ) )
+    if ( aParam->Value().TypeId() != EVariantTypeMap )
 		{
 		User::Leave( KErrArgument );
 		}
 	
 	TLiwVariant variant; variant.PushL( );
 	TPtrC8 tempBuf( KNullDesC8 );
-	if ( map->FindL( KActionMap, variant ) 
+	if ( aParam->Value().AsMap()->FindL( KActionMap, variant ) 
 			&& variant.Get( tempBuf ) )
 		{
 		aAction.CreateL( tempBuf );
@@ -393,7 +392,6 @@
 		}
 	
 	CleanupStack::PopAndDestroy( &variant );
-	CleanupStack::PopAndDestroy( map );
     }
 
 // -----------------------------------------------------------------------------
@@ -437,15 +435,15 @@
         if( pos != KErrNotFound )
        	    {
    	    	TLiwVariant variant = (*outList)[pos].Value();
-		    CLiwDefaultMap *map = CLiwDefaultMap::NewLC();
-   			variant.Get( *map );
-   			if (map->FindL( KFlag, variant ))
-       		    {
-   	    		TUint flag;
-   		    	variant.Get( flag );
-   			   	result = flag & EActivate;
-       			}
-   	    	CleanupStack::PopAndDestroy( map );
+   	        if ( variant.TypeId() == EVariantTypeMap )
+   	        	{
+   	            if (variant.AsMap()->FindL( KFlag, variant ))
+       	            {
+   	    		    TUint flag;
+   		    	    variant.Get( flag );
+   			   	    result = flag & EActivate;
+       			    }
+   	            }
   		    variant.Reset();
    		    }
 	    }
@@ -462,26 +460,26 @@
 		CLiwDefaultList* aChangeInfoList )
 	{
 	TLiwVariant resultVar = aParam->Value();
-	resultVar.PushL();
-	CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC(); 
-	CLiwDefaultMap* resultMap = CLiwDefaultMap::NewLC(); 
-	resultVar.Get( *resultMap );
+	if ( resultVar.TypeId() == EVariantTypeMap )
+        {
+        resultVar.PushL();
+        CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC(); 
 	
-	CopyVariantL(KId, resultMap, changeInfoMap );
-	CopyVariantL(KPublisherId, resultMap, changeInfoMap );
-	CopyVariantL(KContentType, resultMap, changeInfoMap );
-	CopyVariantL(KContentId, resultMap, changeInfoMap );
-	CopyVariantL(KFlag, resultMap, changeInfoMap );
-	CopyVariantL(KType, aMap, changeInfoMap );
-	CopyVariantL(KActionTrigger, aMap, changeInfoMap );
-	CopyActionTrigger16L( aMap, changeInfoMap );
+        CopyVariantL(KId, resultVar.AsMap(), changeInfoMap );
+        CopyVariantL(KPublisherId, resultVar.AsMap(), changeInfoMap );
+        CopyVariantL(KContentType, resultVar.AsMap(), changeInfoMap );
+        CopyVariantL(KContentId, resultVar.AsMap(), changeInfoMap );
+        CopyVariantL(KFlag, resultVar.AsMap(), changeInfoMap );
+        CopyVariantL(KType, aMap, changeInfoMap );
+        CopyVariantL(KActionTrigger, aMap, changeInfoMap );
+        CopyActionTrigger16L( aMap, changeInfoMap );
 	
-	changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) );
+        changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) );
 	
-	aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) );
-	CleanupStack::PopAndDestroy( resultMap );
-	CleanupStack::PopAndDestroy( changeInfoMap );
-	CleanupStack::PopAndDestroy( &resultVar );
+        aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) );
+        CleanupStack::PopAndDestroy( changeInfoMap );
+        CleanupStack::PopAndDestroy( &resultVar );
+        }
 	}
 
 
--- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpliwmap.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingutils/contentpublishingmap/inc/cpliwmap.h	Mon Mar 15 12:41:53 2010 +0200
@@ -112,7 +112,7 @@
      */
     IMPORT_C TBool GetPropertyL( const TDesC8& aProperty,
              RBuf& aResult ) const;
-
+    
     /**
      * Fetches value for property(key) from internal map
      *
@@ -588,6 +588,14 @@
      * @return result of RSqlStatement::ColumnIndex
      */ 
     TInt ColumnIndexL( RSqlStatement& aStmt, const TDesC& aColumnName )	const;
+    
+    /**
+     * Returns ETrue if a property has valid name and type
+     * @param aProperty property name
+     * @return ETrue if property is valid, EFalse if not
+     */ 
+    TBool IsPropertyValidL( const TDesC8& aProperty ) const;
+
 protected:
 
     /**
--- a/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpliwmap.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/contentpublishingsrv/contentpublishingutils/contentpublishingmap/src/cpliwmap.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -20,6 +20,7 @@
 #include <liwgenericparam.h>
 #include <escapeutils.h>
 #include <badesca.h>
+#include <aiwvarianttype.hrh>
 
 #include "cpliwmap.h"
 #include "cpdebug.h"
@@ -737,16 +738,7 @@
 //
 TBool CCPLiwMap::IsPublisherNameL() const
     {
-    TBool result( EFalse );
-    RBuf buffer;
-    buffer.CleanupClosePushL();
-    result = GetPropertyL( KPublisherId, buffer );
-    if( result && buffer.Length() == KErrNone )
-        {
-        User::Leave( KErrArgument );
-        }
-    CleanupStack::PopAndDestroy( &buffer );
-    return result;
+    return IsPropertyValidL( KPublisherId );
     }
 
 // ---------------------------------------------------------------------------
@@ -755,16 +747,7 @@
 //
 TBool CCPLiwMap::IsContentTypeL() const
     {
-    TBool result( EFalse );
-    RBuf buffer;
-    buffer.CleanupClosePushL();
-    result = GetPropertyL( KContentType, buffer );
-    if( result && buffer.Length() == KErrNone )
-        {
-        User::Leave( KErrArgument );
-        }
-    CleanupStack::PopAndDestroy( &buffer );
-    return result;
+    return IsPropertyValidL( KContentType );
     }
 
 // ---------------------------------------------------------------------------
@@ -773,16 +756,7 @@
 //
 TBool CCPLiwMap::IsContentIdL() const
     {
-    TBool result( EFalse );
-    RBuf buffer;
-    buffer.CleanupClosePushL();
-    result = GetPropertyL( KContentId, buffer );
-    if( result && buffer.Length() == KErrNone )
-        {
-        User::Leave( KErrArgument );
-        }
-    CleanupStack::PopAndDestroy( &buffer );
-    return result;
+    return IsPropertyValidL( KContentId );
     }
 
 // ---------------------------------------------------------------------------
@@ -1266,5 +1240,38 @@
     return ret;
     }
 
-
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CCPLiwMap::IsPropertyValidL( const TDesC8& aProperty ) const
+    {
+    CP_DEBUG( _L8("CCPLiwMap::IsPropertyValidL") );
+    TBool found( EFalse );
+    TInt pos( 0 );
+    const TLiwGenericParam* paramForValue = iMap->FindFirst( pos, aProperty );
+    if ( pos != KErrNotFound )
+        {
+        found = ETrue;
+        TInt length;
+        if( paramForValue->Value().TypeId() == EVariantTypeDesC )
+            {
+            length = paramForValue->Value().AsDes().Length(); 
+            }
+        else if ( paramForValue->Value().TypeId() == EVariantTypeDesC8 )
+            {
+            length = paramForValue->Value().AsData().Length();
+            }
+        else
+            {
+            User::Leave( KErrBadName );
+            }
+        
+        if ( length == 0 )
+            {
+            User::Leave( KErrArgument );
+            }
+        }
+    return found;
+    }
     
--- a/group/bld.inf	Fri Mar 12 15:43:54 2010 +0200
+++ b/group/bld.inf	Mon Mar 15 12:41:53 2010 +0200
@@ -27,7 +27,6 @@
 #include "../backsteppingsrv/group/bld.inf"
 #include "../contentpublishingsrv/group/bld.inf"
 #include "../homescreensrv_plat/group/bld.inf"
-#include "../contextutility/group/bld.inf"
 #include "../contentcontrolsrv/group/bld.inf"
 
 
--- a/homescreenpluginsrv/hspsdom/bwins/hspsdomdocumentu.def	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsdom/bwins/hspsdomdocumentu.def	Mon Mar 15 12:41:53 2010 +0200
@@ -26,48 +26,50 @@
 	?SetNodeId@ChspsDomNode@@QAEXH@Z @ 25 NONAME ; void ChspsDomNode::SetNodeId(int)
 	?Item@ChspsDomList@@QBEPAVMhspsDomListItem@@H@Z @ 26 NONAME ; class MhspsDomListItem * ChspsDomList::Item(int) const
 	?ItemIndex@ChspsDomList@@QBEHABVMhspsDomListItem@@@Z @ 27 NONAME ; int ChspsDomList::ItemIndex(class MhspsDomListItem const &) const
-	?NextSibling@ChspsDomDepthIterator@@UAEPAVChspsDomNode@@AAV2@@Z @ 28 NONAME ; class ChspsDomNode * ChspsDomDepthIterator::NextSibling(class ChspsDomNode &)
-	?ValueStringPoolIndex@ChspsDomAttribute@@QBEFXZ @ 29 NONAME ; short ChspsDomAttribute::ValueStringPoolIndex(void) const
-	?CreateElementNSL@ChspsDomDocument@@QAEPAVChspsDomNode@@ABVTDesC8@@0@Z @ 30 NONAME ; class ChspsDomNode * ChspsDomDocument::CreateElementNSL(class TDesC8 const &, class TDesC8 const &)
-	?DeleteChild@ChspsDomNode@@QAEXPAV1@@Z @ 31 NONAME ; void ChspsDomNode::DeleteChild(class ChspsDomNode *)
-	?SetRootNode@ChspsDomDocument@@QAEXPAVChspsDomNode@@@Z @ 32 NONAME ; void ChspsDomDocument::SetRootNode(class ChspsDomNode *)
-	?ContentType@ChspsDomNode@@QAEABW4TContentType@@XZ @ 33 NONAME ; enum TContentType const & ChspsDomNode::ContentType(void)
-	?Namespace@ChspsDomNode@@QAEABVTDesC8@@XZ @ 34 NONAME ; class TDesC8 const & ChspsDomNode::Namespace(void)
-	?CloneL@ChspsDomAttribute@@QAEPAV1@XZ @ 35 NONAME ; class ChspsDomAttribute * ChspsDomAttribute::CloneL(void)
-	?AddChildL@ChspsDomNode@@QAEXPAV1@@Z @ 36 NONAME ; void ChspsDomNode::AddChildL(class ChspsDomNode *)
-	?NewL@ChspsDomDocument@@SAPAV1@XZ @ 37 NONAME ; class ChspsDomDocument * ChspsDomDocument::NewL(void)
-	?IsRefNode@ChspsDomNode@@QBEHXZ @ 38 NONAME ; int ChspsDomNode::IsRefNode(void) const
-	?SetPCDataL@ChspsDomNode@@QAEXABVTDesC8@@@Z @ 39 NONAME ; void ChspsDomNode::SetPCDataL(class TDesC8 const &)
-	?Value@ChspsDomAttribute@@QAEABVTDesC8@@XZ @ 40 NONAME ; class TDesC8 const & ChspsDomAttribute::Value(void)
-	??1ChspsDomDepthIterator@@UAE@XZ @ 41 NONAME ; ChspsDomDepthIterator::~ChspsDomDepthIterator(void)
-	?CreateRefNodeL@ChspsDomNode@@QAEPAV1@XZ @ 42 NONAME ; class ChspsDomNode * ChspsDomNode::CreateRefNodeL(void)
-	?Reset@ChspsDomList@@QAEXXZ @ 43 NONAME ; void ChspsDomList::Reset(void)
-	?StringPool@ChspsDomNode@@QBEAAVChspsDomStringPool@@XZ @ 44 NONAME ; class ChspsDomStringPool & ChspsDomNode::StringPool(void) const
-	?AttributeValue@ChspsDomNode@@QBEABVTDesC8@@ABV2@@Z @ 45 NONAME ; class TDesC8 const & ChspsDomNode::AttributeValue(class TDesC8 const &) const
-	?SetContentType@ChspsDomNode@@QAEXABW4TContentType@@@Z @ 46 NONAME ; void ChspsDomNode::SetContentType(enum TContentType const &)
-	?NextL@ChspsDomDepthIterator@@UAEPAVChspsDomNode@@XZ @ 47 NONAME ; class ChspsDomNode * ChspsDomDepthIterator::NextL(void)
-	?CloneL@ChspsDomDocument@@QAEPAV1@XZ @ 48 NONAME ; class ChspsDomDocument * ChspsDomDocument::CloneL(void)
-	?AttributeList@ChspsDomNode@@QBEAAVChspsDomList@@XZ @ 49 NONAME ; class ChspsDomList & ChspsDomNode::AttributeList(void) const
-	?LastNode@ChspsDomDocument@@QBEPAVChspsDomNode@@XZ @ 50 NONAME ; class ChspsDomNode * ChspsDomDocument::LastNode(void) const
-	??1ChspsDomAttribute@@UAE@XZ @ 51 NONAME ; ChspsDomAttribute::~ChspsDomAttribute(void)
-	?NewL@ChspsDomDocument@@SAPAV1@AAVRReadStream@@@Z @ 52 NONAME ; class ChspsDomDocument * ChspsDomDocument::NewL(class RReadStream &)
-	?SetParent@ChspsDomNode@@QAEXPAV1@@Z @ 53 NONAME ; void ChspsDomNode::SetParent(class ChspsDomNode *)
-	?RootNode@ChspsDomDocument@@QBEPAVChspsDomNode@@XZ @ 54 NONAME ; class ChspsDomNode * ChspsDomDocument::RootNode(void) const
-	?Name@ChspsDomNode@@UAEABVTDesC8@@XZ @ 55 NONAME ; class TDesC8 const & ChspsDomNode::Name(void)
-	?First@ChspsDomList@@QAEPAVMhspsDomListItem@@XZ @ 56 NONAME ; class MhspsDomListItem * ChspsDomList::First(void)
-	?NameStringPoolIndex@ChspsDomAttribute@@QBEFXZ @ 57 NONAME ; short ChspsDomAttribute::NameStringPoolIndex(void) const
-	?Name@ChspsDomAttribute@@UAEABVTDesC8@@XZ @ 58 NONAME ; class TDesC8 const & ChspsDomAttribute::Name(void)
-	?NewL@ChspsDomDocument@@SAPAV1@PBVHBufC8@@@Z @ 59 NONAME ; class ChspsDomDocument * ChspsDomDocument::NewL(class HBufC8 const *)
-	?ReplaceChildL@ChspsDomNode@@QAEXPAV1@0@Z @ 60 NONAME ; void ChspsDomNode::ReplaceChildL(class ChspsDomNode *, class ChspsDomNode *)
-	?AddItemL@ChspsDomList@@QAEXPAVMhspsDomListItem@@@Z @ 61 NONAME ; void ChspsDomList::AddItemL(class MhspsDomListItem *)
-	?AppendPCDataL@ChspsDomNode@@QAEXABVTDesC8@@@Z @ 62 NONAME ; void ChspsDomNode::AppendPCDataL(class TDesC8 const &)
-	?SetRefNode@ChspsDomNode@@QAEXH@Z @ 63 NONAME ; void ChspsDomNode::SetRefNode(int)
-	?AddItemL@ChspsDomList@@QAEXPAVMhspsDomListItem@@H@Z @ 64 NONAME ; void ChspsDomList::AddItemL(class MhspsDomListItem *, int)
-	?Parent@ChspsDomNode@@QBEPAV1@XZ @ 65 NONAME ; class ChspsDomNode * ChspsDomNode::Parent(void) const
-	?StringPool@ChspsDomDocument@@QBEAAVChspsDomStringPool@@XZ @ 66 NONAME ; class ChspsDomStringPool & ChspsDomDocument::StringPool(void) const
-	??1ChspsDomDocument@@UAE@XZ @ 67 NONAME ; ChspsDomDocument::~ChspsDomDocument(void)
-	?CloneL@ChspsDomNode@@QAEPAV1@AAVChspsDomStringPool@@@Z @ 68 NONAME ; class ChspsDomNode * ChspsDomNode::CloneL(class ChspsDomStringPool &)
-	?DeleteItem@ChspsDomList@@QAEXH@Z @ 69 NONAME ; void ChspsDomList::DeleteItem(int)
-	?DescendantCount@ChspsDomNode@@QBEHXZ @ 70 NONAME ; int ChspsDomNode::DescendantCount(void) const
-	?DomNodeCount@ChspsDomDocument@@QBEHXZ @ 71 NONAME ; int ChspsDomDocument::DomNodeCount(void) const
+	?SetValueL@ChspsDomAttribute@@QAEXH@Z @ 28 NONAME ; void ChspsDomAttribute::SetValueL(int)
+	?NextSibling@ChspsDomDepthIterator@@UAEPAVChspsDomNode@@AAV2@@Z @ 29 NONAME ; class ChspsDomNode * ChspsDomDepthIterator::NextSibling(class ChspsDomNode &)
+	?ValueStringPoolIndex@ChspsDomAttribute@@QBEFXZ @ 30 NONAME ; short ChspsDomAttribute::ValueStringPoolIndex(void) const
+	?CreateElementNSL@ChspsDomDocument@@QAEPAVChspsDomNode@@ABVTDesC8@@0@Z @ 31 NONAME ; class ChspsDomNode * ChspsDomDocument::CreateElementNSL(class TDesC8 const &, class TDesC8 const &)
+	?DeleteChild@ChspsDomNode@@QAEXPAV1@@Z @ 32 NONAME ; void ChspsDomNode::DeleteChild(class ChspsDomNode *)
+	?SetRootNode@ChspsDomDocument@@QAEXPAVChspsDomNode@@@Z @ 33 NONAME ; void ChspsDomDocument::SetRootNode(class ChspsDomNode *)
+	?ContentType@ChspsDomNode@@QAEABW4TContentType@@XZ @ 34 NONAME ; enum TContentType const & ChspsDomNode::ContentType(void)
+	?Namespace@ChspsDomNode@@QAEABVTDesC8@@XZ @ 35 NONAME ; class TDesC8 const & ChspsDomNode::Namespace(void)
+	?CloneL@ChspsDomAttribute@@QAEPAV1@XZ @ 36 NONAME ; class ChspsDomAttribute * ChspsDomAttribute::CloneL(void)
+	?AddChildL@ChspsDomNode@@QAEXPAV1@@Z @ 37 NONAME ; void ChspsDomNode::AddChildL(class ChspsDomNode *)
+	?NewL@ChspsDomDocument@@SAPAV1@XZ @ 38 NONAME ; class ChspsDomDocument * ChspsDomDocument::NewL(void)
+	?IsRefNode@ChspsDomNode@@QBEHXZ @ 39 NONAME ; int ChspsDomNode::IsRefNode(void) const
+	?SetPCDataL@ChspsDomNode@@QAEXABVTDesC8@@@Z @ 40 NONAME ; void ChspsDomNode::SetPCDataL(class TDesC8 const &)
+	?Value@ChspsDomAttribute@@QAEABVTDesC8@@XZ @ 41 NONAME ; class TDesC8 const & ChspsDomAttribute::Value(void)
+	??1ChspsDomDepthIterator@@UAE@XZ @ 42 NONAME ; ChspsDomDepthIterator::~ChspsDomDepthIterator(void)
+	?CreateRefNodeL@ChspsDomNode@@QAEPAV1@XZ @ 43 NONAME ; class ChspsDomNode * ChspsDomNode::CreateRefNodeL(void)
+	?Reset@ChspsDomList@@QAEXXZ @ 44 NONAME ; void ChspsDomList::Reset(void)
+	?StringPool@ChspsDomNode@@QBEAAVChspsDomStringPool@@XZ @ 45 NONAME ; class ChspsDomStringPool & ChspsDomNode::StringPool(void) const
+	?AttributeValue@ChspsDomNode@@QBEABVTDesC8@@ABV2@@Z @ 46 NONAME ; class TDesC8 const & ChspsDomNode::AttributeValue(class TDesC8 const &) const
+	?SetContentType@ChspsDomNode@@QAEXABW4TContentType@@@Z @ 47 NONAME ; void ChspsDomNode::SetContentType(enum TContentType const &)
+	?NextL@ChspsDomDepthIterator@@UAEPAVChspsDomNode@@XZ @ 48 NONAME ; class ChspsDomNode * ChspsDomDepthIterator::NextL(void)
+	?CloneL@ChspsDomDocument@@QAEPAV1@XZ @ 49 NONAME ; class ChspsDomDocument * ChspsDomDocument::CloneL(void)
+	?AttributeList@ChspsDomNode@@QBEAAVChspsDomList@@XZ @ 50 NONAME ; class ChspsDomList & ChspsDomNode::AttributeList(void) const
+	?LastNode@ChspsDomDocument@@QBEPAVChspsDomNode@@XZ @ 51 NONAME ; class ChspsDomNode * ChspsDomDocument::LastNode(void) const
+	??1ChspsDomAttribute@@UAE@XZ @ 52 NONAME ; ChspsDomAttribute::~ChspsDomAttribute(void)
+	?NewL@ChspsDomDocument@@SAPAV1@AAVRReadStream@@@Z @ 53 NONAME ; class ChspsDomDocument * ChspsDomDocument::NewL(class RReadStream &)
+	?NewL@ChspsDomAttribute@@SAPAV1@HAAVChspsDomStringPool@@@Z @ 54 NONAME ; class ChspsDomAttribute * ChspsDomAttribute::NewL(int, class ChspsDomStringPool &)
+	?SetParent@ChspsDomNode@@QAEXPAV1@@Z @ 55 NONAME ; void ChspsDomNode::SetParent(class ChspsDomNode *)
+	?RootNode@ChspsDomDocument@@QBEPAVChspsDomNode@@XZ @ 56 NONAME ; class ChspsDomNode * ChspsDomDocument::RootNode(void) const
+	?Name@ChspsDomNode@@UAEABVTDesC8@@XZ @ 57 NONAME ; class TDesC8 const & ChspsDomNode::Name(void)
+	?First@ChspsDomList@@QAEPAVMhspsDomListItem@@XZ @ 58 NONAME ; class MhspsDomListItem * ChspsDomList::First(void)
+	?NameStringPoolIndex@ChspsDomAttribute@@QBEFXZ @ 59 NONAME ; short ChspsDomAttribute::NameStringPoolIndex(void) const
+	?CloneL@ChspsDomNode@@QAEPAV1@AAVChspsDomStringPool@@H@Z @ 60 NONAME ; class ChspsDomNode * ChspsDomNode::CloneL(class ChspsDomStringPool &, int)
+	?Name@ChspsDomAttribute@@UAEABVTDesC8@@XZ @ 61 NONAME ; class TDesC8 const & ChspsDomAttribute::Name(void)
+	?NewL@ChspsDomDocument@@SAPAV1@PBVHBufC8@@@Z @ 62 NONAME ; class ChspsDomDocument * ChspsDomDocument::NewL(class HBufC8 const *)
+	?ReplaceChildL@ChspsDomNode@@QAEXPAV1@0@Z @ 63 NONAME ; void ChspsDomNode::ReplaceChildL(class ChspsDomNode *, class ChspsDomNode *)
+	?AddItemL@ChspsDomList@@QAEXPAVMhspsDomListItem@@@Z @ 64 NONAME ; void ChspsDomList::AddItemL(class MhspsDomListItem *)
+	?AppendPCDataL@ChspsDomNode@@QAEXABVTDesC8@@@Z @ 65 NONAME ; void ChspsDomNode::AppendPCDataL(class TDesC8 const &)
+	?SetRefNode@ChspsDomNode@@QAEXH@Z @ 66 NONAME ; void ChspsDomNode::SetRefNode(int)
+	?AddItemL@ChspsDomList@@QAEXPAVMhspsDomListItem@@H@Z @ 67 NONAME ; void ChspsDomList::AddItemL(class MhspsDomListItem *, int)
+	?Parent@ChspsDomNode@@QBEPAV1@XZ @ 68 NONAME ; class ChspsDomNode * ChspsDomNode::Parent(void) const
+	?StringPool@ChspsDomDocument@@QBEAAVChspsDomStringPool@@XZ @ 69 NONAME ; class ChspsDomStringPool & ChspsDomDocument::StringPool(void) const
+	??1ChspsDomDocument@@UAE@XZ @ 70 NONAME ; ChspsDomDocument::~ChspsDomDocument(void)
+	?DeleteItem@ChspsDomList@@QAEXH@Z @ 71 NONAME ; void ChspsDomList::DeleteItem(int)
+	?DescendantCount@ChspsDomNode@@QBEHXZ @ 72 NONAME ; int ChspsDomNode::DescendantCount(void) const
+	?DomNodeCount@ChspsDomDocument@@QBEHXZ @ 73 NONAME ; int ChspsDomDocument::DomNodeCount(void) const
 
--- a/homescreenpluginsrv/hspsdom/eabi/hspsdomdocumentu.def	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsdom/eabi/hspsdomdocumentu.def	Mon Mar 15 12:41:53 2010 +0200
@@ -22,7 +22,7 @@
 	_ZN12ChspsDomNode14SetContentTypeERK12TContentType @ 21 NONAME
 	_ZN12ChspsDomNode17CloneWithoutKidsLER18ChspsDomStringPool @ 22 NONAME
 	_ZN12ChspsDomNode4NameEv @ 23 NONAME
-	_ZN12ChspsDomNode6CloneLER18ChspsDomStringPool @ 24 NONAME
+	_ZN12ChspsDomNode6CloneLER18ChspsDomStringPooli @ 24 NONAME
 	_ZN12ChspsDomNode6PCDataEv @ 25 NONAME
 	_ZN12ChspsDomNode9AddChildLEPS_ @ 26 NONAME
 	_ZN12ChspsDomNode9AddChildLEPS_i @ 27 NONAME
@@ -42,59 +42,61 @@
 	_ZN16ChspsDomDocumentD2Ev @ 41 NONAME
 	_ZN17ChspsDomAttribute4NameEv @ 42 NONAME
 	_ZN17ChspsDomAttribute4NewLERK6TDesC8R18ChspsDomStringPool @ 43 NONAME
-	_ZN17ChspsDomAttribute5ValueEv @ 44 NONAME
-	_ZN17ChspsDomAttribute6CloneLEv @ 45 NONAME
-	_ZN17ChspsDomAttribute9SetValueLERK6TDesC8 @ 46 NONAME
-	_ZN17ChspsDomAttributeD0Ev @ 47 NONAME
-	_ZN17ChspsDomAttributeD1Ev @ 48 NONAME
-	_ZN17ChspsDomAttributeD2Ev @ 49 NONAME
-	_ZN18ChspsDomStringPool10AddStringLERK6TDesC8 @ 50 NONAME
-	_ZN21ChspsDomDepthIterator11NextSiblingER12ChspsDomNode @ 51 NONAME
-	_ZN21ChspsDomDepthIterator4NewLER12ChspsDomNode @ 52 NONAME
-	_ZN21ChspsDomDepthIterator5FirstEv @ 53 NONAME
-	_ZN21ChspsDomDepthIterator5NextLEv @ 54 NONAME
-	_ZN21ChspsDomDepthIteratorD0Ev @ 55 NONAME
-	_ZN21ChspsDomDepthIteratorD1Ev @ 56 NONAME
-	_ZN21ChspsDomDepthIteratorD2Ev @ 57 NONAME
-	_ZNK12ChspsDomList10StringPoolEv @ 58 NONAME
-	_ZNK12ChspsDomList4ItemEi @ 59 NONAME
-	_ZNK12ChspsDomList6LengthEv @ 60 NONAME
-	_ZNK12ChspsDomList9ItemIndexERK16MhspsDomListItem @ 61 NONAME
-	_ZNK12ChspsDomNode10StringPoolEv @ 62 NONAME
-	_ZNK12ChspsDomNode13AttributeListEv @ 63 NONAME
-	_ZNK12ChspsDomNode14AttributeValueERK6TDesC8 @ 64 NONAME
-	_ZNK12ChspsDomNode15DescendantCountEv @ 65 NONAME
-	_ZNK12ChspsDomNode6NodeIdEv @ 66 NONAME
-	_ZNK12ChspsDomNode6ParentEv @ 67 NONAME
-	_ZNK12ChspsDomNode9IsRefNodeEv @ 68 NONAME
-	_ZNK12ChspsDomNode9ItemIndexERK16MhspsDomListItem @ 69 NONAME
-	_ZNK16ChspsDomDocument10StringPoolEv @ 70 NONAME
-	_ZNK16ChspsDomDocument12DomNodeCountEv @ 71 NONAME
-	_ZNK16ChspsDomDocument12ExternalizeLER12RWriteStream @ 72 NONAME
-	_ZNK16ChspsDomDocument4SizeEv @ 73 NONAME
-	_ZNK16ChspsDomDocument8LastNodeEv @ 74 NONAME
-	_ZNK16ChspsDomDocument8RootNodeEv @ 75 NONAME
-	_ZNK17ChspsDomAttribute19NameStringPoolIndexEv @ 76 NONAME
-	_ZNK17ChspsDomAttribute20ValueStringPoolIndexEv @ 77 NONAME
-	_ZTI12ChspsDomList @ 78 NONAME
-	_ZTI12ChspsDomNode @ 79 NONAME
-	_ZTI16ChspsDomDocument @ 80 NONAME
-	_ZTI17ChspsDomAttribute @ 81 NONAME
-	_ZTI18ChspsDomStringPool @ 82 NONAME
-	_ZTI21ChspsDomDepthIterator @ 83 NONAME
-	_ZTV12ChspsDomList @ 84 NONAME
-	_ZTV12ChspsDomNode @ 85 NONAME
-	_ZTV16ChspsDomDocument @ 86 NONAME
-	_ZTV17ChspsDomAttribute @ 87 NONAME
-	_ZTV18ChspsDomStringPool @ 88 NONAME
-	_ZTV21ChspsDomDepthIterator @ 89 NONAME
-	_ZThn4_N12ChspsDomNode4NameEv @ 90 NONAME
-	_ZThn4_N17ChspsDomAttribute4NameEv @ 91 NONAME
-	_ZThn4_N17ChspsDomAttributeD0Ev @ 92 NONAME
-	_ZThn4_N17ChspsDomAttributeD1Ev @ 93 NONAME
-	_ZThn4_N21ChspsDomDepthIterator11NextSiblingER12ChspsDomNode @ 94 NONAME
-	_ZThn4_N21ChspsDomDepthIterator5FirstEv @ 95 NONAME
-	_ZThn4_N21ChspsDomDepthIterator5NextLEv @ 96 NONAME
-	_ZThn4_N21ChspsDomDepthIteratorD0Ev @ 97 NONAME
-	_ZThn4_N21ChspsDomDepthIteratorD1Ev @ 98 NONAME
+	_ZN17ChspsDomAttribute4NewLEiR18ChspsDomStringPool @ 44 NONAME
+	_ZN17ChspsDomAttribute5ValueEv @ 45 NONAME
+	_ZN17ChspsDomAttribute6CloneLEv @ 46 NONAME
+	_ZN17ChspsDomAttribute9SetValueLERK6TDesC8 @ 47 NONAME
+	_ZN17ChspsDomAttribute9SetValueLEi @ 48 NONAME
+	_ZN17ChspsDomAttributeD0Ev @ 49 NONAME
+	_ZN17ChspsDomAttributeD1Ev @ 50 NONAME
+	_ZN17ChspsDomAttributeD2Ev @ 51 NONAME
+	_ZN18ChspsDomStringPool10AddStringLERK6TDesC8 @ 52 NONAME
+	_ZN21ChspsDomDepthIterator11NextSiblingER12ChspsDomNode @ 53 NONAME
+	_ZN21ChspsDomDepthIterator4NewLER12ChspsDomNode @ 54 NONAME
+	_ZN21ChspsDomDepthIterator5FirstEv @ 55 NONAME
+	_ZN21ChspsDomDepthIterator5NextLEv @ 56 NONAME
+	_ZN21ChspsDomDepthIteratorD0Ev @ 57 NONAME
+	_ZN21ChspsDomDepthIteratorD1Ev @ 58 NONAME
+	_ZN21ChspsDomDepthIteratorD2Ev @ 59 NONAME
+	_ZNK12ChspsDomList10StringPoolEv @ 60 NONAME
+	_ZNK12ChspsDomList4ItemEi @ 61 NONAME
+	_ZNK12ChspsDomList6LengthEv @ 62 NONAME
+	_ZNK12ChspsDomList9ItemIndexERK16MhspsDomListItem @ 63 NONAME
+	_ZNK12ChspsDomNode10StringPoolEv @ 64 NONAME
+	_ZNK12ChspsDomNode13AttributeListEv @ 65 NONAME
+	_ZNK12ChspsDomNode14AttributeValueERK6TDesC8 @ 66 NONAME
+	_ZNK12ChspsDomNode15DescendantCountEv @ 67 NONAME
+	_ZNK12ChspsDomNode6NodeIdEv @ 68 NONAME
+	_ZNK12ChspsDomNode6ParentEv @ 69 NONAME
+	_ZNK12ChspsDomNode9IsRefNodeEv @ 70 NONAME
+	_ZNK12ChspsDomNode9ItemIndexERK16MhspsDomListItem @ 71 NONAME
+	_ZNK16ChspsDomDocument10StringPoolEv @ 72 NONAME
+	_ZNK16ChspsDomDocument12DomNodeCountEv @ 73 NONAME
+	_ZNK16ChspsDomDocument12ExternalizeLER12RWriteStream @ 74 NONAME
+	_ZNK16ChspsDomDocument4SizeEv @ 75 NONAME
+	_ZNK16ChspsDomDocument8LastNodeEv @ 76 NONAME
+	_ZNK16ChspsDomDocument8RootNodeEv @ 77 NONAME
+	_ZNK17ChspsDomAttribute19NameStringPoolIndexEv @ 78 NONAME
+	_ZNK17ChspsDomAttribute20ValueStringPoolIndexEv @ 79 NONAME
+	_ZTI12ChspsDomList @ 80 NONAME
+	_ZTI12ChspsDomNode @ 81 NONAME
+	_ZTI16ChspsDomDocument @ 82 NONAME
+	_ZTI17ChspsDomAttribute @ 83 NONAME
+	_ZTI18ChspsDomStringPool @ 84 NONAME
+	_ZTI21ChspsDomDepthIterator @ 85 NONAME
+	_ZTV12ChspsDomList @ 86 NONAME
+	_ZTV12ChspsDomNode @ 87 NONAME
+	_ZTV16ChspsDomDocument @ 88 NONAME
+	_ZTV17ChspsDomAttribute @ 89 NONAME
+	_ZTV18ChspsDomStringPool @ 90 NONAME
+	_ZTV21ChspsDomDepthIterator @ 91 NONAME
+	_ZThn4_N12ChspsDomNode4NameEv @ 92 NONAME
+	_ZThn4_N17ChspsDomAttribute4NameEv @ 93 NONAME
+	_ZThn4_N17ChspsDomAttributeD0Ev @ 94 NONAME
+	_ZThn4_N17ChspsDomAttributeD1Ev @ 95 NONAME
+	_ZThn4_N21ChspsDomDepthIterator11NextSiblingER12ChspsDomNode @ 96 NONAME
+	_ZThn4_N21ChspsDomDepthIterator5FirstEv @ 97 NONAME
+	_ZThn4_N21ChspsDomDepthIterator5NextLEv @ 98 NONAME
+	_ZThn4_N21ChspsDomDepthIteratorD0Ev @ 99 NONAME
+	_ZThn4_N21ChspsDomDepthIteratorD1Ev @ 100 NONAME
 
--- a/homescreenpluginsrv/hspsdom/src/hspsdomattribute.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsdom/src/hspsdomattribute.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -35,7 +35,6 @@
     {
     }
 
-
 // -----------------------------------------------------------------------------
 // ChspsDomAttribute::ConstructL
 // Symbian 2nd phase constructor can leave.
@@ -45,6 +44,17 @@
     {
     iNameRef = iStringPool.AddStringL( aName );
     }
+
+// -----------------------------------------------------------------------------
+// ChspsDomAttribute::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void ChspsDomAttribute::ConstructL( const TInt aName )
+    {
+    iNameRef = aName;
+    }
+
 // -----------------------------------------------------------------------------
 // ChspsDomAttribute::NewL
 // Two-phased constructor.
@@ -63,6 +73,23 @@
     return self;
     }    
 
+// -----------------------------------------------------------------------------
+// ChspsDomAttribute::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C ChspsDomAttribute* ChspsDomAttribute::NewL( 
+        const TInt aName,
+        ChspsDomStringPool& aStringPool )
+    {
+    ChspsDomAttribute* self = new( ELeave ) ChspsDomAttribute( aStringPool );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    CleanupStack::Pop( self );
+
+    return self;
+    } 
 
 // -----------------------------------------------------------------------------
 // ChspsDomAttribute::NewL
@@ -106,18 +133,38 @@
 // ChspsDomAttribute::CloneL
 // -----------------------------------------------------------------------------
 //
-ChspsDomAttribute* ChspsDomAttribute::CloneL( ChspsDomStringPool& aStringPool )
-    {
-    const TDesC8& name = iStringPool.String( iNameRef );
+ChspsDomAttribute* ChspsDomAttribute::CloneL( ChspsDomStringPool& aStringPool,
+                                              const TBool aFastClone )
+    {        
+    ChspsDomAttribute* clone = NULL;
     
-    ChspsDomAttribute* clone = ChspsDomAttribute::NewL( name, aStringPool );
+    if( aFastClone )
+        {
+        clone = ChspsDomAttribute::NewL( iNameRef, aStringPool );
+        }
+    else
+        {    
+        const TDesC8& name = iStringPool.String( iNameRef );
+        clone = ChspsDomAttribute::NewL( name, aStringPool );
+        }
+    
     CleanupStack::PushL( clone );
+    
     if ( iValueRef > KErrNotFound )
         {
-        const TDesC8& value = iStringPool.String( iValueRef );
-        clone->SetValueL( value );
+        if( aFastClone )
+            {
+            clone->SetValueL( iValueRef );
+            }
+        else
+            {
+            const TDesC8& value = iStringPool.String( iValueRef );
+            clone->SetValueL( value );
+            }
         }
+    
     CleanupStack::Pop( clone );    
+    
     return clone;
     
     }
@@ -169,6 +216,14 @@
     iValueRef = iStringPool.AddStringL( aValue );
     }
 
+// -----------------------------------------------------------------------------
+// ChspsDomAttribute::SetValueL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void ChspsDomAttribute::SetValueL( const TInt aValue )
+    {
+    iValueRef = aValue;
+    }
    
 // -----------------------------------------------------------------------------
 // ChspsDomAttribute::Size
--- a/homescreenpluginsrv/hspsdom/src/hspsdomdocument.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsdom/src/hspsdomdocument.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -38,7 +38,7 @@
     clone->iDomStringPool = iDomStringPool->CloneL();
     if ( iRootNode )
         {
-        clone->iRootNode = iRootNode->CloneL( *clone->iDomStringPool );
+        clone->iRootNode = iRootNode->CloneL( *clone->iDomStringPool, ETrue );
         }
     
     CleanupStack::Pop( clone );
@@ -101,6 +101,7 @@
     ChspsDomDocument* self = new( ELeave ) ChspsDomDocument;
     
     CleanupStack::PushL( self );
+    self->ConstructL();
     aStream >> *self;
     CleanupStack::Pop(self);
 
@@ -174,13 +175,9 @@
 //
 EXPORT_C void ChspsDomDocument::InternalizeL( RReadStream& aStream )
     {
-    if(iDomStringPool)
-        {
-        delete iDomStringPool;
-        iDomStringPool = NULL;    
-        }
-    iDomStringPool = ChspsDomStringPool::NewL( aStream );
-        
+    iDomStringPool->Reset();
+    iDomStringPool->InternalizeL( aStream );    
+    
     if ( iRootNode )
         {
         delete iRootNode;
--- a/homescreenpluginsrv/hspsdom/src/hspsdomnode.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsdom/src/hspsdomnode.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -54,7 +54,29 @@
     {
     iNameRef = iStringPool.AddStringL( aName );
     iNSRef = iStringPool.AddStringL( aNS );
-    
+    Construct2L();
+    }
+
+// -----------------------------------------------------------------------------
+// ChspsDomNode::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void ChspsDomNode::ConstructL(
+    const TInt aName,
+    const TInt aNS )
+    {
+    iNameRef = aName;
+    iNSRef = aNS;
+    Construct2L();
+    }
+
+// -----------------------------------------------------------------------------
+// ChspsDomNode::Construct2L 
+// -----------------------------------------------------------------------------
+//
+void ChspsDomNode::Construct2L()
+    {
     iChildList = ChspsDomList::NewL( ChspsDomList::ENodeList, iStringPool );
     iAttributeList = ChspsDomList::NewL( ChspsDomList::EAttributeList, iStringPool );
     }
@@ -80,6 +102,25 @@
 
 // -----------------------------------------------------------------------------
 // ChspsDomNode::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+ChspsDomNode* ChspsDomNode::NewL(
+    const TInt aName,
+    const TInt aNS, 
+    ChspsDomStringPool& aStringPool )
+    {
+    ChspsDomNode* self = new( ELeave ) ChspsDomNode( aStringPool );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aName, aNS );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// ChspsDomNode::NewL
 // Two-phased stream constructor.
 // -----------------------------------------------------------------------------
 //
@@ -109,26 +150,38 @@
 // Clones this node and it's child nodes. This is a recursive function.
 // -----------------------------------------------------------------------------
 //
-EXPORT_C ChspsDomNode* ChspsDomNode::CloneL( ChspsDomStringPool& aStringPool )
+EXPORT_C ChspsDomNode* ChspsDomNode::CloneL( ChspsDomStringPool& aStringPool,
+                                             const TBool aFastClone )
     {
-    const TDesC8& name = iStringPool.String( iNameRef );
-    const TDesC8& ns = iStringPool.String( iNSRef );
+    ChspsDomNode* clone = NULL;
     
-    ChspsDomNode*  clone = ChspsDomNode::NewL( name, ns, aStringPool );
+    if( aFastClone )
+        {
+        clone = ChspsDomNode::NewL( iNameRef, iNSRef, aStringPool );
+        }
+    else
+        {
+        const TDesC8& name = iStringPool.String( iNameRef );
+        const TDesC8& ns = iStringPool.String( iNSRef );        
+        clone = ChspsDomNode::NewL( name, ns, aStringPool );
+        }
+
     CleanupStack::PushL( clone );
+
     if ( iPCData )
         {
         clone->AppendPCDataL( *iPCData );
         }
+    
     clone->iNodeId = iNodeId;
     clone->iRefNode = iRefNode;
     
     TInt childCount( iChildList->Length() );
    
-    for ( TInt i=0; i<childCount; i++ )
+    for( TInt i = 0; i < childCount; i++ )
         {
         ChspsDomNode* childClone = 
-            static_cast<ChspsDomNode*>( iChildList->Item(i) )->CloneL( aStringPool );
+            static_cast<ChspsDomNode*>( iChildList->Item(i) )->CloneL( aStringPool, aFastClone );
         CleanupStack::PushL( childClone );
         childClone->iParentNode = clone;
         clone->iChildList->AddItemL( childClone );
@@ -136,10 +189,10 @@
         }
     
     TInt attrCount( iAttributeList->Length() );
-    for ( TInt j=0; j<attrCount; j++ )
+    for( TInt j = 0; j < attrCount; j++ )
         {
         ChspsDomAttribute* attrClone = 
-            static_cast<ChspsDomAttribute*>( iAttributeList->Item(j) )->CloneL( aStringPool );
+            static_cast<ChspsDomAttribute*>( iAttributeList->Item(j) )->CloneL( aStringPool, aFastClone );
         CleanupStack::PushL( attrClone );
         clone->iAttributeList->AddItemL( attrClone );
         CleanupStack::Pop( attrClone );
@@ -490,8 +543,7 @@
 // -----------------------------------------------------------------------------
 //
 void ChspsDomNode::ExternalizeL( RWriteStream& aStream ) const
-    {
-    
+    {    
     aStream.WriteInt16L( iNameRef );
     aStream.WriteInt16L( iNSRef );
     aStream.WriteInt8L( iRefNode );
--- a/homescreenpluginsrv/hspsdom/src/hspsdomstringpool.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsdom/src/hspsdomstringpool.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -117,6 +117,23 @@
     }
 
 // -----------------------------------------------------------------------------
+// ChspsDomStringPool::Reset
+// -----------------------------------------------------------------------------
+//
+void ChspsDomStringPool::Reset()
+    {    
+    if( iStringPool.Count() > 0 )
+        {
+        iStringPool.ResetAndDestroy();        
+        }
+    
+    if( iStringPoolOptimizer.Count() > 0 )
+        {
+        iStringPoolOptimizer.Reset();
+        }
+    }
+
+// -----------------------------------------------------------------------------
 // ChspsDomStringPool::AddStringL
 // -----------------------------------------------------------------------------
 //
--- a/homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsinstallationhandler.h	Mon Mar 15 12:41:53 2010 +0200
@@ -239,6 +239,14 @@
         ThspsServiceCompletedMessage hspsInstallTheme( 
                 const TDesC& aManifestFileName, 
                 TDes8& aHeaderData );
+        
+        /**
+         * Parses the manifest file and requests installation of next phases.
+         * @since S60 5.2
+         * @param aManifest is full path of the installation script file - a manifest file
+         */
+        void DoInstallThemeL(
+                const TDesC& aManifest );
                         
         /**
         * From MhspsInstallationService hspsInstallNextPhaseL
@@ -640,24 +648,7 @@
                 HBufC8& aValue8, 
                 const TDesC8& aTag,
                 HBufC*& aResultString );
-        
-        /**
-         * Enabler for customization where the input is
-         * searched from all unremovable drives (eclipsing).
-         * Drives are searched in descending alphabetical order, 
-         * from Y: to A:, and ending with the Z: drive. 
-         * All drives which end-user can freely modify/crack 
-         * are skipped from the search.         
-         * @since S60 5.2
-         * @param aPath Path to the resource file (input)
-         * @param aFilename Name and extension of the file (input)
-         * @param aDrivePathName Full path with a drive letter to the 
-         *                       resource file (output)
-         */
-        void FindFile(                
-                const TDesC& aPath,
-                const TDesC& aFilename,
-                TFileName& aDrivePathName );
+                
     public: 
         
         ChspsResult* iResult;
@@ -710,7 +701,7 @@
         TBool iDefaultSpecificationSet;
                        
         // Path to installation files
-        TPtrC iThemeFilePath;
+        TPath iThemeFilePath;
         
         // Application or interface UID of the installed theme
         TUint iRootUid;
@@ -787,8 +778,8 @@
         // Set if "EhspsODTAdded" -notifications should be blocked (e.g. ROM installations)
         TBool iDisableNotifications;
 
-        // Set if installation files are located in ROM
-        TBool iRomInstallation;
+        // Set if installation files are located in ROM or in UDA, validation is not required
+        TBool iTrustedInstallation;
         
         // Set if widget mutliinstance flag
         TInt32 iMultiInstance;
--- a/homescreenpluginsrv/hspsmanager/inc/hspsrominstaller.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsrominstaller.h	Mon Mar 15 12:41:53 2010 +0200
@@ -77,22 +77,6 @@
         virtual ~ChspsRomInstaller();
       
     public: // New functions
-           
-        /**         
-         * Finds plugin_*.dat and app_*.dat files from Z\private\200159C0\install
-         * File names are stored into iImportsArrayV1 member array
-         * @since S60 5.0
-         */
-        void FindImportsV1L();                
-                                                
-        /**
-         * Imports.
-         * Returns a reference to the imports list, which is maintained by the class.
-         * Contents of the list is set in FindImportsL() function.
-         * @since S60 5.0
-         * @return an array of *.DAT files which were found from the ROM drive.
-         */
-        const RPointerArray<HBufC>& ImportsV1();
         
         /**
          * InstallTheme
@@ -118,10 +102,11 @@
                 const TInt aConfigurationUid );
         
         /**         
-         * Gets names of the folders which should be installed from Z\private\200159C0\install
+         * Retrieves manifest files from both Z and C drives located in
+         * \\private\200159C0\install\ paths.
          * @since S60 5.0
          */
-        void GetInstallationFoldersL(  
+        void FindInstallationFilesL(  
                 RPointerArray<HBufC>& aFolders );
         
 #ifdef HSPS_LOG_ACTIVE        
@@ -175,18 +160,21 @@
         * @since S60 5.0
         */
         void ConstructL();           
+                        
+        void DoFindInstallationFilesL(  
+                RPointerArray<HBufC>& aFolders,
+                const TDesC& aPath );
         
         /**
-         * SetImportsFilterL.
-         * Finds specific imports ("plugin_*.dat"/"app_*.dat" files) from ROM drive's 
-         * import folder. Search results are appended into iImportsArray member.
-         * @since S60 5.0
-         * @param aFileFilter is a filter for finding the imports
-         * @param 
-         * @return ETrue if files were found and added into the array
+         * Finds an installation file from a directory structure 
+         * which has UID in hex format as folder name.
+         * @since S60 5.2
+         * @param aConfigurationUid Configuration to be found
+         * @param aManifest Found manifest file
          */
-        TBool SetImportsFilterL(      
-                const TDesC& aFileFilter );
+        void FindInstallationFileL(  
+                const TInt aConfigurationUid,
+                TFileName& aManifest );
         
     private: // Data    
     	               
@@ -199,10 +187,7 @@
         ChspsInstallationHandler* iInstallationHandler;
         
         // Required by the installation process
-        TBuf8<KMaxHeaderDataLength8> iHeaderData;
-        
-        // An array of found *.DAT files
-        RPointerArray<HBufC> iImportsArrayV1;                              
+        TBuf8<KMaxHeaderDataLength8> iHeaderData;                                    
         
         // Results of the previous installation 
         ThspsServiceCompletedMessage iRet;
--- a/homescreenpluginsrv/hspsmanager/inc/hspsserverutil.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsserverutil.h	Mon Mar 15 12:41:53 2010 +0200
@@ -523,6 +523,26 @@
                         const TDesC8& aNodeTag,
                         ChspsDomNode& aDomNode );	
         
+	    /**	     
+         * Eclipsing enabler for customization where the input is 
+         * searched from all secure unremovable drives. 
+         * Drives are searched in descending alphabetical order, 
+         * from Y: to A:, and ending with the Z: drive. 
+         * All drives which end-user can freely modify/crack 
+         * are skipped from the search.         
+         * @since S60 5.2
+	     * @param aFs is a reference to open file server session handle
+	     * @param aPath is path of the file
+	     * @param aFilename is name and extension of the file
+	     * @param aDrivePathName Full path with a drive letter to the 
+         *                       resource file (output)
+	     */
+	    static TInt FindFile(
+	             RFs& aFs,
+	             const TDesC& aPath,
+	             const TDesC& aFilename,         
+	             TFileName& aDrivePathName );
+	    
 	private:
         /**
          * Internal method. Do not call directly!
--- a/homescreenpluginsrv/hspsmanager/inc/hspsthemeserver.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/inc/hspsthemeserver.h	Mon Mar 15 12:41:53 2010 +0200
@@ -808,21 +808,11 @@
     void HandleRomInstallationsL();
     
     /**
-     * Executes installation of manifest files from the ROM drive.
+     * Installs widgets located at \private\200159C0\install\ directories.
      * @since S60 5.0 
      */
-    void InstallManifestsFromRomDriveL();
-                                
-    /**
-     * V2 method for finding manifest files from Z\private\200159C0\install subfolders,
-     * these folders should have a "hsps" subfolder.
-     * Appends iManifestFiles array. 
-     * @since S60 5.0     
-     * @param aPluginFolders holds names of the plugin folders which are V2 based
-     */
-    void FindRomInstallationsV2L(        
-        RPointerArray<HBufC>& aPluginFolders );
-    
+    void InstallWidgetsL();
+                                        
     /**
      * Initiates uninstallation of a manifest file located under the imports folder.
      * @since S60 5.0
--- a/homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/src/hspsinstallationhandler.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -56,6 +56,7 @@
 _LIT8(KhspsDefinitionEngine, "hspsdefinitionengine");
 
 _LIT(KPathDelim, "\\");
+_LIT(KPrivateInstall, "\\private\\200159c0\\install\\");
 _LIT(KHsps, "\\hsps\\" );
 _LIT(KXuikon, "xuikon\\" );
 
@@ -99,7 +100,7 @@
     iDefaultSpecificationSet = EFalse;
     iDefaultSpecification = ELangNone;
     iInstallationMode = EServiceHandler;
-    iRomInstallation = EFalse;
+    iTrustedInstallation = EFalse;
 	iInstallationType = EInstallationTypeNew;
 	iFamilyMask = 0;
     }
@@ -297,9 +298,11 @@
 // -----------------------------------------------------------------------------
 void ChspsInstallationHandler::ResetL()
     {
+    iThemeFilePath.FillZ();    
     iFamilyMask = 0;
     iInstallationPhase = EhspsPhaseInitialise;    
-    iThemeStatus = EhspsThemeStatusNone;  
+    iThemeStatus = EhspsThemeStatusNone;
+    iTrustedInstallation = EFalse;
     iFileNotFound = EFalse;
     delete iMediaType;
     iMediaType = NULL;
@@ -357,97 +360,21 @@
         TDes8& aHeaderData)
     {
     // Assume that the installation fails
-    ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed;           
-    iResult->iXuikonError = KErrManifestFileCorrupted;
-        
-    // Reset memeber variables
-    TInt errorCode = KErrNone;
-    TRAP( errorCode, ResetL() );
-    if ( !errorCode )
-        {        
-        // Get manifest file path
-        iThemeFilePath.Set( TParsePtrC( aManifestFileName ).DriveAndPath() );
-        // Check if ROM installation is requested
-        iRomInstallation = EFalse;
-        TParse driveParser;
-        driveParser.Set( iThemeFilePath, NULL, NULL );
-        TInt driveNumber;
-        if ( RFs::CharToDrive( driveParser.Drive()[0], driveNumber ) == KErrNone )
-            {
-            if ( driveNumber == EDriveZ )
-                {
-                iRomInstallation = ETrue;
-                }
-            }
-            
-#ifdef HSPS_LOG_ACTIVE    
-        if ( iLogBus )
-            {            
-            iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme() - *** Parsing a manifest file:" ) );
-            }
-#endif       
-        if( BaflUtils::FileExists( iFsSession, aManifestFileName ) )
-             {
-             // Parse XML from the manifest file
-             TRAP( errorCode, Xml::ParseL( *iXmlParser, iFsSession, aManifestFileName ));     
-             }        
-        else
-            {
-#ifdef HSPS_LOG_ACTIVE    
-            if ( iLogBus )
-                {           
-                iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme() - Manifest was not found!" ) );
-                }
-#endif            
-            iFileNotFound = ETrue;
-            errorCode = KErrNotFound;
-            }
+    ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed;                       
+    iResult->iXuikonError = 0;    
+    iResult->iIntValue2 = 0;
+    
+    TRAPD( err, DoInstallThemeL(aManifestFileName) );
+    if( !err )
+        {
+        // correct headerdata is in iHeaderData set by CheckHeaderL()
+        aHeaderData = iHeaderData->Des();        
+                   
+        // Set next phase
+        iInstallationPhase = EhspsPhaseCleanup;
+        ret = EhspsInstallThemeSuccess;
         }
-        
-    if ( !errorCode && !iFileNotFound )
-        {        
-        // The manifest file has been read at this point and following callbacks have been executed:
-        // (unless the manifest was invalid): OnContent, OnStartElement, OnEndElement
-
-        // Detect installation type.
-        // Performance optimization: do not check if installing from rom.
-        if( !iRomInstallation )
-            {
-            // Check type of installation
-            TBool instancesFound = EFalse;
-            TRAP( errorCode, instancesFound = IsPluginUsedInAppConfsL() );            
-            if( iThemeServer.PluginInHeaderCache( TUid::Uid( iThemeUid ) ) && instancesFound )                    
-                {
-                // Plugin should be found from cache, update notifications are
-                // sent only when plugins are used by one/more app configurations
-                iInstallationType = EInstallationTypeUpdate;
-                }
-            else
-                {
-                iInstallationType = EInstallationTypeNew;
-                }
-            }                
-        if ( !errorCode )
-            {
-            // Check the manifest        
-            TRAP( errorCode, ValidateL() );
-            }
-        if ( !errorCode )
-            {
-            // correct headerdata is in iHeaderData set by CheckHeaderL()
-            aHeaderData = iHeaderData->Des();
-            
-            ret = EhspsInstallThemeSuccess;
-               
-            // Set next phase
-            iInstallationPhase = EhspsPhaseCleanup;
-           
-            // number of all resources to iResult
-            iResult->iIntValue2 = 0;
-            }
-        }
-
-    if ( errorCode )
+    else
         {     
 #ifdef HSPS_LOG_ACTIVE  
         if( iLogBus )
@@ -455,11 +382,87 @@
             iLogBus->LogText( _L( "ChspsInstallationHandler::hspsInstallTheme(): - Installation failed with error code %d" ),
                     errorCode );
             }
-#endif              
+#endif       
         }
+        
+    iResult->iSystemError = err;
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// ChspsInstallationHandler::DoInstallThemeL()
+// -----------------------------------------------------------------------------
+void ChspsInstallationHandler::DoInstallThemeL(
+        const TDesC& aManifest )
+    {        
+    // Reset memeber variables    
+    ResetL();
+        
+    TParsePtrC parsePtr( aManifest );        
+                
+    // Store the path to the installation file     
+    __ASSERT_DEBUG( aManifest.Length() < KMaxFileName, User::Leave( KErrBadName ) );
+    iThemeFilePath.Copy( parsePtr.DriveAndPath() );    
+        
+    // If trying to install widgets from one of our private install directories
+    const TPath path = parsePtr.Path();
+    if( path.Length() > KPrivateInstall().Length() 
+            && path.Left( KPrivateInstall().Length() ) == KPrivateInstall() ) 
+        {                    
+        // Check if ROM or UDA installation was requested
+        if( parsePtr.DrivePresent() )
+            {            
+            TInt driveNumber;
+            if ( RFs::CharToDrive( parsePtr.Drive()[0], driveNumber ) == KErrNone )
+                {
+                iTrustedInstallation = ( driveNumber == EDriveZ || driveNumber == EDriveC );                
+                }
+            }
+        }    
+            
+    if( !BaflUtils::FileExists( iFsSession, aManifest ) )
+        {
+#ifdef HSPS_LOG_ACTIVE    
+        if ( iLogBus )
+            {           
+            iLogBus->LogText( _L( "ChspsInstallationHandler::DoInstallThemeL() - *** Manifest was not found!" ) );
+            }
+#endif    
+        User::Leave( KErrNotFound );
+        }
+       
+#ifdef HSPS_LOG_ACTIVE    
+    if ( iLogBus )
+        {            
+        iLogBus->LogText( _L( "ChspsInstallationHandler::DoInstallThemeL() - *** Parsing a manifest file" ) );
+        }
+#endif       
     
-    iResult->iSystemError = errorCode;
-    return ret;
+    // Parse XML from the manifest file
+    Xml::ParseL( *iXmlParser, iFsSession, aManifest );    
+                    
+    // The manifest file has been read at this point and following callbacks have been executed:
+    // OnContent(), OnStartElement() and OnEndElement()
+    
+    // Performance optimization: do not check if installing from rom.
+    if( !iTrustedInstallation )
+        {
+        // Check type of installation        
+        TBool instancesFound = IsPluginUsedInAppConfsL();            
+        if( iThemeServer.PluginInHeaderCache( TUid::Uid( iThemeUid ) ) && instancesFound )                    
+            {
+            // Plugin should be found from cache, update notifications are
+            // sent only when plugins are used by one/more app configurations
+            iInstallationType = EInstallationTypeUpdate;
+            }
+        else
+            {
+            iInstallationType = EInstallationTypeNew;
+            }
+        }                
+        
+    // Check the parsed input        
+    ValidateL();                    
     }
 
 // -----------------------------------------------------------------------------
@@ -489,7 +492,8 @@
 // -----------------------------------------------------------------------------
 //
 void ChspsInstallationHandler::ValidateL()
-    {                                    
+    {               
+    // Check resources
     TFileName interfacePath( GetInterfacePath() );       
     if ( interfacePath.Length() )        
        {
@@ -513,7 +517,7 @@
        AddLocalesL( iThemeFilePath );                       
        }       
           
-   // Validate input from the manifest
+   // Validate other input from the manifest
    CheckHeaderL();
            
    if ( iSecurityEnforcer.CheckThemeLockingL( *iOdt ) )
@@ -747,7 +751,7 @@
             _L8( "0" ) );
         }
 
-    if ( iRomInstallation )
+    if ( iTrustedInstallation )
         {
         // Update configuration state to KConfStateConfirmed
         hspsServerUtil::SetAttributeValueL( 
@@ -1739,54 +1743,7 @@
         iMultiInstance = KMultiInstanceDefaultValue;
         }
     }
- 
- // -----------------------------------------------------------------------------
- // ChspsInstallationHandler::FindFile
- // Eclipsing support for customization 
- // -----------------------------------------------------------------------------
- //
- void ChspsInstallationHandler::FindFile(
-         const TDesC& aPath,
-         const TDesC& aFilename,         
-         TFileName& aDrivePathName )
-     {                   
-     TParsePtrC parser( aPath );
-     const TPath path = parser.Path();              
-               
-     // Find the input file, search from the user area (UDA) first, 
-     // exclude external/remote drives from the search - otherwise end-users  
-     // could introduce fixed configurations (e.g. operator locks wouldn't work)
-     TFindFile fileFinder( iFsSession );
-     fileFinder.SetFindMask( 
-         KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
-     iFsSession.SetSessionToPrivate( EDriveZ );
-     TInt err = fileFinder.FindByDir( aFilename, path );
-     iFsSession.SetSessionToPrivate( EDriveC );
-     if( !err )          
-         {         
-         // Return the path with a drive reference 
-         aDrivePathName = fileFinder.File();        
-         TParsePtrC drvParser( aDrivePathName );
-         if( !drvParser.DrivePresent() )
-             {             
-             err = KErrNotFound;
-             }
-         }
-     
-     if( err )
-         {
-         // Not found from C nor Z drives
-#ifdef HSPS_LOG_ACTIVE  
-         if( iLogBus )
-             {
-             iLogBus->LogText( 
-                     _L( "ChspsInstallationHandler::FindFile(): - couldnt' find file '%S'" ),
-                     &aDrivePathName );
-             }
-    #endif
-         }
-     }
- 
+  
 // -----------------------------------------------------------------------------
 // Parsing of the manifest elements.
 // -----------------------------------------------------------------------------
@@ -1987,10 +1944,11 @@
             HBufC* nameBuf = CnvUtfConverter::ConvertToUnicodeFromUtf8L( *iContent );                        
             // Find full path to the file 
             TFileName fullName;
-            FindFile( 
-                iThemeFilePath, 
-                nameBuf->Des(),
-                fullName );
+            hspsServerUtil::FindFile(
+                    iFsSession,                    
+                    iThemeFilePath, 
+                    nameBuf->Des(),
+                    fullName );
             delete nameBuf;
             nameBuf = NULL;
             if( !fullName.Length() )
--- a/homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/src/hspsmaintenancehandler.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -4580,14 +4580,15 @@
     ChspsODT& aOdt)
     {
     
+    // If active application configuration is LicenceeRestorable 
     if ( aHeader->Flags() & EhspsThemeStatusLicenceeRestorable )
         {
-        // Licensee restorable configuration active -> Reinstall configuration
+        // Reinstall the configuration from ROM
         iThemeServer.ReinstallConfL( aHeader->RootUid(), aHeader->ThemeUid() );
         }
     else
         {
-        // Get licensee restorable configuation
+        // Try to activate a configuation with the LicenceeRestorable status
         ChspsODT* searchMask = ChspsODT::NewL();
         CleanupStack::PushL( searchMask );
         searchMask->SetRootUid( aHeader->RootUid() );
--- a/homescreenpluginsrv/hspsmanager/src/hspsrominstaller.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/src/hspsrominstaller.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -27,8 +27,14 @@
 #include "hspsclientrequesthandler.h"
 #include "hspsserverutil.h"
 
-_LIT( KInstallDirectoryZ, "z:\\private\\200159c0\\install\\" );
-_LIT( KHsps, "hsps");
+_LIT(KPrivateInstallZ, "Z:\\private\\200159c0\\install\\");
+_LIT(KPrivateInstallC, "C:\\private\\200159c0\\install\\");
+_LIT(KMaskAllFiles, "*");
+_LIT(KBackslash, "\\");
+_LIT(KHsps, "hsps");
+_LIT(KTestLanguage, "00");
+_LIT(KManifest, "manifest.dat");
+
 
 // ========================= MEMBER FUNCTIONS ==================================
 
@@ -95,108 +101,147 @@
 ChspsRomInstaller::~ChspsRomInstaller()
     {            
     Cancel(); // Causes call to DoCancel()    
-    delete iInstallationHandler; 
-    iImportsArrayV1.ResetAndDestroy();    
+    delete iInstallationHandler;         
     }
 
 // -----------------------------------------------------------------------------
-// ChspsRomInstaller::SetImportsFilterL()
+// ChspsRomInstaller::FindInstallationFilesL()
 // -----------------------------------------------------------------------------
 //
-TBool ChspsRomInstaller::SetImportsFilterL(      
-        const TDesC& aFileFilter )                        
+void ChspsRomInstaller::FindInstallationFilesL(  
+        RPointerArray<HBufC>& aFolders )
     {
-    TFindFile fileFinder( iFsSession );
-    CDir* fileList( NULL );
-    fileFinder.FindWildByDir( aFileFilter, KInstallDirectoryZ, fileList );
-    if ( fileList )
-        {
-        CleanupStack::PushL( fileList );
-                
-        TFileName sourceName;               
-        for( TInt i = 0; i < fileList->Count(); i++ )       
-            {
-            const TEntry& entry = (*fileList)[i];                        
-            sourceName.Copy( KInstallDirectoryZ );          
-            sourceName.Append( entry.iName );                   
-            iImportsArrayV1.AppendL( sourceName.AllocL() );            
-            }
-        
-        CleanupStack::PopAndDestroy( fileList );
-        fileList = NULL;
-        }
-           
-    return EFalse;
+    __ASSERT_DEBUG( aFolders.Count() == 0, User::Leave( KErrArgument ) );
+    
+    DoFindInstallationFilesL( aFolders, KPrivateInstallC );    
+    DoFindInstallationFilesL( aFolders, KPrivateInstallZ );    
     }
 
 // -----------------------------------------------------------------------------
-// ChspsRomInstaller::GetInstallationFoldersL()
+// ChspsRomInstaller::DoFindInstallationFilesL()
 // -----------------------------------------------------------------------------
 //
-void ChspsRomInstaller::GetInstallationFoldersL(  
-        RPointerArray<HBufC>& aFolders )
-    {
-    aFolders.ResetAndDestroy();
-    
-    _LIT(KAllFolders, "*");    
-    _LIT(KFolderSuffix, "\\");
-    CDir* fileList( NULL );    
+void ChspsRomInstaller::DoFindInstallationFilesL(  
+        RPointerArray<HBufC>& aFolders,
+        const TDesC& aPath )
+    {               
     TFindFile fileFinder( iFsSession );    
-    fileFinder.FindWildByDir( KAllFolders, KInstallDirectoryZ, fileList );        
-    if ( fileList )
+    fileFinder.SetFindMask( 
+         KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
+    CDir* dirList( NULL );             
+    fileFinder.FindWildByDir( KMaskAllFiles, aPath, dirList );
+    if ( dirList )
         {
-        CleanupStack::PushL( fileList );
-        
-        TFileName sourceName;
-        TBool verChecked = EFalse;
-        for( TInt i = 0; i < fileList->Count(); i++ )       
+        CleanupStack::PushL( dirList );
+                     
+        const TInt count = dirList->Count();
+        const TInt KMaxEntryLength = KMaxFileName - 50; 
+        for( TInt i = 0; i < count; i++ )
             {
-            const TEntry& entry = (*fileList)[i];                        
-            if ( entry.IsDir() )
-                {                                  
-                const TEntry& entry = (*fileList)[i];                        
-                sourceName.Copy( KInstallDirectoryZ );          
-                sourceName.Append( entry.iName );
-                sourceName.Append( KFolderSuffix );
+            const TEntry& dirEntry = (*dirList)[i];                        
+            if ( dirEntry.IsDir() )
+                {
+                // Populate path for the manifest file
+                const TEntry& folderEntry = (*dirList)[i];
 
-                if ( !verChecked )
+                // Check for length of the directory name
+                if( dirEntry.iName.Length() > KMaxEntryLength ) 
                     {
-                    // Check whether the V2 directory structure is available
-                    TFileName nameV2;
-                    nameV2.Copy( sourceName );                    
-                    nameV2.Append( KHsps );
-                    nameV2.Append( KFolderSuffix );
-                    if( !BaflUtils::FolderExists( iFsSession, nameV2 ) )
-                        {
-                        CleanupStack::PopAndDestroy( fileList );
-                        return;            
-                        }
-                    verChecked = ETrue;
+                    // Skip plugins which have too long name
+                    continue;
                     }
                 
-                aFolders.AppendL( sourceName.AllocL() );                    
+                TFileName manifest( aPath );
+                manifest.Append( dirEntry.iName );
+                manifest.Append( KBackslash );
+                manifest.Append( KHsps );
+                manifest.Append( KBackslash );
+                manifest.Append( KTestLanguage );
+                manifest.Append( KBackslash );
+                manifest.Append( KManifest );
+                
+                // Check for duplicates
+                TBool isShadowed = EFalse;
+                TParsePtrC manifestPtr( manifest );                
+                for( TInt i=0; i < aFolders.Count(); i++ )
+                    {
+                    TParsePtrC ptr( aFolders[i]->Des() );
+                    if( ptr.Path() == manifestPtr.Path() )
+                        {
+                        isShadowed = ETrue;
+                        break;
+                        }
+                    }
+                
+                if( !isShadowed )
+                    {
+                    // Append the drive information (C or Z)
+                    TFileName driveIncluded;
+                    hspsServerUtil::FindFile(
+                            iFsSession,
+                            manifest,
+                            KNullDesC,
+                            driveIncluded );
+                    if( driveIncluded.Length() )
+                        {                        
+                        HBufC* nameBuf = driveIncluded.AllocLC();                
+                        aFolders.AppendL( nameBuf );
+                        CleanupStack::Pop( nameBuf );
+                        }
+                    }
                 }
             }
         
-        CleanupStack::PopAndDestroy( fileList );
-        fileList = NULL;
-        }            
-    }
-
-void ChspsRomInstaller::FindImportsV1L()
-    {
-    iImportsArrayV1.ResetAndDestroy();
-    SetImportsFilterL( KFilterAllPluginImportsV1 );            
-    SetImportsFilterL( KFilterAllAppImportsV1 );
+        CleanupStack::PopAndDestroy( dirList );
+        dirList = 0;
+        }           
     }
 
 // -----------------------------------------------------------------------------
-// ChspsRomInstaller::ImportsV1
+// ChspsRomInstaller::FindInstallationFileL
 // -----------------------------------------------------------------------------
 //
-const RPointerArray<HBufC>& ChspsRomInstaller::ImportsV1()
-    {
-    return iImportsArrayV1;
+void ChspsRomInstaller::FindInstallationFileL(  
+        const TInt aConfigurationUid,
+        TFileName& aManifest )
+    {                                
+    aManifest.FillZ();
+    
+    _LIT(KFormat, "*_%X");    
+    TFileName fileMask;
+    fileMask.Format( KFormat, aConfigurationUid );
+                            
+    TFindFile fileFinder( iFsSession );
+    CDir* dirList( NULL );           
+    fileFinder.FindWildByDir( fileMask, KPrivateInstallZ, dirList );
+    if ( !dirList )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    CleanupStack::PushL( dirList );                
+
+    const TInt count = dirList->Count();        
+    for( TInt i = 0; i < count; i++ )
+        {        
+        const TEntry& dirEntry = (*dirList)[i];                        
+        if ( dirEntry.IsDir() )
+            {
+            // Populate path for the manifest file
+            const TEntry& folderEntry = (*dirList)[i];
+                        
+            aManifest.Copy( KPrivateInstallZ );
+            aManifest.Append( dirEntry.iName );
+            aManifest.Append( KBackslash );
+            aManifest.Append( KHsps );
+            aManifest.Append( KBackslash );
+            aManifest.Append( KTestLanguage );
+            aManifest.Append( KBackslash );
+            aManifest.Append( KManifest );
+            break;
+            }
+        }            
+    CleanupStack::PopAndDestroy( dirList );               
     }
 
 // -----------------------------------------------------------------------------
@@ -228,52 +273,44 @@
 ThspsServiceCompletedMessage ChspsRomInstaller::ReinstallThemeL(
         const TInt aAppUid,
         const TInt aConfigurationUid )
-    {    
+    {                 
+    __ASSERT_DEBUG( aAppUid > 0 && aConfigurationUid > 0, User::Leave( KErrArgument ) );                 
+    
     ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed;
     
-    iImportsArrayV1.ResetAndDestroy();
-    
-    if ( aAppUid > 0 && aConfigurationUid > 0 )
-        {
-        // Setup a filter for finding a specific import
-        _LIT(KFormat, "app_%X_*_%X_1.0.dat");    
-        HBufC* filter = HBufC::NewLC( KMaxFileName );
-        filter->Des().AppendFormat( KFormat, aAppUid, aConfigurationUid );                        
-        SetImportsFilterL( *filter );        
-        CleanupStack::PopAndDestroy( filter );
-        
-        // There should be only one import matching the UIDs
-        if ( iImportsArrayV1.Count() == 1 )
-            {           
-            // Get path for a manifest from the import's file name
-            HBufC* manifestBuf = iThemeServer.GetManifestFromImportLC( 
-                    iImportsArrayV1[0]->Des(),
-                    KInstallDirectoryZ );
-            if ( manifestBuf )
-                {         
-                // Sync request
-                ret = InstallThemeL( manifestBuf->Des() );
-                CleanupStack::PopAndDestroy( manifestBuf );
-                }
+    // Find an installation file from the ROM
+    TFileName manifest;
+    FindInstallationFileL( 
+        aConfigurationUid,
+        manifest );                           
+    if ( manifest.Length() > 0 )
+        {                                
+        // Install the plugin configuration (sync request)
+        ret = InstallThemeL( manifest );                
+        }        
+    if( ret == EhspsInstallThemeSuccess )
+        {                          
+        // The installed application configuration should now hold only plugin references,
+        // in addition it hasn't been updated to the header cache        
+        iThemeServer.UpdateHeaderListCacheL();
+                        
+        // Complete reinstallation of the application configuration
+        ChspsODT* odt = ChspsODT::NewL();
+        CleanupStack::PushL( odt );
+        User::LeaveIfError( iThemeServer.GetConfigurationL( aAppUid, aConfigurationUid, *odt ) );               
+        if ( odt->ConfigurationType() == EhspsAppConfiguration )
+            {    
+            ChspsClientRequestHandler* clientReqHandler = ChspsClientRequestHandler::NewL( iThemeServer );
+            CleanupStack::PushL( clientReqHandler );
+            
+            // Append configurations from referred plugins to the application configuration's DOM
+            clientReqHandler->HandlePluginReferencesL( *odt );
+            
+            CleanupStack::PopAndDestroy( clientReqHandler );
             }
-        
-        iImportsArrayV1.ResetAndDestroy();
+        CleanupStack::PopAndDestroy( odt );
         }
     
-    // Complete application configuration reinstallation
-    ChspsODT* odt = ChspsODT::NewL();
-    CleanupStack::PushL( odt );
-    User::LeaveIfError( iThemeServer.GetConfigurationL( aAppUid, aConfigurationUid, *odt ) );
-    if ( odt->ConfigurationType() == EhspsAppConfiguration )
-        {
-        // Add plugin configurations to the application configuration
-        ChspsClientRequestHandler* clientReqHandler = ChspsClientRequestHandler::NewL( iThemeServer );
-        CleanupStack::PushL( clientReqHandler );
-        clientReqHandler->HandlePluginReferencesL( *odt );
-        CleanupStack::PopAndDestroy( clientReqHandler );
-        }
-    CleanupStack::PopAndDestroy( odt );
-    
     return ret;
     }
 
--- a/homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -1842,6 +1842,56 @@
     CleanupStack::PopAndDestroy( iter );
     return targetNode;
     } 
+
+
+// -----------------------------------------------------------------------------
+ // hspsServerUtil::FindFile
+ // Eclipsing support for customization 
+ // -----------------------------------------------------------------------------
+ //
+ TInt hspsServerUtil::FindFile(
+         RFs& aFs,
+         const TDesC& aPath,
+         const TDesC& aFilename,         
+         TFileName& aDrivePathName )
+     {   
+     TInt err = KErrNotFound;
+     
+     TParsePtrC parser( aPath );
+     const TPath path = parser.Path();
+          
+     TFileName filename( aFilename );         
+     if( filename.Length() == 0 )
+         {
+         filename.Copy( parser.NameAndExt() );
+         }
+     
+     if( filename.Length() > 0 && path.Length() > 0 )
+         {              
+         // Find the input file, search from the user area (UDA) first, 
+         // exclude external/remote drives from the search - otherwise end-users  
+         // could introduce fixed configurations (e.g. operator locks wouldn't work)
+         TFindFile fileFinder( aFs );
+         fileFinder.SetFindMask( 
+             KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted );
+         aFs.SetSessionToPrivate( EDriveE );
+         err = fileFinder.FindByDir( filename, path );
+         aFs.SetSessionToPrivate( EDriveC );     
+         if( !err )          
+             {         
+             // Return the path with a drive reference 
+             aDrivePathName = fileFinder.File();        
+             TParsePtrC drvParser( aDrivePathName );
+             if( !drvParser.DrivePresent() )
+                 {             
+                 err = KErrNotFound;
+                 }
+             }
+         }
+              
+     return err;
+     }
+
 // -----------------------------------------------------------------------------
 // hspsServerUtil::hspsServerUtil
 // -----------------------------------------------------------------------------
--- a/homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsmanager/src/hspsthemeserver.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -19,7 +19,7 @@
 #define __INCLUDE_CAPABILITY_NAMES__
 
 // INCLUDE FILES
-#include <mw/memorymanager.h>
+#include <mw/MemoryManager.h>
 #include <centralrepository.h>
 #include <f32file.h>
 #include <bautils.h>
@@ -2269,6 +2269,7 @@
 		ChspsODT& aOdt )
 	{		  			
 	TBool localized = ETrue;
+	iFsSession.SetSessionToPrivate( EDriveC );
 	
 	TLanguage requestedLanguage = DeviceLanguage();
 	if ( requestedLanguage == ELangNone )
@@ -2635,12 +2636,12 @@
             
             //install
             TRAPD( err, installer->InstallConfigurationL( *manifestBuf ) );
-#ifdef HSPS_LOG_ACTIVE            
             if ( err != KErrNone )
                 {
-                iLogBus->LogText( _L( "ChspsThemeServer::InstallUDAWidgetsL(): - Installation failed" ) );
+#ifdef HSPS_LOG_ACTIVE                            
+                iLogBus->LogText( _L( "ChspsThemeServer::InstallUDAWidgetsL(): - Installation failed" ) );                
+#endif
                 }
-#endif
             CleanupStack::PopAndDestroy( manifestBuf );
             }
         CleanupStack::PopAndDestroy( installer );
@@ -2681,10 +2682,10 @@
     if( ( errorCode == KErrNone ) &&
         ( fwVersion.Length() == 0 ) )
         {
-        // Install manifest files from ROM
-        InstallManifestsFromRomDriveL();
+        // Install widgets from \private\200159C0\install\ directories (ROM and UDA image)
+        InstallWidgetsL();
 
-        // install widgets from UDA image
+        // Install widgets from \private\200159C0\imports\ directory (UDA image)
         InstallUDAWidgetsL();
         
         // Post RFS installations have been done, prevent re-installations at next startup
@@ -2719,7 +2720,7 @@
             {
             // Phone software has been updated.
             CreateBackupDataL();
-            InstallManifestsFromRomDriveL();
+            InstallWidgetsL();
             RestoreApplicationConfigurationsL();
             // Save new firmware version to cenrep
             if ( errorCode == KErrNone )
@@ -2762,70 +2763,57 @@
     }
 
 // -----------------------------------------------------------------------------
-// ChspsThemeServer::InstallManifestsFromRomDriveL()
+// ChspsThemeServer::InstallWidgetsL()
 // -----------------------------------------------------------------------------
 //
-void ChspsThemeServer::InstallManifestsFromRomDriveL()
-	{							
-	if ( iRomInstaller || iManifestFiles.Count() )
-	    {
-	    // Invalid usage
-	    User::Leave( KErrGeneral );
-	    }	
+void ChspsThemeServer::InstallWidgetsL()
+    {    
+    __ASSERT_DEBUG( !iRomInstaller, User::Leave( KErrGeneral) );	
 	iRomInstaller = ChspsRomInstaller::NewL( *this, iFsSession );	
 #ifdef HSPS_LOG_ACTIVE            	
 	iRomInstaller->SetLogBus( iLogBus );
 #endif
-	
-	// An array for installation files with V2 directory structure
+		
 	RPointerArray<HBufC> pluginFolders;
     CleanupClosePushL( pluginFolders );				
 	        
-    // Retrieve an array of folder names 
-    iRomInstaller->GetInstallationFoldersL( pluginFolders );  
-		
-    // Add manifest files from the subfolders
-    FindRomInstallationsV2L( pluginFolders );
-    
-    pluginFolders.ResetAndDestroy();
-        
-    if ( iManifestFiles.Count() < 1 )
-        {
+    // Find UDA and ROM widgets to be installed     
+    iRomInstaller->FindInstallationFilesL( pluginFolders );
+            
+	// Install the manifest files    
+    for( TInt index=0; index < pluginFolders.Count(); index++ )
+        {         
+        TPtrC namePtr( pluginFolders[index]->Des() );                               
 #ifdef HSPS_LOG_ACTIVE            
-        iLogBus->LogText( _L( "ChspsThemeServer::InstallManifestsFromRomDriveL(): - mandatory plugins were not found from the ROM drive!" ) );
-#endif                                  
-        // Mandatory plugins were missing from the ROM drive
-        User::Leave( KErrGeneral );
-        }
-    
-	CleanupStack::PopAndDestroy( 1, &pluginFolders );
-	
-	
-	// Install configurations from the manifest files 
-    ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed;
-    for( TInt manifestIndex=0; manifestIndex < iManifestFiles.Count(); manifestIndex++ )
-        {                               
-        // Synchronous API call 
-        TPtr name( iManifestFiles[manifestIndex]->Des() );
-#ifdef HSPS_LOG_ACTIVE            
-        iLogBus->LogText( _L( "ChspsThemeServer::InstallManifestsFromRomDriveL(): - installing ROM configuration from: %S" ), &name );
+        iLogBus->LogText( _L( "ChspsThemeServer::InstallWidgetsL(): - installing configuration: %S" ), &namePtr );
 #endif      
-        ret = iRomInstaller->InstallThemeL( name  );
+                
+        // Synchronous method
+        ThspsServiceCompletedMessage ret = iRomInstaller->InstallThemeL( namePtr  );
         if ( ret != EhspsInstallThemeSuccess )
             {
 #ifdef HSPS_LOG_ACTIVE            
-            iLogBus->LogText( _L( "ChspsThemeServer::InstallManifestsFromRomDriveL(): - configuration is corrupted, critical error - shutting down!" ) );
+            iLogBus->LogText( _L( "ChspsThemeServer::InstallWidgetsL(): - installation failed: %S" ), &namePtr );
 #endif                  
 //            User::Leave( KErrAbort );
             }
         }
+    
+    if ( pluginFolders.Count() == 0 )
+        {
+#ifdef HSPS_LOG_ACTIVE            
+        iLogBus->LogText( _L( "ChspsThemeServer::InstallWidgetsL(): - mandatory plugins were not found!" ) );
+#endif                                  
+        // Mandatory plugins were missing 
+        User::Leave( KErrCorrupt );
+        }
         
-    // Cancel any actions done in the previous functionality
-    iManifestFiles.ResetAndDestroy();
+    pluginFolders.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( 1, &pluginFolders );
 		
 	// The ROM installer is not needed anymore and therefore it can be released
 	delete iRomInstaller;
-	iRomInstaller = NULL;
+	iRomInstaller = 0;
 	
 	// Force updating of the header cache
     ThspsRepositoryInfo info( EhspsCacheUpdate );
@@ -2833,34 +2821,6 @@
 	}
 
 // -----------------------------------------------------------------------------
-// ChspsThemeServer::FindRomInstallationsV2L()
-// -----------------------------------------------------------------------------
-//
-void ChspsThemeServer::FindRomInstallationsV2L(        
-        RPointerArray<HBufC>& aPluginFolders )
-    {    
-    _LIT(KHspsFolder, "hsps\\");
-    TFileName hspsPath;
-    for( TInt folderIndex=0; folderIndex < aPluginFolders.Count(); folderIndex++ )
-        {
-        // Set path
-        hspsPath.Copy( aPluginFolders[folderIndex]->Des() );
-        hspsPath.Append( KHspsFolder );        
-                        
-        // Add full path into the installation queue
-        TInt len = hspsPath.Length() + 3 + KDoubleBackSlash().Length() + KManifestFile().Length();
-        HBufC* manifestBuf = HBufC::NewLC( len );        
-        manifestBuf->Des().Copy( hspsPath );
-        manifestBuf->Des().Append( _L("00") );                        
-        manifestBuf->Des().Append( KDoubleBackSlash );
-        manifestBuf->Des().Append( KManifestFile );        
-                
-        iManifestFiles.AppendL( manifestBuf );                
-        CleanupStack::Pop( manifestBuf );                       
-        }
-    }
-
-// -----------------------------------------------------------------------------
 // ChspsThemeServer::GetConfigurationHeader()
 // -----------------------------------------------------------------------------
 //
--- a/homescreenpluginsrv/hspsodt/src/hspsodt.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsodt/src/hspsodt.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -15,7 +15,6 @@
 *
 */
 
-
 #include "hspsodt.h"
 #include <s32strm.h>
 #include <s32mem.h>
@@ -23,9 +22,6 @@
 #include "hspsdomdocument.h"
 #include "hspsresource.h"
 
-/* Literal delim is used in separation of theme header and and other data in ODT-streaming. */
-_LIT(KDelim, "#");
-
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -148,20 +144,16 @@
 // -----------------------------------------------------------------------------    
 EXPORT_C HBufC8* ChspsODT::MarshalHeaderL() const
     {
-    CBufFlat* buf = CBufFlat::NewL( KMaxHeaderDataLength8 );
-    CleanupStack::PushL( buf );
-    RBufWriteStream stream( *buf );     //stream over the buffer
-    CleanupClosePushL( stream );
+    HBufC8* buf = HBufC8::NewLC( HeaderSize() );
+    TPtr8 ptr = buf->Des();
+    RDesWriteStream stream( ptr );
+    stream.PushL();
     ExternalizeHeaderL( stream );
-    CleanupStack::PopAndDestroy( &stream );
+    stream.Pop();
+    stream.Close();
+    CleanupStack::Pop( buf );
     
-    //Create a heap descriptor from the buffer
-    HBufC8* des = HBufC8::NewL( buf->Size() );
-    TPtr8 ptr( des->Des() );
-    buf->Read( 0, ptr, buf->Size() );
-    CleanupStack::PopAndDestroy( buf );
-    
-    return des;
+    return buf;
     }
 
 // -----------------------------------------------------------------------------
@@ -188,7 +180,6 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void ChspsODT::UnMarshalHeaderL( const TDesC8& aStreamData )
     {
-
     RDesReadStream stream( aStreamData );
     CleanupClosePushL( stream );
     InternalizeHeaderL( stream );
@@ -215,9 +206,8 @@
 EXPORT_C void ChspsODT::InternalizeL( RReadStream& aStream )
     {
     InternalizeHeaderL( aStream );
-    // consumes header delimiter
-    aStream.ReadInt16L();
     InternalizeResourceListL( aStream );    
+
     delete iDomDocument;
     iDomDocument = NULL;
     iDomDocument = ChspsDomDocument::NewL( aStream );
@@ -229,88 +219,147 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------    
 void ChspsODT::ExternalizeHeaderL( RWriteStream& aStream ) const
-    {
-    if ( iPackageVersion )
+    {    
+    const TDesC& packageVersion = PackageVersion();
+    aStream.WriteInt32L( packageVersion.Length() );
+    if( packageVersion.Length() > 0 )
+        {
+        aStream << packageVersion;
+        }
+        
+    aStream.WriteUint32L( iThemeUid );
+    
+    const TDesC& providerName = ProviderName();
+    aStream.WriteInt32L( providerName.Length() );
+    if( providerName.Length() > 0 )
+        {
+        aStream << providerName;
+        }         
+
+    const TDesC& themeFullName = ThemeFullName();
+    aStream.WriteInt32L( themeFullName.Length() );
+    if( themeFullName.Length() > 0 )
+        {
+        aStream << themeFullName;
+        }      
+    
+    const TDesC& themeShortName = ThemeShortName();
+    aStream.WriteInt32L( themeShortName.Length() );
+    if( themeShortName.Length() > 0 )
+        {
+        aStream << themeShortName;
+        }    
+
+    const TDesC& themeVersion = ThemeVersion();
+    aStream.WriteInt32L( themeVersion.Length() );
+    if( themeVersion.Length() > 0 )
         {
-        aStream << *iPackageVersion;
-        }
-    else
+        aStream << themeVersion;
+        }              
+        
+    const TDesC& description = Description();
+    aStream.WriteInt32L( description.Length() );
+    if( description.Length() > 0 )
+        {
+        aStream << description;
+        }            
+
+    const TDesC& logoFile = LogoFile();
+    aStream.WriteInt32L( logoFile.Length() );
+    if( logoFile.Length() > 0 )
+        {
+        aStream << logoFile;
+        }        
+
+    const TDesC& previewFile = PreviewFile();
+    aStream.WriteInt32L( previewFile.Length() );
+    if( previewFile.Length() > 0 )
         {
-        aStream << KNullDesC;
+        aStream << previewFile;
+        }            
+
+    aStream.WriteUint32L( iFamilyMask );    
+    aStream.WriteUint32L( iConfigurationType );    
+    aStream.WriteUint32L( iRootUid );    
+    aStream.WriteUint32L( iProviderUid );  
+    aStream.WriteUint32L( iFlags );
+    
+    aStream.WriteInt32L( iLanguage );    
+    aStream.WriteInt32L( iMultiInstance );    
+    }
+
+
+// -----------------------------------------------------------------------------
+// ChspsODT::HeaderSize
+// Calculate header size in bytes.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------    
+TInt ChspsODT::HeaderSize() const
+    {
+    TInt size = sizeof( TInt32 );
+    if( PackageVersion().Length() > 0 )
+        {         
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += PackageVersion().Size();
         }
     
-    aStream.WriteUint32L( iFamilyMask );
-    aStream.WriteUint32L( iConfigurationType );
-    aStream.WriteUint32L( iRootUid );
-    aStream.WriteUint32L( iProviderUid );
-    aStream.WriteUint32L( iThemeUid );
-    aStream.WriteInt32L( iMultiInstance );
+    size += sizeof( TUint32 ); // iThemeUid
     
-    if ( iDescription )
+    size += sizeof( TInt32 );
+    if( ProviderName().Length() > 0 )
         {
-        aStream << *iDescription;
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += ProviderName().Size();
         }    
-    else
+    
+    size += sizeof( TInt32 );
+    if( ThemeFullName().Length() > 0 )
         {
-        aStream << KNullDesC;
-        }
-    if ( iLogoFile )
-        {
-        aStream << *iLogoFile;
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += ThemeFullName().Size();
         }    
-    else
+    
+    size += sizeof( TInt32 );
+    if( ThemeShortName().Length() > 0 )
         {
-        aStream << KNullDesC;
-        }
-    if ( iPreviewFile )
-        {
-        aStream << *iPreviewFile;
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += ThemeShortName().Size();
         }    
-    else
-        {
-        aStream << KNullDesC;
-        }
-    if ( iProviderName )
+    
+    size += sizeof( TInt32 );
+    if( ThemeVersion().Length() > 0 )
         {
-        aStream << *iProviderName;
-        }
-    else
-        {
-        aStream << KNullDesC;
-        }
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += ThemeVersion().Size();
+        }    
     
-    if ( iThemeFullName )
+    size += sizeof( TInt32 );
+    if( Description().Length() > 0 )
         {
-        aStream << *iThemeFullName;
-        }
-    else 
-        {
-        aStream << KNullDesC;
-        }
-        
-    if ( iThemeShortName )
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += Description().Size();
+        }    
+    
+    size += sizeof( TInt32 );
+    if( LogoFile().Length() > 0 )
         {
-        aStream << *iThemeShortName;
-        }
-    else 
-        {
-        aStream << KNullDesC;
-        }
-        
-    if ( iThemeVersion )
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += LogoFile().Size();
+        }    
+    
+    size += sizeof( TInt32 );
+    if( PreviewFile().Length() > 0 )
         {
-        aStream << *iThemeVersion;
-        }
-    else
-        {
-        aStream << KNullDesC;
-        }
+        size += sizeof( TUint32 ); // String streaming insert also max. 32bit member of TCardinality.
+        size += PreviewFile().Size();
+        }    
     
-    aStream.WriteInt32L( iLanguage );
-    aStream.WriteUint32L( iFlags );
+    size += sizeof( TUint32 ) * 5; // iFamilyMask, iConfigurationType,
+                                   // iRootUid, iProviderUid, iFlags
+
+    size += sizeof( TInt32 ) * 2; // iLanguage, iMultiInstance                
     
-    // end of the header delimiter
-    aStream.WriteL( KDelim );
+    return size;
     }
 
 // -----------------------------------------------------------------------------
@@ -319,59 +368,111 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------       
 EXPORT_C void ChspsODT::InternalizeHeaderL( RReadStream& aStream )
-    {
-    HBufC* version = HBufC::NewL( aStream, KMaxFileName );
-    CleanupStack::PushL( version );
-    if ( iPackageVersion && version->Des().Compare( iPackageVersion->Des() ) != 0 )
+    {    
+    TInt len = aStream.ReadInt32L();
+    HBufC* version = NULL;
+    if( len > 0 )
+        {
+        version = HBufC::NewL( aStream, len );
+        }
+    CleanupStack::PushL( version );    
+    
+    // Check version request.
+    if( iPackageVersion )
         {
-        // Package version check requested (iPackageVersion defined) 
-        // and package version not supported
-        User::Leave( KErrNotSupported );
+        TBool supported = ETrue;
+        if( version == NULL )
+            {
+            supported = EFalse;
+            }
+        else if( version &&
+                 version->Compare( *iPackageVersion ) != 0 )
+            {
+            supported = EFalse;
+            }    
+    
+        if( !supported )
+            {
+            // Package version check requested (iPackageVersion defined) 
+            // and package version not supported
+            User::Leave( KErrNotSupported );
+            }
         }
-    if ( !iPackageVersion && version->Length() )
+    
+    if( version )
         {
-        // Package version check not requested
+        delete iPackageVersion;
+        iPackageVersion = NULL;    
         iPackageVersion = version->AllocL();
         }
     CleanupStack::PopAndDestroy( version );
-    
-    iFamilyMask = aStream.ReadUint32L();    
-    iConfigurationType = aStream.ReadUint32L();
-    iRootUid = aStream.ReadUint32L();
-    iProviderUid = aStream.ReadUint32L();
+
     iThemeUid = aStream.ReadUint32L();
-    iMultiInstance = aStream.ReadInt32L();
-    
-    delete iDescription;
-    iDescription = NULL;
-    iDescription = HBufC::NewL(aStream, KMaxDescLength );
-    
-    delete iLogoFile;
-    iLogoFile = NULL;
-    iLogoFile = HBufC::NewL(aStream, KMaxFileName );
-    
-    delete iPreviewFile;
-    iPreviewFile = NULL;
-    iPreviewFile = HBufC::NewL(aStream, KMaxFileName );
-        
+          
     delete iProviderName;
     iProviderName = NULL;
-    iProviderName = HBufC::NewL(aStream, KMaxFileName );
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {
+        iProviderName = HBufC::NewL( aStream, len );
+        }
     
     delete iThemeFullName;
     iThemeFullName = NULL;
-    iThemeFullName = HBufC::NewL(aStream, KMaxFileName );
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {
+        iThemeFullName = HBufC::NewL( aStream, len );
+        }
     
     delete iThemeShortName;
     iThemeShortName = NULL;
-    iThemeShortName = HBufC::NewL(aStream, KMaxFileName );
-    
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {    
+        iThemeShortName = HBufC::NewL( aStream, len );
+        }
+
     delete iThemeVersion;
     iThemeVersion = NULL;
-    iThemeVersion = HBufC::NewL(aStream, KMaxFileName );
-        
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {    
+        iThemeVersion = HBufC::NewL( aStream, len );
+        }
+
+    delete iDescription;
+    iDescription = NULL;
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {    
+        iDescription = HBufC::NewL( aStream, len );
+        }
+
+    delete iLogoFile;
+    iLogoFile = NULL;
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {    
+        iLogoFile = HBufC::NewL( aStream, len );
+        }
+
+    delete iPreviewFile;
+    iPreviewFile = NULL;
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {    
+        iPreviewFile = HBufC::NewL( aStream, len );
+        }
+    
+    iFamilyMask = aStream.ReadUint32L();     
+    iConfigurationType = aStream.ReadUint32L();    
+    iRootUid = aStream.ReadUint32L();    
+    iProviderUid = aStream.ReadUint32L();    
+    iFlags = aStream.ReadUint32L();
+    
     iLanguage = aStream.ReadInt32L();
-    iFlags = aStream.ReadUint32L();
+    iMultiInstance = aStream.ReadInt32L();        
     }
 
 // -----------------------------------------------------------------------------
@@ -583,9 +684,16 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void ChspsODT::SetProviderNameL( const TDesC& aName )
     {
-    delete iProviderName;
-    iProviderName = NULL;
-    iProviderName = aName.AllocL();
+    if( iProviderName )
+        {
+        delete iProviderName;
+        iProviderName = NULL;
+        }
+    
+    if( aName.Length() != 0 )
+        {        
+        iProviderName = aName.AllocL();
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -612,9 +720,16 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void ChspsODT::SetThemeFullNameL( const TDesC& aName )
     {
-    delete iThemeFullName;
-    iThemeFullName = NULL;
-    iThemeFullName = aName.AllocL();
+    if( iThemeFullName )
+        {
+        delete iThemeFullName;
+        iThemeFullName = NULL;
+        }
+    
+    if( aName.Length() != 0 )
+        {        
+        iThemeFullName = aName.AllocL();
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -641,9 +756,16 @@
 // -----------------------------------------------------------------------------    
 EXPORT_C void ChspsODT::SetThemeShortNameL( const TDesC& aName )
     {
-    delete iThemeShortName;
-    iThemeShortName = NULL;
-    iThemeShortName = aName.AllocL();
+    if( iThemeShortName )
+        {
+        delete iThemeShortName;
+        iThemeShortName = NULL;
+        }
+    
+    if( aName.Length() != 0 )
+        {        
+        iThemeShortName = aName.AllocL();
+        }    
     }
 
 // -----------------------------------------------------------------------------
@@ -670,9 +792,16 @@
 // -----------------------------------------------------------------------------    
 EXPORT_C void ChspsODT::SetThemeVersionL( const TDesC& aVersion )
     {
-    delete iThemeVersion;
-    iThemeVersion = NULL;
-    iThemeVersion = aVersion.AllocL();
+    if( iThemeVersion )
+        {
+        delete iThemeVersion;
+        iThemeVersion = NULL;
+        }
+    
+    if( aVersion.Length() != 0 )
+        {        
+        iThemeVersion = aVersion.AllocL();
+        }    
     }
 
 // -----------------------------------------------------------------------------
@@ -804,9 +933,16 @@
 // -----------------------------------------------------------------------------    
 EXPORT_C void ChspsODT::SetPackageVersionL( const TDesC& aVersion )
     {
-    delete iPackageVersion;
-    iPackageVersion = NULL;
-    iPackageVersion = aVersion.AllocL();
+    if( iPackageVersion )
+        {
+        delete iPackageVersion;
+        iPackageVersion = NULL;
+        }
+    
+    if( aVersion.Length() != 0 )
+        {        
+        iPackageVersion = aVersion.AllocL();
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -867,9 +1003,16 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void ChspsODT::SetDescriptionL( const TDesC& aDesc )
     {    
-    delete iDescription;
-    iDescription = NULL;
-    iDescription = aDesc.AllocL();
+    if( iDescription )
+        {
+        delete iDescription;
+        iDescription = NULL;
+        }
+    
+    if( aDesc.Length() != 0 )
+        {        
+        iDescription = aDesc.AllocL();
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -891,10 +1034,17 @@
 // ChspsODT::SetLogoFileL
 // -----------------------------------------------------------------------------
 EXPORT_C void ChspsODT::SetLogoFileL( const TDesC& aPath )
-    {    
-    delete iLogoFile;
-    iLogoFile = NULL;
-    iLogoFile = aPath.AllocL();
+    {
+    if( iLogoFile )
+        {
+        delete iLogoFile;
+        iLogoFile = NULL;
+        }
+    
+    if( aPath.Length() != 0 )
+        {        
+        iLogoFile = aPath.AllocL();
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -916,10 +1066,17 @@
 // ChspsODT::SetPreviewFileL
 // -----------------------------------------------------------------------------
 EXPORT_C void ChspsODT::SetPreviewFileL( const TDesC& aPath )
-    {    
-    delete iPreviewFile;
-    iPreviewFile = NULL;
-    iPreviewFile = aPath.AllocL();
+    {
+    if( iPreviewFile )
+        {
+        delete iPreviewFile;
+        iPreviewFile = NULL;
+        }
+    
+    if( aPath.Length() != 0 )
+        {        
+        iPreviewFile = aPath.AllocL();
+        }
     }
 
 // -----------------------------------------------------------------------------
--- a/homescreenpluginsrv/hspspluginregistry/src/hspsdefinitionrepository.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspspluginregistry/src/hspsdefinitionrepository.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -20,6 +20,7 @@
 #include <s32file.h>
 #include <s32mem.h>
 #include <sysutil.h>
+#include <bautils.h>
 
 #include "hsps_builds_cfg.hrh"
 
@@ -638,8 +639,7 @@
 			    }
 			
 			CleanupStack::PopAndDestroy( fileName );
-			
-			
+						
 			// Set drive information
 			iTempFileName1.Format( _L("%S"), &res->FileName() );				
 			TParsePtr f( iTempFileName1 );		
@@ -1048,19 +1048,22 @@
     if ( !errorCode )
    	    {
         // Create the directory structure
-	    TInt err = iFs.MkDirAll( *iPath );
-	    if ( err != KErrNone && err != KErrAlreadyExists )
-	        {
-	        errorCode = err;
-	        
+        if( !BaflUtils::FolderExists( iFs, *iPath ) )
+            {
+            TInt err = iFs.MkDirAll( *iPath );
+            if ( err != KErrNone && err != KErrAlreadyExists )
+                {
+                errorCode = err;
+                
 #ifdef HSPS_LOG_ACTIVE
-            if( iLogBus )
-                {
-                iLogBus->LogText( _L( "ChspsDefinitionRepository::WriteToFileL(): - error %d." ),
-                        err );
+                if( iLogBus )
+                    {
+                    iLogBus->LogText( _L( "ChspsDefinitionRepository::WriteToFileL(): - error %d." ),
+                            err );
+                    }
+#endif	        
                 }
-#endif	        
-	        }
+            }
 	   	       
 	    if ( !errorCode )    
 		    {
--- a/homescreenpluginsrv/hspsresource/src/hspsresource.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/hspsresource/src/hspsresource.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -63,16 +63,20 @@
 EXPORT_C ChspsResource* ChspsResource::CloneL()
     {
     ChspsResource* clone = ChspsResource::NewL();
+    
     CleanupStack::PushL( clone );
+    
     clone->SetLockingPolicy( iLockingPolicy );    
     clone->SetResourceType( iResourceType );
-    clone->SetLanguage( iLanguage );         
-    clone->SetResourceIdL( *iResourceID );    
-    clone->SetFileNameL( *iFileName );
+    clone->SetLanguage( iLanguage );
+    clone->SetResourceIdL( ResourceId() );    
+    clone->SetFileNameL( FileName() );
     clone->SetMimeTypeL( iMimeType );
     clone->SetConfigurationUid( iConfigurationUid );
+    clone->SetTagsL( Tags() );
     
     CleanupStack::Pop( clone );
+    
     return clone;
     }
 
@@ -95,37 +99,30 @@
     aStream.WriteUint32L( iLockingPolicy );    
     aStream.WriteUint32L( iResourceType );
     aStream.WriteUint32L( iLanguage );
-        
-    if ( iResourceID )
+
+    const TDesC& resourceId = ResourceId();
+    aStream.WriteInt32L( resourceId.Length() );
+    if ( resourceId.Length() > 0 )
         {
-        aStream << *iResourceID;
-        }
-    else
-        {
-        aStream << KNullDesC;
+        aStream << resourceId;
         }
           
-    if ( iFileName )
+    const TDesC& fileName = FileName(); 
+    aStream.WriteInt32L( fileName.Length() );
+    if ( fileName.Length() > 0 )
         {
-        aStream << *iFileName;
-        }
-    else 
-        {
-        aStream << KNullDesC;
-        }
-    
+        aStream << fileName;
+        }    
      
     iMimeType.ExternalizeL(aStream);    
     
     aStream.WriteUint32L( iConfigurationUid );
     
-    if ( iTags )
+    const TDesC& tags = Tags();
+    aStream.WriteInt32L( tags.Length() );
+    if ( tags.Length() > 0 )
         {
-        aStream << *iTags;
-        }
-    else 
-        {
-        aStream << KNullDesC;
+        aStream << tags;
         }
     }
        
@@ -141,12 +138,20 @@
     iLanguage = (TLanguage)aStream.ReadUint32L();    
 
     delete iResourceID;
-    iResourceID = NULL;
-    iResourceID = HBufC::NewL(aStream, KMaxFileName );
+    iResourceID = NULL;    
+    TInt len = aStream.ReadInt32L();
+    if( len > 0 )
+        {
+        iResourceID = HBufC::NewL( aStream, len );
+        }
      
     delete iFileName;
     iFileName = NULL;
-    iFileName = HBufC::NewL(aStream, KMaxFileName );
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {
+        iFileName = HBufC::NewL( aStream, len );
+        }
     
     iMimeType.InternalizeL(aStream);          
     
@@ -154,7 +159,11 @@
     
     delete iTags;
     iTags = NULL;
-    iTags = HBufC::NewL(aStream, KMaxTagsLength );
+    len = aStream.ReadInt32L();
+    if( len > 0 )
+        {
+        iTags = HBufC::NewL( aStream, len );
+        }
     }
     
 // -----------------------------------------------------------------------------
@@ -205,9 +214,16 @@
 //
 EXPORT_C void ChspsResource::SetResourceIdL( const TDesC& aResourceId )
     {
-    delete iResourceID;
-    iResourceID = NULL;
-    iResourceID = aResourceId.AllocL();
+    if( iResourceID )
+        {
+        delete iResourceID;
+        iResourceID = NULL;
+        }
+    
+    if( aResourceId.Length() > 0 )
+        {
+        iResourceID = aResourceId.AllocL();
+        }
     }
     
 // -----------------------------------------------------------------------------
@@ -234,9 +250,16 @@
 //
 EXPORT_C void ChspsResource::SetFileNameL( const TDesC& aFileName )
     {
-    delete iFileName;
-    iFileName = NULL;
-    iFileName = aFileName.AllocL();
+    if( iFileName )
+        {
+        delete iFileName;
+        iFileName = NULL;
+        }
+    
+    if( aFileName.Length() > 0 )
+        {
+        iFileName = aFileName.AllocL();
+        }
     }
     
 // -----------------------------------------------------------------------------
@@ -254,8 +277,7 @@
         {
         return KNullDesC;
         }
-    }
-    
+    }    
     
 // -----------------------------------------------------------------------------
 // ChspsResource::SetMimeTypeL().
@@ -322,9 +344,16 @@
 //
 EXPORT_C void ChspsResource::SetTagsL( const TDesC& aTag )
     {
-    delete iTags;
-    iTags = NULL;
-    iTags = aTag.AllocL();
+    if( iTags )
+        {
+        delete iTags;
+        iTags = NULL;
+        }
+    
+    if( aTag.Length() > 0 )
+        {
+        iTags = aTag.AllocL();
+        }
     }
     
 // -----------------------------------------------------------------------------
--- a/homescreenpluginsrv/inc/hspsdomattribute.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/inc/hspsdomattribute.h	Mon Mar 15 12:41:53 2010 +0200
@@ -52,6 +52,17 @@
         IMPORT_C static ChspsDomAttribute* NewL( 
             const TDesC8& aName, 
             ChspsDomStringPool& aStringPool );
+
+        /**
+        * Two-phased constructor 8 bit.
+        * 
+        * @since S60 5.0
+        * @param aName          Name of attribute (String pool index).
+        * @param aStringPool    Attached string pool.
+        */
+        IMPORT_C static ChspsDomAttribute* NewL( 
+            const TInt aName, 
+            ChspsDomStringPool& aStringPool );        
         
         /**
         * Two-phased stream constructor.
@@ -83,9 +94,11 @@
         * 
         * @since S60 5.0
         * @param aStringPool Original string pool clone.
+        * @param aFastClone     If ETrue, then fast mode cloning is used.
         * @return Pointer to an attribute. Ownership is transferred to a caller.
         */
-        ChspsDomAttribute* CloneL( ChspsDomStringPool& aStringPool );        
+        ChspsDomAttribute* CloneL( ChspsDomStringPool& aStringPool,
+                                   const TBool aFastClone = EFalse );        
         
         /**
         * Get the attribute value.
@@ -104,6 +117,14 @@
         IMPORT_C void SetValueL( const TDesC8& aValue );
         
         /**
+        * Set attribute value.
+        * 
+        * @since S60 5.0
+        * @param aValue Attribute ref value.
+        */
+        IMPORT_C void SetValueL( const TInt aValue );
+        
+        /**
         * Get the attributes name string pool index.
         *  
         * @since S60 5.0
@@ -127,8 +148,7 @@
         * @since S60 5.0
         * @return Name.
         */
-        IMPORT_C const TDesC8& Name();
-        
+        IMPORT_C const TDesC8& Name();        
        
         /**
         * Documented in ChspsDomListItem::Size.
@@ -159,6 +179,10 @@
         */
         void ConstructL( const TDesC8& aName );
 
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( const TInt aName );        
      
     private:    // Data
         //String pool to get string for references, not owned.
--- a/homescreenpluginsrv/inc/hspsdomnode.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/inc/hspsdomnode.h	Mon Mar 15 12:41:53 2010 +0200
@@ -63,7 +63,20 @@
             const TDesC8& aName, 
             const TDesC8& aNS,
             ChspsDomStringPool& aStringPool );
-              
+
+        /**
+        * Two-phased constructor.
+        * 
+        * @since S60 5.0
+        * @param aName          Name of node (string pool index).
+        * @param aNS            Namespace (string pool index).
+        * @param aStringPool    Attached string pool.
+        */
+        static ChspsDomNode* NewL( 
+            const TInt aName, 
+            const TInt aNS,
+            ChspsDomStringPool& aStringPool );        
+        
         /**
         * Two-phased stream constructor.
         * 
@@ -83,10 +96,13 @@
         * Makes a clone from this node and it's child nodes.
         * 
         * @since S60 5.0
-        * @param aStringPool A new string pool.
+        * @param aStringPool    A new string pool.
+        * @param aFastClone     If ETrue, then fast mode cloning is used. 
+        * 
         * @return Pointer to a clone node. Caller has the ownership.
         */
-        IMPORT_C ChspsDomNode* CloneL( ChspsDomStringPool& aStringPool );
+        IMPORT_C ChspsDomNode* CloneL( ChspsDomStringPool& aStringPool,
+                                       const TBool aFastClone = EFalse );
         
         /**
         * Makes a clone only from this node.
@@ -299,8 +315,7 @@
         IMPORT_C const TDesC8& AttributeValue(const TDesC8& aAttribute) const;
    
    public: //From MhspsDomListItem
-        
-        
+                
         /**
         * Documented in ChspsDomListItem::Size
         */
@@ -321,8 +336,7 @@
         * Documented in ChspsDomListItem::Name
         */
         IMPORT_C const TDesC8& Name();       
-        
-    
+            
     public:          
     
         /**
@@ -350,6 +364,16 @@
         * By default Symbian 2nd phase constructor is private.
         */
         void ConstructL( const TDesC8& aName, const TDesC8& aNS );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( const TInt aName, const TInt aNS );        
+
+        /**
+        * Construct members
+        */
+        void Construct2L();        
         
     private:    // Data
         
--- a/homescreenpluginsrv/inc/hspsdomstringpool.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/inc/hspsdomstringpool.h	Mon Mar 15 12:41:53 2010 +0200
@@ -68,6 +68,13 @@
         */
         ChspsDomStringPool* CloneL(); 
         
+        /**
+        * Reset string pool to be reused.
+        * 
+        * @since Series 60 5.2
+        */
+        void Reset();         
+        
    public: //Adding
         
         /**
--- a/homescreenpluginsrv/inc/hspsodt.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/inc/hspsodt.h	Mon Mar 15 12:41:53 2010 +0200
@@ -498,19 +498,16 @@
         */
         static void CopyODTDataL( const ChspsODT& aSource, ChspsODT& aTarget );
         
-    private:    // Data
-
-        // Family mask (bits for e.g. vga, qhd_tch etc resolutions)
-        TUint32 iFamilyMask;
+        /**
+        * Calculate header size in bytes.
+        * 
+        * @return TInt  Header size.
+        */
+        TInt HeaderSize() const;
         
-    	// Configuration type
-    	TUint	iConfigurationType;
-    	
-    	// Application or interface uid
-        TUint  iRootUid;
-        
-        // The publisher
-        TUint  iProviderUid;
+    private:    // Data        
+        // Indicates whether we are able to internalize the instance        
+        HBufC* iPackageVersion;        
         
         // Identifies specific configuration
         TUint  iThemeUid;
@@ -519,17 +516,8 @@
         HBufC* iThemeShortName;
         
         // Revision number
-        HBufC* iThemeVersion;
-        
-        // Indicates whether we are able to internalize the instance        
-        HBufC* iPackageVersion;
-        
-        // Language of the ODT instance
-        TInt   iLanguage;
-        
-        // Multiple instances allowed/not
-        TInt   iMultiInstance;
-        
+        HBufC* iThemeVersion;        
+                
         // Description of the widget
         HBufC* iDescription;
         
@@ -538,10 +526,28 @@
         
         // Path to the preview file
         HBufC* iPreviewFile;
+
+        // Family mask (bits for e.g. vga, qhd_tch etc resolutions)
+        TUint32 iFamilyMask;
         
+        // Configuration type
+        TUint   iConfigurationType;
+        
+        // Application or interface uid
+        TUint  iRootUid;
+        
+        // The publisher
+        TUint  iProviderUid;
+
         // ThspsThemeStatus
-        TUint  iFlags;
-                        
+        TUint  iFlags;        
+        
+        // Language of the ODT instance
+        TInt   iLanguage;
+        
+        // Multiple instances allowed/not
+        TInt   iMultiInstance;        
+        
         // Pointer to list of unlocalized resources
         CArrayPtrSeg<ChspsResource>* iResourceList;
                 
--- a/homescreenpluginsrv/inc/hspsresource.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreenpluginsrv/inc/hspsresource.h	Mon Mar 15 12:41:53 2010 +0200
@@ -289,15 +289,15 @@
         TInt iConfigurationUid;
         
         // Filename without the extension
-        TDesC* iResourceID;
+        HBufC* iResourceID;
         
         // Full path and name
-        TDesC* iFileName;
+        HBufC* iFileName;
                 
         TDataType iMimeType;
         
         // Tags seperated with a colon
-        TDesC* iTags;
+        HBufC* iTags;
 
          // Reserved pointer for future extension
         TAny* iReserved;
--- a/homescreensrv_plat/ai_variation_api/inc/activeidle2domaincrkeys.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/ai_variation_api/inc/activeidle2domaincrkeys.h	Mon Mar 15 12:41:53 2010 +0200
@@ -123,4 +123,9 @@
  */
 const TUint32 KAIWallpaperPath = 0x00000851;
 
+/**
+ * Key id to store plugin id of active view
+ */
+const TUint32 KAIActiveViewPluginId = 0x00000852;
+
 #endif // __AI2INTERNALCRKEYS_H__
--- a/homescreensrv_plat/group/bld.inf	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/group/bld.inf	Mon Mar 15 12:41:53 2010 +0200
@@ -37,6 +37,5 @@
 #include "../xcfw_api/group/bld.inf"
 #include "../idlefw_api/group/bld.inf"
 #include "../hs_widget_publisher_api/group/bld.inf"
-#include "../context_utility_api/group/bld.inf"
 #include "../hs_settings_api/group/bld.inf"
 #include "../hs_content_control_api/group/bld.inf"
--- a/homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahpapplauncher.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_actionhandler/actionhandlerplugins/src/ahpapplauncher.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -106,26 +106,37 @@
 
     if ( !ExtractUidL( aMap, appUid, KApplicationUid ) )
         {
-        RApaLsSession appSession;
-        CleanupClosePushL( appSession );
-        User::LeaveIfError( appSession.Connect( ) );
-
-        CApaCommandLine* cmd = CApaCommandLine::NewLC( );
-        cmd->SetCommandL( GetCommandL( aMap ) );
-        RBuf documentNameValue;
-        CleanupClosePushL( documentNameValue );
-        if( !ExtractDesL( aMap, documentNameValue, KDocumentName ) )
+        TApaTaskList taskList( iEnv->WsSession() );       
+        TApaTask task = taskList.FindApp( appUid );
+        if ( task.Exists( ) )
+            {
+            errCode = KErrNone;
+            task.BringToForeground();
+            }
+        else
             {
-            cmd->SetDocumentNameL( documentNameValue );
+            // app not yet running
+            RApaLsSession appSession;
+            CleanupClosePushL( appSession );
+            User::LeaveIfError( appSession.Connect( ) );
+    
+            CApaCommandLine* cmd = CApaCommandLine::NewLC( );
+            cmd->SetCommandL( GetCommandL( aMap ) );
+            RBuf documentNameValue;
+            CleanupClosePushL( documentNameValue );
+            if( !ExtractDesL( aMap, documentNameValue, KDocumentName ) )
+                {
+                cmd->SetDocumentNameL( documentNameValue );
+                }
+            TApaAppInfo appInfo;
+            appSession.GetAppInfo( appInfo, appUid );
+            cmd->SetExecutableNameL( appInfo.iFullName );
+            errCode = appSession.StartApp( *cmd );
+    
+            CleanupStack::PopAndDestroy( &documentNameValue );
+            CleanupStack::PopAndDestroy( cmd );
+            CleanupStack::PopAndDestroy( &appSession );
             }
-        TApaAppInfo appInfo;
-        appSession.GetAppInfo( appInfo, appUid );
-        cmd->SetExecutableNameL( appInfo.iFullName );
-        errCode = appSession.StartApp( *cmd );
-
-        CleanupStack::PopAndDestroy( &documentNameValue );
-        CleanupStack::PopAndDestroy( cmd );
-        CleanupStack::PopAndDestroy( &appSession );
         }
     return errCode;
     }
--- a/homescreensrv_plat/sapi_homescreenplugin/src/hspsconfigurationif.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_homescreenplugin/src/hspsconfigurationif.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -1131,15 +1131,6 @@
         {
         inParamVariant = inParam->Value();
         pluginId.Set( inParamVariant.AsData() );
-        // Check that plugin node exists
-        ChspsDomNode* node = &( CHspsLiwUtilities::FindRootNodeByIdentifierL( 
-            KPluginElement,
-            pluginId,
-            *( iHspsConfigurationService->GetDOML().RootNode() ) ) );
-        if ( !node )
-            {
-            User::Leave( KErrNotFound );
-            }
         }
     else
         {
--- a/homescreensrv_plat/sapi_homescreenplugin/tsrc/common/src/mt_hspsteststep.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/common/src/mt_hspsteststep.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -401,6 +401,8 @@
 
     RDesReadStream inParamStream;
     inParamStream.Open( inParamBufPtr );
+    
+    // If this fails, field sizes are invalid in the "LIW" input
     CLiwGenericParamList* inParamList = 
         CLiwGenericParamList::NewL( inParamStream );
     inParamStream.Release();
--- a/homescreensrv_plat/sapi_homescreenplugin/tsrc/group/updatetests.cmd	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/group/updatetests.cmd	Mon Mar 15 12:41:53 2010 +0200
@@ -20,4 +20,5 @@
  
 if exist \epoc32\winscw\c\sys\bin\mt_*.dll del \epoc32\winscw\c\sys\bin\mt_*.dll
 if exist \epoc32\winscw\c\sys\hash\mt_*.dll del \epoc32\winscw\c\sys\hash\mt_*.dll
-copy \epoc32\release\winscw\udeb\mt_*.dll \epoc32\winscw\c\sys\bin
\ No newline at end of file
+md \epoc32\winscw\c\sys\bin\
+copy \epoc32\release\winscw\udeb\mt_*.dll \epoc32\winscw\c\sys\bin\
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hsps_restoreactiveappconf_1.h	Mon Mar 15 12:41:53 2010 +0200
@@ -0,0 +1,580 @@
+/*
+* Copyright (c) 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:  Test case RestoreActiveAppConf(2) test data
+*
+*/
+
+#ifndef MT_HSPS_RESTOREACTIVEAPPCONF_1_H_
+#define MT_HSPS_RESTOREACTIVEAPPCONF_1_H_
+
+/* 
+RestoreActiveAppConf(1)
+-------------------
+ 
+Test purpose:
+
+Verify that Operator configuration gets activated if the active 
+application configuration is in error state prior to the GetActiveAppConf request.
+
+Pre-conditions:
+
+•   There must be installed test themes for ActiveIdle application and Minimal 
+    configuration must be set as active.
+
+Test steps:
+
+Test step 1:
+•   Input:
+    SetConfState
+•   Expected output:
+    Active application configuration was successfully set to error state
+
+Test step 2:
+•   Input:
+    GetActiveAppConf
+•   Expected output:
+    Operator configuration in “Confirmed” state
+
+*/
+
+
+// Test step 1 method:
+const TUint8 restoreactiveappconf_1_ts_1_method[] = "SetConfState";
+
+// Test step 1 input:
+const TUint8 restoreactiveappconf_1_ts_1_input[] = {
+// SetConfState(Input)
+// - Version 1.0
+// - Item count (LE)
+10,
+2,0,0,0,
+// - SetConfState(Input)::confid
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+6,0,0,0,
+26,
+'c','o','n','f','I','d',
+// - SetConfState(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'1',
+// - SetConfState(Input)::state
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+5,0,0,0,
+22,
+'s','t','a','t','e',
+// - SetConfState(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+5,0,0,0,
+22,
+'e','r','r','o','r'
+};
+
+// Test step 1 expected output:
+const TUint8 restoreactiveappconf_1_ts_1_output[] = {
+// SetConfState(Output)
+// - Version 1.0
+// - Item count (LE)
+10,
+1,0,0,0,
+// - SetConfState(Output)::status
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+6,0,0,0,
+26,
+'s','t','a','t','u','s',
+// - SetConfState(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeTInt32
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+1,
+0,0,0,0
+};
+
+
+
+
+// Test step 2 method:
+const TUint8 restoreactiveappconf_1_ts_2_method[] = "GetActiveAppConf";
+
+
+// Test step 2 input:
+const TUint8 restoreactiveappconf_1_ts_2_input = 0;
+
+ 
+// Test step 2 expected output:
+const TUint8 restoreactiveappconf_1_ts_2_output[] = {
+// GetActiveAppConf(Output)
+// - Version 1.0
+// - Item count (LE)
+10,
+1,0,0,0,
+// GetActiveAppConf(Output)::appConf
+// - Variant name
+//   - Version 1.0
+//   - Semantic ID (LE)
+//   - Variant name length (LE)
+//   - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//   - Variant name
+10,
+12,0,0,0,
+7,0,0,0,
+30,
+'a','p','p','C','o','n','f',
+// - Variant value
+//   - Version 1.0
+//   - Variant value type, EVariantTypeMap
+10,
+8,
+// - appConf map
+//   - Version 1.0
+//   - Item count (LE)
+10,
+12,0,0,0,
+// - appConf::id
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+2,0,0,0,
+10,
+'i','d',
+// - appConf::id
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'1',
+// - appConf::uid
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+3,0,0,0,
+14,
+'u','i','d',
+// - appConf::uid
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+10,0,0,0,
+42,
+'0','x','2','0','0','0','B','1','3','0',
+// - appConf::type
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+4,0,0,0,
+18,
+'t','y','p','e',
+// - appConf::type
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+11,0,0,0,
+46,
+'a','p','p','l','i','c','a','t','i','o','n',
+// - appConf::interface
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+9,0,0,0,
+38,
+'i','n','t','e','r','f','a','c','e',
+// - appConf::interface
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+10,0,0,0,
+42,
+'0','x','2','0','0','0','0','F','B','1',
+// - appConf::name
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+4,0,0,0,
+18,
+'n','a','m','e',
+// - appConf::name
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+15,0,0,0,
+62,
+'O','p','e','r','a','t','o','r',' ','-',' ','r','o','o','t',
+// - appConf::multiinstance
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+13,0,0,0,
+54,
+'m','u','l','t','i','i','n','s','t','a','n','c','e',
+// - appConf::multiinstance
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'1',
+// - appConf::description
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+4,0,0,0,
+18,
+'d','e','s','c',
+// - appConf::description
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+0,0,0,0,
+2,
+// - appConf::state
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+5,0,0,0,
+22,
+'s','t','a','t','e',
+// - appConf::state
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+12,0,0,0,
+50,
+'N','o','t','C','o','n','f','i','r','m','e','d',
+// - appConf::max_child
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+9,0,0,0,
+38,
+'m','a','x','_','c','h','i','l','d',
+// - appConf::max_child
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'6',
+// - appConf::plugins
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+7,0,0,0,
+30,
+'p','l','u','g','i','n','s',
+// - appConf::plugins
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeList
+10,
+7,
+// - appConf::plugins
+//   - Version 1.0
+//   - Item count (LE)
+10,
+1,0,0,0,
+// - appConf::plugins
+//   - Version 1.0
+//   - List item starts
+10,
+0,0,0,0,
+// - appConf::plugins[0]
+//   - Version 1.0
+//   - Variant value type, EVariantTypeMap
+10,
+8,
+// - plugins[0] map
+//   - Version 1.0
+//   - Item count (LE)
+10,
+4,0,0,0,
+// - plugins[0]::id
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+2,0,0,0,
+10,
+'i','d',
+// - plugins[0]::id
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'1',
+// - plugins[0]::uid
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+3,0,0,0,
+14,
+'u','i','d',
+// - plugins[0]::uid
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+10,0,0,0,
+42,
+'0','x','2','0','0','0','B','1','3','1',
+// - plugins[0]::activationstate
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+15,0,0,0,
+62,
+'a','c','t','i','v','a','t','i','o','n','s','t','a','t','e',
+// - plugins[0]::activationstate
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'1',
+// - plugins[0]::locking_status
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+14,0,0,0,
+58,
+'l','o','c','k','i','n','g','_','s','t','a','t','u','s',
+// - plugins[0]::locking_status
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+4,0,0,0,
+18,
+'n','o','n','e',
+// - appConf::settings
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+8,0,0,0,
+34,
+'s','e','t','t','i','n','g','s',
+// - appConf::settings
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeList
+10,
+7,
+// - appConf::settings
+//   - Version 1.0
+//   - Item count (LE)
+10,
+0,0,0,0,
+// - appConf::resources
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+9,0,0,0,
+38,
+'r','e','s','o','u','r','c','e','s',
+// - appConf::resources
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeList
+10,
+7,
+// - appConf::resources
+//   - Version 1.0
+//   - List item count
+10,
+0,0,0,0
+};
+
+#endif /* MT_HSPS_RESTOREACTIVEAPPCONF_1_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hsps_restoreactiveappconf_2.h	Mon Mar 15 12:41:53 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 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:  Test case RestoreActiveAppConf(2) test data
+*
+*/
+
+#ifndef C_MT_HSPS_RESTOREACTIVEAPPCONF_2_H
+#define C_MT_HSPS_RESTOREACTIVEAPPCONF_2_H
+
+/* 
+RestoreActiveAppConf(2)
+-------------------
+ 
+Test purpose:
+
+Verify that Minimal configuration gets re-installed from ROM 
+(due to the statuslicenceerestorable status) if the active application 
+configuration is in error state prior to the GetActiveAppConf request.
+
+Pre-conditions:
+
+•   There must be installed test themes for ActiveIdle application and Minimal 
+    configuration must be set as active.
+
+Test steps:
+
+Test step 1:
+•   Input:
+    SetConfState
+•   Expected output:
+    Active application configuration was successfully set to error state
+
+Test step 2:
+•   Input:
+    GetActiveAppConf
+•   Expected output:
+    Minimal configuration with configuration state “Confirmed”
+
+*/
+
+
+// Test step 1 method:
+const TUint8 restoreactiveappconf_2_ts_1_method[] = "SetConfState";
+
+// Test step 1 input:
+const TUint8 restoreactiveappconf_2_ts_1_input[] = {
+// SetConfState(Input)
+// - Version 1.0
+// - Item count (LE)
+10,
+2,0,0,0,
+// - SetConfState(Input)::confid
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+6,0,0,0,
+26,
+'c','o','n','f','I','d',
+// - SetConfState(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+1,0,0,0,
+6,
+'1',
+// - SetConfState(Input)::state
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+5,0,0,0,
+22,
+'s','t','a','t','e',
+// - SetConfState(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeDesC
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+5,
+5,0,0,0,
+22,
+'e','r','r','o','r'
+};
+
+// Test step 1 expected output:
+const TUint8 restoreactiveappconf_2_ts_1_output[] = {
+// SetConfState(Output)
+// - Version 1.0
+// - Item count (LE)
+10,
+1,0,0,0,
+// - SetConfState(Output)::status
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+6,0,0,0,
+26,
+'s','t','a','t','u','s',
+// - SetConfState(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeTInt32
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+1,
+0,0,0,0
+};
+
+
+
+
+// Test step 2 method:
+const TUint8 restoreactiveappconf_2_ts_2_method[] = "GetActiveAppConf";
+
+
+// Test step 2 input:
+const TUint8 restoreactiveappconf_2_ts_2_input = 0;
+
+ 
+// Test step 2 expected output:
+const TUint8 restoreactiveappconf_2_ts_2_output[] = {
+// GetActiveAppConf(Output)
+// - Version 1.0
+// - Item count (LE)
+10,
+1,0,0,0,
+// - GetActiveAppConf(Output)::status
+//   - Variant name
+//     - Version 1.0
+//     - Semantic ID (LE)    
+//     - Variant name length (LE)
+//     - Variant name descriptor maximum length ( ( variant name length * 4 ) + 2 )
+//     - Variant name
+10,
+12,0,0,0,
+6,0,0,0,
+26,
+'s','t','a','t','u','s',
+// - GetActiveAppConf(Input)::value
+//   - Variant value
+//     - Version 1.0
+//     - Variant value type, EVariantTypeTInt32
+//     - Variant value length (LE)
+//     - Variant value descriptor maximum length ( ( variant value length * 4 ) + 2 )
+//     - Variant value
+10,
+1,
+255,255,255,255
+};
+
+#endif // C_MT_HSPS_RESTOREACTIVEAPPCONF_2_H
--- a/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hspsconfigurationif.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/inc/mt_hspsconfigurationif.h	Mon Mar 15 12:41:53 2010 +0200
@@ -452,7 +452,17 @@
          * Test case function for test case Customization(1)
          * See HSPS module test specification
          */
-        void Customization_1_L();
+        void Customization_1_L();        
+        /**
+         * Test case function for test case RestoreActiveAppConf(1)
+         * See HSPS module test specification 
+         */
+        void RestoreActiveAppConf_1_L();
+        /**
+         * Test case function for test case RestoreActiveAppConf(2)
+         * See HSPS module test specification 
+         */
+        void RestoreActiveAppConf_2_L();
         
     private:    // Data
 
--- a/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/homescreensrv_plat/sapi_homescreenplugin/tsrc/hspsconfigurationif/src/mt_hspsconfigurationif.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -118,6 +118,9 @@
 #include "mt_hsps_restoreconfigurations_1.h"
 // customizations
 #include "mt_hsps_customization_1.h"
+// restoractiveeappconf
+#include "mt_hsps_restoreactiveappconf_1.h"
+#include "mt_hsps_restoreactiveappconf_2.h"
 
 // ======== LOCAL CONSTANTS ====================================================
 
@@ -2992,6 +2995,68 @@
     }
 
 //------------------------------------------------------------------------------
+// Test case: RestoreActiveAppConf(1)
+//------------------------------------------------------------------------------
+void MT_CHSPSConfigurationIf::RestoreActiveAppConf_1_L()
+    {        
+    // Pre conditions: activate configuration which hasn't got statuslicenceerestorable status        
+    EUNIT_PRINT( _L8( "Pre conditions: Set Active configuration Minimal" ) );
+    SetActiveConfigurationL( KHSPSTestAppUid, KHSPSActiveConfMinimal );    
+
+    // Get ODT and fill in the plugin DOMs
+    EUNIT_PRINT( _L8( "Pre conditions: Attach to HSPS service IConfiguration interface" ) );
+    AttachServiceL( KHSPS, KHSPSConfigurationIf, KHSPSTestAppUid );
+    
+    // Test step 1: invalidate state of the active application configuration
+    EUNIT_PRINT( _L8( "Test step 1" ) );    
+    RunTestStepSyncL(                   
+        ( TUint8* )restoreactiveappconf_1_ts_1_method,
+        ( TUint8* )restoreactiveappconf_1_ts_1_input,
+        ( TUint8* )restoreactiveappconf_1_ts_1_output );   
+    EUNIT_PRINT( _L8( "Test step passed" ) );
+        
+    // Test step 2: retrieve the app conf, Operator configuration should be now active    
+    EUNIT_PRINT( _L8( "Test step 2" ) );
+    RunTestStepSyncL(                   
+        ( TUint8* )restoreactiveappconf_1_ts_2_method,
+        ( TUint8* )restoreactiveappconf_1_ts_2_input,
+        ( TUint8* )restoreactiveappconf_1_ts_2_output );        
+    EUNIT_PRINT( _L8( "Test step passed" ) );
+    }
+
+
+//------------------------------------------------------------------------------
+// Test case: RestoreActiveAppConfL(2)
+//------------------------------------------------------------------------------
+void MT_CHSPSConfigurationIf::RestoreActiveAppConf_2_L()
+    {        
+    // Pre conditions: activate configuration with a statuslicenceerestorable status        
+    EUNIT_PRINT( _L8( "Pre conditions: Set Active configuration Operator" ) );
+    SetActiveConfigurationL( KHSPSTestAppUid, KHSPSActiveConfOperator );    
+
+    // Get ODT and fill in the plugin DOMs
+    EUNIT_PRINT( _L8( "Pre conditions: Attach to HSPS service IConfiguration interface" ) );
+    AttachServiceL( KHSPS, KHSPSConfigurationIf, KHSPSTestAppUid );
+    
+    // Test step 1: invalidate state of the active application configuration
+    EUNIT_PRINT( _L8( "Test step 1" ) );    
+    RunTestStepSyncL(                   
+        ( TUint8* )restoreactiveappconf_2_ts_1_method,
+        ( TUint8* )restoreactiveappconf_2_ts_1_input,
+        ( TUint8* )restoreactiveappconf_2_ts_1_output );   
+    EUNIT_PRINT( _L8( "Test step passed" ) );
+        
+    // Test step 2: retrieve the app conf, we should fail installing the Operator 
+    // configuration as it is not in ROM
+    EUNIT_PRINT( _L8( "Test step 2" ) );
+    RunTestStepSyncL(                   
+        ( TUint8* )restoreactiveappconf_2_ts_2_method,
+        ( TUint8* )restoreactiveappconf_2_ts_2_input,
+        ( TUint8* )restoreactiveappconf_2_ts_2_output );        
+    EUNIT_PRINT( _L8( "Test step passed" ) );
+    }
+
+//------------------------------------------------------------------------------
 // Test case table
 //------------------------------------------------------------------------------
 EUNIT_BEGIN_TEST_TABLE(
@@ -3526,6 +3591,19 @@
        "FUNCTIONALITY",
        SetupL, Customization_1_L, Teardown )
 
+    EUNIT_TEST(   
+       "RestoreActiveAppConfL(1)",
+       "IConfiguration",
+       "SetActivePlugin",
+       "FUNCTIONALITY",
+       SetupL, RestoreActiveAppConf_1_L, Teardown )
+
+    EUNIT_TEST(   
+       "RestoreActiveAppConfL(2)",
+       "IConfiguration",
+       "SetActivePlugin",
+       "FUNCTIONALITY",
+       SetupL, RestoreActiveAppConf_2_L, Teardown )
        
     EUNIT_END_TEST_TABLE
 
Binary file idlefw/conf/activeidle2.confml has changed
Binary file idlefw/conf/activeidle2_10275102.crml has changed
--- a/idlefw/plugins/mcsplugin/publisher/inc/mcsplugindata.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/mcsplugin/publisher/inc/mcsplugindata.h	Mon Mar 15 12:41:53 2010 +0200
@@ -26,6 +26,7 @@
 #include <hspluginsettings.h>
 #include <propertymap.h>
 #include <mcsmenu.h>
+#include <msvapi.h>     // For MMsvSessionObserver
 
 class TMenuItem;
 class CMCSPluginEngine;
@@ -91,7 +92,8 @@
  *  @since
  */
 class CMCSPluginData : public CBase,
-    public HSPluginSettingsIf::MHomeScreenSettingsObserver
+    public HSPluginSettingsIf::MHomeScreenSettingsObserver,
+    public MMsvSessionObserver
     {
 
 public:
@@ -172,11 +174,27 @@
                            const TDesC8& aPluginUid, const TDesC8& aPluginId );
 
     /**
-     * CreateBkmMenuItemsL
+     * CreateRunTimeMenuItemsL
      * @param void
      * @return void
      */
-    void CreateBkmMenuItemsL();
+    void CreateRuntimeMenuItemsL();
+    
+    // from base class MMsvSessionObserver
+
+    /**
+     * Handles an event from the message server.
+     * Not used, but must be defined to be able to use the messaging server.
+     *
+     * @since S60 v3.2
+     * @param aEvent Indicates the event type.
+     * @param aArg1 Event type-specific argument value
+     * @param aArg2 Event type-specific argument value
+     * @param aArg3 Event type-specific argument value
+     */
+    void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, 
+        TAny* aArg3 );
+    
 private:
 
     /**
@@ -217,10 +235,16 @@
     const TDesC8& iInstanceUid;
 
     // MCS asynchronous operation watcher, owned 
-    CMCSPluginWatcher* iSaveWatcher;
+    CMCSPluginWatcher* iSaveWatcher; 
 
     // MCS resource handle, owned 
     RMenu iMenu;
+    
+    /**
+     * Message server session
+     * Own.
+     */
+    CMsvSession* iMsvSession;
     };
 
 #endif // CMCSPLUGINDATA_H
--- a/idlefw/plugins/mcsplugin/publisher/inc/mcspluginengine.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/mcsplugin/publisher/inc/mcspluginengine.h	Mon Mar 15 12:41:53 2010 +0200
@@ -127,7 +127,7 @@
      * @param aAttr
      * @return CGulIcon*
      */
-    CGulIcon* ItemIconL( CMenuItem& aMenuItem, const TDesC& aAttr );
+    CGulIcon* ItemIconL( CMenuItem* aMenuItem, const TDesC& aAttr );
 
     /**
      * Returns text for given menu item and given attribute
@@ -135,7 +135,7 @@
      * @param aMenuItem
      * @param aAttr
      */
-    TPtrC ItemTextL( CMenuItem& aMenuItem, const TDesC& aAttr );
+    TPtrC ItemTextL( CMenuItem* aMenuItem, const TDesC& aAttr );
 
     /** 
      * Launches menu item
@@ -168,11 +168,11 @@
         CMenuItem* aItem, const TInt aValueToAdd );
 
     /**
-     * CreateBkmMenuItemsL
+     * CreateRuntimeMenuItemsL
      * @param void
      * @return void
      */
-    void CreateBkmMenuItemsL();
+    void CreateRuntimeMenuItemsL();
 
 private:
     // from MMCSPluginWatcherObserver
@@ -198,10 +198,10 @@
      * InitL
      */
     void InitL();
-
+    
     /**
      * Tells the settings container to start observing 
-     * for changes in mailbox db.     
+     * for changes in mailbox db and changes in MCS.
      */
     void StartObservingL();
 
--- a/idlefw/plugins/mcsplugin/publisher/src/mcsplugin.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/mcsplugin/publisher/src/mcsplugin.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -89,13 +89,8 @@
 //
 CMCSPlugin::~CMCSPlugin()
     {
-    Release( iContent );
-    
-    if ( iEngine )
-        {
-        TRAP_IGNORE( iEngine->CleanMCSItemsL() );
-        }
-    
+     Release( iContent );
+
     delete iEngine;
     iObservers.Close();
     
@@ -162,7 +157,9 @@
         return;
         }
 
-    CMenuItem* item( iEngine->FetchMenuItemL( aData.MenuItem() ) );
+    CMenuItem* item = NULL;
+    TRAP_IGNORE ( item = iEngine->FetchMenuItemL( aData.MenuItem() ) );
+    
     CleanupStack::PushL( item );
     
     // One widget item has iDataCount number of elements
@@ -173,7 +170,7 @@
             //Publish image
             if ( aObserver.CanPublish( *this, i, aIndex ) )
                 {
-                CGulIcon* icon( iEngine->ItemIconL( *item, 
+                CGulIcon* icon( iEngine->ItemIconL( item, 
                     TPtrC16( ( const TText16* ) iContentModel[ i ].cid ) ) );
                 
                 aObserver.PublishPtr( *this, i, icon , aIndex );
@@ -184,7 +181,7 @@
             //Publish  text
             if ( aObserver.CanPublish( *this, i, aIndex ) )
                 {
-                TPtrC name( iEngine->ItemTextL( *item, 
+                TPtrC name( iEngine->ItemTextL( item, 
                     TPtrC16( ( const TText16* ) iContentModel[ i ].cid ) ) );
                 
                 aObserver.Publish( *this, i, name, aIndex );
@@ -202,10 +199,10 @@
 //
 void CMCSPlugin::Start( TStartReason aReason )
     {
-    if( aReason == EPluginStartup )
+    if ( aReason == EPluginStartup )
         {
-        TRAP_IGNORE( iEngine->CreateBkmMenuItemsL() );
-        }
+        TRAP_IGNORE( iEngine->CreateRuntimeMenuItemsL() );
+        }    
     }
 
 // ----------------------------------------------------------------------------
@@ -213,8 +210,12 @@
 // 
 // ----------------------------------------------------------------------------
 //
-void CMCSPlugin::Stop( TStopReason /*aReason*/ )
+void CMCSPlugin::Stop( TStopReason aReason )
     {
+    if( aReason == EPluginShutdown )
+        {
+        TRAP_IGNORE( iEngine->CleanMCSItemsL() );
+        }
     }
 
 // ----------------------------------------------------------------------------
--- a/idlefw/plugins/mcsplugin/publisher/src/mcsplugindata.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/mcsplugin/publisher/src/mcsplugindata.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -20,6 +20,10 @@
 #include <aistrcnv.h>
 #include <favouritesdbobserver.h>
 #include <favouritesdb.h>        
+#include <msvuids.h>        // For KMsvRootIndexEntryIdValue
+
+#include <mcsmenuitem.h>
+#include <mcsmenufilter.h>
 
 #include "mcsplugindata.h"
 #include "mcspluginengine.h"
@@ -36,14 +40,22 @@
 _LIT8( KProperValueBookmark, "bookmark" );
 _LIT8( KProperValueAppl, "application" );
 
+_LIT( KMailboxUid, "0x100058c5" );
+_LIT8( KMailboxUid8, "0x100058c5" );
+_LIT( KMenuMailboxIconId, "16388" );
+_LIT( KMenuMailboxMaskId, "16389" );
+
 _LIT( KUrl, "url" );
 _LIT( KMenuIconFile, "aimcsplugin.mif" );
-_LIT( KMenuIconId, "16386" );
-_LIT( KMenuMaskId, "16387" );
+_LIT( KMenuBookmarkIconId, "16386" );
+_LIT( KMenuBookmarkMaskId, "16387" );
 _LIT( KInitialRefCount, "1" );
 _LIT( KMenuAttrRefcount, "ref_count" );
 _LIT( KMyMenuData, "matrixmenudata" );
+_LIT( KMenuTypeShortcut, "menu:shortcut" );
+_LIT( KMenuAttrParameter, "param" );
 
+#define KMCSCmailMtmUidValue 0x2001F406
 
 // ======== LOCAL FUNCTIONS ========
 
@@ -105,6 +117,7 @@
 //
 void CMCSPluginData::ConstructL()
     {
+    iMsvSession = CMsvSession::OpenAsObserverL( *this );
     iPluginSettings = CHomescreenSettings::Instance();
     if( iPluginSettings == NULL )
         {
@@ -134,6 +147,7 @@
     iMenu.Close();
 
     delete iSaveWatcher;
+    delete iMsvSession;
     }
 
 // ---------------------------------------------------------------------------
@@ -433,11 +447,22 @@
     }
 
 // ---------------------------------------------------------------------------
-// Creates bookmark menu item if it does not exist
+// Creates runtime generated menuitems (bookmarks/mailboxes if they 
+// it does not exist yet in MCS. If they do, their ref_count is incremented.
+// Called during Plugin startup.
 // ---------------------------------------------------------------------------
 //
-void CMCSPluginData::CreateBkmMenuItemsL()
+void CMCSPluginData::CreateRuntimeMenuItemsL()
     {
+    
+    // start mailboxes observing and get the number of
+    // mailboxes defined in the device
+
+    TMsvId entryID = KMsvRootIndexEntryIdValue;
+    CMsvEntry* rootEntry = iMsvSession->GetEntryL( entryID );
+    TInt mailboxCount = rootEntry->Count();
+    CleanupStack::PushL( rootEntry );
+    
     RPointerArray<CItemMap> settings;
     TCleanupItem settingsCleanupItem( ItemMapArrayCleanupFunc, &settings );
     CleanupStack::PushL( settingsCleanupItem );
@@ -456,7 +481,7 @@
         RPointerArray<HSPluginSettingsIf::CPropertyMap>& properties
             = itemMap->Properties();
 
-        TPtrC8 uid8, type;
+        TPtrC8 uid8, type, param8;
 
         for( TInt j = 0; j < properties.Count(); j++ )
             {
@@ -469,10 +494,16 @@
                 {
                 uid8.Set( properties[j]->Value() );
                 }
+            else if ( properties[j]->Name() ==  KProperNameParam )
+                {
+                param8.Set( properties[j]->Value() );
+                }
             }
 
         if( type == KProperValueBookmark )
             {
+            
+            // The shortcut is a bookmark
             TMenuItem menuItem = CreateMenuItemL( properties );
 
             CActiveSchedulerWait* wait = 
@@ -501,40 +532,168 @@
                 newItem->SetAttributeL( KMenuAttrUid, *uid );
                 newItem->SetAttributeL( KMenuAttrLongName, bkmItem->Name() );
                 newItem->SetAttributeL( KMenuAttrIconFile, KMenuIconFile );
-                newItem->SetAttributeL( KMenuAttrIconId, KMenuIconId );
-                newItem->SetAttributeL( KMenuAttrMaskId, KMenuMaskId );
+                newItem->SetAttributeL( KMenuAttrIconId, KMenuBookmarkIconId );
+                newItem->SetAttributeL( KMenuAttrMaskId, KMenuBookmarkMaskId );
                 newItem->SetAttributeL( KMenuAttrRefcount, KInitialRefCount );
                 newItem->SetAttributeL( KUrl , bkmItem->Url() );
 
                 CMenuOperation* op = newItem->SaveL( iSaveWatcher->iStatus );
-                TInt newId = newItem->Id();
-                iData[i].MenuItem().SetId( newId );
 
                 iSaveWatcher->StopAndWatch( op, wait );
 
                 // Start the nested scheduler loop.
                 wait->Start();
 
-                CleanupStack::Pop( newItem );
+                SaveSettingsL( i, *newItem );
+
+                CleanupStack::PopAndDestroy( newItem );
                 CleanupStack::PopAndDestroy( uid );
                 CleanupStack::PopAndDestroy( bkmItem );
                 }
             else
                 {
                 CMenuItem* item = CMenuItem::OpenL( iMenu, menuItem );
-
-                if( iEngine.UpdateMenuItemsRefCountL( item, 1 ) > 0 )
+                CleanupStack::PushL( item );
+                if ( iEngine.UpdateMenuItemsRefCountL( item, 1 ) > 0 )
                     {
                     CMenuOperation* op = item->SaveL( iSaveWatcher->iStatus );
                     iSaveWatcher->StopAndWatch( op, wait );
                     // Start the nested scheduler loop.
                     wait->Start();
+                    SaveSettingsL( i, *item );
                     }
+                CleanupStack::PopAndDestroy( item );
                 }
 
             CleanupStack::PopAndDestroy( wait );
             wait = NULL;
             }
+
+        else if ( uid8 == KMailboxUid8 && mailboxCount > 0 )
+             {
+             // The shortcut is a Mailbox
+             
+             TMenuItem menuItem = CreateMenuItemL( properties );
+
+             CActiveSchedulerWait* wait = 
+                             new ( ELeave ) CActiveSchedulerWait;
+             CleanupStack::PushL( wait );
+
+             if ( menuItem.Id() == 0 )
+                {
+                // mailbox menuitem does not exist yet. We have to create it
+                // first, we try to find its ID among existing mailboxes:bì 
+
+                // extract Mailbox ID from HSPS
+                TInt pos = param8.Locate( TChar( ':' ) ) + 1;
+                TPtrC8 mailboxId8 = param8.Mid( pos );
+                
+                HBufC *mailboxId( NULL );
+                mailboxId = AiUtility::CopyToBufferL( mailboxId, mailboxId8 );
+                CleanupStack::PushL( mailboxId );
+                
+                // compare ID with existing mailboxes
+                rootEntry->SetSortTypeL( TMsvSelectionOrdering( 
+                            KMsvGroupByType | KMsvGroupByStandardFolders, 
+                            EMsvSortByDetailsReverse, ETrue ) );
+                
+                TBuf<255> boxId;
+                TBool found = EFalse;
+                TInt index = rootEntry->Count();
+
+                while ( !found && --index >= 0 )
+                    {
+                    const TMsvEntry& tentry = ( *rootEntry )[ index ];
+                    if ( tentry.iMtm.iUid == KMCSCmailMtmUidValue )
+                        {
+                        boxId.Num( tentry.Id() );
+                        if ( boxId == *mailboxId )
+                            {
+                            found = ETrue;
+                            }
+                        }
+                    }
+
+                CleanupStack::PopAndDestroy( mailboxId );
+                
+                // mailbox still exists in Mail application
+                // we have to create a new menuitem
+                if ( found )
+                    {
+
+                    // get the mailbox name
+                    const TMsvEntry& tentry = ( *rootEntry )[ index ];
+                    TPtrC name = tentry.iDetails;
+
+                    HBufC *param( NULL );
+                    param = AiUtility::CopyToBufferL( param, param8 );
+                    CleanupStack::PushL( param );
+
+                    // create a new menuitem with ref_count 1
+                    CMenuItem* newItem = CMenuItem::CreateL( iMenu, 
+                                                         KMenuTypeShortcut, 
+                                                         GetMCSPluginFolderIdL(), 
+                                                         0 );
+                    CleanupStack::PushL( newItem );
+
+                    // mailbox is a shortcut item with "mailbox:mailboxID" parameter
+                    newItem->SetAttributeL( KMenuAttrUid, KMailboxUid );
+                    newItem->SetAttributeL( KMenuAttrLongName, name );
+                    newItem->SetAttributeL( KMenuAttrParameter, *param );
+                    newItem->SetAttributeL( KMenuAttrRefcount, KInitialRefCount );
+
+                    // setting icon for the shortcut
+                    newItem->SetAttributeL( KMenuAttrIconFile, KMenuIconFile );
+                    newItem->SetAttributeL( KMenuAttrIconId, KMenuMailboxIconId );
+                    newItem->SetAttributeL( KMenuAttrMaskId, KMenuMailboxMaskId );
+
+                    CMenuOperation* op = newItem->SaveL( iSaveWatcher->iStatus );
+                    iSaveWatcher->StopAndWatch( op, wait );
+
+                    // Start the nested scheduler loop.
+                    wait->Start();
+
+                    SaveSettingsL( i, *newItem );
+
+                    CleanupStack::PopAndDestroy( newItem );
+                    CleanupStack::PopAndDestroy( param );
+                    }
+                }
+             else 
+                {
+                // mailbox menu item already exists -> increment ref_count by 1
+                CMenuItem* item = CMenuItem::OpenL( iMenu, menuItem );
+                CleanupStack::PushL( item );
+                if ( iEngine.UpdateMenuItemsRefCountL( item, 1 ) > 0 )
+                    {
+                    CMenuOperation* op = item->SaveL( iSaveWatcher->iStatus );
+                    iSaveWatcher->StopAndWatch( op, wait );
+
+                    // Start the nested scheduler loop.
+                    wait->Start();
+                    SaveSettingsL( i, *item );
+                    }
+                 CleanupStack::PopAndDestroy( item );
+                }
+             CleanupStack::PopAndDestroy( wait );
+             wait = NULL;
+             
+             }
         }
     CleanupStack::PopAndDestroy(); // settingsCleanupItem
+    CleanupStack::PopAndDestroy( rootEntry );
     }
+
+// ---------------------------------------------------------------------------
+// From class MMsvSessionObserver.
+// Handles an event from the message server.
+// ---------------------------------------------------------------------------
+//
+void CMCSPluginData::HandleSessionEventL(
+                                     TMsvSessionEvent /*aEvent*/, 
+                                     TAny* /*aArg1*/, 
+                                     TAny* /*aArg2*/,
+                                     TAny* /*aArg3*/ )
+    {
+
+    }
--- a/idlefw/plugins/mcsplugin/publisher/src/mcspluginengine.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/mcsplugin/publisher/src/mcspluginengine.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -187,7 +187,6 @@
             RMenuNotifier::EItemsReordered |
             RMenuNotifier::EItemAttributeChanged,
             iNotifyWatcher->iStatus );
-        
         iNotifyWatcher->WatchNotify( this );
         }
     }
@@ -275,30 +274,40 @@
 // skin definition from attribute and sets attributes to aMenuItem.
 // ---------------------------------------------------------------------------
 //
-CGulIcon* CMCSPluginEngine::ItemIconL( CMenuItem& aMenuItem, 
+CGulIcon* CMCSPluginEngine::ItemIconL( CMenuItem* aMenuItem, 
     const TDesC& aAttr )
     {
+    
     CMenuItem* menuItem;
 
-    TInt id = aMenuItem.Id();
+    // check if item exists in MCS
+    if ( aMenuItem )
+        { 
+        TInt id = aMenuItem->Id();
 
-    // because the flags might have changed, we have
-    // to get a fresh copy of menu item from Menu Server
-    CMenuItem* mi = CMenuItem::OpenL( iMenu, id );
-    TUint32 flags = mi->Flags();
-    delete mi;
+        // because the flags might have changed, we have
+        // to get a fresh copy of menu item from Menu Server
+        CMenuItem* mi = CMenuItem::OpenL( iMenu, id );
+        TUint32 flags = mi->Flags();
+        delete mi;
+
+        TUint32 isHidden = flags & TMenuItem::EHidden;
+        TUint32 isMissing = flags & TMenuItem::EMissing;
 
-    TUint32 isHidden = flags & TMenuItem::EHidden;
-    TUint32 isMissing = flags & TMenuItem::EMissing;
-
-    if ( iUndefinedItem && ( isHidden || isMissing ) )
+        if ( iUndefinedItem && ( isHidden || isMissing ) )
+            {
+            menuItem = iUndefinedItem;
+            }
+        else
+            {
+            menuItem = aMenuItem;
+            }
+        }
+    else 
         {
+        // item not found in MCS. Use Undefined Icon
         menuItem = iUndefinedItem;
         }
-    else
-        {
-        menuItem = &aMenuItem;
-        }
 
     CAknIcon* icon( NULL );
     CGulIcon* gIcon( NULL );
@@ -341,32 +350,42 @@
 // Returns text string for the given attribute
 // ---------------------------------------------------------------------------
 //
-TPtrC CMCSPluginEngine::ItemTextL( CMenuItem& aMenuItem, const TDesC& aAttr )
-    {    
-    // if item is hidden or missing (mmc card removed)
-    // use "Undefined" text instead
+TPtrC CMCSPluginEngine::ItemTextL( CMenuItem* aMenuItem, const TDesC& aAttr )
+    {
+
     CMenuItem* menuItem;
 
-    TInt id = aMenuItem.Id();
+    // check if item exists in MCS
+    if ( aMenuItem )
+        {
+        TInt id = aMenuItem->Id();
+
+        // because the flags might have changed, we have
+        // to get a fresh copy of the menu item from Menu Server
+        CMenuItem* mi = CMenuItem::OpenL( iMenu, id );
+        TUint32 flags = mi->Flags();
+        delete mi;
+
+        TUint32 isHidden = flags & TMenuItem::EHidden;
+        TUint32 isMissing = flags & TMenuItem::EMissing;
 
-    // because the flags might have changed, we have
-    // to get a fresh copy of the menu item from Menu Server
-    CMenuItem* mi = CMenuItem::OpenL( iMenu, id );
-    TUint32 flags = mi->Flags();
-    delete mi;
-
-    TUint32 isHidden = flags & TMenuItem::EHidden;
-    TUint32 isMissing = flags & TMenuItem::EMissing;
-
-    if ( iUndefinedItem && ( isHidden || isMissing ) )
+        // if item is hidden or missing (mmc card removed)
+        // use "Undefined" text instead
+        if ( iUndefinedItem && ( isHidden || isMissing ) )
+            {
+            menuItem = iUndefinedItem;
+            }
+        else
+            {
+            menuItem = aMenuItem;
+            }
+        }
+    else 
         {
+        // item not found in MCS. Use "Undefined" text
         menuItem = iUndefinedItem;
         }
-    else
-        {
-        menuItem = &aMenuItem;
-        }
-        
+    
     TBool exists( KErrNotFound );
     
     TPtrC name( menuItem->GetAttributeL( aAttr, exists ) );
@@ -393,9 +412,10 @@
         CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog(
             CAknNoteDialog::EConfirmationTone,
             CAknNoteDialog::ENoTimeout );
+        CleanupStack::PushL( dialog );
         dialog->SetTextL( temp->Des() );
         dialog->ExecuteDlgLD( R_MCS_DISABLE_OPEN_ITEM_DLG );
-        
+        CleanupStack::Pop( dialog );
         CleanupStack::PopAndDestroy( temp );        
         return;
         }
@@ -407,16 +427,34 @@
 
     TMCSData& dataItem( iPluginData->DataItemL( aIndex ) );
     
-    CMenuItem* item( CMenuItem::OpenL( iMenu, dataItem.MenuItem().Id() ) );
+    CMenuItem* item = NULL;
+    TRAP_IGNORE( item = CMenuItem::OpenL( iMenu, dataItem.MenuItem().Id() ) );
+
+    // item does not exist at all in MCS
+    if ( item == NULL )
+        {
+        HBufC* temp = StringLoader::LoadLC( R_MCS_DISABLE_OPEN_ITEM_MISSING );
+
+        CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog(
+            CAknNoteDialog::EConfirmationTone,
+            CAknNoteDialog::ENoTimeout );
+        CleanupStack::PushL( dialog );
+        dialog->SetTextL( temp->Des() );
+        dialog->ExecuteDlgLD( R_MCS_DISABLE_OPEN_ITEM_DLG );
+        CleanupStack::Pop( dialog );
+        CleanupStack::PopAndDestroy( temp );
+        temp = NULL;
+
+        return;
+        }
+
     CleanupStack::PushL( item );
-    
 
     TBool attrExists = ETrue;
 
     TPtrC uid = item->GetAttributeL( KMenuAttrUid, attrExists );
 
-    // trying to run non-existing application ( that was replaced by "Undefined" app )
-    // OR trying to run hidden or missing application (e.g. unistalled app 
+    // trying to run hidden or missing application (e.g. unistalled app 
     // or app on MMC which was removed )
     // -> We display a note for a user that this is not possible¨
     TUint32 isHidden = item->Flags() & TMenuItem::EHidden;
@@ -431,8 +469,10 @@
         CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog(
             CAknNoteDialog::EConfirmationTone,
             CAknNoteDialog::ENoTimeout );
+        CleanupStack::PushL( dialog );
         dialog->SetTextL( temp->Des() );
         dialog->ExecuteDlgLD( R_MCS_DISABLE_OPEN_ITEM_DLG );
+        CleanupStack::Pop( dialog );
         CleanupStack::PopAndDestroy( temp );
         temp = NULL;
 
@@ -567,28 +607,8 @@
     
     for ( TInt i = 0; i < count; i++ )
         {
-        TMCSData& data( iPluginData->DataItemL(i) );
+        TMCSData& data( iPluginData->DataItemL( i ) );
         data.SetDirty( ETrue );
-        
-        // Check that all the data still exist is MCS, if flag is hidden or
-        // missing, we have to remove data from UI
-        CMenuItem* menuItem = NULL; 
-
-        TRAP_IGNORE (
-                menuItem = CMenuItem::OpenL( iMenu, data.MenuItem().Id() );
-        )
-
-        // item not found. Use "Undefined" item as a replacement
-        if ( !menuItem )
-            {
-            CleanupStack::PushL( menuItem );
-            iPluginData->ReplaceMenuItemL( i, iUndefinedItemHeader );
-            iPluginData->SaveSettingsL( i, *iUndefinedItem );
-            CleanupStack::Pop( menuItem );
-            }
-
-        delete menuItem;
-        menuItem = NULL;
         }
 
     // Notification must be activated again
@@ -837,9 +857,9 @@
 // Creates bookmark menu item if it does not exist
 // ---------------------------------------------------------------------------
 //
-void CMCSPluginEngine::CreateBkmMenuItemsL()
+void CMCSPluginEngine::CreateRuntimeMenuItemsL()
     {
-    iPluginData->CreateBkmMenuItemsL();
+    iPluginData->CreateRuntimeMenuItemsL();
     }
 
 // End of file
--- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -557,33 +557,34 @@
     {
     if (aSettingIndex >= 0 && aSettingIndex < iSettings.Count())
         {
-        // Old setting type is bookmark. Remove bookmark item from MCS 
-        // if it was created in runtime.
-        if( iSettings[aSettingIndex].type == EBookmark )
-            {
-                iBkmList->RemoveMenuItemL( iSettings[aSettingIndex].id );
-            }
-
-        // Old setting type is application.
-        // Remove app item from MCS if it was created in runtime (mailbox).
-        if ( iSettings[ aSettingIndex ].type == EApplication )
-            {
-                iAppList->RemoveMenuItemL( iSettings[ aSettingIndex ].id );
-            }
-
-        iSettings[aSettingIndex].id = aId;
-        iSettings[aSettingIndex].type = aType;
+        TSettingItem oldItem = iSettings[ aSettingIndex ];
+        iSettings[ aSettingIndex ].id = aId;
+        iSettings[ aSettingIndex ].type = aType;
 
         if ( aType == EApplication )
             {
             CMenuItem& item = iAppList->ItemL( aId );
             SaveSettingsL( aSettingIndex, item );
             }
-        else
+         else
             {
             CMenuItem& item = iBkmList->ItemL( aId );
             SaveSettingsL( aSettingIndex, item );
             }
+        
+        // Old setting type is bookmark. Remove bookmark item from MCS 
+        // if it was created in runtime.
+        if ( oldItem.type == EBookmark )
+            {
+                iBkmList->RemoveMenuItemL( oldItem.id );
+            }
+
+        // Old setting type is application.
+        // Remove app item from MCS if it was created in runtime (mailbox).
+        if ( oldItem.type == EApplication )
+            {
+                iAppList->RemoveMenuItemL( oldItem.id );
+            }
 
         return ETrue;
         }
--- a/idlefw/plugins/sapidataplugin/group/sapidataplugin.mmp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/group/sapidataplugin.mmp	Mon Mar 15 12:41:53 2010 +0200
@@ -40,18 +40,20 @@
 END
 
 
-LIBRARY         euser.lib
-LIBRARY    	    bafl.lib
-LIBRARY         efsrv.lib
-LIBRARY    	    liwservicehandler.lib 
-LIBRARY         ecom.lib
-LIBRARY         aiutils.lib
-LIBRARY         cone.lib
-LIBRARY         avkon.lib
-LIBRARY         fbscli.lib
-LIBRARY         egul.lib
-LIBRARY         aknskins.lib  
-LIBRARY         charconv.lib 
+LIBRARY			euser.lib
+LIBRARY			bafl.lib
+LIBRARY			efsrv.lib
+LIBRARY			liwservicehandler.lib 
+LIBRARY			ecom.lib
+LIBRARY			aiutils.lib
+LIBRARY			cone.lib
+LIBRARY			avkon.lib
+LIBRARY			fbscli.lib
+LIBRARY			egul.lib
+LIBRARY			aknskins.lib  
+LIBRARY			charconv.lib 
+LIBRARY			estor.lib
+
 // End of File
 SOURCEPATH ../src
 
--- a/idlefw/plugins/sapidataplugin/inc/sapidata.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/inc/sapidata.h	Mon Mar 15 12:41:53 2010 +0200
@@ -270,14 +270,20 @@
     /**
     * Called by the observer to refresh the changed content
     *   
-    * @param aPublisher  publisher.
-    * @param aContentType  content type.
-    * @param aContentId content Id.
-    * @param aOperation operation (add/delete/update/execute).
+    * @param aPublisher     publisher.
+    * @param aContentType   content type.
+    * @param aContentId     content Id.
+    * @param aOperation     operation (add/delete/update/execute).
+    * @param aDataMap       data map if available. Can be NULL.
+    *                       Ownership NOT transferred.
+    * 
     * @return void
     */
-    void RefreshL( TDesC& aPublisher, TDesC& aContentType, 
-            TDesC& aContentId, TDesC& aOperation );
+    void RefreshL( TDesC& aPublisher,
+                   TDesC& aContentType, 
+                   TDesC& aContentId,
+                   TDesC& aOperation,
+                   CLiwDefaultMap* aDataMap );
      
     /**
     * Createts the filter map and push it in the stack
--- a/idlefw/plugins/sapidataplugin/inc/sapidataobserver.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/inc/sapidataobserver.h	Mon Mar 15 12:41:53 2010 +0200
@@ -37,8 +37,7 @@
 NONSHARABLE_CLASS( CSapiDataObserver ) : public CBase, 
     public MLiwNotifyCallback
     {
-public:
-    // constructor and destructor
+public: // constructor and destructor
     
     /**
     * Part of the two phased constuction
@@ -57,8 +56,7 @@
     */   
     ~CSapiDataObserver();
 
-private:
-    // construtors
+private:  // construtors
     
     /**
     * Constructor
@@ -77,8 +75,7 @@
     */
     void ConstructL( MLiwInterface* aInterface, CSapiData* aData );
        
-public:  
-    //from MLiwNotifyCallbackc
+public: //from MLiwNotifyCallback
     
     /**
     * Handles notifications caused by an asynchronous Execute*CmdL call
@@ -98,8 +95,7 @@
         CLiwGenericParamList& aEventParamList,
         const CLiwGenericParamList& /*aInParamList*/);
 
-public:
-    // new functions
+public:  // new functions
     
     /**
     * Registers to CPS for add, delete , update and execute notifications
@@ -114,15 +110,12 @@
     */
     void ReleaseL();
         
-private:
-    // data
+private: // data
     
     /** Interface Reference, not owned */    
     MLiwInterface* iInterface;   
     /** Reference of the sapi data, not owned */
     CSapiData* iData;    
-    /** Call back error code */
-    TInt iError;        
     };
 
 #endif // SAPIDATAOBSERVER_H
--- a/idlefw/plugins/sapidataplugin/inc/sapidataplugin.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/inc/sapidataplugin.h	Mon Mar 15 12:41:53 2010 +0200
@@ -30,6 +30,7 @@
 class MAiContentItemIterator;
 class CSapiData;
 class CGulIcon;
+class CLiwDefaultMap;
 
 /**
  *  @ingroup group_sapidataplugin
@@ -189,11 +190,15 @@
     /**
     * RefereshL a specific image of text in the widget
     *
-    * @param aContentType content type
-    * @param aOperation operation performed
+    * @param aContentType   content type
+    * @param aOperation     operation performed
+    * @param aDataMap       data map if available. Can be NULL.
+    *                       Ownership NOT transferred.
     * @return void
     */
-    void RefreshL(TDesC& aContentType, TDesC& aOperation);
+    void RefreshL( TDesC& aContentType,
+                   TDesC& aOperation,
+                   CLiwDefaultMap* aDataMap );
     
     /**
     * Is plugin active to publish the data 
--- a/idlefw/plugins/sapidataplugin/src/sapidata.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/src/sapidata.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -699,12 +699,15 @@
 // RefreshL
 // ---------------------------------------------------------------------------
 //
-void CSapiData::RefreshL( TDesC& aPublisher, TDesC& aContentType, 
-                TDesC& aContentId, TDesC& aOperation )
+void CSapiData::RefreshL( TDesC& aPublisher,
+                          TDesC& aContentType, 
+                          TDesC& aContentId,
+                          TDesC& aOperation,
+                          CLiwDefaultMap* aDataMap )
     {
      if ( CanUpdate( aPublisher, aContentType, aContentId ) )
     	 {
-    	 iPlugin->RefreshL( aContentType, aOperation);
+    	 iPlugin->RefreshL( aContentType, aOperation, aDataMap );
     	 }
     }
 
--- a/idlefw/plugins/sapidataplugin/src/sapidataobserver.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/src/sapidataobserver.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -19,6 +19,7 @@
 #include <liwservicehandler.h>
 #include <liwvariant.h>
 #include <liwgenericparam.h>
+#include <S32MEM.H>
 #include "sapidata.h"
 #include "sapidataobserver.h"
 #include "sapidatapluginconst.h"
@@ -56,9 +57,7 @@
     inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant(aRegistry)));
     inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant(aFilter)));
         
-    iError = KErrNone;
-    TRAP( iError, iInterface->ExecuteCmdL( 
-                KRequestNotification,
+    TRAP_IGNORE( iInterface->ExecuteCmdL(KRequestNotification,
                 *inParamList,
                 *outParamList,
                 0,
@@ -81,9 +80,7 @@
         CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
         CleanupStack::PushL( outParamList );
         
-        TInt err(KErrNone);
-        TRAP(err, iInterface->ExecuteCmdL( 
-                KRequestNotification,
+        TRAP_IGNORE( iInterface->ExecuteCmdL( KRequestNotification,
                 *inParamList,
                 *outParamList,
                 KLiwOptCancel,
@@ -129,7 +126,6 @@
     {
      
     // Is plugin active to refresh the published data
-	iError = aErrorCode;        
 	TInt count(0);
 	TInt pos(0);
 	const TLiwGenericParam* param(NULL);
@@ -178,31 +174,61 @@
 				  }
 			   }
 		   else if ( iData->IsPluginActive() ) 
-			   { 
-			   // notification from content registry
-			   found = map->FindL( KContentType, variant );
-			   if (found)
-				  {
-				  contentType = variant.AsDes().AllocLC();
-				  }
-			   variant.Reset();
-			   found = map->FindL( KContentId, variant );
-			   if (found)
-				  {
-				  contentId = variant.AsDes().AllocLC();
-				  }
-			   variant.Reset();
-			   iData->RefreshL( *publisher, *contentType, *contentId, *operation );
-			   
-			   if ( contentId )
-				   {
-				   CleanupStack::PopAndDestroy( contentId );
-				   }
-			  if ( contentType )
-				   {
-				   CleanupStack::PopAndDestroy( contentType );
-				   }
-			   }
+		       {                                              
+                // notification from content registry
+                found = map->FindL( KContentType, variant );
+                if( found )
+                    {
+                    contentType = variant.AsDes().AllocLC();
+                    }
+                variant.Reset();
+                
+                // content id
+                found = map->FindL( KContentId, variant );
+                if( found )
+                    {
+                    contentId = variant.AsDes().AllocLC();
+                    }
+                variant.Reset();
+                                
+                // Data map. Optional.
+                CLiwDefaultMap* dataMap = NULL;
+                
+                found = map->FindL( KDataMap, variant);
+                if( found )
+                    {
+                    TPtrC8 data = variant.AsData();                    
+                    RDesReadStream datastrm ( data );
+                    CleanupClosePushL( datastrm );
+                    dataMap = CLiwDefaultMap::NewLC( datastrm );
+                    // There is no CLiwDefaultMap::NewL( RReadStream )
+                    // so, must do some work with cleanup stack here.
+                    CleanupStack::Pop( dataMap );
+                    CleanupStack::PopAndDestroy(); // datastrm                    
+                    dataMap->PushL();
+                    }                
+                
+                iData->RefreshL( *publisher,
+                                 *contentType,
+                                 *contentId,
+                                 *operation,
+                                 dataMap );
+                
+                if( dataMap )
+                    {
+                    CleanupStack::PopAndDestroy( dataMap );
+                    }
+                
+                if( contentId )
+                    {
+                    CleanupStack::PopAndDestroy( contentId );
+                    }
+                
+                if( contentType )
+                    {
+                    CleanupStack::PopAndDestroy( contentType );
+                    }			  
+                }
 		   else
 			   {
 			   // remember update if plugin is in suspend mode
--- a/idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -362,33 +362,42 @@
 //Refresh a specific image of text in the widget
 // ---------------------------------------------------------------------------
 //
-void CSapiDataPlugin::RefreshL(TDesC& aContentType, TDesC& aOperation)
-    {     
-	 TInt observers( iObservers.Count() );        
-	 TInt transactionId = reinterpret_cast<TInt>( this );
-	 
-	 for ( TInt obsIndex = 0; obsIndex < observers; obsIndex++ )
-		{
-		MAiContentObserver* observer = iObservers[obsIndex];
-		
-		if ( observer->StartTransaction( transactionId ) == KErrNone ) 				
-			{
-			if ( aOperation != KOperationDelete )
-				{
-				iData->PublishL( observer, aContentType );
-				}
-			else
-				{
-				iData->RemoveL( observer, aContentType  );	
-				}
-			
-			observer->Commit( transactionId );
-			}
-		
-		 // Relese memory of the published text
-         iDataArray.ResetAndDestroy();
-		 iIconArray.Reset();
-		}	 
+void CSapiDataPlugin::RefreshL( TDesC& aContentType,
+                                TDesC& aOperation,
+                                CLiwDefaultMap* aDataMap )
+    {    
+    const TInt observerCount( iObservers.Count() );    
+    const TInt transactionId = reinterpret_cast<TInt>( this );
+    
+    for( TInt obsIndex = 0; obsIndex < observerCount; obsIndex++ )
+        {
+        MAiContentObserver* observer = iObservers[obsIndex];
+    
+        if( observer->StartTransaction( transactionId ) == KErrNone ) 				
+            {
+            if ( aOperation != KOperationDelete )
+                {
+                if( aDataMap )
+                    {
+                    iData->PublishDataL( observer, aDataMap );
+                    }
+                else
+                    {
+                    iData->PublishL( observer, aContentType );
+                    }            
+                }
+            else
+                {
+                iData->RemoveL( observer, aContentType  );
+                }
+    
+            observer->Commit( transactionId );
+            }
+    
+        // Relese memory of the published text
+        iDataArray.ResetAndDestroy();
+        iIconArray.Reset();
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -413,6 +422,7 @@
     {
     if( aReason == ESystemStartup )
         {
+        TRAP_IGNORE( PublishL() );
         TRAP_IGNORE( iData->SetStartupReasonL( KSystemStartup ));
         }
     else if( aReason == EPageStartup )
@@ -421,6 +431,7 @@
         }
     else if( aReason == EPluginStartup )
         {
+        TRAP_IGNORE( PublishL() );
         TRAP_IGNORE( iData->SetStartupReasonL( KPluginStartup));
         }
     }
@@ -600,17 +611,17 @@
         // Configurations 
         iData->ConfigureL( configurationItemsArr );
         
+        iPluginState = ESuspend;
+        
         // Activate the publisher
         iData->ChangePublisherStatusL( KActive );
-        iData->TriggerActiveL();
-                
         // Register for notifications
         iData->RegisterPublisherObserverL();
-        
-        PublishL();
-        
-        iPluginState = ESuspend;
-        
+        // Execute the active trigger 
+        iData->TriggerActiveL();
+        // There must be at least 1 milli second delay 
+        // to register the second observer as both are using the 
+        // same MLiwInterface object
         iData->RegisterContentObserverL();
         }
     
--- a/layers.sysdef.xml	Fri Mar 12 15:43:54 2010 +0200
+++ b/layers.sysdef.xml	Mon Mar 15 12:41:53 2010 +0200
@@ -16,7 +16,6 @@
   		<module name="homescreensrv_api_tests">
   			<unit unitID="hsdo.content_harvester.test" name="content_harvester.test" bldFile="&layer_real_source_path;/homescreensrv_plat/content_harvester_plugin_api/tsrc/group" mrp="" />
   			<unit unitID="hsdo.menu_content_service.test" name="menu_content_service.test" bldFile="&layer_real_source_path;/homescreensrv_plat/menu_content_service_api/tsrc/group" mrp="" />
-  			<unit unitID="hsdo.ai_utilities_api.test" name="ai_utilities_api.test" bldFile="&layer_real_source_path;/homescreensrv_plat/ai_utilities_api/internal/tsrc/group" mrp="" />
   			<unit unitID="hsdo.action_handler_plugin_api.test" name="action_handler_plugin_api.test" bldFile="&layer_real_source_path;/homescreensrv_plat/action_handler_plugin_api/tsrc/group" mrp="" />
   			<unit unitID="hsdo.menu_sat_interface_api.test" name="menu_sat_interface_api.test" bldFile="&layer_real_source_path;/homescreensrv_plat/menu_sat_interface_api/tsrc/group" mrp="" />
   			<unit unitID="hsdo.sapi_homescreenplugin.test" name="sapi_homescreenplugin.test" bldFile="&layer_real_source_path;/homescreensrv_plat/sapi_homescreenplugin/tsrc/group" mrp="" />
--- a/menucontentsrv/group/mcsmenuhandler.mmp	Fri Mar 12 15:43:54 2010 +0200
+++ b/menucontentsrv/group/mcsmenuhandler.mmp	Mon Mar 15 12:41:53 2010 +0200
@@ -57,6 +57,7 @@
 LIBRARY         cone.lib
 LIBRARY         efsrv.lib 
 LIBRARY         avkon.lib
+LIBRARY         charconv.lib
 
 SOURCEPATH      ../data
 START RESOURCE  200113DE.rss
--- a/menucontentsrv/handlerinc/menuuninstalloperation.h	Fri Mar 12 15:43:54 2010 +0200
+++ b/menucontentsrv/handlerinc/menuuninstalloperation.h	Mon Mar 15 12:41:53 2010 +0200
@@ -21,6 +21,7 @@
 
 #include <e32base.h>
 #include <SWInstApi.h>
+#include <widgetregistryclient.h>
 
 class RMenu;
 class CMenuItem;
@@ -51,11 +52,11 @@
 
     void ConstructL( CMenuItem& aItem );
 
-    void AppInfoL( const TUid& aAppUid, TPtrC8& aMimeType, TUid& aPackageUid );
+    void AppInfoL( const TUid& aAppUid, RBuf8& aMimeType, TUid& aPackageUid );
 
     TBool GetInstallPkgUidL( const TDesC& aAppFullName, TUid& aPackageUid );
     void GetJavaSuitUidL( const TUid& aAppUid, TUid& aPackageUid );
-    TBool IsWidgetL( const TUid& aAppUid );
+    TBool IsWidget( const TUid& aAppUid );
 
 private:    // from CActive
 
@@ -73,6 +74,7 @@
         }                   iState;
     SwiUI::RSWInstLauncher  iUninstaller;
     CMenuOperation*         iRemoveOperation;
+    RWidgetRegistryClientSession iWidgetRegistry;
     TInt                    iId;
     };
 
--- a/menucontentsrv/handlersrc/menuuninstalloperation.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/menucontentsrv/handlersrc/menuuninstalloperation.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -17,11 +17,11 @@
 #include <apgcli.h>
 #include <swi/sisregistrysession.h>
 #include <swi/sisregistryentry.h>
-#include <widgetregistryclient.h>
 #include <javaregistry.h>
 #include <javaregistrypackageentry.h>
 #include <javaregistryapplicationentry.h>
 #include <mcsmenuutils.h>
+#include <utf.h>
 #include "mcsdef.h"
 #include "mcsmenu.h"
 #include "mcsmenuitem.h"
@@ -44,6 +44,7 @@
     Cancel();
     iUninstaller.Close();
     delete iRemoveOperation;
+    iWidgetRegistry.Close();
     }
 
 // ---------------------------------------------------------
@@ -84,12 +85,12 @@
 //
 void CMenuUninstallOperation::ConstructL( CMenuItem& aItem )
     {
+    User::LeaveIfError( iWidgetRegistry.Connect() );
     TBool exists;
     TPtrC uidAttr( aItem.GetAttributeL( KMenuAttrUid, exists ) );
     TUint uid;
     TUid packageUid = KNullUid;
-    TPtrC8 mimeType;
-
+    
 
     if( !exists )
         {
@@ -112,13 +113,16 @@
     // Prepare parameters
     MenuUtils::GetTUint( uidAttr, uid );
     
+    
+    RBuf8 mimeType;
+    mimeType.CleanupClosePushL();
     AppInfoL( TUid::Uid( uid ), mimeType, packageUid );
 
     // Commence the uninstallations
     iUninstaller.Uninstall( iStatus, packageUid, mimeType );
     iObserverStatus = KRequestPending;
     if( mimeType == KMidletMimeType()
-            && IsWidgetL( TUid::Uid( uid ) ) )	
+            && IsWidget( TUid::Uid( uid ) ) )	
 		{
     	//we remove java type app(it will gain different uid
 		//during next install) and widget type app(it MIGHT get
@@ -131,7 +135,7 @@
     	//appscanner will hide it for later passible reinstallation 
     	iState = ERemoving;
     	}
-    
+    CleanupStack::PopAndDestroy( &mimeType );
     SetActive();
     }
 
@@ -139,7 +143,8 @@
 // CMenuUninstallOperation::AppInfo
 // ---------------------------------------------------------
 //
-void CMenuUninstallOperation::AppInfoL( const TUid& aAppUid, TPtrC8& aMimeType, TUid& aPackageUid )
+void CMenuUninstallOperation::AppInfoL( const TUid& aAppUid, 
+        RBuf8& aMimeType, TUid& aPackageUid )
 	{
 	TUid typeUid;
 	RApaLsSession apaLsSession;
@@ -152,12 +157,27 @@
     		typeUid == KMidletType )
         {
         GetJavaSuitUidL( aAppUid, aPackageUid );
-        aMimeType.Set( KMidletMimeType );
+        User::LeaveIfError( aMimeType.Create( KMidletMimeType() ) );
         }
-    else if( IsWidgetL( aAppUid ) )
+    else if( IsWidget( aAppUid ) )
         {
         aPackageUid = aAppUid;
-        aMimeType.Set( KWidgetMimeType );
+        CWidgetPropertyValue* widgetProperty( iWidgetRegistry.
+                GetWidgetPropertyValueL( aAppUid, EMimeType ) );
+        CleanupStack::PushL( widgetProperty );
+        TPtrC mimeType( *widgetProperty );
+        if (mimeType.Length() == 0)
+            {
+            User::LeaveIfError( aMimeType.Create( KWidgetMimeType() ) );
+            }
+        else 
+            {
+            HBufC8*  mimeType8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( mimeType );
+            CleanupStack::PushL( mimeType8 );
+            User::LeaveIfError( aMimeType.Create( *mimeType8 ) );
+            CleanupStack::PopAndDestroy( mimeType8 );
+            }
+        CleanupStack::PopAndDestroy( widgetProperty );
         }
     else
         {
@@ -167,7 +187,7 @@
         	{
         	aPackageUid = aAppUid;
         	}
-        aMimeType.Set( KAppMimeType );
+        User::LeaveIfError( aMimeType.Create( KAppMimeType() ) );
         }
 
     CleanupStack::PopAndDestroy( &apaLsSession );
@@ -278,21 +298,10 @@
 // ---------------------------------------------------------
 //
 
-TBool CMenuUninstallOperation::IsWidgetL( const TUid& aAppUid )
-	{
-	RWidgetRegistryClientSession widgetReg;
-	TBool isWidget;
-
-	if( KErrNone != widgetReg.Connect() )
-		{
-		return EFalse;
-		}
-	CleanupClosePushL( widgetReg);
-	isWidget = widgetReg.IsWidget( aAppUid );
-	CleanupStack::PopAndDestroy( &widgetReg );
-
-	return isWidget;
-	}
+TBool CMenuUninstallOperation::IsWidget( const TUid& aAppUid )
+    {
+    return iWidgetRegistry.IsWidget( aAppUid );
+    }
 
 // ---------------------------------------------------------
 // CMenuUninstallOperation::RunL
--- a/menucontentsrv/srvsrc/menusrvmain.cpp	Fri Mar 12 15:43:54 2010 +0200
+++ b/menucontentsrv/srvsrc/menusrvmain.cpp	Mon Mar 15 12:41:53 2010 +0200
@@ -16,7 +16,7 @@
 */
 
 // INCLUDE FILES
-#include <mw/memorymanager.h>
+#include <mw/MemoryManager.h>
 #include "menusrv.h"
 
 // ==================== LOCAL FUNCTIONS ====================