homescreensrv_plat/sapi_homescreenplugin/hspsservice/src/hspsconfigurationservice.cpp
branchRCL_3
changeset 74 edd621764147
parent 0 79c6a41cd166
--- a/homescreensrv_plat/sapi_homescreenplugin/hspsservice/src/hspsconfigurationservice.cpp	Tue Apr 27 16:57:49 2010 +0300
+++ b/homescreensrv_plat/sapi_homescreenplugin/hspsservice/src/hspsconfigurationservice.cpp	Tue May 11 16:30:05 2010 +0300
@@ -62,6 +62,7 @@
 //
 CHspsConfigurationService::~CHspsConfigurationService()
     {
+    iProperty.Close();
     iPluginIds.Close();
     if(iHspsRequestClient)
         {
@@ -85,7 +86,7 @@
 // ---------------------------------------------------------------------------
 //
 CHspsConfigurationService::CHspsConfigurationService() :
-    iInvalidODT ( ETrue )
+        iODTVersion( 0 )
     {
     }
 
@@ -113,11 +114,49 @@
 		User::Leave( KErrNotFound );
 		}
 
-    // If current ODT is invalidated, then update it.
-    if( iInvalidODT )
-        {
-        GetODTL( iHspsODT->RootUid() );
-        }	
+     if( iODTVersion < 1 )
+         {
+         GetODTL( iHspsODT->RootUid() );         
+         }     
+     
+     // Get app uid/key
+     TInt key = 0;
+     GetAppUidL( key );
+     if( key < 1 )
+         {
+         User::Leave( KErrNotFound );
+         }
+     
+     if( iODTVersion < 1 )
+         {
+         User::LeaveIfError( 
+             iProperty.Attach( 
+                 KPropertyHspsCat, 
+                 key ) 
+                 );
+         User::LeaveIfError( 
+             iProperty.Get( 
+                 KPropertyHspsCat, 
+                 key, 
+                 iODTVersion ) 
+                 );         
+         }
+     else
+         {
+         // Check whether the ODT needs to be updated
+         TInt latestVersion( -1 );
+         User::LeaveIfError( 
+             iProperty.Get( 
+                 KPropertyHspsCat, 
+                 key,
+                 latestVersion ) 
+                 );      
+         if( latestVersion != iODTVersion )
+             {
+             GetODTL( iHspsODT->RootUid() );
+             iODTVersion = latestVersion;
+             }              
+         }
 	
 	return iHspsODT->DomDocument();
 	}
@@ -152,7 +191,7 @@
     else
         {
         // ODT is now valid.
-        iInvalidODT = EFalse;
+
         /*
         // Start observing ODT changes
         if ( EhspsServiceRequestSheduled != iHspsRequestClient->hspsGetODTUpdate() )
@@ -211,7 +250,7 @@
 // -----------------------------------------------------------------------------
 EXPORT_C void CHspsConfigurationService::InvalidateODT()
     {
-    iInvalidODT = ETrue;
+    iODTVersion = 0;
     }
 
 // -----------------------------------------------------------------------------