coreapplicationuis/SysAp/Src/SysApAppUi.cpp
changeset 81 676b6116ca93
parent 77 b01c07dfcf84
equal deleted inserted replaced
78:175a0d824084 81:676b6116ca93
    15 *
    15 *
    16 */
    16 */
    17 // INCLUDES
    17 // INCLUDES
    18 
    18 
    19 #include <startupdomainpskeys.h>
    19 #include <startupdomainpskeys.h>
    20 #include "sysapappui.h"
    20 #include "SysApAppUi.h"
    21 #include "coreapplicationuisprivatepskeys.h"
    21 #include "coreapplicationuisprivatepskeys.h"
    22 #include <HbDeviceMessageBoxSymbian.h>
    22 #include <hbdevicemessageboxsymbian.h>
    23 //#include <hbdevicepowermenusymbian.h>
    23 //#include <hbdevicepowermenusymbian.h>
    24 #include <sacls.h>
    24 #include <sacls.h>
    25 #include <featmgr.h>
    25 #include <featmgr.h>
    26 #include <DevEncProtectedPSKey.h>
    26 #include <DevEncProtectedPSKey.h>
    27 #include <ctsydomainpskeys.h>
    27 #include <ctsydomainpskeys.h>
    28 #include <secuisystemlock.h>
    28 #include <secuisystemlock.h>
    29 #include <apgtask.h>
    29 #include <apgtask.h>
    30 #include <hwrmpowerstatesdkpskeys.h>
    30 #include <hwrmpowerstatesdkpskeys.h>
    31 #include <wlaninternalpskeys.h> 
    31 #include <wlaninternalpskeys.h> 
    32 #include <HbDeviceNotificationDialogSymbian.h>
    32 #include <hbdevicenotificationdialogsymbian.h>
    33 #include <hbsymbianvariant.h>
    33 #include <hbsymbianvariant.h>
    34 #include <hbtextresolversymbian.h>
    34 #include <hbtextresolversymbian.h>
    35 #include <UikonInternalPSKeys.h>
    35 #include <UikonInternalPSKeys.h>
    36 
    36 
    37 //#include "SysApWsClient.h"
    37 //#include "SysApWsClient.h"
   109 _LIT(KPsmPlugin,"com.nokia.hb.powersavemodeplugin/1.0");
   109 _LIT(KPsmPlugin,"com.nokia.hb.powersavemodeplugin/1.0");
   110 _LIT(KPsm,"PSM");
   110 _LIT(KPsm,"PSM");
   111 _LIT(KCharging,"Charging");
   111 _LIT(KCharging,"Charging");
   112 _LIT(KPsmlocalisationfile, "powermanagement_");
   112 _LIT(KPsmlocalisationfile, "powermanagement_");
   113 _LIT(KtsfilePath, "z:/resource/qt/translations/");
   113 _LIT(KtsfilePath, "z:/resource/qt/translations/");
   114 _LIT(KlowbatteryIcon,"qtg_small_bt_low_battery.svg");
   114 _LIT(KlowbatteryIcon,"qtg_small_bt_low_battery");
   115 _LIT(KbatteryFullIcon,"qtg_status_battery.svg");
   115 _LIT(KbatteryFullIcon,"qtg_status_battery");	
   116 
   116 
   117 
   117 
   118 
   118 
   119 // ============================ MEMBER FUNCTIONS ==============================
   119 // ============================ MEMBER FUNCTIONS ==============================
   120 
   120 
   321 
   321 
   322     RProperty::Define( KPSUidCoreApplicationUIs,KCoreAppUIsPowerMenuCustomDialogStatus, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy );
   322     RProperty::Define( KPSUidCoreApplicationUIs,KCoreAppUIsPowerMenuCustomDialogStatus, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy );
   323     RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogUninitialized );
   323     RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogUninitialized );
   324     
   324     
   325 	TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CHbIndicatorSymbian::NewL()") ) );
   325 	TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CHbIndicatorSymbian::NewL()") ) );
   326     iHbIndicatorSymbian = CHbIndicatorSymbian::NewL();
   326    
   327 	
   327 	TBool result = HbTextResolverSymbian::Init(KPsmlocalisationfile, KtsfilePath);
   328 	  TBool result = HbTextResolverSymbian::Init(KPsmlocalisationfile, KtsfilePath);
       
   329 	
   328 	
   330     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: END") ) );    
   329     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: END") ) );    
   331     }
   330     }
   332 
   331 
   333 // ----------------------------------------------------------------------------
   332 // ----------------------------------------------------------------------------
   337 void CSysApAppUi::FreeResources()
   336 void CSysApAppUi::FreeResources()
   338     {
   337     {
   339     TRACES( RDebug::Print( _L("CSysApAppUi::FreeResources") ) );
   338     TRACES( RDebug::Print( _L("CSysApAppUi::FreeResources") ) );
   340     delete iSysApBatteryInfoController;
   339     delete iSysApBatteryInfoController;
   341     delete iSysApPsmController;
   340     delete iSysApPsmController;
   342     delete iVariantAccState; 
       
   343 
       
   344     delete iSysApAudioRoutingObserver;
   341     delete iSysApAudioRoutingObserver;
   345 
   342 
   346     delete iChargingAnimation;
   343     delete iChargingAnimation;
   347     iChargingAnimation=NULL;
   344     iChargingAnimation=NULL;
   348 
   345 
   388     delete iSysApCenRepLogsObserver;
   385     delete iSysApCenRepLogsObserver;
   389     delete iSysApOfflineModeController;
   386     delete iSysApOfflineModeController;
   390     
   387     
   391     delete iSysApUsbIndicatorController;
   388     delete iSysApUsbIndicatorController;
   392     delete iKeyguardController;
   389     delete iKeyguardController;
   393     delete iHbIndicatorSymbian; 
       
   394     delete iSysApKeyManagement;
   390     delete iSysApKeyManagement;
   395     iSysApKeyManagement = NULL;
   391     iSysApKeyManagement = NULL;
   396     
   392     
   397     REComSession::FinalClose();
   393     REComSession::FinalClose();
   398     iResourcesFreed = ETrue;
   394     iResourcesFreed = ETrue;
   526         }
   522         }
   527 		
   523 		
   528        if ( iSysApPsmController->FullPsmEnabled() )
   524        if ( iSysApPsmController->FullPsmEnabled() )
   529            {
   525            {
   530            // activate psm indicator 
   526            // activate psm indicator 
   531             iVariantAccState = CHbSymbianVariant::NewL(&KPsm, CHbSymbianVariant::EDes);
   527            HandlePsmAndChargingIndicatorL(ETrue,KPsm);                
   532             if (!iHbIndicatorSymbian->Activate(KPsmPlugin,iVariantAccState)) 
       
   533                {
       
   534                int error = iHbIndicatorSymbian->Error();
       
   535                //use the errorcode...
       
   536                }
       
   537            }
   528            }
   538      
   529      
   539        }
   530        }
   540     
   531     
   541     TInt batteryStatus = StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryStatus );
   532     TInt batteryStatus = StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryStatus );
   695     }
   686     }
   696 
   687 
   697 void CSysApAppUi::ShowNoteL( const TDesC& noteText )const
   688 void CSysApAppUi::ShowNoteL( const TDesC& noteText )const
   698     {          
   689     {          
   699  	TRACES( RDebug::Print( _L("CSysApAppUi::ShowNoteL:: constructing CHbDeviceMessageBoxSymbian:BeGIN") ) );    
   690  	TRACES( RDebug::Print( _L("CSysApAppUi::ShowNoteL:: constructing CHbDeviceMessageBoxSymbian:BeGIN") ) );    
   700     CHbDeviceMessageBoxSymbian *note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
   691   CHbDeviceMessageBoxSymbian *note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
   701  	CleanupStack::PushL(note);
   692  	CleanupStack::PushL(note);
   702     TRACES( RDebug::Print( _L("CSysApAppUi::ShowNoteL:: construction of CHbDeviceMessageBoxSymbian:END") ) ); 
   693   TRACES( RDebug::Print( _L("CSysApAppUi::ShowNoteL:: construction of CHbDeviceMessageBoxSymbian:END") ) ); 
   703     note->SetTextL(noteText);
   694   note->SetTextL(noteText);
   704 	note->SetTimeout(3000);
   695 	note->SetTimeout(0);
   705  	TRACES( RDebug::Print( _L("CSysApAppUi:: Display of  CHbDeviceMessageBoxSymbian::Begin") ) );    
   696  	TRACES( RDebug::Print( _L("CSysApAppUi:: Display of  CHbDeviceMessageBoxSymbian::Begin") ) );    
   706     note->ShowL();
   697   note->ShowL();
   707 	TRACES( RDebug::Print( _L("CSysApAppUi:: Display of  CHbDeviceMessageBoxSymbian::End") ) );
   698 	TRACES( RDebug::Print( _L("CSysApAppUi:: Display of  CHbDeviceMessageBoxSymbian::End") ) );
   708 	CleanupStack::PopAndDestroy(note);
   699 	CleanupStack::PopAndDestroy(note);
   709     }
   700     }
   710 
   701 
   711 
   702 
  1355         }
  1346         }
  1356 
  1347 
  1357     if ( accessoryState == EAccModeHandPortable )
  1348     if ( accessoryState == EAccModeHandPortable )
  1358         {
  1349         {
  1359         TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryDisconnectedL:Before Deactivating accessory Plugin")));
  1350         TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryDisconnectedL:Before Deactivating accessory Plugin")));
  1360         iHbIndicatorSymbian->Deactivate(KAccesoryPlugin);
  1351         CHbIndicatorSymbian* HbIndicatorSymbian = CHbIndicatorSymbian::NewL();
       
  1352         CleanupStack::PushL(HbIndicatorSymbian);
       
  1353         HbIndicatorSymbian->Deactivate(KAccesoryPlugin);
       
  1354         User::LeaveIfError(HbIndicatorSymbian->Error());
       
  1355         CleanupStack::PopAndDestroy(HbIndicatorSymbian); // indicator
  1361         TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryDisconnectedL:After  Deactivating accessory Plugin")));
  1356         TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryDisconnectedL:After  Deactivating accessory Plugin")));
  1362         iSysApLightsController->AccessoryConnectedL( EFalse );
  1357         iSysApLightsController->AccessoryConnectedL( EFalse );
  1363         iSysApCenRepController->SetInt( KCRUidCoreApplicationUIsSysAp, KSysApAccessoryConnected, 0 );
  1358         iSysApCenRepController->SetInt( KCRUidCoreApplicationUIsSysAp, KSysApAccessoryConnected, 0 );
  1364         }
  1359         }
  1365 
  1360 
  1391 
  1386 
  1392 void CSysApAppUi::HandleAccessoryConnectedL( TAccMode aAccessoryState, TInt aPhysicalConnectionType )
  1387 void CSysApAppUi::HandleAccessoryConnectedL( TAccMode aAccessoryState, TInt aPhysicalConnectionType )
  1393     {
  1388     {
  1394     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL( aAccessoryState: %d )(aPhysicalConnectionType: %d "), aAccessoryState, aPhysicalConnectionType ) );
  1389     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL( aAccessoryState: %d )(aPhysicalConnectionType: %d "), aAccessoryState, aPhysicalConnectionType ) );
  1395 
  1390 
  1396     CHbSymbianVariantMap* iAccVariantMap = CHbSymbianVariantMap::NewL();
  1391     CHbSymbianVariantMap* AccVariantMap = CHbSymbianVariantMap::NewL();
  1397     CleanupStack::PushL(iAccVariantMap);
  1392     CleanupStack::PushL(AccVariantMap);
  1398     CHbSymbianVariant* variantAccState = CHbSymbianVariant::NewL(&aAccessoryState, CHbSymbianVariant::EInt);
  1393     CHbSymbianVariant* variantAccState = CHbSymbianVariant::NewL(&aAccessoryState, CHbSymbianVariant::EInt);
  1399     iAccVariantMap->Add(KAccMode,variantAccState);
  1394     AccVariantMap->Add(KAccMode,variantAccState);
  1400     CHbSymbianVariant* variantAccType = CHbSymbianVariant::NewL(&aPhysicalConnectionType, CHbSymbianVariant::EInt);
  1395     CHbSymbianVariant* variantAccType = CHbSymbianVariant::NewL(&aPhysicalConnectionType, CHbSymbianVariant::EInt);
  1401     iAccVariantMap->Add(KAccPhyConType,variantAccType);
  1396     AccVariantMap->Add(KAccPhyConType,variantAccType);
  1402     
  1397     
  1403     
  1398     
  1404     CHbSymbianVariant* iAccVariant = CHbSymbianVariant::NewL(iAccVariantMap, CHbSymbianVariant::EVariantMap ); 
  1399     CHbSymbianVariant* AccVariant = CHbSymbianVariant::NewL(AccVariantMap, CHbSymbianVariant::EVariantMap ); 
  1405     CleanupStack::PushL(iAccVariant);
  1400     CleanupStack::PushL(AccVariant);
  1406     iHbIndicatorSymbian->Activate(KAccesoryPlugin, iAccVariant);
  1401     CHbIndicatorSymbian* HbIndicatorSymbian = CHbIndicatorSymbian::NewL();
  1407 
  1402     CleanupStack::PushL(HbIndicatorSymbian);
       
  1403     HbIndicatorSymbian->Activate(KAccesoryPlugin, AccVariant);
       
  1404     User::LeaveIfError(HbIndicatorSymbian->Error());
  1408 
  1405 
  1409     TInt swState( StateOfProperty( KPSUidStartup, KPSGlobalSystemState ) );
  1406     TInt swState( StateOfProperty( KPSUidStartup, KPSGlobalSystemState ) );
  1410     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL: swState: %d"), swState ) );
  1407     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL: swState: %d"), swState ) );
  1411 
  1408 
  1412     if( UiReady() || swState == ESwStateSecurityCheck )
  1409     if( UiReady() || swState == ESwStateSecurityCheck )
  1438                 }
  1435                 }
  1439             }
  1436             }
  1440         }
  1437         }
  1441     SetIhfIndicatorL();
  1438     SetIhfIndicatorL();
  1442     SetHacIndicatorL();
  1439     SetHacIndicatorL();
  1443     CleanupStack::PopAndDestroy(2);
  1440     CleanupStack::PopAndDestroy(3);
  1444     }
  1441     }
  1445 
  1442 
       
  1443 
       
  1444 void CSysApAppUi::SetPosIndicatorL(TInt aValue)
       
  1445     {
       
  1446     TRACES( RDebug::Print( _L("CSysApAppUi::SetPosIndicatorL begin") ) );
       
  1447     _LIT(KGpsIndicatorPlugin, "com.nokia.positioning.indicatorplugin/1.0");
       
  1448     CHbIndicatorSymbian* HbIndicatorSymbian = CHbIndicatorSymbian::NewL();
       
  1449     CleanupStack::PushL(HbIndicatorSymbian);
       
  1450     if(aValue)
       
  1451         {
       
  1452         TRACES( RDebug::Print( _L("CSysApAppUi::SetPosIndicatorL activate") ) );
       
  1453         HbIndicatorSymbian->Activate(KGpsIndicatorPlugin);
       
  1454         User::LeaveIfError(HbIndicatorSymbian->Error());
       
  1455        
       
  1456         }
       
  1457     else
       
  1458         {
       
  1459         TRACES( RDebug::Print( _L("CSysApAppUi::SetPosIndicatorL deactivate") ) );
       
  1460         HbIndicatorSymbian->Deactivate(KGpsIndicatorPlugin);
       
  1461         User::LeaveIfError(HbIndicatorSymbian->Error());
       
  1462         }
       
  1463     CleanupStack::PopAndDestroy(HbIndicatorSymbian); 
       
  1464     }
  1446 
  1465 
  1447 // ----------------------------------------------------------------------------
  1466 // ----------------------------------------------------------------------------
  1448 // CSysApAppUi::SetHacIndicatorL()
  1467 // CSysApAppUi::SetHacIndicatorL()
  1449 // ----------------------------------------------------------------------------
  1468 // ----------------------------------------------------------------------------
  1450 void CSysApAppUi::SetHacIndicatorL()
  1469 void CSysApAppUi::SetHacIndicatorL()
  1782     // will take care in next sub
  1801     // will take care in next sub
  1783     
  1802     
  1784     switch ( aStatus )
  1803     switch ( aStatus )
  1785         {
  1804         {
  1786         case MSysApPsmControllerNotifyCallback::EPsmActivationComplete:
  1805         case MSysApPsmControllerNotifyCallback::EPsmActivationComplete:
       
  1806              TRACES( RDebug::Print( _L("CSysApAppUi::NotifyPowerSaveModeL case MSysApPsmControllerNotifyCallback::EPsmActivationComplete: indicator activation ") ) );
  1787              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1807              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1788              iVariantAccState = CHbSymbianVariant::NewL(&KPsm, CHbSymbianVariant::EDes);
  1808              HandlePsmAndChargingIndicatorL(ETrue,KPsm);
  1789              if (!iHbIndicatorSymbian->Activate(KPsmPlugin,iVariantAccState)) 
       
  1790                 {
       
  1791                 int error = iHbIndicatorSymbian->Error();
       
  1792                 //use the errorcode...
       
  1793                 }
       
  1794              break;
  1809              break;
  1795         
  1810         
  1796         case MSysApPsmControllerNotifyCallback::EPsmDeactivationComplete:
  1811         case MSysApPsmControllerNotifyCallback::EPsmDeactivationComplete:
  1797              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1812             TRACES( RDebug::Print( _L("CSysApAppUi::NotifyPowerSaveModeL case MSysApPsmControllerNotifyCallback::EPsmDeactivationComplete: indicator deactivation") ) );
  1798              if (!iHbIndicatorSymbian->Deactivate(KPsmPlugin)) 
  1813             UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1799                 {
  1814             HandlePsmAndChargingIndicatorL(EFalse,KPsm);  
  1800                 int error = iHbIndicatorSymbian->Error();
  1815               
  1801                  //use the errorcode...
       
  1802                 }
       
  1803             break;
  1816             break;
  1804             
  1817             
  1805         case MSysApPsmControllerNotifyCallback::EPsmActivationFailed:
  1818         case MSysApPsmControllerNotifyCallback::EPsmActivationFailed:
  1806             ShowUiNoteL( ECannotActivatePowerSaveMode );
  1819             ShowUiNoteL( ECannotActivatePowerSaveMode );
  1807             break;
  1820             break;
  1814             break;   
  1827             break;   
  1815         }
  1828         }
  1816     }
  1829     }
  1817 
  1830 
  1818 
  1831 
       
  1832 
       
  1833 void CSysApAppUi::HandlePsmAndChargingIndicatorL(TBool aValue,const TDesC& aLiteral )
       
  1834     {
       
  1835     TRACES( RDebug::Print( _L("CSysApAppUi::HandlePsmAndChargingIndicatorL aValue:%d"), aValue ) );
       
  1836     CHbIndicatorSymbian* HbIndicatorSymbian = CHbIndicatorSymbian::NewL();
       
  1837     CleanupStack::PushL(HbIndicatorSymbian);
       
  1838    if(aValue)
       
  1839        {
       
  1840     TRACES( RDebug::Print( _L("CSysApAppUi::HandlePsmAndChargingIndicatorL activate") ) );
       
  1841     CHbSymbianVariant* VariantAccState = CHbSymbianVariant::NewL(&aLiteral, CHbSymbianVariant::EDes);
       
  1842     CleanupStack::PushL(VariantAccState);
       
  1843     HbIndicatorSymbian->Activate(KPsmPlugin,VariantAccState);
       
  1844     User::LeaveIfError(HbIndicatorSymbian->Error()); 
       
  1845     CleanupStack::PopAndDestroy(VariantAccState);
       
  1846        }
       
  1847    else
       
  1848        {
       
  1849        TRACES( RDebug::Print( _L("CSysApAppUi::HandlePsmAndChargingIndicatorL deactivate") ) );
       
  1850        HbIndicatorSymbian->Deactivate(KPsmPlugin);
       
  1851        User::LeaveIfError(HbIndicatorSymbian->Error());
       
  1852        
       
  1853        }
       
  1854    CleanupStack::PopAndDestroy(HbIndicatorSymbian);
       
  1855     }
  1819 // ----------------------------------------------------------------------------
  1856 // ----------------------------------------------------------------------------
  1820 // CSysApAppUi::ShowAlarmIndicatorL()
  1857 // CSysApAppUi::ShowAlarmIndicatorL()
  1821 // ----------------------------------------------------------------------------
  1858 // ----------------------------------------------------------------------------
  1822 
  1859 
  1823 void CSysApAppUi::ShowAlarmIndicatorL( TBool aShowIndicator )
  1860 void CSysApAppUi::ShowAlarmIndicatorL( TBool aShowIndicator )
  2108                 ShowNoteL( KBatteryFull() );
  2145                 ShowNoteL( KBatteryFull() );
  2109                 }
  2146                 }
  2110                 break;
  2147                 break;
  2111             case ERechargeBatteryNote:
  2148             case ERechargeBatteryNote:
  2112                 {
  2149                 {
  2113                 iSysApLightsController->BatteryEmptyL( ETrue );
       
  2114                 _LIT(KRechargeBattery,"Battery empty. Recharge");
  2150                 _LIT(KRechargeBattery,"Battery empty. Recharge");
  2115                 ShowNoteL( KRechargeBattery() );
  2151                 ShowNoteL( KRechargeBattery() );
       
  2152                 iSysApLightsController->BatteryEmptyL( ETrue );
  2116                 }
  2153                 }
  2117                 break;
  2154                 break;
  2118             case ENotChargingNote:
  2155             case ENotChargingNote:
  2119                 {
  2156                 {
  2120                 _LIT(KNotCharging,"Not charging");
  2157                 _LIT(KNotCharging,"Not charging");
  2121                 ShowNoteL( KNotCharging() );
  2158                 ShowNoteL( KNotCharging() );
  2122                 }
  2159                 }
  2123                 break;
  2160                 break;
  2124             case EBatteryFullUnplugChargerNote:
  2161             case EBatteryFullUnplugChargerNote:
  2125                 {
  2162                 {
  2126                 iSysApLightsController->BatteryEmptyL( ETrue );
       
  2127                  _LIT(KunplugCharger,"txt_power_dpopinfo_unplug_charger_to_save_energy");                 
  2163                  _LIT(KunplugCharger,"txt_power_dpopinfo_unplug_charger_to_save_energy");                 
  2128                  HBufC* unplugCharger = HbTextResolverSymbian::LoadL(KunplugCharger);
  2164                  HBufC* unplugCharger = HbTextResolverSymbian::LoadL(KunplugCharger);
  2129                  _LIT(KbatteryFull,"txt_power_management_dpophead_100_full");
  2165                  _LIT(KbatteryFull,"txt_power_management_dpophead_100_full");
  2130                  HBufC* batteryFull = HbTextResolverSymbian::LoadL(KbatteryFull);
  2166                  HBufC* batteryFull = HbTextResolverSymbian::LoadL(KbatteryFull);
  2131                  CHbDeviceNotificationDialogSymbian::NotificationL(KbatteryFullIcon,*unplugCharger,*batteryFull);       
  2167                  CHbDeviceNotificationDialogSymbian::NotificationL(KbatteryFullIcon,*unplugCharger,*batteryFull);       
  2132                  }
  2168                  }
  2133                 break;
  2169                 break;
  2134             case EUnplugChargerNote:
  2170             case EUnplugChargerNote:
  2135                 {
  2171                 {
  2136                 _LIT(KUnplugCharger,"Unplug charger from power supply to save energy");
  2172                 _LIT(KunplugCharger,"txt_power_dpopinfo_unplug_charger_to_save_energy"); 
  2137                 ShowNoteL( KUnplugCharger() );
  2173                 HBufC* unplugcharger = HbTextResolverSymbian::LoadL(KunplugCharger);
       
  2174                 ShowNoteL(*unplugcharger);
  2138                 }
  2175                 }
  2139                 break;
  2176                 break;
  2140             case ESysApRestartPhone:
  2177             case ESysApRestartPhone:
  2141                 {
  2178                 {
  2142 				//Show the restart note
  2179 				//Show the restart note
  2183 // ----------------------------------------------------------------------------
  2220 // ----------------------------------------------------------------------------
  2184 //
  2221 //
  2185 void CSysApAppUi::HandleChargingStatusL( const TInt aValue )
  2222 void CSysApAppUi::HandleChargingStatusL( const TInt aValue )
  2186     {
  2223     {
  2187     TRACES( RDebug::Print( _L("CSysApAppUi::HandleChargingStatusL aValue: %d"), aValue ) );
  2224     TRACES( RDebug::Print( _L("CSysApAppUi::HandleChargingStatusL aValue: %d"), aValue ) );
  2188     
  2225            
  2189     TBool showNote( ETrue );
       
  2190     
       
  2191     UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  2226     UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  2192 
  2227 
  2193     if ( iSysApPsmController && UiReady() ) 
  2228     if ( UiReady() ) 
  2194         {             
  2229         { 
  2195         if ( iCharging && !iSysApPsmController->ChargerConnected() ) // first time after charger connection
  2230         if ( iCharging ) // first time after charger connection
  2196             {
  2231             {
       
  2232             TRACES( RDebug::Print( _L("CSysApAppUi::HandleChargingStatusL charging ") ) );
  2197             iSysApPsmController->ConnectCharger( ETrue );
  2233             iSysApPsmController->ConnectCharger( ETrue );
  2198             iSysApPsmController->DoEnableFullPsm(EFalse);             
  2234             iSysApPsmController->DoEnableFullPsm(EFalse);
  2199             iVariantAccState = CHbSymbianVariant::NewL(&KCharging, CHbSymbianVariant::EDes);
  2235             HandlePsmAndChargingIndicatorL(ETrue,KCharging); 
  2200                
       
  2201             if (!iHbIndicatorSymbian->Activate(KPsmPlugin,iVariantAccState)) 
       
  2202                {
       
  2203                int error = iHbIndicatorSymbian->Error();
       
  2204                //use the errorcode...
       
  2205                }
       
  2206               
       
  2207                            
       
  2208             }
  2236             }
  2209         else if ( aValue == EChargingStatusNotConnected )
  2237         else if ( aValue == EChargingStatusNotConnected )
  2210             {
  2238             {
       
  2239             TRACES( RDebug::Print( _L("CSysApAppUi::HandleChargingStatusL not charging ") ) );
  2211             iSysApPsmController->ConnectCharger( EFalse );
  2240             iSysApPsmController->ConnectCharger( EFalse );
  2212             if (!iHbIndicatorSymbian->Deactivate(KPsmPlugin)) 
  2241             HandlePsmAndChargingIndicatorL(EFalse,KCharging);  
  2213                {
  2242             }  
  2214                int error = iHbIndicatorSymbian->Error();
  2243        }
  2215                //use the errorcode...
  2244     TRACES( RDebug::Print( _L("CSysApAppUi::HandleChargingStatusL end ") ) );
  2216                }
  2245     HandleChargerNotesL( aValue );    
  2217             }            
  2246        
  2218         }
       
  2219     if( showNote )
       
  2220         {
       
  2221         HandleChargerNotesL( aValue );    
       
  2222         }
       
  2223     }
  2247     }
  2224 
  2248 
  2225 
  2249 
  2226 // ----------------------------------------------------------------------------
  2250 // ----------------------------------------------------------------------------
  2227 // CSysApAppUi::HandleChargerNotesL()
  2251 // CSysApAppUi::HandleChargerNotesL()