webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
--- a/webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp	Tue Aug 31 16:17:46 2010 +0300
+++ b/webengine/wrtharvester/src/wrtharvesterpsnotifier.cpp	Wed Sep 01 12:28:30 2010 +0100
@@ -19,7 +19,9 @@
 #include "wrtharvesterpsnotifier.h"
 #include "wrtharvester.h"
 #include <UikonInternalPSKeys.h>//For MMC Observing
-#include <usbmsshared.h>//For USB monitor
+#include <startupdomainpskeys.h> // For shutdown observer
+#include <UsbWatcherInternalPSKeys.h>// for Mass storage mode observing
+#include <usbpersonalityids.h>
 
 // ============================ MEMBER FUNCTIONS =============================
 
@@ -71,24 +73,24 @@
     {
     CActiveScheduler::Add( this );
     TInt r(KErrNone);
-    if( iKey != EWidgetMMCAltered  )
+    if( iKey != EWidgetMassStorageMode  )
     	{	
     	// define property to be integer type
     	r = RProperty::Define( KPropertyCat, iKey, RProperty::EInt );
     	}
 
-    if ( r != KErrAlreadyExists || r != KErrNone )
+    if ( r != KErrAlreadyExists && r != KErrNone )
         {
         User::LeaveIfError( r );
         }
     // Attach the key
-    if( iKey == EWidgetMMCAltered )
-		{
-		User::LeaveIfError( iProperty.Attach( KPSUidUikon,KUikMMCInserted ));
-		}
-    else if( iKey == EWidgetMassStorageMode )
+    if( iKey == EWidgetMassStorageMode )
         {
-        User::LeaveIfError( iProperty.Attach( KUsbMsDriveState_Category,EUsbMsDriveState_DriveStatus ));
+        User::LeaveIfError( iProperty.Attach( KPSUidUsbWatcher,KUsbWatcherSelectedPersonality));
+        }    	
+    else if( iKey == EWidgetSystemShutdown )
+        {
+        User::LeaveIfError( iProperty.Attach( KPSUidStartup,KPSGlobalSystemState  ));
         }    	
     else
     	{
@@ -128,15 +130,23 @@
     
     TInt value( 0 );
     TInt r (KErrNone);
-    TUsbMsDrivesStatus allDrivesStatus;
-    if( iKey != EWidgetMMCAltered && iKey != EWidgetMassStorageMode )
+    
+    if( iKey != EWidgetMassStorageMode )
     	{
-    	iProperty.Get( KPropertyCat, iKey, value );	
+    		if (iKey == EWidgetSystemShutdown)
+    	        GetValue( value);
+    	    else
+    	        iProperty.Get( KPropertyCat, iKey, value );	
     	}    
     else
         {        
-        r = iProperty.Get( allDrivesStatus );
+        r = iProperty.Get( value );
         }
+
+#ifdef _DEBUG    
+    RDebug::Print(_L("KEY %d   VALUE %d "),iKey,value);        
+#endif
+        
     if( r == KErrNone )
         {
         if( iKey == EWidgetUIState && value == 1 )
@@ -148,9 +158,42 @@
             iHarvester->ClearAllOperations();
             SetValue(1);
             }
+        else if( iKey == EWidgetUIState && value == 3 )
+            {            
+            iHarvester->SetReinstallWidget(ETrue);
+            }    
+        else if( iKey == EWidgetMassStorageMode  )
+            {
+            if( value == KUsbPersonalityIdMS )
+                {
+#ifdef _DEBUG                    
+                RDebug::Print(_L("WE are in mass storage mode"));
+#endif                    
+                iHarvester->SetMSMode(1);    
+                }
+                else
+                {
+#ifdef _DEBUG                    
+                RDebug::Print(_L("NO LONGER in mass storage mode"));
+#endif                    
+                iHarvester->SetMSMode(0);
+                }
+            }
         else if( iKey == EWidgetRegAltered && value == 1 )
             {
-             iHarvester->UpdateL();
+            if(iHarvester->IsInMSMode())
+                {
+                iHarvester->SetRegistryAccess(EFalse);
+                }
+            else
+            	{
+            	iHarvester->SetRegistryAccess(ETrue);
+                } 	
+            iHarvester->UpdateL();
+            }
+		else if( iKey == EWidgetSystemShutdown && value == ESwStateShuttingDown  )
+            {
+             iHarvester->SetSystemShutdown(ETrue);
             }
         }
     }