coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp
changeset 29 6a787171e1de
parent 21 c4cbaa4fb734
child 61 224b21efc2d4
equal deleted inserted replaced
28:b0b858956ed5 29:6a787171e1de
    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"
    46     {
    47     {
    47     RFs fileSession;
    48     RFs fileSession;
    48     RFile file;
    49     RFile file;
    49     User::LeaveIfError(fileSession.Connect());
    50     User::LeaveIfError(fileSession.Connect());
    50     TInt err = file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
    51     TInt err = file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
    51 
    52         
    52     if ( err != KErrNone )
    53     if ( err != KErrNone )
    53         {
    54         {
    54         RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , FileWrite : Failed to open the file"));
    55         RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , FileWrite : Failed to open the file"));
    55         return;
    56         return;
    56         }
    57         }
       
    58 
    57     TInt pos = 0;
    59     TInt pos = 0;
    58     file.Seek(ESeekEnd,pos);
    60     file.Seek(ESeekEnd,pos);
    59     TInt size = files.Count();
    61     TInt size = files.Count();
    60     RBuf filenameBuf;
    62     RBuf filenameBuf;
    61 
    63 
    72         fileText.Seek(ESeekStart);
    74         fileText.Seek(ESeekStart);
    73         fileText.Write(filenameBuf);
    75         fileText.Write(filenameBuf);
    74         CleanupStack::PopAndDestroy();//Filename
    76         CleanupStack::PopAndDestroy();//Filename
    75         file.Flush();
    77         file.Flush();
    76         }
    78         }
       
    79 
    77     file.Close();
    80     file.Close();
    78     fileSession.Close();    
    81     fileSession.Close();    
    79     }
    82     }
    80 
    83 
    81 static void MergeFilesL()
    84 static void MergeFilesL()
    91     TInt number_of_chars;
    94     TInt number_of_chars;
    92     
    95     
    93     User::LeaveIfError(fileSession.Connect());
    96     User::LeaveIfError(fileSession.Connect());
    94     TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
    97     TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
    95 
    98 
    96     TInt err1 = fileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
    99 		if(ret != KErrNone)
    97     
   100 			{
    98     fileName.Seek(ESeekEnd,pos);
   101 			RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
    99     if ( ret != KErrNone || err1 != KErrNone)
   102 			return;
   100             {
   103 			}
       
   104     ret = fileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
       
   105     if ( ret != KErrNone)
       
   106             {
       
   107             excludeFileName.Close();
   101             RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
   108             RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
   102             return;
   109             return;
   103             }
   110             }
       
   111     fileName.Seek(ESeekEnd,pos);
       
   112     
   104     HBufC* buffer = HBufC::NewMaxLC( buffer_size );        
   113     HBufC* buffer = HBufC::NewMaxLC( buffer_size );        
   105     TPtr8 bufferPtr( (TUint8*)buffer->Ptr(), buffer_size);
   114     TPtr8 bufferPtr( (TUint8*)buffer->Ptr(), buffer_size);
   106     
   115     
   107     TInt err(0);
   116     TInt err(0);
   108     err = excludeFileName.Size( size_of_script );
   117     err = excludeFileName.Size( size_of_script );
   151     
   160     
   152     RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL, Replace returned %d"),rev);
   161     RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL, Replace returned %d"),rev);
   153     
   162     
   154     file.Flush();
   163     file.Flush();
   155     file.Close();
   164     file.Close();
       
   165     dir.Close();
   156     fileSession.Close();
   166     fileSession.Close();
   157     
   167 
   158     Swi::RSisRegistrySession session;
   168     Swi::RSisRegistrySession session;
   159     CleanupClosePushL(session);
   169     CleanupClosePushL(session);
   160     User::LeaveIfError(session.Connect());
   170     User::LeaveIfError(session.Connect());
   161     
   171     
   162     // Get the installed application UIDs
   172     // Get the installed application UIDs
   454         aPath.Append( KScriptKeySeparator );
   464         aPath.Append( KScriptKeySeparator );
   455         aPath.AppendNumFixedWidthUC( KDeepFormatterRFSPlugin, EHex, KHexLength );
   465         aPath.AppendNumFixedWidthUC( KDeepFormatterRFSPlugin, EHex, KHexLength );
   456         aPath.Append( KScriptUidSeparator );
   466         aPath.Append( KScriptUidSeparator );
   457         INFO_1( "Script = '%S'", &aPath );
   467         INFO_1( "Script = '%S'", &aPath );
   458         }
   468         }
       
   469     else
       
   470         {
       
   471         RDebug::Print(_L("Resetting the KStartupFirstBoot value"));
       
   472 		CRepository* repository = CRepository::NewL(KCRUidStartup);
       
   473         CleanupStack::PushL( repository );
       
   474         repository->Reset(KStartupFirstBoot);
       
   475         CleanupStack::PopAndDestroy( repository );
       
   476         }
   459     }
   477     }
   460 
   478 
   461 // ---------------------------------------------------------------------------
   479 // ---------------------------------------------------------------------------
   462 // CFormatterRFSPlugin::ExecuteCustomCommandL
   480 // CFormatterRFSPlugin::ExecuteCustomCommandL
   463 // ---------------------------------------------------------------------------
   481 // ---------------------------------------------------------------------------