homescreensrv_plat/sapi_homescreenplugin/src/hspsconfigurationif.cpp
changeset 4 1a2a00e78665
parent 0 79c6a41cd166
child 12 502e5d91ad42
--- a/homescreensrv_plat/sapi_homescreenplugin/src/hspsconfigurationif.cpp	Tue Jan 26 12:11:15 2010 +0200
+++ b/homescreensrv_plat/sapi_homescreenplugin/src/hspsconfigurationif.cpp	Tue Feb 02 00:23:10 2010 +0200
@@ -243,6 +243,10 @@
         {
         TRAP( err, SetActivePluginL( aInParamList, aOutParamList ) );
         }
+    else if ( aCmdName.CompareF( KRestoreConfigurations ) == 0 )
+        {
+        TRAP( err, RestoreConfigurationsL( aInParamList, aOutParamList ) );
+        }
     //UNKNOWN COMMAND
     else
         {
@@ -1159,6 +1163,54 @@
 
     }
 
+
+// -----------------------------------------------------------------------------
+// Restores plugin configurations when the client has panicked
+// -----------------------------------------------------------------------------
+//
+void CHSPSConfigurationIf::RestoreConfigurationsL( 
+    const CLiwGenericParamList& aInParamList, 
+    CLiwGenericParamList& aOutParamList )
+    {                
+    // Get restore parameter
+    const TLiwGenericParam* inParam;
+    TInt pos = 0;
+    
+    inParam = aInParamList.FindFirst( 
+        pos, 
+        KHspsLiwRestore );    
+    if ( !inParam )
+        {
+        // Manadatory parameter missing
+        User::Leave( KErrArgument );
+        }
+    
+    TLiwVariant inParamVariant = inParam->Value();
+    TPtrC8 restore( inParamVariant.AsData() );
+    
+    TBool restoreAll = EFalse;            
+    if( restore.CompareF( KHspsLiwRestoreAll ) == 0 )
+        {
+        restoreAll = ETrue;
+        }
+    else if( restore.CompareF( KHspsLiwRestoreActive ) != 0 )
+        {
+        User::Leave( KErrArgument );
+        }           
+    
+    // Get client application's uid
+    TInt appUid;
+    iHspsConfigurationService->GetAppUidL( appUid );
+        
+    iHspsPersonalisationService->RestoreConfigurationsL( appUid, restoreAll );
+
+    // Invalidate ODT.
+    iHspsConfigurationService->InvalidateODT();
+    
+    // Create output parameters
+    CHspsLiwUtilities::RestoreConfigurationsOutputL( aOutParamList );
+    }
+
 // ======== GLOBAL FUNCTIONS ===================================================