webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp
branchRCL_3
changeset 36 c711bdda59f4
parent 35 1f3c3f2f5b0a
child 48 79859ed3eea9
equal deleted inserted replaced
35:1f3c3f2f5b0a 36:c711bdda59f4
    17  
    17  
    18 
    18 
    19 #include "wrtharvesterpsnotifier.h"
    19 #include "wrtharvesterpsnotifier.h"
    20 #include "wrtharvester.h"
    20 #include "wrtharvester.h"
    21 #include <UikonInternalPSKeys.h>//For MMC Observing
    21 #include <UikonInternalPSKeys.h>//For MMC Observing
    22 #include <usbmsshared.h>//For USB monitor
       
    23 #include <startupdomainpskeys.h> // For shutdown observer
    22 #include <startupdomainpskeys.h> // For shutdown observer
       
    23 #include <UsbWatcherInternalPSKeys.h>// for Mass storage mode observing
       
    24 #include <usbpersonalityids.h>
    24 
    25 
    25 // ============================ MEMBER FUNCTIONS =============================
    26 // ============================ MEMBER FUNCTIONS =============================
    26 
    27 
    27 // ---------------------------------------------------------------------------
    28 // ---------------------------------------------------------------------------
    28 // Creates an instance of CCHPluginNotifier implementation
    29 // Creates an instance of CCHPluginNotifier implementation
    70 //
    71 //
    71 void CWrtHarvesterPSNotifier::ConstructL()
    72 void CWrtHarvesterPSNotifier::ConstructL()
    72     {
    73     {
    73     CActiveScheduler::Add( this );
    74     CActiveScheduler::Add( this );
    74     TInt r(KErrNone);
    75     TInt r(KErrNone);
    75     if( iKey != EWidgetMMCAltered  )
    76     if( iKey != EWidgetMassStorageMode  )
    76     	{	
    77     	{	
    77     	// define property to be integer type
    78     	// define property to be integer type
    78     	r = RProperty::Define( KPropertyCat, iKey, RProperty::EInt );
    79     	r = RProperty::Define( KPropertyCat, iKey, RProperty::EInt );
    79     	}
    80     	}
    80 
    81 
    81     if ( r != KErrAlreadyExists && r != KErrNone )
    82     if ( r != KErrAlreadyExists && r != KErrNone )
    82         {
    83         {
    83         User::LeaveIfError( r );
    84         User::LeaveIfError( r );
    84         }
    85         }
    85     // Attach the key
    86     // Attach the key
    86     if( iKey == EWidgetMMCAltered )
    87     if( iKey == EWidgetMassStorageMode )
    87 		{
    88         {
    88 		User::LeaveIfError( iProperty.Attach( KPSUidUikon,KUikMMCInserted ));
    89         User::LeaveIfError( iProperty.Attach( KPSUidUsbWatcher,KUsbWatcherSelectedPersonality));
    89 		}
       
    90     else if( iKey == EWidgetMassStorageMode )
       
    91         {
       
    92         User::LeaveIfError( iProperty.Attach( KUsbMsDriveState_Category,EUsbMsDriveState_DriveStatus ));
       
    93         }    	
    90         }    	
    94     else if( iKey == EWidgetSystemShutdown )
    91     else if( iKey == EWidgetSystemShutdown )
    95         {
    92         {
    96         User::LeaveIfError( iProperty.Attach( KPSUidStartup,KPSGlobalSystemState  ));
    93         User::LeaveIfError( iProperty.Attach( KPSUidStartup,KPSGlobalSystemState  ));
    97         }    	
    94         }    	
   131     iProperty.Subscribe( iStatus );
   128     iProperty.Subscribe( iStatus );
   132     SetActive();
   129     SetActive();
   133     
   130     
   134     TInt value( 0 );
   131     TInt value( 0 );
   135     TInt r (KErrNone);
   132     TInt r (KErrNone);
   136     TUsbMsDrivesStatus allDrivesStatus;
   133     
   137     if( iKey != EWidgetMMCAltered && iKey != EWidgetMassStorageMode )
   134     if( iKey != EWidgetMassStorageMode )
   138     	{
   135     	{
   139     		if (iKey == EWidgetSystemShutdown)
   136     		if (iKey == EWidgetSystemShutdown)
   140     	        GetValue( value);
   137     	        GetValue( value);
   141     	    else
   138     	    else
   142     	        iProperty.Get( KPropertyCat, iKey, value );	
   139     	        iProperty.Get( KPropertyCat, iKey, value );	
   143     	}    
   140     	}    
   144     else
   141     else
   145         {        
   142         {        
   146         r = iProperty.Get( allDrivesStatus );
   143         r = iProperty.Get( value );
   147         }
   144         }
       
   145 
       
   146 #ifdef _DEBUG    
       
   147     RDebug::Print(_L("KEY %d   VALUE %d "),iKey,value);        
       
   148 #endif
       
   149         
   148     if( r == KErrNone )
   150     if( r == KErrNone )
   149         {
   151         {
   150         if( iKey == EWidgetUIState && value == 1 )
   152         if( iKey == EWidgetUIState && value == 1 )
   151             {
   153             {
   152             iHarvester->TryLaunchNextOperationL();
   154             iHarvester->TryLaunchNextOperationL();
   157             SetValue(1);
   159             SetValue(1);
   158             }
   160             }
   159         else if( iKey == EWidgetUIState && value == 3 )
   161         else if( iKey == EWidgetUIState && value == 3 )
   160             {            
   162             {            
   161             iHarvester->SetReinstallWidget(ETrue);
   163             iHarvester->SetReinstallWidget(ETrue);
   162             }        
   164             }    
       
   165         else if( iKey == EWidgetMassStorageMode  )
       
   166             {
       
   167             if( value == KUsbPersonalityIdMS )
       
   168                 {
       
   169 #ifdef _DEBUG                    
       
   170                 RDebug::Print(_L("WE are in mass storage mode"));
       
   171 #endif                    
       
   172                 iHarvester->SetMSMode(1);    
       
   173                 }
       
   174                 else
       
   175                 {
       
   176 #ifdef _DEBUG                    
       
   177                 RDebug::Print(_L("NO LONGER in mass storage mode"));
       
   178 #endif                    
       
   179                 iHarvester->SetMSMode(0);
       
   180                 }
       
   181             }
   163         else if( iKey == EWidgetRegAltered && value == 1 )
   182         else if( iKey == EWidgetRegAltered && value == 1 )
   164             {
   183             {
   165             if(iHarvester->IsInMSMode())
   184             if(iHarvester->IsInMSMode())
   166                 {
   185                 {
   167                 iHarvester->SetRegistryAccess(EFalse);
   186                 iHarvester->SetRegistryAccess(EFalse);