persistentstorage/centralrepository/cenrepsrv/srvrepos_noc.cpp
changeset 15 3eacc0623088
parent 14 15018f1726c7
child 17 55f2396f6d25
equal deleted inserted replaced
14:15018f1726c7 15:3eacc0623088
    78 	}
    78 	}
    79 	
    79 	
    80 /**
    80 /**
    81 Attempt to reset a single key to it's value in the file in the given location. Routine
    81 Attempt to reset a single key to it's value in the file in the given location. Routine
    82 attempts to find a .cre file first. If ( and only if ) a cre file doesn't exist the 
    82 attempts to find a .cre file first. If ( and only if ) a cre file doesn't exist the 
       
    83 routine attempts to find a txt file. In the presence of multi rofs, it needs to perform
       
    84 merging of all the rom keyspaces first before doing a reset, hence we are not able to perform
       
    85 the reading line by line for efficiency purpose.
       
    86 */
       
    87 #ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS	
       
    88 void CServerRepository::ResetFromIniFileL(TUint32 aId, 
       
    89 										  CIniFileIn::TIniFileOpenMode aIniFileOpenMode,
       
    90 										  TBool& aKeyFound)
       
    91 	{
       
    92 	aKeyFound=EFalse;
       
    93 
       
    94 	CSharedRepository* rep=NULL;
       
    95 	// Attempt to reset key to the aLocation if exist
       
    96 	//dont fail if repository not found
       
    97 	TServerResources::iObserver->LoadRepositoryLC(iRepository->Uid(),EFalse,rep,aIniFileOpenMode);
       
    98 	
       
    99 	if (rep)
       
   100 		{
       
   101 		TServerSetting* s = rep->GetSettings().Find(aId);					
       
   102 		if(s)
       
   103 			{
       
   104 			aKeyFound=ETrue;
       
   105 			// Mark the setting as default again
       
   106 			s->SetClean();
       
   107 			iRepository->ResetAndPersistL(*s);
       
   108 			s->SetAccessPolicy(GetFallbackAccessPolicy(aId));
       
   109 			}
       
   110 		}
       
   111 	CleanupStack::PopAndDestroy(rep);
       
   112 	}
       
   113 #else
       
   114 /**
       
   115 Attempt to reset a single key to it's value in the file in the given location. Routine
       
   116 attempts to find a .cre file first. If ( and only if ) a cre file doesn't exist the 
    83 routine attempts to find a txt file.
   117 routine attempts to find a txt file.
    84 Note that it would be possible to use LoadRepositoryLC here but for the txt file
   118 Note that it would be possible to use LoadRepositoryLC here but for the txt file
    85 that would take longer. This is because in LoadRepositoryLC the txt file is 
   119 that would take longer. This is because in LoadRepositoryLC the txt file is 
    86 completely processed. The Reset specific txt file opening code below is quicker because 
   120 completely processed. The Reset specific txt file opening code below is quicker because 
    87 it is just attempting to find the reset key.
   121 it is just attempting to find the reset key.
    88 */
   122 */
    89 #ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS	
       
    90 void CServerRepository::ResetFromIniFileL(TUint32 aId, 
       
    91 										  CIniFileIn::TIniFileOpenMode aIniFileOpenMode,
       
    92 										  TBool& aKeyFound)
       
    93 	{
       
    94 	aKeyFound=EFalse;
       
    95 
       
    96 	CSharedRepository* rep=NULL;
       
    97 	// Attempt to reset key to the aLocation if exist
       
    98 	//dont fail if repository not found
       
    99 	TServerResources::iObserver->LoadRepositoryLC(iRepository->Uid(),EFalse,rep,aIniFileOpenMode);
       
   100 	
       
   101 	if (rep)
       
   102 		{
       
   103 		TServerSetting* s = rep->GetSettings().Find(aId);					
       
   104 		if(s)
       
   105 			{
       
   106 			aKeyFound=ETrue;
       
   107 			// Mark the setting as default again
       
   108 			s->SetClean();
       
   109 			iRepository->ResetAndPersistL(*s);
       
   110 			s->SetAccessPolicy(GetFallbackAccessPolicy(aId));
       
   111 			}
       
   112 		}
       
   113 	CleanupStack::PopAndDestroy(rep);
       
   114 	}
       
   115 #else
       
   116 void CServerRepository::ResetFromIniFileL(TUint32 aId, 
   123 void CServerRepository::ResetFromIniFileL(TUint32 aId, 
   117 										  TCentRepLocation aLocation,
   124 										  TCentRepLocation aLocation,
   118 										  TBool& aKeyFound)
   125 										  TBool& aKeyFound)
   119 	{
   126 	{
   120 	aKeyFound=EFalse;
   127 	aKeyFound=EFalse;