homescreensrv_plat/sapi_homescreenplugin/hspsservice/src/hspsconfigurationservice.cpp
branchRCL_3
changeset 19 edd621764147
parent 0 79c6a41cd166
equal deleted inserted replaced
16:b276298d5729 19:edd621764147
    60 // Destructor.
    60 // Destructor.
    61 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    62 //
    62 //
    63 CHspsConfigurationService::~CHspsConfigurationService()
    63 CHspsConfigurationService::~CHspsConfigurationService()
    64     {
    64     {
       
    65     iProperty.Close();
    65     iPluginIds.Close();
    66     iPluginIds.Close();
    66     if(iHspsRequestClient)
    67     if(iHspsRequestClient)
    67         {
    68         {
    68         iHspsRequestClient->hspsCancelGetODTUpdate();
    69         iHspsRequestClient->hspsCancelGetODTUpdate();
    69         }
    70         }
    83 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    84 // Constructor.
    85 // Constructor.
    85 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    86 //
    87 //
    87 CHspsConfigurationService::CHspsConfigurationService() :
    88 CHspsConfigurationService::CHspsConfigurationService() :
    88     iInvalidODT ( ETrue )
    89         iODTVersion( 0 )
    89     {
    90     {
    90     }
    91     }
    91 
    92 
    92 // ---------------------------------------------------------------------------
    93 // ---------------------------------------------------------------------------
    93 // Two-phased constructor.
    94 // Two-phased constructor.
   111 		{		
   112 		{		
   112 		//Odt is not parsed, leave.
   113 		//Odt is not parsed, leave.
   113 		User::Leave( KErrNotFound );
   114 		User::Leave( KErrNotFound );
   114 		}
   115 		}
   115 
   116 
   116     // If current ODT is invalidated, then update it.
   117      if( iODTVersion < 1 )
   117     if( iInvalidODT )
   118          {
   118         {
   119          GetODTL( iHspsODT->RootUid() );         
   119         GetODTL( iHspsODT->RootUid() );
   120          }     
   120         }	
   121      
       
   122      // Get app uid/key
       
   123      TInt key = 0;
       
   124      GetAppUidL( key );
       
   125      if( key < 1 )
       
   126          {
       
   127          User::Leave( KErrNotFound );
       
   128          }
       
   129      
       
   130      if( iODTVersion < 1 )
       
   131          {
       
   132          User::LeaveIfError( 
       
   133              iProperty.Attach( 
       
   134                  KPropertyHspsCat, 
       
   135                  key ) 
       
   136                  );
       
   137          User::LeaveIfError( 
       
   138              iProperty.Get( 
       
   139                  KPropertyHspsCat, 
       
   140                  key, 
       
   141                  iODTVersion ) 
       
   142                  );         
       
   143          }
       
   144      else
       
   145          {
       
   146          // Check whether the ODT needs to be updated
       
   147          TInt latestVersion( -1 );
       
   148          User::LeaveIfError( 
       
   149              iProperty.Get( 
       
   150                  KPropertyHspsCat, 
       
   151                  key,
       
   152                  latestVersion ) 
       
   153                  );      
       
   154          if( latestVersion != iODTVersion )
       
   155              {
       
   156              GetODTL( iHspsODT->RootUid() );
       
   157              iODTVersion = latestVersion;
       
   158              }              
       
   159          }
   121 	
   160 	
   122 	return iHspsODT->DomDocument();
   161 	return iHspsODT->DomDocument();
   123 	}
   162 	}
   124 
   163 
   125 // -----------------------------------------------------------------------------
   164 // -----------------------------------------------------------------------------
   150         User::Leave( KErrNotFound );    
   189         User::Leave( KErrNotFound );    
   151         }
   190         }
   152     else
   191     else
   153         {
   192         {
   154         // ODT is now valid.
   193         // ODT is now valid.
   155         iInvalidODT = EFalse;
   194 
   156         /*
   195         /*
   157         // Start observing ODT changes
   196         // Start observing ODT changes
   158         if ( EhspsServiceRequestSheduled != iHspsRequestClient->hspsGetODTUpdate() )
   197         if ( EhspsServiceRequestSheduled != iHspsRequestClient->hspsGetODTUpdate() )
   159             {
   198             {
   160 #ifdef HSPS_LOG_ACTIVE
   199 #ifdef HSPS_LOG_ACTIVE
   209 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   210 // See header for comments.
   249 // See header for comments.
   211 // -----------------------------------------------------------------------------
   250 // -----------------------------------------------------------------------------
   212 EXPORT_C void CHspsConfigurationService::InvalidateODT()
   251 EXPORT_C void CHspsConfigurationService::InvalidateODT()
   213     {
   252     {
   214     iInvalidODT = ETrue;
   253     iODTVersion = 0;
   215     }
   254     }
   216 
   255 
   217 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------
   218 // Gets application configuration family
   257 // Gets application configuration family
   219 // -----------------------------------------------------------------------------
   258 // -----------------------------------------------------------------------------