cellular/SSSettings/src/CSSSettingsRefreshHandler.cpp
changeset 15 d7fc66ccd6fb
parent 13 e32024264ebb
child 31 a2467631ae02
equal deleted inserted replaced
13:e32024264ebb 15:d7fc66ccd6fb
   229         // Refresh handling needed only if the refresh has happened.
   229         // Refresh handling needed only if the refresh has happened.
   230         iRCspCache.HandleRefresh();
   230         iRCspCache.HandleRefresh();
   231         iRSSSettings.HandleRefresh();
   231         iRSSSettings.HandleRefresh();
   232         }
   232         }
   233 
   233 
       
   234     TBool cspEfFound =  
       
   235         aFiles.Locate( KCsp1Ef ) != KErrNotFound || 
       
   236         aFiles.Locate( KCsp2Ef ) != KErrNotFound; 
       
   237 
       
   238     // KCspEf is no longer provided by SAT but GS and PS seem to depend on it, 
       
   239     // handled here for now. 
       
   240     TBool fileFound =  
       
   241         aFiles.Locate( iNotifyInfo->iObservedFile ) != KErrNotFound || 
       
   242         cspEfFound && iNotifyInfo->iObservedFile == KCspEf; 
       
   243 
       
   244 
   234     // By default refresh is allowed.
   245     // By default refresh is allowed.
   235     TBool allow(ETrue);
   246     TBool allow(ETrue);
   236 
   247 
   237     // Handle only if there is observer.
   248     // Handle only if there is observer.
   238     if ( iNotifyInfo->iObserver )
   249     if ( iNotifyInfo->iObserver )
   239         {
   250         {
   240         // Handle only if observer wants to listen this event.
   251         // Handle only if observer wants to listen this event.
   241         if ( iNotifyInfo->iObservedRefreshType & aType )
   252         if ( iNotifyInfo->iObservedRefreshType & aType )
   242             {
   253             {
   243             TInt changedFiles(0);     
   254             if ( aType != EFileChangeNotification || fileFound )
   244             // Only change notification will contain file list.
       
   245             if ( aType == EFileChangeNotification )
       
   246                 {              
       
   247                 if ( aFiles.Locate( KCspEf ) != KErrNotFound )
       
   248                     {
       
   249                     changedFiles += KCspEf;
       
   250                     }
       
   251                 // Check if the changed files is what is wanted to be listened.
       
   252                 changedFiles = changedFiles & iNotifyInfo->iObservedFile;
       
   253                 }
       
   254 
       
   255             // For change notification the filelist must contain files, for
       
   256             // other refresh types it is empty.
       
   257             if ( ( aType != EFileChangeNotification ) ||
       
   258                  ( ( aType == EFileChangeNotification ) && 
       
   259                    changedFiles ) )
       
   260                 {
   255                 {
   261                 if ( aFunctionality == ESSSettingsRefresh )
   256                 if ( aFunctionality == ESSSettingsRefresh )
   262                     {
   257                     {
   263                     // Inform the observer about the refresh event.
   258                     // Inform the observer about the refresh event.
   264                     iNotifyInfo->iObserver->Refresh(
   259                     iNotifyInfo->iObserver->Refresh(
   265                         aType,
   260                         aType, iNotifyInfo->iObservedFile );
   266                         ( TSatElementaryFiles ) changedFiles  );
   261                     iRSatRefresh->RefreshEFRead( cspEfFound );
   267                         
       
   268                     if ( aFiles.Locate( KCsp1Ef ) != KErrNotFound )
       
   269                         {
       
   270                         iRSatRefresh->RefreshEFRead( ETrue );
       
   271                         }
       
   272                     else if( aFiles.Locate( KCsp2Ef ) != KErrNotFound )
       
   273                         {
       
   274                         iRSatRefresh->RefreshEFRead( ETrue );
       
   275                         }
       
   276                     else
       
   277                         {
       
   278                         iRSatRefresh->RefreshEFRead( EFalse );
       
   279                         }
       
   280                     }
   262                     }
   281                 else // ESSSettingsAllowRefresh
   263                 else // ESSSettingsAllowRefresh
   282                     {
   264                     {
   283                     // Inform the observer about the coming refresh event.
   265                     // Inform the observer about the coming refresh event.
   284                     allow = iNotifyInfo->iObserver->AllowRefresh(
   266                     allow = iNotifyInfo->iObserver->AllowRefresh(
   285                         aType,
   267                         aType, iNotifyInfo->iObservedFile );
   286                         ( TSatElementaryFiles ) changedFiles );
       
   287                     }
   268                     }
   288                 }
   269                 }
   289             
   270             
   290             // If there is no client listening changed files SSSettings has to
   271             // If there is no client listening changed files SSSettings has to
   291             // check if some CSP file is into the list and send right response
   272             // check if some CSP file is into the list and send right response
   292             // since itself reads CSP files.    
   273             // since itself reads CSP files.    
   293             if ( !changedFiles )
   274             if ( !fileFound )
   294                 {
   275             	{
   295                 if ( aFiles.Locate( KCsp1Ef ) != KErrNotFound )
   276                 iRSatRefresh->RefreshEFRead( !cspEfFound );
   296                     {
       
   297                     iRSatRefresh->RefreshEFRead( EFalse );
       
   298                     }
       
   299                 else if( aFiles.Locate( KCsp2Ef ) != KErrNotFound )
       
   300                     {
       
   301                     iRSatRefresh->RefreshEFRead( EFalse );
       
   302                     }
       
   303                 else
       
   304                     {
       
   305                     iRSatRefresh->RefreshEFRead( ETrue );
       
   306                     }
       
   307                 }
   277                 }
   308             __SSSLOGSTRING1("[SSS]    DoHandleRefresh: changedFiles: %d", changedFiles);
       
   309             }
   278             }
   310         else
   279         else
   311             {
   280             {
   312             iRSatRefresh->RefreshEFRead( EFalse );    
       
   313             }
       
   314         }
       
   315 
       
   316     if ( !iNotifyInfo->iObserver && ( aType == EFileChangeNotification 
       
   317         || aType == ESimInitFileChangeNotification 
       
   318         || aType == ESimInit ) )
       
   319         {
       
   320         if ( aFiles.Locate( KCsp1Ef ) != KErrNotFound )
       
   321             {
       
   322             iRSatRefresh->RefreshEFRead( EFalse );
   281             iRSatRefresh->RefreshEFRead( EFalse );
   323             }
   282             }
   324         else if( aFiles.Locate( KCsp2Ef ) != KErrNotFound )
   283         }
   325             {
   284     else if ( aType == EFileChangeNotification 
   326             iRSatRefresh->RefreshEFRead( EFalse );
   285         || aType == ESimInitFileChangeNotification 
   327             }           
   286         || aType == ESimInit )
   328         else 
   287         {
   329             {
   288         iRSatRefresh->RefreshEFRead( !cspEfFound );
   330             iRSatRefresh->RefreshEFRead( ETrue );
   289         }
   331             }
   290     else 
   332         }   
   291         {
   333                 
   292         // Do nothing
       
   293         }
       
   294     	    	
   334     __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::DoHandleRefresh");
   295     __SSSLOGSTRING("[SSS] <--CSSSettingsRefreshHandler::DoHandleRefresh");
   335     return allow;
   296     return allow;
   336     }
   297     }
   337 
   298 
   338 // -----------------------------------------------------------------------------
   299 // -----------------------------------------------------------------------------