coreapplicationuis/SysAp/Src/SysApLightsController.cpp
branchRCL_3
changeset 10 469fa8a78de7
parent 0 2e3d3ce01487
child 15 312d2b433792
--- a/coreapplicationuis/SysAp/Src/SysApLightsController.cpp	Tue May 25 12:52:36 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/SysApLightsController.cpp	Wed Jun 09 09:52:12 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -29,6 +29,7 @@
 #endif // RD_LIGHT_CONTROL_CHANGE
 
 #include "SysApFeatureManager.h"
+#include "startupdomainpskeys.h"
 
 // CONSTANTS
 
@@ -216,7 +217,13 @@
         {
         iLightPluginHandler->HandleEventNoAction( SysApLightExtension::EChargerConnection, TPckgBuf<TBool>(aConnected) );
         }        
-#endif // RD_LIGHT_CONTROL_CHANGE           
+#endif // RD_LIGHT_CONTROL_CHANGE 
+	TInt state( 0 );
+	TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+    if ( error == KErrNone && state == ESwStateCharging ) 
+		{
+		EnableActivityManagerL();
+		}		
     }
 
 // ----------------------------------------------------------------------------
@@ -969,16 +976,26 @@
         return;
         }
 
-    TInt err(KErrNone);
+	TInt err(KErrNone);
+    TInt state( 0 );
+    TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
     
-#ifdef RD_LIGHT_CONTROL_CHANGE
-    if ( !iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandOff ) )
+    if ( error == KErrNone && state != ESwStateCharging ) 
         {
-        TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
-        }
+#ifdef RD_LIGHT_CONTROL_CHANGE
+		if ( !iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandOff ) )
+			{
+			TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
+			}
 #else //  RD_LIGHT_CONTROL_CHANGE
-    TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
-#endif // RD_LIGHT_CONTROL_CHANGE            
+		TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
+#endif // RD_LIGHT_CONTROL_CHANGE  
+		}
+	else
+		{
+		TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
+		iSysApAppUi.StopChargingBatteryL();
+		}            
     // Ignore unreserved in use warnings.
     if ( err != KErrNone && err != KErrInUse )
         {
@@ -1078,6 +1095,13 @@
                 iLightsCurrentlyOn = ETrue;
                 iLastLightsOnTime.HomeTime(); 
                 }
+				
+			TInt state( 0 );
+			TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+    		if ( error == KErrNone && state == ESwStateCharging ) 
+				{
+				iSysApAppUi.StartChargingBatteryL();
+				}	
             }
         else
             {