webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 62 c711bdda59f4
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    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 <startupdomainpskeys.h> // For shutdown observer
    22 #include <usbmsshared.h>//For USB monitor
    23 #include <UsbWatcherInternalPSKeys.h>// for Mass storage mode observing
       
    24 #include <usbpersonalityids.h>
       
    25 
    23 
    26 // ============================ MEMBER FUNCTIONS =============================
    24 // ============================ MEMBER FUNCTIONS =============================
    27 
    25 
    28 // ---------------------------------------------------------------------------
    26 // ---------------------------------------------------------------------------
    29 // Creates an instance of CCHPluginNotifier implementation
    27 // Creates an instance of CCHPluginNotifier implementation
    71 //
    69 //
    72 void CWrtHarvesterPSNotifier::ConstructL()
    70 void CWrtHarvesterPSNotifier::ConstructL()
    73     {
    71     {
    74     CActiveScheduler::Add( this );
    72     CActiveScheduler::Add( this );
    75     TInt r(KErrNone);
    73     TInt r(KErrNone);
    76     if( iKey != EWidgetMassStorageMode  )
    74     if( iKey != EWidgetMMCAltered  )
    77     	{	
    75     	{	
    78     	// define property to be integer type
    76     	// define property to be integer type
    79     	r = RProperty::Define( KPropertyCat, iKey, RProperty::EInt );
    77     	r = RProperty::Define( KPropertyCat, iKey, RProperty::EInt );
    80     	}
    78     	}
    81 
    79 
    82     if ( r != KErrAlreadyExists && r != KErrNone )
    80     if ( r != KErrAlreadyExists || r != KErrNone )
    83         {
    81         {
    84         User::LeaveIfError( r );
    82         User::LeaveIfError( r );
    85         }
    83         }
    86     // Attach the key
    84     // Attach the key
    87     if( iKey == EWidgetMassStorageMode )
    85     if( iKey == EWidgetMMCAltered )
       
    86 		{
       
    87 		User::LeaveIfError( iProperty.Attach( KPSUidUikon,KUikMMCInserted ));
       
    88 		}
       
    89     else if( iKey == EWidgetMassStorageMode )
    88         {
    90         {
    89         User::LeaveIfError( iProperty.Attach( KPSUidUsbWatcher,KUsbWatcherSelectedPersonality));
    91         User::LeaveIfError( iProperty.Attach( KUsbMsDriveState_Category,EUsbMsDriveState_DriveStatus ));
    90         }    	
       
    91     else if( iKey == EWidgetSystemShutdown )
       
    92         {
       
    93         User::LeaveIfError( iProperty.Attach( KPSUidStartup,KPSGlobalSystemState  ));
       
    94         }    	
    92         }    	
    95     else
    93     else
    96     	{
    94     	{
    97     	User::LeaveIfError( iProperty.Attach( KPropertyCat, iKey));
    95     	User::LeaveIfError( iProperty.Attach( KPropertyCat, iKey));
    98    	 	}
    96    	 	}
   128     iProperty.Subscribe( iStatus );
   126     iProperty.Subscribe( iStatus );
   129     SetActive();
   127     SetActive();
   130     
   128     
   131     TInt value( 0 );
   129     TInt value( 0 );
   132     TInt r (KErrNone);
   130     TInt r (KErrNone);
   133     
   131     TUsbMsDrivesStatus allDrivesStatus;
   134     if( iKey != EWidgetMassStorageMode )
   132     if( iKey != EWidgetMMCAltered && iKey != EWidgetMassStorageMode )
   135     	{
   133     	{
   136     		if (iKey == EWidgetSystemShutdown)
   134     	iProperty.Get( KPropertyCat, iKey, value );	
   137     	        GetValue( value);
       
   138     	    else
       
   139     	        iProperty.Get( KPropertyCat, iKey, value );	
       
   140     	}    
   135     	}    
   141     else
   136     else
   142         {        
   137         {        
   143         r = iProperty.Get( value );
   138         r = iProperty.Get( allDrivesStatus );
   144         }
   139         }
   145 
       
   146 #ifdef _DEBUG    
       
   147     RDebug::Print(_L("KEY %d   VALUE %d "),iKey,value);        
       
   148 #endif
       
   149         
       
   150     if( r == KErrNone )
   140     if( r == KErrNone )
   151         {
   141         {
   152         if( iKey == EWidgetUIState && value == 1 )
   142         if( iKey == EWidgetUIState && value == 1 )
   153             {
   143             {
   154             iHarvester->TryLaunchNextOperationL();
   144             iHarvester->TryLaunchNextOperationL();
   156         else if(iKey == EWidgetUIState && value == 2)
   146         else if(iKey == EWidgetUIState && value == 2)
   157             {
   147             {
   158             iHarvester->ClearAllOperations();
   148             iHarvester->ClearAllOperations();
   159             SetValue(1);
   149             SetValue(1);
   160             }
   150             }
   161         else if( iKey == EWidgetUIState && value == 3 )
       
   162             {            
       
   163             iHarvester->SetReinstallWidget(ETrue);
       
   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             }
       
   182         else if( iKey == EWidgetRegAltered && value == 1 )
   151         else if( iKey == EWidgetRegAltered && value == 1 )
   183             {
   152             {
   184             if(iHarvester->IsInMSMode())
   153              iHarvester->UpdateL();
   185                 {
       
   186                 iHarvester->SetRegistryAccess(EFalse);
       
   187                 }
       
   188             else
       
   189             	{
       
   190             	iHarvester->SetRegistryAccess(ETrue);
       
   191                 } 	
       
   192             iHarvester->UpdateL();
       
   193             }
       
   194 		else if( iKey == EWidgetSystemShutdown && value == ESwStateShuttingDown  )
       
   195             {
       
   196              iHarvester->SetSystemShutdown(ETrue);
       
   197             }
   154             }
   198         }
   155         }
   199     }
   156     }
   200 
   157 
   201 // ---------------------------------------------------------------------------
   158 // ---------------------------------------------------------------------------