--- a/coreapplicationuis/SysAp/Src/SysApAppUi.cpp Fri Sep 03 16:56:10 2010 +0300
+++ b/coreapplicationuis/SysAp/Src/SysApAppUi.cpp Wed Sep 22 18:06:15 2010 +0300
@@ -55,7 +55,7 @@
#include "sysapkeymanagement.h"
#include "SysApShutdownImage.h"
#include "SysApKeySndHandler.h"
-
+#include "SysApCenRepSilentModeObserver.h"
#include "SysApShutdownAnimation.h"
#include "SysApEtelConnector.h"
@@ -74,6 +74,21 @@
#include <usbpersonalityids.h>
#include "sysap.rsg"
#include <hbindicatorsymbian.h>
+//Qt Highway
+#include <xqappmgr.h>
+#include <xqaiwdecl.h>
+#include <xqaiwrequest.h>
+#include <QString.h>
+#include <QVariant.h>
+#include <QMap.h>
+#include <QList.h>
+//For End Key
+#include <APGWGNAM.H>
+//For HS RPropertyKey
+#include <homescreendomainpskeys.h>
+//For Hs Changes
+#include <afactivitylauncher.h>
+#include <apgcli.h>
class CHbSymbianVariant;
const TInt KModifierMask( 0 );
@@ -156,7 +171,10 @@
RWindowGroup groupWin = iCoeEnv->RootWin();
User::LeaveIfError ( iCapturedEKeyPowerOff = groupWin.CaptureKey( EKeyPowerOff, KModifierMask, KModifierMask ) );
User::LeaveIfError ( iCapturedEKeyPowerOffUpAndDowns = groupWin.CaptureKeyUpAndDowns( EStdKeyDevice2, KModifierMask, KModifierMask ) );
-
+ //Capture SEND and END keys
+ User::LeaveIfError ( iCapturedEKeySendKey = groupWin.CaptureKey( EKeyPhoneSend, KModifierMask, KModifierMask ) );
+ User::LeaveIfError ( iCapturedEKeyEndKey = groupWin.CaptureKey( EKeyPhoneEnd, KModifierMask, KModifierMask ) );
+
TRACES ( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CSysApDefaultKeyHandler::NewL()") ) );
iSysApDefaultKeyHandler = CSysApDefaultKeyHandler::NewL(*this);
@@ -256,6 +274,10 @@
TRACES( RDebug::Print( _L("CCSysApAppUi::ConstructL trying CSysApCenRepHacSettingObserver::NewL") ) );
iSysApCenRepHacSettingObserver = CSysApCenRepHacSettingObserver::NewL( *this );
+ TRACES( RDebug::Print( _L("CCSysApAppUi::ConstructL trying CSysApCenRepSilentModeObserver::NewL") ) );
+ iSysApCenRepSilentModeObserver = CSysApCenRepSilentModeObserver::NewL( );
+
+
#ifndef RD_MULTIPLE_DRIVE
if ( iSysApFeatureManager->MmcSupported() )
{
@@ -344,13 +366,17 @@
RWindowGroup groupWin = iCoeEnv->RootWin();
groupWin.CancelCaptureKey( iCapturedEKeyPowerOff );
groupWin.CancelCaptureKeyUpAndDowns( iCapturedEKeyPowerOffUpAndDowns );
+ //Deregister SendKey
+ groupWin.CancelCaptureKey( iCapturedEKeySendKey );
+ //Deregister EndKey
+ groupWin.CancelCaptureKey( iCapturedEKeyEndKey );
delete iSysApDefaultKeyHandler;
delete iSysApCenRepLightSettingsObserver;
delete iSysApCenRepBtObserver;
delete iSysApCenRepHacSettingObserver;
delete iSysApCenRepController;
-
+ delete iSysApCenRepSilentModeObserver;
delete iSysApPubSubObserver;
delete iSysApLightsController;
@@ -665,14 +691,14 @@
return iResourcesFreed;
}
-void CSysApAppUi::ShowExampleUiNoteL( const TDesC& noteText )const
+void CSysApAppUi::ShowNoteL( const TDesC& noteText )const
{
- TRACES( RDebug::Print( _L("CSysApAppUi::ShowExampleUiNoteL:: constructing CHbDeviceMessageBoxSymbian:BeGIN") ) );
+ TRACES( RDebug::Print( _L("CSysApAppUi::ShowNoteL:: constructing CHbDeviceMessageBoxSymbian:BeGIN") ) );
CHbDeviceMessageBoxSymbian *note = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
CleanupStack::PushL(note);
- TRACES( RDebug::Print( _L("CSysApAppUi::ShowExampleUiNoteL:: construction of CHbDeviceMessageBoxSymbian:END") ) );
+ TRACES( RDebug::Print( _L("CSysApAppUi::ShowNoteL:: construction of CHbDeviceMessageBoxSymbian:END") ) );
note->SetTextL(noteText);
- note->SetTimeout(300);
+ note->SetTimeout(3000);
TRACES( RDebug::Print( _L("CSysApAppUi:: Display of CHbDeviceMessageBoxSymbian::Begin") ) );
note->ShowL();
TRACES( RDebug::Print( _L("CSysApAppUi:: Display of CHbDeviceMessageBoxSymbian::End") ) );
@@ -1263,7 +1289,7 @@
TPtrC aStringPointer = aString->Des();
aStringPointer.Set(KPowerPressKey);
TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
- ShowExampleUiNoteL( aStringPointer );
+ ShowNoteL( aStringPointer );
CleanupStack::PopAndDestroy(); // aString
}
@@ -2056,64 +2082,42 @@
// CSysApAppUi::ShowUiNoteL( const TSysApNoteIds aNote ) const
// ----------------------------------------------------------------------------
-void CSysApAppUi::ShowUiNoteL( const TSysApNoteIds aNote ) const
+void CSysApAppUi::ShowUiNoteL( const TSysApNoteIds aNote )
{
- TRACES( RDebug::Print( _L("CSysApAppUi::ShowUiNoteL aNote: %d"), aNote ) );
-
+ TRACES( RDebug::Print( _L("CSysApAppUi::ShowUiNoteL aNote") ) );
TInt swState( StateOfProperty( KPSUidStartup, KPSGlobalSystemState ) );
-
if( UiReady() || swState == ESwStateSecurityCheck)
- {
+ {
+ TRACES( RDebug::Print( _L("CSysApAppUi::ShowUiNoteL aNote: %d"), aNote ) );
switch ( aNote )
{
case EBatteryLowNote:
{
- _LIT(KPowerPressKey,"Battery low");
- HBufC* aString = HBufC16::NewLC(100);
- TPtrC aStringPointer = aString->Des();
- aStringPointer.Set(KPowerPressKey);
- TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
- ShowExampleUiNoteL( aStringPointer );
- CleanupStack::PopAndDestroy(); // aString
+ _LIT(KLowBattery,"Battery low");
+ ShowNoteL( KLowBattery() );
}
break;
case EBatteryFullNote:
{
- _LIT(KPowerPressKey,"Battery full");
- HBufC* aString = HBufC16::NewLC(100);
- TPtrC aStringPointer = aString->Des();
- aStringPointer.Set(KPowerPressKey);
- TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
- ShowExampleUiNoteL( aStringPointer );
- CleanupStack::PopAndDestroy(); // aString
+ _LIT(KBatteryFull,"Battery full");
+ ShowNoteL( KBatteryFull() );
}
break;
case ERechargeBatteryNote:
{
iSysApLightsController->BatteryEmptyL( ETrue );
- _LIT(KPowerPressKey,"Battery empty. Recharge");
- HBufC* aString = HBufC16::NewLC(100);
- TPtrC aStringPointer = aString->Des();
- aStringPointer.Set(KPowerPressKey);
- TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
- ShowExampleUiNoteL( aStringPointer );
- CleanupStack::PopAndDestroy(); // aString
+ _LIT(KRechargeBattery,"Battery empty. Recharge");
+ ShowNoteL( KRechargeBattery() );
}
break;
case ENotChargingNote:
{
- _LIT(KPowerPressKey,"Not charging");
- HBufC* aString = HBufC16::NewLC(100);
- TPtrC aStringPointer = aString->Des();
- aStringPointer.Set(KPowerPressKey);
- TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
- ShowExampleUiNoteL( aStringPointer );
- CleanupStack::PopAndDestroy(); // aString
+ _LIT(KNotCharging,"Not charging");
+ ShowNoteL( KNotCharging() );
}
break;
case EBatteryFullUnplugChargerNote:
{
- TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
iSysApLightsController->BatteryEmptyL( ETrue );
_LIT(KunplugCharger,"txt_power_dpopinfo_unplug_charger_to_save_energy");
HBufC* unplugCharger = HbTextResolverSymbian::LoadL(KunplugCharger);
@@ -2124,22 +2128,28 @@
break;
case EUnplugChargerNote:
{
- _LIT(KPowerPressKey,"Unplug charger from power supply to save energy");
- HBufC* aString = HBufC16::NewLC(250);
- TPtrC aStringPointer = aString->Des();
- aStringPointer.Set(KPowerPressKey);
- TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );
- ShowExampleUiNoteL( aStringPointer );
- CleanupStack::PopAndDestroy(); // aString
+ _LIT(KUnplugCharger,"Unplug charger from power supply to save energy");
+ ShowNoteL( KUnplugCharger() );
}
break;
+ case ESysApRestartPhone:
+ {
+ //Show the restart note
+ _LIT(KRestartPhone,"Phone will be restarted");
+ ShowNoteL( KRestartPhone() );
+ //wait for 3 seconds to close note. Other wise the shutdown will continue
+ //without waiting for note to complete.
+ User::After(4000000);
+ //Now restart the device
+ DoShutdownL( ETrue, RStarterSession::EDataRestoreReset );
+ }
+ break;
default:
break;
}
}
}
-
-
+
// ----------------------------------------------------------------------------
// CSysApAppUi::BatteryEmptyL()
// ----------------------------------------------------------------------------
@@ -2776,6 +2786,30 @@
Exit();
break;
#endif
+ case EKeyPhoneSend:
+ {
+ TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, Send key event received::Start") ) );
+ if (UiReady()&& aKeyEvent.iRepeats == 0)
+ {
+ //Ignore LongPress on SEND key event as Long press generates Short press event too,
+ //And there is no Different use case for long press.
+ HandleSendKeyEventL();
+ }
+ TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, Send key event received::End") ) );
+ break;
+ }
+ case EKeyPhoneEnd:
+ {
+ TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL, End key event received") ) );
+ if (UiReady() && aKeyEvent.iRepeats == 0)
+ {
+ //Ignore LongPress on END key event as Long press generates Short press event too,
+ //And there is no Different use case for long press.
+ HandleEndKeyEventL();
+ }
+ TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL()::EKeyPhoneEnd: End" ) ) );
+ break;
+ }
case EKeyPowerOff:
//Short power key press
iKeyBoardRepeatCount++;
@@ -4055,6 +4089,93 @@
}
}
-
+/**
+ * Handles SEND key events
+ * If SEND key is pressed in idle Home screen view, This will bring LOGS View without DialPad.
+ * otherwise, it brings LOGS&Dial pad.
+ */
+void CSysApAppUi::HandleSendKeyEventL()
+ {
+ TRACES( RDebug::Print( _L("CSysApAppUi::HandleSendKeyEventL: START") ) );
+ //Check whether ForeGround app is HomeScreen
+ TInt hsStatus(EHomeScreenIdleState) ;
+ //Get the RProperty
+ User::LeaveIfError( RProperty::Get(KHsCategoryUid, KHsCategoryStateKey, hsStatus));
+ //Enable dialpad in Non-HS view
+ const TBool enableDialPad( EHomeScreenIdleState != hsStatus );
+
+ //invoke LOGS/Dialer app
+ XQApplicationManager appMgr;
+ QScopedPointer<XQAiwRequest> request(appMgr.create(QString("logs"), XQI_LOGS_VIEW, XQOP_LOGS_SHOW, false));
+
+ if (!request.isNull())
+ {
+ TRACES( RDebug::Print( _L("CSysApAppUi::HandleSendKeyEventL::Request::Begin") ) );
+ int retValue = -1;
+
+ QVariantMap map;
+ map.insert(XQLOGS_VIEW_INDEX, QVariant(0));
+ map.insert(XQLOGS_SHOW_DIALPAD, QVariant(enableDialPad));
+ map.insert(XQLOGS_DIALPAD_TEXT, QVariant(QString()));
+
+ QList<QVariant> arglist;
+
+ arglist.append(QVariant(map));
+ request->setArguments(arglist);
+ QVariant ret(retValue);
+ request->send(ret);
+ TRACES( RDebug::Print( _L("CSysApAppUi::InvokeApp::Request::End") ) );
+ }
+
+ TRACES( RDebug::Print( _L("CSysApAppUi::HandleSendKeyEventL: End") ) );
+ }
+
+/**
+ * Handles END key events
+ * If END key is pressed, Fore ground app will be exits and
+ * Home screen view will brought to Foreground
+ */
+void CSysApAppUi::HandleEndKeyEventL()
+ {
+ TRACES( RDebug::Print( _L("CSysApAppUi::HandleEndKeyEventL: Start") ) );
+ //Get ForeGround App
+ TInt foregroundWindowGroupId = iEikonEnv->WsSession().GetFocusWindowGroup();
+ CApaWindowGroupName* doomedApp = CApaWindowGroupName::NewLC(iEikonEnv->WsSession(),foregroundWindowGroupId );
+
+ //Bring the HS before killing the ForeGround App.
+ _LIT(KHsActivactionUri, "appto://20022F35?activityname=HsIdleView");
+ RApaLsSession apaLsSession;
+ CleanupClosePushL(apaLsSession);
+ User::LeaveIfError(apaLsSession.Connect());
+ CAfActivityLauncher *activityEnabler = CAfActivityLauncher::NewLC(apaLsSession, iEikonEnv->WsSession());
+ activityEnabler->launchActivityL(KHsActivactionUri);
+ CleanupStack::PopAndDestroy(activityEnabler);
+ CleanupStack::PopAndDestroy(&apaLsSession);
+
+ //End or Kill the Foreground App
+ //If Phone is in HS idle view, End key have no impact.
+ if ( !doomedApp->IsSystem() )
+ {
+ TApaTask task( iEikonEnv->WsSession() );
+ task.SetWgId( foregroundWindowGroupId );
+ TRACES (
+ const TDesC& caption = doomedApp->Caption();
+ const TDesC& docname = doomedApp->DocName();
+ const TDesC& wgname = doomedApp->WindowGroupName();
+ TUid uid = doomedApp->AppUid();
+ RDebug::Print( _L("CSysApAppUi::HandleEndKeyEventL: Closing app \"%S\" (ThreadId %d, WgId %d, UID 0x%X); Docname: %S, WGName : %S"),
+ &caption,
+ (TUint)(task.ThreadId()),
+ foregroundWindowGroupId,
+ uid.iUid,
+ &docname,
+ &wgname);
+ );
+ task.EndTask();
+ TRACES( RDebug::Print(_L("CSysApAppUi::HandleKeyEventL::HandleEndKeyEventL, End task event triggered") ) );
+ }
+ CleanupStack::PopAndDestroy(doomedApp);//doomedApp
+ TRACES( RDebug::Print( _L("CSysApAppUi::HandleEndKeyEventL: End") ) );
+ }
//end of file