coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp
branchRCL_3
changeset 30 fc3225a0ab43
parent 24 a72ff4214918
child 39 469fa8a78de7
equal deleted inserted replaced
24:a72ff4214918 30:fc3225a0ab43
    21 #include <driveinfo.h>
    21 #include <driveinfo.h>
    22 #include <swi/sisregistrysession.h>
    22 #include <swi/sisregistrysession.h>
    23 #include <swi/sisregistryentry.h>
    23 #include <swi/sisregistryentry.h>
    24 #include <swi/sisregistrypackage.h>
    24 #include <swi/sisregistrypackage.h>
    25 #include <mmf/common/mmfcontrollerpluginresolver.h>
    25 #include <mmf/common/mmfcontrollerpluginresolver.h>
       
    26 #include <starterdomaincrkeys.h>
    26 // USER INCLUDE
    27 // USER INCLUDE
    27 #include "formatterrfsplugin.h"
    28 #include "formatterrfsplugin.h"
    28 #include "formatterrfspluginprivatecrkeys.h"
    29 #include "formatterrfspluginprivatecrkeys.h"
    29 #include "formatterrfsplugincommon.h"
    30 #include "formatterrfsplugincommon.h"
    30 #include "trace.h"
    31 #include "trace.h"
    84     {
    85     {
    85     
    86     
    86     RFs fileSession;
    87     RFs fileSession;
    87     RFile excludeFileName;
    88     RFile excludeFileName;
    88     
    89     
    89     RFile fileName;
       
    90     TInt pos = 0;
       
    91     TInt size_of_script( 0 );
       
    92     TInt buffer_size( sizeof(TText) );
       
    93     TInt number_of_chars;
       
    94     
       
    95     User::LeaveIfError(fileSession.Connect());
    90     User::LeaveIfError(fileSession.Connect());
    96     TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
    91     TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
    97 
    92 
    98 		if(ret != KErrNone)
    93 		if(ret != KErrNone)
    99 			{
    94 			{
   100 			RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
    95 			RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
   101 			return;
    96 			return;
   102 			}
    97 			}
   103     ret = fileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
       
   104     if ( ret != KErrNone)
       
   105             {
       
   106             excludeFileName.Close();
       
   107             RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
       
   108             return;
       
   109             }
       
   110     fileName.Seek(ESeekEnd,pos);
       
   111     
       
   112     HBufC* buffer = HBufC::NewMaxLC( buffer_size );        
       
   113     TPtr8 bufferPtr( (TUint8*)buffer->Ptr(), buffer_size);
       
   114     
       
   115     TInt err(0);
       
   116     err = excludeFileName.Size( size_of_script );
       
   117     number_of_chars = size_of_script / sizeof(TText);
       
   118 
       
   119     TInt i(0);
       
   120     for (i = 0; i < number_of_chars; i++)
       
   121        {
       
   122        if ( err == KErrNone )
       
   123             {
       
   124             err = excludeFileName.Read( bufferPtr);                
       
   125             }
       
   126         fileName.Write(bufferPtr);
       
   127         }
       
   128     fileName.Flush();
       
   129     fileName.Close();
       
   130     
       
   131     excludeFileName.Close();
    98     excludeFileName.Close();
       
    99 
       
   100     CFileMan* fileMan=CFileMan::NewL(fileSession);
       
   101     CleanupStack::PushL(fileMan);
       
   102  
       
   103     TInt result=fileMan->Copy(_L("c:\\private\\100059C9\\excludelist.txt"),_L("c:\\private\\100059C9\\excludelistcache.txt"),CFileMan::EOverWrite);
       
   104 		RDebug::Print(_L("CFormatterRFSPlugin::MergeFilesL copying the excludelist.txt to excludelistcache.txt , CFileMan::Copy returned = %d"), result);   
       
   105     CleanupStack::PopAndDestroy(fileMan);
       
   106 
   132     fileSession.Close();
   107     fileSession.Close();
   133     CleanupStack::PopAndDestroy();//buffer
       
   134 
       
   135     }
   108     }
   136 
   109 
   137 static HBufC* ExcludeListNameL( TChar aSystemDrive )
   110 static HBufC* ExcludeListNameL( TChar aSystemDrive )
   138     {
   111     {
   139     FUNC_LOG;
   112     FUNC_LOG;
   463         aPath.Append( KScriptKeySeparator );
   436         aPath.Append( KScriptKeySeparator );
   464         aPath.AppendNumFixedWidthUC( KDeepFormatterRFSPlugin, EHex, KHexLength );
   437         aPath.AppendNumFixedWidthUC( KDeepFormatterRFSPlugin, EHex, KHexLength );
   465         aPath.Append( KScriptUidSeparator );
   438         aPath.Append( KScriptUidSeparator );
   466         INFO_1( "Script = '%S'", &aPath );
   439         INFO_1( "Script = '%S'", &aPath );
   467         }
   440         }
       
   441     else
       
   442         {
       
   443         RDebug::Print(_L("Resetting the KStartupFirstBoot value"));
       
   444 		CRepository* repository = CRepository::NewL(KCRUidStartup);
       
   445         CleanupStack::PushL( repository );
       
   446         repository->Reset(KStartupFirstBoot);
       
   447         CleanupStack::PopAndDestroy( repository );
       
   448         }
   468     }
   449     }
   469 
   450 
   470 // ---------------------------------------------------------------------------
   451 // ---------------------------------------------------------------------------
   471 // CFormatterRFSPlugin::ExecuteCustomCommandL
   452 // CFormatterRFSPlugin::ExecuteCustomCommandL
   472 // ---------------------------------------------------------------------------
   453 // ---------------------------------------------------------------------------