--- a/idlehomescreen/xmluirendering/uiengine/src/xnkeyeventdispatcher.cpp Wed Sep 15 12:00:00 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnkeyeventdispatcher.cpp Wed Oct 13 14:18:30 2010 +0300
@@ -17,11 +17,9 @@
// System includes
#include <AknUtils.h>
-#include <AknPriv.hrh>
// User includes
#include "xnappuiadapter.h"
-#include "xnviewadapter.h"
#include "xnfocuscontrol.h"
#include "xnkeyeventdispatcher.h"
#include "xntype.h"
@@ -42,11 +40,7 @@
( k == EStdKeyLeftArrow || k == EStdKeyRightArrow || \
k == EStdKeyUpArrow || k == EStdKeyDownArrow )
-// Constants
-const TInt KOneView( 1 );
-
-_LIT8( KEnablePartialInput, "splitinputenabled" );
-_LIT8( KTextEditor, "texteditor" );
+const TInt KOneView = 1;
// -----------------------------------------------------------------------------
// SetInitialFocusL
@@ -151,11 +145,7 @@
{
iCoeEnv->RemoveMessageMonitorObserver( *this );
- CXnAppUiAdapter& appui( iUiEngine.AppUiAdapter() );
-
- appui.ViewManager().RemoveObserver( *this );
-
- appui.UiStateListener().RemoveObserver( *this );
+ iUiEngine.ViewManager()->RemoveObserver( *this );
delete iLoseFocus;
delete iGainFocus;
@@ -181,11 +171,7 @@
{
MakeVisible( EFalse );
- CXnAppUiAdapter& appui( iUiEngine.AppUiAdapter() );
-
- appui.UiStateListener().AddObserver( *this );
-
- appui.ViewManager().AddObserver( *this );
+ iUiEngine.ViewManager()->AddObserver( *this );
iCoeEnv->AddMessageMonitorObserverL( *this );
}
@@ -242,44 +228,6 @@
}
// -----------------------------------------------------------------------------
-// CXnKeyEventDispatcher::NotifyStatusPaneSizeChanged()
-//
-// -----------------------------------------------------------------------------
-//
-void CXnKeyEventDispatcher::NotifyStatusPaneSizeChanged()
- {
- // No implementation required
- }
-
-// -----------------------------------------------------------------------------
-// CXnKeyEventDispatcher::NotifyResourceChanged()
-//
-// -----------------------------------------------------------------------------
-//
-void CXnKeyEventDispatcher::NotifyResourceChanged( TInt aType )
- {
- if ( aType == KAknSplitInputEnabled )
- {
- if ( iActiveTextEditor )
- {
- CXnProperty* prop( NULL );
-
- TRAP_IGNORE( prop =
- iActiveTextEditor->GetPropertyL( KEnablePartialInput ) );
-
- if ( prop && prop->StringValue() == XnPropertyNames::KTrue )
- {
- iUiEngine.EnablePartialTouchInput( iActiveTextEditor, ETrue );
- }
- }
- }
- else if ( aType == KAknSplitInputDisabled )
- {
- iUiEngine.EnablePartialTouchInput( NULL, EFalse );
- }
- }
-
-// -----------------------------------------------------------------------------
// CXnKeyEventDispatcher::PointerEvent()
//
// -----------------------------------------------------------------------------
@@ -290,43 +238,6 @@
}
// -----------------------------------------------------------------------------
-// CXnKeyEventDispatcher::SetTextEditorActive()
-//
-// -----------------------------------------------------------------------------
-//
-void CXnKeyEventDispatcher::SetTextEditorActive( CXnNode* aNode,
- TBool aActivate )
- {
- if ( iActiveTextEditor && iActiveTextEditor != aNode )
- {
- CXnNode* activeTextEditor( iActiveTextEditor );
- iActiveTextEditor = NULL;
-
- // Run lose focus to text editor node
- TRAP_IGNORE( SetNodeL( activeTextEditor, NULL, ETrue ) );
- }
-
- if ( aActivate && aNode && aNode->Type()->Type() == KTextEditor )
- {
- iActiveTextEditor = aNode;
- }
- else
- {
- iActiveTextEditor = NULL;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CXnKeyEventDispatcher::IsTextEditorActive
-//
-// -----------------------------------------------------------------------------
-//
-TBool CXnKeyEventDispatcher::IsTextEditorActive() const
- {
- return iActiveTextEditor ? ETrue : EFalse;
- }
-
-// -----------------------------------------------------------------------------
// CXnKeyEventDispatcher::OfferKeyEventL
// Handles key events.
// -----------------------------------------------------------------------------
@@ -358,11 +269,6 @@
{
keyYesNoApps = ETrue;
- if ( aKeyEvent.iScanCode == EStdKeyNo && aType == EEventKey )
- {
- iUiEngine.AppUiAdapter().ViewAdapter().CloseAllPopupsL();
- }
-
iFocusChanged = EFalse;
// AppsKey, YesKey, NoKey events must be always handled, and if we don't
@@ -375,45 +281,38 @@
if ( IS_ARROW_KEY( aKeyEvent.iScanCode ) && aType == EEventKey )
{
- if ( !appui.FocusShown() || !iNode )
+ if ( !appui.FocusShown() )
{
appui.ShowFocus();
if ( !iNode )
{
- if ( iActiveTextEditor )
- {
- iNode = iActiveTextEditor;
- }
- else
+ // Find initial location for focus
+ ResolveAndSetFocusL();
+
+ // If focus is still not set, we are in normal mode and the view is empty.
+ // left and right arrows lead to next/previous view. When other arrows
+ // are pressed, the focus is hidden.
+ if( !iNode )
{
- // Find initial location for focus
- ResolveAndSetFocusL();
-
- // If focus is still not set, we are in normal mode and the view is empty.
- // left and right arrows lead to next/previous view. When other arrows
- // are pressed, the focus is hidden.
- if( !iNode )
+ if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
+ aKeyEvent.iScanCode == EStdKeyRightArrow )
{
- if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
- aKeyEvent.iScanCode == EStdKeyRightArrow )
- {
- iUiEngine.ViewManager()->ActivateNextViewL();
- }
- else if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
- aKeyEvent.iScanCode == EStdKeyLeftArrow )
- {
- iUiEngine.ViewManager()->ActivatePreviousViewL();
- }
- else
- {
- // hide focus if view is not switched
- appui.HideFocus();
- }
+ iUiEngine.ViewManager()->ActivateNextViewL();
+ }
+ else if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
+ aKeyEvent.iScanCode == EStdKeyLeftArrow )
+ {
+ iUiEngine.ViewManager()->ActivatePreviousViewL();
}
-
- return EKeyWasConsumed;
+ else
+ {
+ // hide focus if view is not switched
+ appui.HideFocus();
+ }
}
+
+ return EKeyWasConsumed;
}
}
}
@@ -532,14 +431,6 @@
{
if ( aToLose )
{
- CXnControlAdapter* adapter( aToLose->Control() );
-
- // Don't change control focus when <texteditor> element is focused
- if ( adapter && !iActiveTextEditor )
- {
- adapter->SetFocus( EFalse );
- }
-
aToLose->SetDirtyL( XnDirtyLevel::ERender );
aToLose->UnsetStateL( XnPropertyNames::style::common::KFocus );
@@ -553,34 +444,20 @@
iLoseFocus = BuildTriggerNodeL( iUiEngine,
XnPropertyNames::action::trigger::name::KLoseFocus );
}
-
- if ( iActiveTextEditor != aToLose )
- {
- aToLose->ReportXuikonEventL( *iLoseFocus );
- }
+
+ aToLose->ReportXuikonEventL( *iLoseFocus );
+ }
+
+ CXnControlAdapter* adapter( aToLose->Control() );
+
+ if ( adapter )
+ {
+ adapter->SetFocus( EFalse );
}
}
if ( aToGain )
{
- TBool isTextEditor( aToGain->Type()->Type() == KTextEditor );
-
- if ( iActiveTextEditor && ( ( aSource != XnEventSource::EStylus && !isTextEditor ) ||
- ( iActiveTextEditor->Namespace() != aToGain->Namespace() ) ||
- ( isTextEditor && iActiveTextEditor != aToGain ) ) )
- {
- // Remove focus from active <texteditor> element
- SetTextEditorActive( NULL, EFalse );
- }
-
- CXnControlAdapter* adapter( aToGain->Control() );
-
- // Don't change control focus when <texteditor> element is focused
- if ( adapter && !iActiveTextEditor )
- {
- adapter->SetFocus( ETrue );
- }
-
aToGain->SetDirtyL( XnDirtyLevel::ERender );
if ( aNotify )
@@ -591,17 +468,15 @@
XnPropertyNames::action::trigger::name::KGainFocus );
}
- if ( iActiveTextEditor != aToGain )
- {
- aToGain->ReportXuikonEventL( *iGainFocus, aSource );
- }
+ aToGain->ReportXuikonEventL( *iGainFocus, aSource );
}
-
- if ( isTextEditor )
+
+ CXnControlAdapter* adapter( aToGain->Control() );
+
+ if ( adapter )
{
- // Set active <texteditor> element
- SetTextEditorActive( aToGain, ETrue );
- }
+ adapter->SetFocus( ETrue );
+ }
}
}
@@ -766,9 +641,6 @@
const CXnViewData& /*aViewData*/ )
{
iMenuNode = NULL;
-
- SetTextEditorActive( NULL, EFalse );
-
ClearPassiveFocusedNodesL();
ClearStateL();
@@ -795,11 +667,11 @@
{
ClearPassiveFocusedNodesL();
- CXnViewData& activeViewData(
- iUiEngine.ViewManager()->ActiveViewData() );
-
if ( iNode )
{
+ CXnViewData& activeViewData(
+ iUiEngine.ViewManager()->ActiveViewData() );
+
const CXnPluginData* pluginData(
activeViewData.Plugin( iNode ) );
@@ -809,17 +681,6 @@
ClearStateL();
}
}
-
- if ( iActiveTextEditor )
- {
- const CXnPluginData* pluginData(
- activeViewData.Plugin( iActiveTextEditor ) );
-
- if ( pluginData == &aPluginData )
- {
- SetTextEditorActive( NULL, EFalse );
- }
- }
}
}