terminalsecurity/SCP/SCPHistoryPlugin/src/SCPHistoryPlugin.cpp
changeset 22 19fb38abab1d
parent 0 b497e44ab2fc
child 24 bf47f3b79154
equal deleted inserted replaced
5:3f7d9dbe57c8 22:19fb38abab1d
    97 	
    97 	
    98 	if ( iFs == NULL )
    98 	if ( iFs == NULL )
    99 	    {
    99 	    {
   100 	    return NULL; // Eventhandler not available
   100 	    return NULL; // Eventhandler not available
   101 	    }	
   101 	    }	
   102 	
       
   103 	// Insert the default security code into the history-buffer if not there yet
       
   104     {	        
       
   105     TInt errSCF = SetConfigFile ();
       
   106 	if (errSCF != KErrNone)
       
   107 	    {		
       
   108 		return NULL;
       
   109 		}
       
   110 		
       
   111     TInt historyItemCounter = 0;
       
   112     if ( GetHistoryItemCount( historyItemCounter ) != KErrNone )
       
   113 	    {
       
   114 	    Dprint ( ( _L( "CSCPHistoryPlugin::HandleEvent historyItemCounter = %d" ), historyItemCounter ) );
       
   115 	    // Hash the security code	
       
   116 		TBuf<KSCPPasscodeMaxLength> codeBuf;
       
   117 		TBuf<KSCPMaxHashLength> hashBuf;
       
   118 		
       
   119 		codeBuf.Copy( KSCPDefaultEnchSecCode );
       
   120 		hashBuf.Zero();
       
   121 		
       
   122 		iEventHandler->HashInput( codeBuf, hashBuf );		        
       
   123         
       
   124         CSCPParamObject* historyObject = NULL;
       
   125 	    TRAPD( err, historyObject = CSCPParamObject::NewL() );
       
   126 	    if ( err == KErrNone )
       
   127 	        {
       
   128  		    historyObject->Set( KHistoryCounterParamID, 1 );
       
   129 		    historyObject->Set( KHistoryItemParamBase, hashBuf );
       
   130         
       
   131             TRAP_IGNORE( historyObject->WriteToFileL( iCfgFilenamepath, iFs ) );
       
   132 	        }
       
   133 	    
       
   134 	    delete historyObject;
       
   135 	    }
       
   136     }
       
   137 	
       
   138 	
   102 	
   139 	// check for Case
   103 	// check for Case
   140     switch ( aID )
   104     switch ( aID )
   141         {
   105         {
   142 
   106