Revision: 201035 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 15 Sep 2010 12:34:44 +0300
branchRCL_3
changeset 50 5a1685599b76
parent 46 bd83ceabce89
child 56 8152b1f1763a
Revision: 201035 Kit: 201036
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/group/AknFepUiAvkonPlugin.mmp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepPredictiveSettingDialog.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidateCharacter.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidatePane.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidateSelected.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlContainerChinese.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlPinyinPopup.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/aknfepuilayoutdatamgr.h
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepPredictiveSettingDialog.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidateCharacter.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidatePane.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidateSelected.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlContainerChinese.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlInputPane.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlPinyinPopup.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrleepcontrol.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrlpinyineep.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuilayoutdatamgr.cpp
fep/aknfep/UiPlugins/AknFepUiInterface/inc/AknFepUiCtrlContainerChinese.h
fep/aknfep/group/AknFep.mmp
fep/aknfep/group/Iconlist.txt
fep/aknfep/group/bld.inf
fep/aknfep/inc/AknFepManager.h
fep/aknfep/inc/AknFepPluginManager.h
fep/aknfep/inc/AknFepUIInputStateEntryMiniQwertyCangJie.h
fep/aknfep/inc/AknFepUIInputStateEntryMiniQwertyPinyinPhrase.h
fep/aknfep/inc/AknFepUiInputStateBase.h
fep/aknfep/inc/AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.h
fep/aknfep/inc/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.h
fep/aknfep/inc/AknFepUiInputStateChineseBase.h
fep/aknfep/inc/AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.h
fep/aknfep/inc/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.h
fep/aknfep/inc/AknFepUiInputStatePredictiveInputMiniQwertyChinesePhrase.h
fep/aknfep/inc/AknFepUiManagerBase.h
fep/aknfep/inc/AknFepUiManagerChinese.h
fep/aknfep/inc/aknfepuiinputminiqwertysogoupinyinphraseplugin.h
fep/aknfep/inc/aknfepuiinputminiqwertysogoustrokephraseplugin.h
fep/aknfep/inc/aknfepuiinputstateminiqwertystrokephrase.h
fep/aknfep/inc/aknfepuiinputstateminiqwertyzhuyinphrase.h
fep/aknfep/src/AknFepKeyCatcher.cpp
fep/aknfep/src/AknFepManager.cpp
fep/aknfep/src/AknFepPluginManager.cpp
fep/aknfep/src/AknFepUIInputStateEntryMiniQwertyCangJie.cpp
fep/aknfep/src/AknFepUIInputStateEntryMiniQwertyPinyinPhrase.cpp
fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp
fep/aknfep/src/AknFepUiInputStateBase.cpp
fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.cpp
fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.cpp
fep/aknfep/src/AknFepUiInputStateCandidateQwertyBaseChinesePhrase.cpp
fep/aknfep/src/AknFepUiInputStateChineseBase.cpp
fep/aknfep/src/AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.cpp
fep/aknfep/src/AknFepUiInputStateEntryQwertyBaseChinesePhrase.cpp
fep/aknfep/src/AknFepUiInputStateEntryThaiPredictive.cpp
fep/aknfep/src/AknFepUiInputStateInitialKoreanMultitap.cpp
fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp
fep/aknfep/src/AknFepUiInputStatePredictiveInputQwertyChinesePhrase.cpp
fep/aknfep/src/AknFepUiManagerChinese.cpp
fep/aknfep/src/aknfepuiinputminiqwertypinyinphrasebase.cpp
fep/aknfep/src/aknfepuiinputminiqwertysogoupinyinphraseplugin.cpp
fep/aknfep/src/aknfepuiinputminiqwertysogoustrokephraseplugin.cpp
fep/aknfep/src/aknfepuiinputminiqwertystrokephrasebase.cpp
fep/aknfep/src/aknfepuiinputstateminiqwertystrokephrase.cpp
fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp
inputmethods_plat/aknfep_pen_support_api/inc/aknfeppeninputenums.h
inputmethods_pub/ptiengine_iti_api/inc/PtiDefs.h
textinput/peninputarc/bwins/peninputlayoutcontrolU.DEF
textinput/peninputarc/eabi/peninputlayoutcontrolU.DEF
textinput/peninputarc/group/bld.inf
textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutbubblectrl.h
textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutmultilineicf.h
textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvirtualkeyctrl.h
textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.h
textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.inl
textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputpopupbubble.h
textinput/peninputarc/inc/pensrvcliinc/peninputsrvobserver.h
textinput/peninputarc/src/peninputclient/penclientimpl.cpp
textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbubblectrl.cpp
textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutcontrol.mmp
textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp
textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutvkbkeyctrl.cpp
textinput/peninputarc/src/peninputlayoutcontrol/peninputpopupbubble.cpp
textinput/peninputarc/src/peninputserverapp/peninputserver.cpp
textinput/peninputarc/src/peninputserverapp/penuiwndctrl.cpp
textinput/peninputcommonctrls/bwins/peninputcommonctrlsU.DEF
textinput/peninputcommonctrls/eabi/peninputcommonctrlsU.DEF
textinput/peninputcommonctrls/inc/peninputbuttons/peninputmultimodebutton.h
textinput/peninputcommonctrls/src/peninputbuttons/peninputbutton.cpp
textinput/peninputcommonlayout/inc/peninputcommonlayoutglobalenum.h
textinput/peninputcommonlayout/inc/peninputlayoutwindowext.h
textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp
textinput/peninputfingerhwrar/group/peninputfingerhwrar.mmp
textinput/peninputfingerhwrar/src/peninputfingerhwrarengine.cpp
textinput/peninputfingerhwrar/src/peninputfingerhwrarnumsymboltable.cpp
textinput/peninputfingerhwrar/src/peninputfingerhwrarsymboltable.cpp
textinput/peninputfingerhwrar/src/peninputfingerhwrarwnd.cpp
textinput/peninputgenericitut/inc/peninputgenericitutdata.h
textinput/peninputgenericitut/inc/peninputgenericitutdatamgr.h
textinput/peninputgenericitut/src/peninputgenericitutdatamgr.cpp
textinput/peninputgenericitut/src/peninputgenericitutwindow.cpp
textinput/peninputgenericitut/src/peninputitutchnuimgr.cpp
textinput/peninputgenericitut/src/peninputitutwesternuimgr.cpp
textinput/peninputgenericvkb/group/iconlist.txt
textinput/peninputgenericvkb/inc/peninputgenericvkblayout.h
textinput/peninputgenericvkb/inc/peninputgenericvkbwindow.h
textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp
textinput/peninputgenericvkb/src/peninputgenericvkbwindow.cpp
textinput/peninputgenericvkb/srcdata/peninputvkbwindow.rss
textinput/peninputsplititut/inc/peninputsplititutdata.h
textinput/peninputsplititut/inc/peninputsplititutdatamgr.h
textinput/peninputsplititut/inc/peninputsplititutwesternuistatespelling.h
textinput/peninputsplititut/inc/peninputsplititutwindow.h
textinput/peninputsplititut/src/peninputsplititutchnuimgr.cpp
textinput/peninputsplititut/src/peninputsplititutdatamgr.cpp
textinput/peninputsplititut/src/peninputsplititutlayout.cpp
textinput/peninputsplititut/src/peninputsplititutwesternuimgr.cpp
textinput/peninputsplititut/src/peninputsplititutwesternuistatespelling.cpp
textinput/peninputsplititut/src/peninputsplititutwindow.cpp
textinput/peninputsplititut/src/peninputsplititutwindowmanager.cpp
textinput/peninputsplitqwerty/group/iconlist.txt
textinput/peninputsplitqwerty/inc/peninputsplitqwertylafdatamgr.h
textinput/peninputsplitqwerty/inc/peninputsplitqwertylayout.h
textinput/peninputsplitqwerty/inc/peninputsplitqwertywindow.h
textinput/peninputsplitqwerty/src/peninputsplitqwertylafdatamgr.cpp
textinput/peninputsplitqwerty/src/peninputsplitqwertylayout.cpp
textinput/peninputsplitqwerty/src/peninputsplitqwertywindow.cpp
textinput/peninputsplitqwerty/srcdata/peninputssqwin.rss
textinput/ptienginev2/src/PtiEngineImpl.cpp
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/group/AknFepUiAvkonPlugin.mmp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/group/AknFepUiAvkonPlugin.mmp	Wed Sep 15 12:34:44 2010 +0300
@@ -67,10 +67,10 @@
 SOURCE          AknFepUiAvkonCtrlContainerChinese.cpp
 SOURCE          AknFepUiAvkonCtrlInputPane.cpp
 SOURCE          AknFepUiAvkonCtrlCandidatePane.cpp
-SOURCE          AknFepUiAvkonCtrlCandidateSelected.cpp
 SOURCE          AknFepUiAvkonCtrlPinyinPopup.cpp
 SOURCE          aknfepuilayoutdatamgr.cpp
 SOURCE          aknfepchineseuidataconv.cpp
+SOURCE          AknFepUIAvkonCtrlCandidateCharacter.cpp
 // for phrase creation
 SOURCE          aknfepuictrleepcontrol.cpp 
 SOURCE          aknfepuictrlpinyineep.cpp 
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepPredictiveSettingDialog.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepPredictiveSettingDialog.h	Wed Sep 15 12:34:44 2010 +0300
@@ -104,6 +104,8 @@
 		// From MEikMenuObserver
 		virtual void DynInitMenuPaneL( TInt aResourceId, 
 		                               CEikMenuPane* aMenuPane );
+		// Process the key events
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
 	    
 	protected:
         /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidateCharacter.h	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2002-2004 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:           
+*       Provides the CAknFepUICtrlCandidateCharacter definition.
+*
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+#ifndef __AKN_FEP_CANDIDATE_CHARACTER_PANE_H__
+#define __AKN_FEP_CANDIDATE_CHARACTER_PANE_H__
+
+#include <e32std.h>
+#include <coecntrl.h>
+
+#include "AknFepUICtrlCandidatePane.h"
+
+class CEikLabel;
+class MAknFepUIEventObserver;
+
+/**
+ * Control representing the selected candidate. Is a window owning control,
+ * that appears over the candidate pane such that it obscures the labels
+ * beneath. Can be hidden, for example if there is no visible selection, 
+ * or if highlighting is disabled.
+ */
+NONSHARABLE_CLASS(CAknFepUICtrlCandidateCharacter) : public CCoeControl
+    {
+public:
+    enum
+        {
+		EOneCandidate = 1,
+        EMaxSelectedCandidateLength = 10 // extend buffer for phrase input
+        };
+public:
+
+    /**
+     * first phase construction
+     */
+    static CAknFepUICtrlCandidateCharacter* NewL( RWindowTreeNode& aParent, 
+    		                                      MAknFepUIEventObserver* aObserver );
+
+    /**
+     * destructor
+     */
+    ~CAknFepUICtrlCandidateCharacter();
+
+    /**
+     * Set the text buffer of the character.
+     *
+     * @param aCharacter, the label will be filled with the characters from aCharacter
+     */
+    void SetText( const TDesC& aCharacter );
+
+    /**
+     * Get the text of the character
+     *
+     */
+	const TDesC* Text() const;
+
+public: // from CCoeControl
+    /**
+     * size changed
+     */
+    virtual void SizeChanged();
+
+    /**
+     * count component controls
+     *
+     * @return number of contained controls
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * Component control
+     *
+     * @param aIndex the control to return, must be between 0 and the number of controls
+     * @return pointer to contained control, ownership is not passed
+     */
+    CCoeControl* ComponentControl(TInt aIndex) const;
+
+    /**
+     * draw
+     *
+     * @param aRect rectangle
+     */
+    virtual void Draw( const TRect& aRect ) const;
+    
+    /**
+     * Set character highlight state
+     *
+     * @param bHighlight highlight or not
+     */
+    void SetHighlight( TBool bHightlight );
+
+protected:
+    /**
+     * second phase construction
+     */
+    void ConstructL( RWindowTreeNode& aParent, MAknFepUIEventObserver* aObserver );
+
+     /**
+      * constructor
+      */
+    CAknFepUICtrlCandidateCharacter();
+
+    /**
+     * layout the rectangles
+     */
+    void LayoutRects();
+
+    /**
+     * layout contained controls
+     */
+    void LayoutContainedControls();
+
+    /**
+     * layout the background frames
+     *
+     * @param aOuterRect filled with outer rect coords
+     * @param aInnerRect filled with inner rect coords
+     *
+     */
+    void CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const;
+    
+private:
+    TAknLayoutRect iRectShadow;
+    TAknLayoutRect iRectHighlight;
+	TBufC<EMaxSelectedCandidateLength> iBuffer;
+	
+private: // the following are owned
+    CEikLabel* iCandidateLabel;
+	TBool iIsHighligt;
+    };
+
+#endif //__AKN_FEP_CANDIDATE_CHARACTER_PANE_H__
+
+// End of file
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidatePane.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidatePane.h	Wed Sep 15 12:34:44 2010 +0300
@@ -36,18 +36,222 @@
 #include "AknFepUICtrlCandidatePane.h"
 #include "AknFepUIAvkonCtrlContainerChinese.h"
 
-class CAknFepUICtrlCandidateSelected;
+class CAknFepUICtrlCandidateCharacter;
+class MAknFepUIEventObserver;
+
+/**
+ * Pane which displays the preview character.
+ */
+NONSHARABLE_CLASS(CAknFepPreview) : public CCoeControl
+	{
+public:
+	/**
+	 * first phase construction
+	 */
+	static CAknFepPreview* NewL( RWindowTreeNode& aParent );
+	
+	/**
+	 * Destruction function
+	 *
+	 */
+	~CAknFepPreview();	
+		
+	/**
+	 * draw
+	 *
+	 * @param aRect rectangle
+	 */
+	virtual void Draw( const TRect& aRect ) const;
+	
+	/**
+	 * size changed
+	 */
+	virtual void SizeChanged();
+	
+	/**
+	 * Show preview lable
+	 * @param aRect rectangle
+	 * @param aCharacter preview text
+	 */
+	void ShowL( TRect& aRect, const TDesC& aCharacter );
+	
+	/**
+	 * Hide preview lable
+	 */
+	void HideL();
+	
+	/**
+	 * count component controls
+	 *
+	 * @return number of contained controls
+	 */
+	TInt CountComponentControls() const;
+
+	/**
+	 * Component control
+	 *
+	 * @param aIndex the control to return, must be between 0 and the number of controls
+	 * @return pointer to contained control, ownership is not passed
+	 */
+	CCoeControl* ComponentControl(TInt aIndex) const;
+	
+protected:
+	/**
+	 * Construction function
+	 *
+	 */
+	CAknFepPreview();
+	
+	/**
+	 * second phase construction
+	 */
+	void ConstructL( RWindowTreeNode& aParent );
+	
+	/**
+	 * layout the background frames
+	 *
+	 * @param aOuterRect filled with outer rect coords
+	 * @param aInnerRect filled with inner rect coords
+	 *
+	 */
+    void CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const;
+
+private:
+    // Preview lable
+	CEikLabel* iPreviewLabel;
+	};
+
+/**
+ * Pane which displays the Up arrow & Down arrow & close.
+ */
+NONSHARABLE_CLASS(CAknFepUICtrlCandidateScroll) : public CCoeControl
+	{
+public:
+	/**
+	 * first phase construction
+	 */
+	static CAknFepUICtrlCandidateScroll* NewL( RWindowTreeNode& aParent, 
+		                                       MAknFepUIEventObserver* aObserver );
+
+	/**
+	 * destructor
+	 */
+	~CAknFepUICtrlCandidateScroll();
+
+	/**
+	 * size changed
+	 */
+	virtual void SizeChanged();	
+
+	/**
+	 * draw
+	 *
+	 * @param aRect rectangle
+	 */
+	virtual void Draw( const TRect& aRect ) const;	
+	
+    /**
+     * Handle pointer event
+     * @param aPointerEvent pointer event
+     */
+    void HandlePointerEventL( const TPointerEvent & aPointerEvent );
+    
+    /**
+     * enable/disable the rendering of the Up Scroll Arrows. 
+     *
+     * @param aValue if ETrue, enable the arrows
+     *  if EFalse, disable the arrrows
+     */
+	void ShowUpScrollArrows( TBool aValue );
+	
+    /**
+     * enable/disable the rendering of the down Scroll Arrows. 
+     *
+     * @param aValue if ETrue, enable the arrows
+     *  if EFalse, disable the arrrows
+     */
+	void ShowDownScrollArrows( TBool aValue );
+	
+    /**
+     * enable/disable the rendering of the Vertical Scroll Arrows. 
+     *
+     * @param aValue if ETrue, enable the arrows
+     *                          if EFalse, disable the arrrows
+     */
+	void ShowVerticalScrollArrows( TBool aValue );
+	
+    /**
+     * are the Vertical Scroll Arrows enabled
+     *
+     * @return if arrows not enabled, returns EFalse
+     */
+	TBool IsShowVerticalScrollArrows() const;
+		
+    
+protected:
+	/**
+	 * second phase construction
+	 */
+	void ConstructL( RWindowTreeNode& aParent, MAknFepUIEventObserver* aObserver );
+	
+    /**
+     * Construct all the bitmap classes
+     */
+    void ConstructBitmapsL();
+    
+	/**
+	  * constructor
+	  */
+	CAknFepUICtrlCandidateScroll();
+	
+	/**
+	 * layout contained controls
+	 */
+	void LayoutIcon();
+	
+	/**
+	 * Calculate the close rect
+	 *
+	 * @param aOuterRect filled with outer rect coords
+	 * @param aInnerRect filled with inner rect coords
+	 *
+	 */
+	void CalculateCloseRects(TRect& aOuterRect, TRect& aInnerRect) const;
+
+private:
+    CFbsBitmap* iScrollCloseBitmap;
+    CFbsBitmap* iScrollCloseBitmapMask;
+    CFbsBitmap* iNaviArrowBitmapUp;
+    CFbsBitmap* iNaviArrowBitmapUpMask;
+    CFbsBitmap* iNaviArrowBitmapDown;
+    CFbsBitmap* iNaviArrowBitmapDownMask;
+    
+    TAknLayoutRect iIndiFepClose;
+    TAknLayoutRect iIndiFepArrowUp;
+    TAknLayoutRect iIndiFepArrowDown;
+    
+    TBool iShowVerticalScrollArrows;
+    TBool iShowUpScrollArrows;
+    TBool iShowDownScrollArrows;
+    TBool iShowClose;
+    
+    MAknFepUIEventObserver* iObServer;
+	};
 
 /**
  * Pane which displays the Chinese Candidates.
  */
-NONSHARABLE_CLASS(CAknFepUICtrlCandidatePane) : public CCoeControl, public MAknFepUICtrlCandidatePane
+NONSHARABLE_CLASS(CAknFepUICtrlCandidatePane) : 
+				public CCoeControl,
+				public MAknFepUICtrlCandidatePane,
+				public MAknFepUIEventObserver
     {
 public:
     /**
      * first phase construction
      */
-    static CAknFepUICtrlCandidatePane* NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr);
+    static CAknFepUICtrlCandidatePane* NewL( RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr, 
+											 MAknFepChineseUiMgr* aMgr );
     /**
      * destructor
      */
@@ -60,6 +264,12 @@
      * @output the text buffer of the Pane
      */
     const TDesC& TextBuffer() const;
+    
+    /**
+     * Handle pointer event
+     * @param aPointerEvent pointer event
+     */
+    void HandlePointerEventL( const TPointerEvent & aPointerEvent );
 
     /**
      * Allows the client to set a descriptor pointer into an existing buffer of 
@@ -169,7 +379,7 @@
      * @return if arrows not enabled, returns EFalse
      */
     TBool IsShowVerticalScrollArrows() const;
-
+		
     /**
      * enable/disable the rendering of the Vertical Scroll Arrows. 
      *
@@ -177,22 +387,15 @@
      *                          if EFalse, disable the arrrows
      */
     void ShowVerticalScrollArrows(TBool aValue);
-
+    
     /**
-     * enable/disable the rendering of the candidate ordinal numbers
+     * This function is not needed.
      *
      * @param aValue if ETrue, enable the ordinals
      *                          if EFalse, disable the ordinals
      *
      */
-    void ShowCandidateOrdinals(TBool aValue);
-
-    /**
-     * enable/disable the rendering of the candidate ordinal numbers
-     *
-     * @return if not shown, return EFalse
-     */
-    TBool IsShowCandidateOrdinals() const;
+    void ShowCandidateOrdinals(TBool /*aValue*/){};
 
     /**
      * This function returns the number of Candidates that are visible in the pane 
@@ -357,6 +560,21 @@
 	 */
 	TBool NeedGetNewCandidatePage();
 	
+	/**
+	 *	Close button is pressed
+	 */
+	void FepUIClosePressed();
+
+	/**
+	 *	Set MAknFepUiStateCtrl pointer
+	 */
+	void SetFepUiState(MAknFepUiStateCtrl* aFepUiState);	
+	
+	/**
+	 *	Hide preview
+	 */
+	void HidePreviewL();
+
 public: // from CCoeControl
     /**
      * size changed
@@ -378,38 +596,20 @@
      * 
      */
     CCoeControl* ComponentControl(TInt aIndex) const;
-
-    /**
-     * draw
-     *
-     * @param aRect rectangle
-     *
-     */
-    virtual void Draw(const TRect& aRect) const;
-    
     
     void Enable(TBool aEnable);
 
 protected:
+    
     /**
      * second phase construction
      */
     void ConstructL(RWindow& aParent);
 
     /**
-     * Construct all the bitmap classes
-     */
-    void ConstructBitmapsL();
-
-    /**
-     * constructor
+     * Construct function
      */
-    CAknFepUICtrlCandidatePane( CAknFepUiLayoutDataMgr* aLafDataMgr );
-
-    /**
-     * layout the rectangles
-     */
-    void LayoutRects();
+    CAknFepUICtrlCandidatePane( CAknFepUiLayoutDataMgr* aLafDataMgr, MAknFepChineseUiMgr* aMgr );
 
     /**
      * layout contained controls
@@ -420,22 +620,16 @@
      * layout the labels for a single candidate
      */
     void LayoutLabel(TInt aIndex);
-
+    
     /**
      * layout the labels for all the candidates (even those that are not currently visible)
      */
     void LayoutLabels();
 
     /**
-     * layout selected candidate
-     * <p> Note that there is only one instance, as there can 
-     * only be one selected candidate at a time. Therefore, the control
-     * is placed in the position that is correct based on the current selection
-     *
-     * @param aIndex the index of the new position of the selected candidate
-     *
+     * layout the scroll pane
      */
-    void LayoutCandidateSelected();
+    void LayoutScroll();
 
     /**
      * set label vilisibilty, according to the current pane layout
@@ -456,44 +650,26 @@
      */
     void InternalSpilitPhraseCandidate();
 
-private: // the following are owned
-    CAknFepUICtrlCandidateSelected* iCandidateSelected;
-    CFbsBitmap* iNaviArrowBitmapLeft;
-    CFbsBitmap* iNaviArrowBitmapLeftMask;
-    CFbsBitmap* iNaviArrowBitmapRight;
-    CFbsBitmap* iNaviArrowBitmapRightMask;
-    CFbsBitmap* iNaviArrowBitmapUp;
-    CFbsBitmap* iNaviArrowBitmapUpMask;
-    CFbsBitmap* iNaviArrowBitmapDown;
-    CFbsBitmap* iNaviArrowBitmapDownMask;
 private: // the following need resetting
-    RPointerArray<CEikLabel> iCandidateLabelArray;
-    RPointerArray<CEikLabel> iOrdinalLabelArray;
+    RPointerArray<CAknFepUICtrlCandidateCharacter> iCandidateLabelArray;
     RArray<TCandidateMode> iCandidateModeArray;
 private: // the following are members
     CAknFepUiLayoutDataMgr* iLafDataMgr;
-    TAknLayoutRect iIndiFepArrowLeft;
-    TAknLayoutRect iIndiFepArrowRight;
-    TAknLayoutRect iIndiFepArrowUp;
-    TAknLayoutRect iIndiFepArrowDown;
     TBufC<EMaxCandidates> iBuffer;
     CAknFepUICtrlContainerChinese::TPaneLayout iPaneLayout;
     TInt iVisibleCount;
     TInt iSelected;
     TBool iHighlighted;
-    TBool iShowHorizontalScrollArrows;
-    TBool iShowVerticalScrollArrows;
-    TBool iShowUpScrollArrows;
-    TBool iShowDownScrollArrows;
-    TBool iShowLeftScrollArrows;
-    TBool iShowRightScrollArrows;
-    TBool iShowCandidateOrdinals;
     RArray<TPage> iPages;
     //next paging candidate index
     TInt iUnpagedIndex;
     TInt iCurDisplayPage;
     CDesCArrayFlat* iCandidateArray;
-    TInt iOrdinalLableWidth;
+    MAknFepChineseUiMgr* iChineseUiMgr;
+    MAknFepUiStateCtrl* iFepUiState;
+    CAknFepUICtrlCandidateScroll* iCtrlScroll;
+    CAknFepPreview* iPreview;
+    TBool iPointDown;
     };
 
 #endif //__AKN_FEP_AVKON_CANDIDATE_PANE_H__
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlCandidateSelected.h	Tue Sep 14 21:59:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
-* Copyright (c) 2002-2004 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""
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:           
-*       Provides the CAknFepUICtrlCandidateSelected definition.
-*
-*/
-
-
-
-
-
-
-
-
-
-
-
-
-#ifndef __AKN_FEP_CANDIDATE_SELECTED_PANE_H__
-#define __AKN_FEP_CANDIDATE_SELECTED_PANE_H__
-
-#include <e32std.h>
-#include <coecntrl.h>
-
-#include "AknFepUICtrlCandidatePane.h"
-
-class CEikLabel;
-
-/**
- * Control representing the selected candidate. Is a window owning control,
- * that appears over the candidate pane such that it obscures the labels
- * beneath. Can be hidden, for example if there is no visible selection, 
- * or if highlighting is disabled.
- */
-NONSHARABLE_CLASS(CAknFepUICtrlCandidateSelected) : public CCoeControl
-    {
-public:
-    enum
-        {
-		EOneCandidate = 1,
-        EMaxSelectedCandidateLength = 10 // extend buffer for phrase input
-        };
-public:
-
-    /**
-     * first phase construction
-     */
-    static CAknFepUICtrlCandidateSelected* NewL(RWindowTreeNode& aParent);
-
-    /**
-     * destructor
-     */
-    ~CAknFepUICtrlCandidateSelected();
-
-    /**
-     * Set the text buffer of the Pane.
-     *
-     * @param aCharacter, the label will be filled with the characters from aCharacter
-     */
-    void SetText(TPtrC aCharacter);
-    
-    /**
-     * Set the ordinal of the Pane.
-     *
-     * @param aOrdinal
-     */
-    void SetOrdinal(TInt aOrdinal);
-
-    /**
-     * This function sets the candidate mode of the pane for rendering purposes.
-     *
-     * @param aMode the new mode
-     */
-    void SetCandidateMode(MAknFepUICtrlCandidatePane::TCandidateMode aMode);
-
-	/**
-	* Set layout
-	* @param aLayout the new layout
-	*/
-	void SetLayout(MAknFepUICtrlContainerChinese::TPaneLayout aLayout);
-	/**
-	* Set ordinal status
-	* @param aValue the new status
-	*/
-	void ShowOrdinal(TBool aValue);
-
-public: // from CCoeControl
-    /**
-     * size changed
-     */
-    virtual void SizeChanged();
-
-    /**
-     * count component controls
-     *
-     * @return number of contained controls
-     */
-    TInt CountComponentControls() const;
-
-    /**
-     * Component control
-     *
-     * @param aIndex the control to return, must be between 0 and the number of controls
-     * @return pointer to contained control, ownership is not passed
-     */
-    CCoeControl* ComponentControl(TInt aIndex) const;
-
-    /**
-     * draw
-     *
-     * @param aRect rectangle
-     */
-    virtual void Draw(const TRect& aRect) const;
-
-protected:
-    /**
-     * second phase construction
-     */
-    void ConstructL(RWindowTreeNode& aParent);
-
-     /**
-      * constructor
-      */
-    CAknFepUICtrlCandidateSelected();
-
-    /**
-     * layout the rectangles
-     */
-    void LayoutRects();
-
-    /**
-     * layout contained controls
-     */
-    void LayoutContainedControls();
-
-    /**
-     * layout the background frames
-     *
-     * @param aOuterRect filled with outer rect coords
-     * @param aInnerRect filled with inner rect coords
-     *
-     */
-    void CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const;
-
-    /**
-     * set label vilisibilty, according to the current pane layout
-     */
-    void UpdateLabelVisibility();
-
-private:
-    TAknLayoutRect iRectShadow;
-    TAknLayoutRect iRectHighlight;
-	TBufC<EMaxSelectedCandidateLength> iBuffer;
-    MAknFepUICtrlCandidatePane::TCandidateMode iCandidateMode;
-    TInt iIndex;
-    MAknFepUICtrlContainerChinese::TPaneLayout iPaneLayout;
-	TBool iShowOrdinal;
-private: // the following are owned
-    CEikLabel* iCandidateLabel;
-    CEikLabel* iOrdinalLabel;
-    };
-
-#endif //__AKN_FEP_CANDIDATE_SELECTED_PANE_H__
-
-// End of file
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlContainerChinese.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlContainerChinese.h	Wed Sep 15 12:34:44 2010 +0300
@@ -40,6 +40,32 @@
 class CAknFepUICtrlPinyinEEP;
 class MAknFepManagerUIInterface;
 class CAknFepUiLayoutDataMgr;
+class MCoeFocusObserver;
+class MAknFepUiStateCtrl;
+
+class MAknFepUIEventObserver
+	{
+public:
+    /**
+     * Click close pane to close
+     */
+	virtual void FepUIClosePressed() = 0;
+	};
+
+class MAknFepChineseUiMgr
+	{
+public:
+    /**
+     * Submit text
+     * @param aText committed text
+     */
+	virtual void SubmitSelectedTextL( const TDesC& aText ) = 0;
+	
+    /**
+     * Close container
+     */
+	virtual void CloseContainer() = 0;
+	};
 
 class MAknFepUICtrlPinyinPopupSizeChangedObserver
     {
@@ -55,7 +81,8 @@
     : 
     public CCoeControl, 
     public MAknFepUICtrlPinyinPopupSizeChangedObserver,
-    public MAknFepUICtrlContainerChinese
+    public MAknFepUICtrlContainerChinese,
+    public MAknFepChineseUiMgr
 {
 public:
     /**
@@ -191,6 +218,31 @@
      * @return if not enabled, return EFalse
      */
     void SetFepMan( MAknFepManagerUIInterface* aFepMan );
+    
+    /**
+     * Handle pointer event
+     * @param aPointerEvent pointer event
+     * 
+     */
+    void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+    
+    /**
+     * Set observer
+     * @param aObserver Obsever object
+     * 
+     */
+    void SetFepUiStateCtrl( MAknFepUiStateCtrl* aFepUiState );
+        
+    /**
+     * Submit text
+     * @param aText committed text
+     */
+    void SubmitSelectedTextL(const TDesC& aText);
+    
+    /**
+     * Close container
+     */
+    void CloseContainer();	
 
 public: // from CCoeControl
 
@@ -224,6 +276,7 @@
     virtual void Draw(const TRect& aRect) const;
 
     virtual void HandleResourceChange(TInt aType); 
+   
 	
 protected: // From CCoeControl
     TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
@@ -311,6 +364,12 @@
      */
 	void CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const;    
 
+    /**
+     * Close UI
+	 *
+     */
+	void CloseUI();
+	
 private:
     CAknFepUiLayoutDataMgr* iLafDataMgr;
     CAknFepUICtrlInputPane* iInputPane;
@@ -318,6 +377,8 @@
 	CAknFepUICtrlPinyinPopup* iPinyinPopupWindow;
 	CAknFepUICtrlPinyinEEP* iEditPane;
 	CAknsFrameBackgroundControlContext* iBgContext; 
+	
+	
 
 private:
 	TBool iEnabled;
@@ -337,6 +398,7 @@
     
     TInt iPhraseCreation;
     MAknFepManagerUIInterface* iFepMan;
+    MAknFepUiStateCtrl* iFepUiState;
 };
 #endif  // __AKN_FEP_UI_AVKON_CONTAINER_CHINESE_H__
 
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlPinyinPopup.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlPinyinPopup.h	Wed Sep 15 12:34:44 2010 +0300
@@ -504,10 +504,7 @@
      * second phase construction
      */
     void ConstructL(RWindow& aParent);
-	/**
-     * Construct arrow bitmap class
-     */
-	void ConstructBitmapsL();
+
     /**
      * layout the rectangles
      */
@@ -591,14 +588,8 @@
     MAknFepUICtrlPinyinPopupSizeChangedObserver* iSizeChangedObserver;
 private: // the following are owned
     CAknsFrameBackgroundControlContext* iBgContext; 
-    CFbsBitmap* iNaviArrowBitmapLeft;
-    CFbsBitmap* iNaviArrowBitmapLeftMask;
-    CFbsBitmap* iNaviArrowBitmapRight;
-    CFbsBitmap* iNaviArrowBitmapRightMask;
 
 private:
-	TAknLayoutRect iIndiFepArrowLeft;
-    TAknLayoutRect iIndiFepArrowRight;
     TInt iSelected;
     TInt iEnabled;
     TToneMark iToneMark;
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/aknfepuilayoutdatamgr.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/aknfepuilayoutdatamgr.h	Wed Sep 15 12:34:44 2010 +0300
@@ -37,13 +37,6 @@
     ECandidatePaneWindowLine,
     EEEPWindowLayout,
     EEEPWindowRect,
-    ECandidatePaneTextLine,
-    EOrdinalCandidateTextLayout,
-    ECandidateWindowLine1,
-    ECandidateWindowLine2,
-    ECandidateWindowLine3,
-    ECandidateWindowLine4,
-    ELayoutCandidateItem,
     ELayoutEntryItem,
     ERectCoverMainPaneInputEntry,
     ERectFirstShadowInputEntry,
@@ -61,8 +54,6 @@
     ELayoutLineRectEntryPane,
     EEntryTextLayout,
     EEntryPaneRect,
-    EIndiFepArrowLeft,
-    EIndiFepArrowRight,   	
     ERectCoverMainPaneInput,
     ERectFirstShadowInput,
     ERectOutlineFrameInput,
@@ -75,8 +66,23 @@
     EEEPSecondHorizLine,
     EEntryHorizLineWindow,
     EEEPSecondHorizLineWindow,
-    EEEPFirstHorizLineWindow
-    
+    EEEPFirstHorizLineWindow,
+    EECPLayout,
+    ECandidateLayout,
+    EECandidateLayout,
+    EEPCandidateLayout,
+    ECharacterLayout,
+    ECharacterTextLayout,
+    EPopupHeightEP,
+    EUpArrowLayout,
+    EDownArrowLayout,
+    ECloseLayout,
+    EScrollLayout,
+    EEntryCLayout,
+    EEntryCPLayout,
+    EECWindowLayout,
+    EInputLayout,
+    EInputTextLayout
     };
 //class CAknFepUiLayoutDataMgr;
 /**
@@ -105,7 +111,7 @@
      * @return None.
      */
     void ReadLafInfo();
-    
+
     /**
      * Get LAF info 
      */
@@ -138,21 +144,15 @@
     TAknWindowLineLayout iCandidatePaneWindowLine;
     
     TAknWindowLineLayout iEEPWindowLayout;
+    TAknWindowLineLayout iECWindowLayout;
     TRect iEEPWindowRect;
+    TRect iECWindowRect;
     TRect iEntryPaneRect;
-    
-    TAknTextLineLayout iCandidatePaneTextLine;
-    TAknWindowLineLayout iCandidateWindowLine1;
-    TAknWindowLineLayout iCandidateWindowLine2;
-    TAknWindowLineLayout iCandidateWindowLine3;
-    TAknWindowLineLayout iCandidateWindowLine4;
-    TAknWindowLineLayout iLayoutCandidateItem;
+
     TAknWindowLineLayout iLayoutEntryItem;
-    
-    TAknTextLineLayout iOrdinalCandidateTextLayout;
+
     TAknTextLineLayout iEntryTextLayout;
     
-    //
     TAknLayoutRect iRectCoverMainPaneInputEntry;
     TAknLayoutRect iRectFirstShadowInputEntry;
     TAknLayoutRect iRectOutlineFrameInputEntry;
@@ -178,17 +178,33 @@
     TAknLayoutText iLayoutInputPaneText;
     TAknLayoutRect iLayoutLineRectEntryPane;
     
-	TAknLayoutRect iIndiFepArrowLeft;
-    TAknLayoutRect iIndiFepArrowRight;
-    
    	TAknLayoutRect iRectCoverMainPaneInput;
     TAknLayoutRect iRectFirstShadowInput;
     TAknLayoutRect iRectOutlineFrameInput;
     TAknLayoutRect iRectInsideAreaInput;
     
+    TAknWindowLineLayout iEntryWithCandidateAndPopUp;    
+    
+    TAknWindowLineLayout iCandidate;
+    TAknWindowLineLayout iECandidate;
+    TAknWindowLineLayout iEPCandidate;
+    TAknWindowLineLayout iCharacterLineLayout;
+    TAknTextLineLayout iCharacterTextLayout;
+    TAknWindowLineLayout iUpArrowLayout;
+    TAknWindowLineLayout iDownArrowLayout;
+    TAknWindowLineLayout iCloseLayout;
+    TAknWindowLineLayout iScrollLayout;
+    TAknWindowLineLayout iEntryCLayout;
+    TAknWindowLineLayout iEntryCPLayout;
+    
+    TAknTextLineLayout iInputTextLayout;
+    TAknWindowLineLayout iInputLayout;
+    
     TAknTextLineLayout iEEPTextLine;
     TInt iEEPCursorHeight;
     TRgb iEEPTextColor;
+    
+    TInt iPopupRectCandidateHeight;
     };
 
 #endif // C_PHRASECREATIONLAYOUTDATAMGR_H
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepPredictiveSettingDialog.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepPredictiveSettingDialog.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -779,6 +779,14 @@
     }
 
 /**
+ *process the key events
+ */
+TKeyResponse CAknFepPredictiveSettingDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+	{
+	return iSettingsList->OfferKeyEventL(aKeyEvent, aType);
+	}
+    
+/**
  *From MEikCommandObserver
  */
 void CAknFepPredictiveSettingDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidateCharacter.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2002-2004 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:           
+*       Provides the CAknFepUICtrlCandidateCharacter methods.
+*
+*/
+
+
+
+
+
+
+
+
+
+
+
+#include <AknUtils.h>
+#include <AknsDrawUtils.h>
+#include <eiklabel.h>
+#include <skinlayout.cdl.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+
+#include "AknFepUiInputStateBase.h"
+#include "AknFepUIAvkonCtrlCandidateCharacter.h"
+#include "AknFepUIAvkonCtrlPinyinPopup.h"
+#include "AknFepUiInterfacePanic.h"
+#include "AknFepUIAvkonCtrlCandidatePane.h"
+
+
+CAknFepUICtrlCandidateCharacter* CAknFepUICtrlCandidateCharacter::NewL( RWindowTreeNode& aParent,
+																		MAknFepUIEventObserver* aObserver )
+    {
+    CAknFepUICtrlCandidateCharacter* self = new(ELeave) CAknFepUICtrlCandidateCharacter;
+    CleanupStack::PushL(self);
+    self->ConstructL( aParent, aObserver );
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAknFepUICtrlCandidateCharacter::~CAknFepUICtrlCandidateCharacter()
+    {
+    delete iCandidateLabel;
+    }
+
+const TDesC* CAknFepUICtrlCandidateCharacter::Text() const
+	{
+	return iCandidateLabel->Text();
+	}
+
+void CAknFepUICtrlCandidateCharacter::SetText( const TDesC& aCharacter )
+    {
+    // make sure that we only copy as many characters as we can show
+    TInt textLen = aCharacter.Length();
+    TInt textLength = textLen > EMaxSelectedCandidateLength? EMaxSelectedCandidateLength:textLen;
+    TPtrC newText = aCharacter.Left( textLength );
+    TPtr ptr = iBuffer.Des();
+    if ( ptr.Compare( newText ) != 0 )
+        {
+        ptr.Copy( newText );
+        
+        // ignore any errors... we have guaranteed that the descriptor already has sufficient characters to avoid a realloc
+        TRAP_IGNORE( iCandidateLabel->SetTextL( iBuffer )); 
+        }
+    }
+
+void CAknFepUICtrlCandidateCharacter::SizeChanged()
+    {
+    LayoutRects();
+    LayoutContainedControls();
+    }
+
+TInt CAknFepUICtrlCandidateCharacter::CountComponentControls() const
+    {
+    CCoeControl* controls[] = 
+        {
+        iCandidateLabel
+        } ;
+
+    TInt count = 0 ;
+    for ( TUint ii = 0; ii < ( sizeof(controls) / sizeof(CCoeControl*)) ;ii++ )
+    	{
+        if(controls[ii])
+        	{
+            count++;
+        	}
+    	}
+    return count ;
+    }
+
+CCoeControl* CAknFepUICtrlCandidateCharacter::ComponentControl( TInt aIndex ) const 
+    {
+    CCoeControl* controls[] = 
+        {
+        iCandidateLabel
+        } ;
+
+    for (TUint ii = 0; ( ii < sizeof(controls) / sizeof(CCoeControl*)); ii++ )
+    	{
+        if ( controls[ii] && aIndex-- == 0 )
+        	{
+            return controls[ii];
+        	}
+    	}
+    // shouldn't be called while no components.
+    return NULL ;
+    }
+
+void CAknFepUICtrlCandidateCharacter::Draw( const TRect& /*aRect*/ ) const
+    {
+    CWindowGc& gc = SystemGc();
+
+    TBool skinnedDraw = EFalse;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRect outerRect;
+    TRect innerRect;
+    CalculateFrameRects( outerRect, innerRect );
+
+    // draw the whole frame background according to the containing context, which in this case
+    // is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
+    
+    // Set highlight color to gray
+    if( iIsHighligt )
+    	{
+        
+        skinnedDraw = AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
+												KAknsIIDQsnFrKeypadButtonFrPressed, 
+												KAknsIIDDefault ); 
+    	}
+    else
+    	{  
+
+		skinnedDraw = AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
+												KAknsIIDQsnFrKeypadButtonFrNormal, 
+												KAknsIIDDefault );
+    	}
+
+    if ( !skinnedDraw )
+        {
+        iRectShadow.DrawRect( gc );
+        iRectHighlight.DrawRect( gc );
+        }
+    }
+
+void CAknFepUICtrlCandidateCharacter::ConstructL( RWindowTreeNode& aParent, MAknFepUIEventObserver* aObserver )
+    {
+    CreateWindowL( aParent );
+
+    iCandidateLabel = new(ELeave) CEikLabel;
+    iCandidateLabel->SetBufferReserveLengthL( EMaxSelectedCandidateLength ); // this will do a realloc now, so no need to later
+    iCandidateLabel->SetContainerWindowL( *this );
+	iCandidateLabel->SetLabelAlignment( ELayoutAlignCenter );
+    }
+
+CAknFepUICtrlCandidateCharacter::CAknFepUICtrlCandidateCharacter()
+    {
+    }
+
+void CAknFepUICtrlCandidateCharacter::LayoutRects()
+    {
+    TRect rect = Rect();
+    iRectShadow.LayoutRect( rect, AKN_LAYOUT_WINDOW_Candidate_selection_highlight_Line_1(rect));
+    iRectHighlight.LayoutRect( rect, AKN_LAYOUT_WINDOW_Candidate_selection_highlight_Line_2(rect));
+    iRectShadow.LayoutRect( rect, AknLayoutScalable_Avkon::cell_hyb_candi_pane_g1( 0 ));
+    }
+
+
+void CAknFepUICtrlCandidateCharacter::LayoutContainedControls()
+    {
+    TRect rect = Rect();
+ 
+    TAknTextLineLayout candidateLayout = AknLayoutScalable_Avkon::cell_hyb_candi_pane_t1(0);
+        
+    TAknLayoutText layoutText;
+    layoutText.LayoutText( rect, candidateLayout );
+    TRect rectText = layoutText.TextRect();
+    const CFont* font = layoutText.Font();
+
+    iCandidateLabel->SetRect( rectText );
+    iCandidateLabel->SetFont( font );
+
+    // override with skin text color
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRgb labelTextColor;
+
+    AknsUtils::GetCachedColor( skin, labelTextColor, 
+                               KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
+
+    TRAP_IGNORE( 
+	    iCandidateLabel->OverrideColorL(EColorLabelText, labelTextColor);	   
+	    );
+    }
+
+void CAknFepUICtrlCandidateCharacter::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
+    {
+    TRect windowRect = Rect();
+
+    TAknLayoutRect topLeft;
+    topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2());
+
+    TAknLayoutRect bottomRight;
+    bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5());
+
+    aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
+    aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
+    }
+
+void CAknFepUICtrlCandidateCharacter::SetHighlight( TBool bHighlight )
+	{
+	iIsHighligt = bHighlight;
+	DrawDeferred();
+	}
+
+// End of file
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidatePane.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidatePane.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -35,24 +35,31 @@
 #include <AknBidiTextUtils.h> 
 #include <AknsUtils.h>
 #include <AknIconUtils.h>
+#include <coecntrl.h>
+#include <aknfepuictrls.mbg>
+#include <skinlayout.cdl.h>
+#include <aknlayoutscalable_avkon.cdl.h>
 
-#include <aknfepuictrls.mbg>
 #include "AknFepUiInterfacePanic.h"
 #include "AknFepUIAvkonCtrlCandidatePane.h"
-#include "AknFepUIAvkonCtrlCandidateSelected.h"
 #include "aknfepchineseuidataconv.h"
 #include "aknfepuilayoutdatamgr.h"
-
-
+#include "AknFepUiInputStateBase.h"
+#include "AknFepUIAvkonCtrlCandidateCharacter.h"
 #include "data_caging_path_literals.hrh"
 
 const TInt CandidateCountLeft = 10;
+const TInt DibertHeight = 480;
+const TInt ShowAboveCharacter = -1;
+const TInt ShowBellowCharacter = 1;
 
 _LIT(KFepUiControlsBitmapFile, "aknfepuictrls.mbm");
 
-CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr)
+CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL( RWindow& aParent, 
+															  CAknFepUiLayoutDataMgr* aLafDataMgr, 
+															  MAknFepChineseUiMgr* aMgr )
     {
-    CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr );
+    CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr, aMgr );
     CleanupStack::PushL(self);
     self->ConstructL(aParent);
     CleanupStack::Pop();
@@ -61,22 +68,14 @@
 
 CAknFepUICtrlCandidatePane::~CAknFepUICtrlCandidatePane()
     {
-    delete iCandidateSelected;
-    delete iNaviArrowBitmapLeft;
-    delete iNaviArrowBitmapLeftMask;
-    delete iNaviArrowBitmapRight;
-    delete iNaviArrowBitmapRightMask;
-    delete iNaviArrowBitmapUp;
-    delete iNaviArrowBitmapUpMask;
-    delete iNaviArrowBitmapDown;
-    delete iNaviArrowBitmapDownMask;
+    delete iCtrlScroll;
+    delete iPreview;
     if(iCandidateArray)
     	{
     	iCandidateArray->Reset();
 		delete iCandidateArray;
     	}
     iCandidateLabelArray.ResetAndDestroy();
-    iOrdinalLabelArray.ResetAndDestroy();
     iCandidateModeArray.Reset();
     iPages.Reset();
     }
@@ -99,7 +98,7 @@
         // as far as the client is concerned, they have removed the character that was selected
         // therefore we must now hide the selected candidate, although the highlighting
         // state remains unchanged
-        iCandidateSelected->MakeVisible(EFalse);
+		iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
         }
     else
         {
@@ -108,7 +107,7 @@
             // make sure that the candidate is visible, as the selection is now
             // within a visible range (it might have been hidden last time
             // the buffer was set)
-            iCandidateSelected->MakeVisible(ETrue);
+			iCandidateLabelArray[iSelected]->SetHighlight( ETrue );
             }
         }
 
@@ -132,27 +131,12 @@
             if(valueChanged)
                 {
                 // we have already allocated enough memory for this
-                CEikLabel* candidateLabel = iCandidateLabelArray[i];
-                TRAP_IGNORE(candidateLabel->SetTextL(newChar));
-
-                // need to update the character if it is in the current selected candidate
-                if(i == iSelected)
-                    {
-                    iCandidateSelected->SetText(newChar);
-                    iCandidateSelected->SetOrdinal(i + 1);
-                    DrawDeferred();
-                    }
-                if(i < iVisibleCount)
-                    {
-                    // only redraw characters that are visible
-                    TRect rect = candidateLabel->Rect();
-                    Window().Invalidate(rect);
-                    }
+				CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
+                candidateLabel->SetText( newChar );
                 }
             }
         ptr.Copy(newText);
         LayoutLabels();
-        LayoutCandidateSelected();
         iVisibleCount = newLength;
         UpdateLabelVisibility();
         }
@@ -174,13 +158,13 @@
 
     if(iVisibleCount - 1 < iSelected)
         {
-        iCandidateSelected->MakeVisible(EFalse);
+		iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
         }
     else
         {
         if(iHighlighted)
             {
-            iCandidateSelected->MakeVisible(ETrue);
+			iCandidateLabelArray[iSelected]->SetHighlight( ETrue );
             }
         }
 
@@ -189,32 +173,24 @@
 
     for(TInt i = 0; i < iVisibleCount; i ++)
         {
-        CEikLabel* candidateLabel = iCandidateLabelArray[i];
+		CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
         const TDesC* txtLabel = candidateLabel->Text();
         newText = (*iCandidateArray)[curPage.iStartIndex + i];
 
-        if((txtLabel->Compare(newText) != 0) )
+        if (( txtLabel->Compare(newText) != 0 ))
             {
             // we have already allocated enough memory for this
-            TRAP_IGNORE( candidateLabel->SetTextL(newText));
+            TRAP_IGNORE( candidateLabel->SetText( newText ));
             }
-            
-            // need to update the character if it is in the current selected candidate
-            if(i == iSelected)
-                {
-                iCandidateSelected->SetText(newText);
-                iCandidateSelected->SetOrdinal(i + 1);
-                DrawDeferred();
-                }
-            if(i < iVisibleCount)
-                {
-                // only redraw labels that are visible
-                TRect rect = candidateLabel->Rect();
-                Window().Invalidate(rect);
+
+        if ( i < iVisibleCount )
+            {
+            // only redraw labels that are visible
+            TRect rect = candidateLabel->Rect();
+            Window().Invalidate( rect );
             }
         }
     LayoutLabels();
-    LayoutCandidateSelected();
     DrawDeferred();
     UpdateLabelVisibility();
     }
@@ -224,9 +200,7 @@
     if(!COMPARE_BOOLS(iHighlighted, aHighlighted))
         {
         iHighlighted = aHighlighted;
-        iCandidateSelected->MakeVisible(aHighlighted);
-
-        iCandidateSelected->DrawDeferred();
+        iCandidateLabelArray[iSelected]->SetHighlight( aHighlighted );
         }
     }
 
@@ -244,21 +218,17 @@
     if(oldMode != aMode)
         {
         iCandidateModeArray[aIndex] = aMode;
-        if(iSelected == aIndex)
-            {
-            LayoutCandidateSelected();
-            }
+        
         // only do drawing if visible
         if(aIndex < iVisibleCount)
             {
             LayoutLabel(aIndex);
             if(iSelected == aIndex && iHighlighted)
                 {
-                iCandidateSelected->DrawDeferred();
                 }
             else
                 {
-                CEikLabel* candidateLabel = iCandidateLabelArray[aIndex];
+				CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[aIndex];
                 TRect rect = candidateLabel->Rect();
                 Window().Invalidate(rect);
                 }
@@ -278,89 +248,41 @@
 
 void CAknFepUICtrlCandidatePane::ShowHorizontalScrollArrows(TBool /*aValue*/)
     {
-    // If the state is changed, the arrows will be redrawn in the new state.
-    //    if(!COMPARE_BOOLS(iShowHorizontalScrollArrows, aValue))
-    //        {
-    //        iShowHorizontalScrollArrows = aValue;
-    //        TRect rect = iIndiFepArrowLeft.Rect();
-    //        Window().Invalidate(rect);
-    //        rect = iIndiFepArrowRight.Rect();
-    //        Window().Invalidate(rect);
-    //        }
+    // Left & right arrow are not need, so do nothing.
     }
 
 void CAknFepUICtrlCandidatePane::ShowUpScrollArrows(TBool aValue)
     {
-    if (iShowUpScrollArrows != aValue)
-        {
-        iShowUpScrollArrows = aValue;
-        TRect rect = iIndiFepArrowUp.Rect();
-        Window().Invalidate(rect);
-        }
+	// call function of scroll pane to show/hide up arrow.
+	iCtrlScroll->ShowUpScrollArrows( aValue );
     }
     
 void CAknFepUICtrlCandidatePane::ShowDownScrollArrows(TBool aValue)
     {
-    if (iShowDownScrollArrows != aValue)
-        {
-        iShowDownScrollArrows = aValue;
-        TRect rect = iIndiFepArrowDown.Rect();
-        Window().Invalidate(rect);
-        }
-        
+	// call function of scroll pane to show/hide down arrow.
+	iCtrlScroll->ShowDownScrollArrows( aValue );
     }
     
 void CAknFepUICtrlCandidatePane::ShowLeftScrollArrows(TBool /*aValue*/)
     {
-    //    if (iShowLeftScrollArrows != aValue)
-    //        {
-    //        iShowLeftScrollArrows = aValue;
-    //        TRect rect = iIndiFepArrowLeft.Rect();
-    //        Window().Invalidate(rect);
-    //        }
+	// Left arrow is not need, so do nothing.
     }
         
 void CAknFepUICtrlCandidatePane::ShowRightScrollArrows(TBool /*aValue*/)
     {
-    //    if (iShowRightScrollArrows != aValue)
-    //        {
-    //        iShowRightScrollArrows = aValue;
-    //        TRect rect = iIndiFepArrowRight.Rect();
-    //        Window().Invalidate(rect);
-    //        }
+	// Right arrow is not need, so do nothing.
     }
 
 TBool CAknFepUICtrlCandidatePane::IsShowVerticalScrollArrows() const
     {
-    return iShowVerticalScrollArrows;
+	// call function of scroll pane to get scroll state
+    return iCtrlScroll->IsShowVerticalScrollArrows();
     }
 
 void CAknFepUICtrlCandidatePane::ShowVerticalScrollArrows(TBool aValue)
     {
-    // If the state is changed, the arrows will be redrawn in the new state.
-    if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue))
-        {
-        iShowVerticalScrollArrows = aValue;
-        TRect rect = iIndiFepArrowUp.Rect();
-        Window().Invalidate(rect);
-        rect = iIndiFepArrowDown.Rect();
-        Window().Invalidate(rect);
-        }
-    }
-
-void CAknFepUICtrlCandidatePane::ShowCandidateOrdinals(TBool aValue)
-    {
-    if(!COMPARE_BOOLS(iShowCandidateOrdinals, aValue))
-        {
-        iShowCandidateOrdinals = aValue;
-        iCandidateSelected->ShowOrdinal(aValue);
-        UpdateLabelVisibility();
-        }
-    }
-
-TBool CAknFepUICtrlCandidatePane::IsShowCandidateOrdinals() const
-    {
-    return iShowCandidateOrdinals;
+	// call function of scroll pane to set scroll state
+	iCtrlScroll->ShowVerticalScrollArrows( aValue );
     }
 
 TInt CAknFepUICtrlCandidatePane::VisibleCandidateCount() const
@@ -441,6 +363,10 @@
         {
         return SelectIndex(iSelected + 1);
         }
+    else if( iSelected == iVisibleCount - 1 )
+    	{
+		return SelectIndex(0);
+    	}
     else
         {
         return EFalse;
@@ -453,41 +379,35 @@
         {
         return SelectIndex(iSelected - 1);
         }
+    else if( iSelected == 0 )
+    	{
+        return SelectIndex( iVisibleCount - 1 );
+        }
     else
         {
         return EFalse;
         }
     }
 
-TBool CAknFepUICtrlCandidatePane::SelectIndex(TInt aIndex, TBool selected)
+TBool CAknFepUICtrlCandidatePane::SelectIndex(TInt aIndex, TBool /*selected*/ )
     {
-    if(aIndex + 1 > iVisibleCount || aIndex < 0)
+    if( aIndex + 1 > iVisibleCount || aIndex < 0 )
         {
         return EFalse;
         }
-    if(iSelected != aIndex)
-        {
-        if(iSelected + 1 > iVisibleCount && iHighlighted)
-            {
-            // candidate selection is currently hidden, as the current 
-            // selection is outside the range of valid candidates, therefore 
-            // show it again
-            iCandidateSelected->MakeVisible(ETrue);
-            }
+
+    if ( iSelected != aIndex )
+    	{
+		iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
+    	}
+    
+    if ( iPointDown || iHighlighted )
+    	{
+		iCandidateLabelArray[aIndex]->SetHighlight( ETrue );
+		
+    	}
         iSelected = aIndex;
-        // move and repopulate the selected candidate control
-        const TDesC* txtLabel = iCandidateLabelArray[aIndex]->Text();
-        iCandidateSelected->SetText(*txtLabel);
-        iCandidateSelected->SetOrdinal(iSelected + 1);
-        
-        LayoutCandidateSelected();
-        if( selected )
-           {
 
-           DrawDeferred();
-           }
-        
-		}
     return ETrue;
     }
 
@@ -526,7 +446,7 @@
     {
     TAknLayoutText layoutText;
     TAknTextLineLayout candidatePaneLayoutText = 
-        CAknFepChineseUIDataConv::AnyToTextLine(iLafDataMgr->RequestData( ECandidatePaneTextLine ));
+        CAknFepChineseUIDataConv::AnyToTextLine(iLafDataMgr->RequestData( ECharacterTextLayout ));
        
     layoutText.LayoutText(Rect(), candidatePaneLayoutText);
 
@@ -589,6 +509,7 @@
     // the previous page of the last page. And then select the last character of 
     // the previous page of the last page, and select next page. First of the last 
     // page is not refreshed.
+    iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
     iSelected = 0;
     }
 
@@ -606,7 +527,6 @@
 
 void CAknFepUICtrlCandidatePane::SizeChanged()
     {
-    LayoutRects();
     LayoutContainedControls();
     }
 
@@ -614,11 +534,11 @@
     {
     TInt count = 0;
     count += iCandidateLabelArray.Count();
-    count += iOrdinalLabelArray.Count();
 
     CCoeControl* controls[] =
         {
-        iCandidateSelected
+        iCtrlScroll,
+        iPreview
         } ;
 
     for (TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
@@ -634,29 +554,21 @@
 CCoeControl* CAknFepUICtrlCandidatePane::ComponentControl(TInt aIndex) const
     {
     TInt candidateCount = iCandidateLabelArray.Count();
-    TInt ordinalCount = iOrdinalLabelArray.Count();
 
     if(aIndex < candidateCount)
         {
         // because this method is const, the const [] operator is selected
         // which means that the pointer is const, so have to cast away constness
         // - a possible alternative is to make the array mutable?
-        return CONST_CAST(CEikLabel*, iCandidateLabelArray[aIndex]);
+        return CONST_CAST(CAknFepUICtrlCandidateCharacter*, iCandidateLabelArray[aIndex]);
         }
     aIndex -= candidateCount;
 
-    if(aIndex < ordinalCount)
-        {
-        // because this method is const, the const [] operator is selected
-        // which means that the pointer is const, so have to cast away constness
-        // - a possible alternative is to make the array mutable?
-        return CONST_CAST(CEikLabel*, iOrdinalLabelArray[aIndex]);
-        }
-    aIndex -= ordinalCount;
-
     CCoeControl* controls[] =
         {
-        iCandidateSelected
+       // iCandidateSelected,
+        iCtrlScroll,
+        iPreview
         } ;
 
     for (TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
@@ -670,182 +582,48 @@
     return NULL ;
     }
 
-void CAknFepUICtrlCandidatePane::Draw(const TRect& /* aRect */) const
-    {
-    CWindowGc& gc = SystemGc();
-
-    if(iShowHorizontalScrollArrows)
-        {
-        if (iShowLeftScrollArrows)
-            {
-            iIndiFepArrowLeft.DrawImage(gc, 
-                                        iNaviArrowBitmapLeft, 
-                                        iNaviArrowBitmapLeftMask);     
-            }
-        
-        if (iShowRightScrollArrows)
-            {
-            iIndiFepArrowRight.DrawImage(gc, 
-                                         iNaviArrowBitmapRight, 
-                                         iNaviArrowBitmapRightMask);
-            }
-        }
-    if(iShowVerticalScrollArrows)
-        {
-        if (iShowUpScrollArrows)
-            {
-            iIndiFepArrowUp.DrawImage(gc,
-                                      iNaviArrowBitmapUp, 
-                                      iNaviArrowBitmapUpMask);
-            }
-            
-        if (iShowDownScrollArrows)
-            {
-            iIndiFepArrowDown.DrawImage(gc, 
-                                        iNaviArrowBitmapDown, 
-                                        iNaviArrowBitmapDownMask);
-            }
-        }
-    }
-
 void CAknFepUICtrlCandidatePane::ConstructL(RWindow& aParent)
     {
     SetContainerWindowL(aParent);
-    ConstructBitmapsL();
 
     TBuf<EOneCandidate> ordinal;
     for(TInt i = 0; i < EMaxCandidates; i++)
         {
-        CEikLabel* candidateLabel = new(ELeave) CEikLabel;
+        CAknFepUICtrlCandidateCharacter* candidateLabel = CAknFepUICtrlCandidateCharacter::NewL( aParent, this );
         CleanupStack::PushL(candidateLabel);
         candidateLabel->SetContainerWindowL(aParent);
-        candidateLabel->SetBufferReserveLengthL(EPhraseLength);
         // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack
         User::LeaveIfError(iCandidateLabelArray.Append(candidateLabel));
         CleanupStack::Pop(); // candidateLabel
 
-        CEikLabel* ordinalLabel = new(ELeave) CEikLabel;
-        CleanupStack::PushL(ordinalLabel);
-        ordinalLabel->SetContainerWindowL(aParent);
-        ordinalLabel->SetBufferReserveLengthL(EOneCandidate);
-        ordinal.Num((i+1)%10); // digits are [1, 2,,, 9, 0] - only want the last digit in the case of 10!
-        ordinalLabel->SetTextL(ordinal);
-        // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack
-        User::LeaveIfError(iOrdinalLabelArray.Append(ordinalLabel));
-        CleanupStack::Pop(); // ordinalLabel
-
         User::LeaveIfError(iCandidateModeArray.Append(ECandidateModeNormal));
         }
 
-    iCandidateSelected = CAknFepUICtrlCandidateSelected::NewL(aParent);
-    iCandidateSelected->MakeVisible(iHighlighted);
-    iCandidateSelected->SetMopParent(this);
     iCandidateArray = new(ELeave) CDesCArrayFlat(1);
+    
+    // scroll part
+    iCtrlScroll = CAknFepUICtrlCandidateScroll::NewL( aParent, this );
+    iCtrlScroll->SetMopParent(this);
+    
+    // character preview
+    iPreview = CAknFepPreview::NewL( aParent );
     }
 
-void CAknFepUICtrlCandidatePane::ConstructBitmapsL()
-    {    
-    MAknsSkinInstance* skin = AknsUtils::SkinInstance();  
-    
-    TFileName bmpFile;
-    bmpFile.Copy(_L("z:"));
-    bmpFile.Append(KDC_BITMAP_DIR);
-    bmpFile.Append(KFepUiControlsBitmapFile);  
-
-    AknsUtils::CreateColorIconL( skin,
-                                 KAknsIIDQgnIndiFepArrowLeft,
-                                 KAknsIIDQsnIconColors,
-                                 EAknsCIQsnIconColorsCG20,
-                                 iNaviArrowBitmapLeft,
-                                 iNaviArrowBitmapLeftMask,
-                                 bmpFile,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_left,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_left_mask,
-                                 AKN_LAF_COLOR( 0 )
-                             );    
-    AknsUtils::CreateColorIconL( skin,
-                                 KAknsIIDQgnIndiFepArrowRight,
-                                 KAknsIIDQsnIconColors,
-                                 EAknsCIQsnIconColorsCG20,
-                                 iNaviArrowBitmapRight,
-                                 iNaviArrowBitmapRightMask,
-                                 bmpFile,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_right,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_right_mask,
-                                 AKN_LAF_COLOR( 0 )
-                             );    
-
-    AknsUtils::CreateColorIconL( skin,
-                                 KAknsIIDQgnIndiFepArrowUp,
-                                 KAknsIIDQsnIconColors,
-                                 EAknsCIQsnIconColorsCG20,
-                                 iNaviArrowBitmapUp,
-                                 iNaviArrowBitmapUpMask,
-                                 bmpFile,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_up,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask,
-                                 AKN_LAF_COLOR( 0 )
-                             );    
-    AknsUtils::CreateColorIconL( skin,
-                                 KAknsIIDQgnIndiFepArrowDown,
-                                 KAknsIIDQsnIconColors,
-                                 EAknsCIQsnIconColorsCG20,
-                                 iNaviArrowBitmapDown,
-                                 iNaviArrowBitmapDownMask,
-                                 bmpFile,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_down,
-                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask,
-                                 AKN_LAF_COLOR( 0 )
-                             );    
-    }
-
-CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr)
+CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr, MAknFepChineseUiMgr* aMgr )
     :
     iPaneLayout(CAknFepUICtrlContainerChinese::ELayoutCandidate),
     iHighlighted(EFalse),
-    iShowHorizontalScrollArrows(EFalse),
-    iShowVerticalScrollArrows(EFalse),
-    iShowUpScrollArrows(ETrue),
-    iShowDownScrollArrows(ETrue),
-    iShowLeftScrollArrows(ETrue),
-    iShowRightScrollArrows(ETrue),
-    iShowCandidateOrdinals(ETrue),
     iCurDisplayPage(0),
-    iOrdinalLableWidth(0)
+    iChineseUiMgr(aMgr),
+    iPointDown( EFalse )
     {
     iLafDataMgr = aLafDataMgr;
     }
 
-void CAknFepUICtrlCandidatePane::LayoutRects()
-    {
-    TRect rect = Rect();
-    
-    TAknWindowLineLayout candidateWindowLine1 = 
-      CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine1));
-    TAknWindowLineLayout candidateWindowLine2 = 
-      CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine2));
-    TAknWindowLineLayout candidateWindowLine3 = 
-      CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine3));
-    TAknWindowLineLayout candidateWindowLine4 = 
-      CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine4));
-
-    iIndiFepArrowLeft.LayoutRect(rect, candidateWindowLine1); 
-    AknIconUtils::SetSize(iNaviArrowBitmapLeft, iIndiFepArrowLeft.Rect().Size());
-
-    iIndiFepArrowRight.LayoutRect(rect, candidateWindowLine2); 
-    AknIconUtils::SetSize(iNaviArrowBitmapRight, iIndiFepArrowRight.Rect().Size());
-
-    iIndiFepArrowUp.LayoutRect(rect, candidateWindowLine3);
-    AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size());
-
-    iIndiFepArrowDown.LayoutRect(rect, candidateWindowLine4);
-    AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size() );
-    }
-
 void CAknFepUICtrlCandidatePane::LayoutContainedControls()
     {
     LayoutLabels();
-    LayoutCandidateSelected();
+    LayoutScroll();
     }
 
 void CAknFepUICtrlCandidatePane::LayoutLabel(TInt aIndex)
@@ -853,80 +631,43 @@
     __ASSERT_DEBUG(aIndex >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount));
     __ASSERT_DEBUG(aIndex < iVisibleCount, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount));
     TRect rect = Rect();
-    CEikLabel* candidateLabel = iCandidateLabelArray[aIndex];
-    CEikLabel* ordinalLabel = iOrdinalLabelArray[aIndex];
+    CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[aIndex];
     TAknWindowLineLayout layoutCandidateItem = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem));
+        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECharacterLayout));
     TAknTextLineLayout candidateLayout = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine));
+        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECharacterTextLayout));
     
     // layout candidate label
     TAknLayoutRect layoutRectCandidateItem;
-    layoutRectCandidateItem.LayoutRect(rect,layoutCandidateItem);
+    layoutRectCandidateItem.LayoutRect( rect,layoutCandidateItem );
     TRect rectCandidateItem = layoutRectCandidateItem.Rect();
-    
-    if(aIndex > 0)
+    if ( aIndex > 0 )
 	    {
 	    rectCandidateItem.iTl.iX = iCandidateLabelArray[aIndex - 1]->Rect().iBr.iX;
         }
+
     TAknLayoutText layoutText;
-    layoutText.LayoutText(rectCandidateItem,candidateLayout);
-    TRect rectText = layoutText.TextRect();
-    rectText.SetWidth(LabelTextWidthInPixels(aIndex));
-
-    candidateLabel->SetRect(rectText);
-    candidateLabel->SetFont(layoutText.Font());
+    layoutText.LayoutText( rectCandidateItem, candidateLayout );
+    TInt interval = candidateLayout.il + candidateLayout.ir;
 
-    // layout ordinal label
-    TAknTextLineLayout ordinalLayout = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout));
-    TBufC16<1> buf;
-    TAknLayoutText layoutOrdinal;
-    TPtr16 ptr = buf.Des();
-    ptr = (*(ordinalLabel->Text())).Left(EOneCandidate);
-    
-    layoutOrdinal.LayoutText(rectCandidateItem,ordinalLayout);
-    
-    const CFont* font = layoutOrdinal.Font();
-    
-    TRect rectOrdinal = layoutOrdinal.TextRect();
-    // align ordinal label and candidate label 
-    
-    /* removed in 2006.03.29
-    rectOrdinal.iTl.iY = rectText.iTl.iY;
-    rectOrdinal.SetWidth(font->TextWidthInPixels(ptr));
-    rectOrdinal.SetHeight(font->HeightInPixels());
-    */
-    
-    // inserted in 2006.03.29
-    TPoint ordinalPosition;
-    TInt ordinalWidth = font->TextWidthInPixels(ptr);
-    ordinalPosition.iX = rectText.iTl.iX - ordinalWidth;
-    ordinalPosition.iY = rectText.iTl.iY;
-    
-    rectOrdinal = TRect(ordinalPosition,
-                        TPoint(ordinalPosition.iX + rectOrdinal.Width(),
-                               ordinalPosition.iY + rectOrdinal.Height()));
-    // end inserting                               
-
-    ordinalLabel->SetRect(rectOrdinal);
-    ordinalLabel->SetFont(font);
-    iOrdinalLableWidth = rectOrdinal.Width();
+    TInt width = LabelTextWidthInPixels( aIndex );
+    TInt minwidth = layoutRectCandidateItem.Rect().Width() - interval ;    
+    if ( width < minwidth )
+    	{
+		width = minwidth;
+    	}    
+    rectCandidateItem.SetWidth( width + interval );
+    candidateLabel->SetRect( rectCandidateItem );
 
     // override colours if skin data present
     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
     TRgb candidateLabelTextColor = layoutText.Color();
-    TRgb ordinalLabelTextColor = layoutOrdinal.Color();
 
     AknsUtils::GetCachedColor(skin, candidateLabelTextColor, 
                               KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19);
 
-    AknsUtils::GetCachedColor(skin, ordinalLabelTextColor,
-        KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19);
-
     TRAP_IGNORE(
         candidateLabel->OverrideColorL(EColorLabelText, candidateLabelTextColor);
-        ordinalLabel->OverrideColorL(EColorLabelText, ordinalLabelTextColor);
         );
     }
 
@@ -937,32 +678,10 @@
         LayoutLabel(i);
         }
     }
-
-void CAknFepUICtrlCandidatePane::LayoutCandidateSelected()
+void CAknFepUICtrlCandidatePane::LayoutScroll()
     {
-    TCandidateMode candidateMode = iCandidateModeArray[iSelected];
-    iCandidateSelected->SetCandidateMode(candidateMode);
-    iCandidateSelected->SetLayout(iPaneLayout);
-
-    TRect ordinalRect = iOrdinalLabelArray[iSelected]->Rect();
-
-    TAknLayoutRect layoutRect;
-    TAknWindowLineLayout layoutCandidateItem = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem));
-    layoutRect.LayoutRect(Rect(),layoutCandidateItem);
-    
-    TRect rectLayoutCandidateItem = layoutRect.Rect();
-    rectLayoutCandidateItem.iTl.iX = ordinalRect.iTl.iX;
-
-    TAknTextLineLayout candidateLayout = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine));
-    TAknTextLineLayout ordinalLayout = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout));
-    rectLayoutCandidateItem.SetWidth(iCandidateLabelArray[iSelected]->Rect().Width() + candidateLayout.il - ordinalLayout.il);
-
-    rectLayoutCandidateItem.SetHeight(rectLayoutCandidateItem.Height() - 1);
-    
-    iCandidateSelected->SetRect(rectLayoutCandidateItem);
+    TAknWindowLineLayout scrolllayout =  CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(EScrollLayout));
+    AknLayoutUtils::LayoutControl( iCtrlScroll, Rect(), scrolllayout );
     }
 
 void CAknFepUICtrlCandidatePane::UpdateLabelVisibility()
@@ -984,17 +703,14 @@
         }
     for(TInt i = 0; i < EMaxCandidates; i++)
         {
-        CEikLabel* candidateLabel = iCandidateLabelArray[i];
-        CEikLabel* ordinalLabel = iOrdinalLabelArray[i];
+        CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
         if(i < number)
             {
             candidateLabel->MakeVisible(ETrue);
-            ordinalLabel->MakeVisible(iShowCandidateOrdinals); // only show if needed
             }
         else
             {
             candidateLabel->MakeVisible(EFalse);
-            ordinalLabel->MakeVisible(EFalse); // don't show it as there is no character to go with it
             }
         }
     }
@@ -1027,7 +743,7 @@
         
     TPage curPage;
     TInt index = iUnpagedIndex;
-    CEikLabel* candidateLabel;
+    CAknFepUICtrlCandidateCharacter* candidateLabel;
     
     curPage.iStartIndex = index;
     curPage.iEndIndex = index;
@@ -1035,23 +751,24 @@
                             EMaxCandidates : phraseCandidateNum - index;
 
     TAknWindowLineLayout layoutCandidateItem = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem));
+        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECharacterLayout));
+    TAknWindowLineLayout candidateRect = 
+        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(EScrollLayout));
+    
     TAknTextLineLayout candidateLayout = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine));
+        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECharacterTextLayout));
     
+    TInt interval = candidateLayout.il + candidateLayout.ir;
     // avoid accessing layout data member
     TAknLayoutRect layoutRect;
     layoutRect.LayoutRect(Rect(),layoutCandidateItem);
     TRect rectLayoutCandidateItem = layoutRect.Rect();
-
     TAknLayoutText layoutText;
     layoutText.LayoutText(rectLayoutCandidateItem,candidateLayout);
-    TRect rectText = layoutText.TextRect();
-            
-    TInt distance = rectText.iTl.iX - rectLayoutCandidateItem.iTl.iX + rectLayoutCandidateItem.iBr.iX - rectText.iBr.iX;
-    rectLayoutCandidateItem.iTl.iX += distance;
+    TRect rectText = Rect();  
+    TInt distance = rectText.iTl.iX - rectLayoutCandidateItem.iTl.iX + rectText.iBr.iX - rectLayoutCandidateItem.iBr.iX;
+    rectLayoutCandidateItem.iBr.iX += distance - candidateRect.iW;
 
-    TInt width = 0;
     TInt i = 0;     
 
     const TInt candidateWidth = rectLayoutCandidateItem.Width();
@@ -1063,6 +780,7 @@
         const CFont* font = layoutText.Font();
         TPtrC newText = (*iCandidateArray)[iUnpagedIndex + i];
         TInt labelWidth = font->TextWidthInPixels( newText );
+        labelWidth = interval + ( labelWidth > layoutText.TextRect().Width() ? labelWidth : layoutText.TextRect().Width());
         if ( labelWidth > candidateWidth )
             {
             TBufC<EPhraseLength+10> buf1;
@@ -1076,17 +794,16 @@
             TRAP_IGNORE(
             {
             iCandidateArray->InsertL( iUnpagedIndex + i, text );
-            candidateLabel->SetTextL(text);
+            candidateLabel->SetText(text);
             });
             	
             }
         else
             {
-            TRAP_IGNORE( candidateLabel->SetTextL(newText));
-            width = LabelTextWidthInPixels(i)+ iOrdinalLableWidth; 
-            rectLayoutCandidateItem.iTl.iX += width;
+            TRAP_IGNORE( candidateLabel->SetText(newText));
+            rectLayoutCandidateItem.iTl.iX += labelWidth;
             }
-        if (rectLayoutCandidateItem.iTl.iX >= rectLayoutCandidateItem.iBr.iX)
+        if (rectLayoutCandidateItem.iTl.iX > rectLayoutCandidateItem.iBr.iX)
             {
             if (index>0)
                 {
@@ -1130,7 +847,11 @@
 
 TBool CAknFepUICtrlCandidatePane::IsLastPage()
     {
-    if( iCandidateArray->Count() == iUnpagedIndex )
+	if( iPages.Count() == 0 )
+		{
+		return ETrue;
+		}
+	else if( iCandidateArray->Count() == iUnpagedIndex )
         {
         return iCurDisplayPage == iPages.Count() - 1;
         }
@@ -1139,14 +860,13 @@
 
 void CAknFepUICtrlCandidatePane::SetInVisiable()
     {
+	iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
+	TRAP_IGNORE( iPreview->HideL());
     for (TInt i = 0; i < EMaxCandidates; i ++)
         {
-        CEikLabel* candidateLabel = iCandidateLabelArray[i];
-        CEikLabel* ordinalLabel = iOrdinalLabelArray[i];
+		CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
         candidateLabel->MakeVisible(EFalse);
-        ordinalLabel->MakeVisible(EFalse);
         }
-    iCandidateSelected->MakeVisible(EFalse);
     }
 
 TBool CAknFepUICtrlCandidatePane::NeedGetNewCandidatePage()
@@ -1161,11 +881,515 @@
 		{
 		for (TInt i=0; i<iVisibleCount; i++)
 			{
-			TRAP_IGNORE(iCandidateLabelArray[i]->SetTextL(KNullDesC));
+			iCandidateLabelArray[i]->SetText( KNullDesC );
 			}
+		TRAP_IGNORE( HidePreviewL();)
 		iCandidateArray->Reset();
 		iVisibleCount = 0;
 		DrawNow();
 		}
 	}
+
+void CAknFepUICtrlCandidatePane::FepUIClosePressed()
+	{
+	// Click close to close container
+	if ( iChineseUiMgr )
+		{
+		iChineseUiMgr->CloseContainer();
+		}
+	}
+
+void CAknFepUICtrlCandidatePane::SetFepUiState( MAknFepUiStateCtrl* aFepUiState )
+    {
+	iFepUiState = aFepUiState;
+    }
+
+void CAknFepUICtrlCandidatePane::HidePreviewL()
+	{
+	if( iPreview && iPreview->IsVisible())
+		{
+		iPreview->HideL();
+		}
+	}
+void CAknFepUICtrlCandidatePane::HandlePointerEventL( const TPointerEvent & aPointerEvent )
+	{
+	CCoeControl::HandlePointerEventL( aPointerEvent );
+    // Press will pop up preview
+	if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+		{
+		for ( TInt i = 0; i < iVisibleCount; i++ )
+            {
+	        if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition ))
+		        {
+				iPointDown = ETrue;
+                SelectIndex( i );
+	            const TDesC* txtLabel = iCandidateLabelArray[i]->Text();
+	            TPoint point = iCandidateLabelArray[i]->PositionRelativeToScreen();
+	            TRect rect( point, iCandidateLabelArray[i]->Size());
+	            // if container is show on top, the preview should show bellow the character
+	            // else the preview should show above the character.
+	            TInt bottom = ShowAboveCharacter;
+	            if ( point.iY < iCandidateLabelArray[i]->Rect().iBr.iY )
+	                {
+				    bottom = ShowBellowCharacter;
+	                }
+	            rect.Move( 0, (iCandidateLabelArray[i]->Size().iHeight ) * bottom );
+	            iPreview->ShowL( rect, *txtLabel );
+	            break;
+	    	    }	        
+            }
+        }
+	// Up will submit text
+	else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && iPointDown )
+		{
+		iPointDown = EFalse;
+	    for ( TInt i = 0; i < iVisibleCount; i++ )
+	        {
+		    if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition ))
+			    {
+			    if ( iChineseUiMgr )
+			        {
+			        const TDesC* text = iCandidateLabelArray[i]->Text();	    
+			        iChineseUiMgr->SubmitSelectedTextL( *text );			        
+			        }
+			    break;
+			    }
+	        }
+	    if( iPreview->IsVisible())
+	    	{
+			iPreview->HideL();
+	    	}
+	    
+	    if( !iHighlighted )
+	    	{
+			iCandidateLabelArray[iSelected]->SetHighlight( iHighlighted );
+	    	}
+		}
+	// Drag out of candidate pane, hide preview
+	else if ( aPointerEvent.iType == TPointerEvent::EDrag && iPointDown )
+		{
+	    TBool bContain = EFalse;
+		for ( TInt i = 0; ( !bContain ) && ( i < iVisibleCount ); i++ )
+		    {
+			if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition ))
+				{
+				TBool bSameIndex = ( i == iSelected );
+				SelectIndex( i );
+				if ( !bSameIndex )
+					{
+					const TDesC* txtLabel = iCandidateLabelArray[i]->Text();
+					TPoint point = iCandidateLabelArray[i]->PositionRelativeToScreen();
+					TRect rect( point, iCandidateLabelArray[i]->Size());
+					TInt bottom = ShowAboveCharacter;
+					// If container is moved to top,
+					// then pop up preview below the character
+					if ( point.iY < iCandidateLabelArray[i]->Rect().iBr.iY )
+						{
+						bottom = ShowBellowCharacter;
+						}
+					rect.Move( 0, (iCandidateLabelArray[i]->Size().iHeight ) * bottom );
+					iPreview->ShowL( rect, *txtLabel );
+					}
+				bContain = ETrue;
+				break;
+			    }
+		    }
+		if ( !bContain )
+			{
+			iPreview->HideL();
+			iCandidateLabelArray[iSelected]->SetHighlight( iHighlighted );	
+			if( !iHighlighted )
+				{
+				iSelected = 0;
+				}
+			}
+		else if( bContain && !iPreview->IsVisible())
+			{
+			const TDesC* txtLabel = iCandidateLabelArray[iSelected]->Text();
+			TPoint point = iCandidateLabelArray[iSelected]->PositionRelativeToScreen();
+			TRect rect( point, iCandidateLabelArray[iSelected]->Size());
+			TInt bottom = ShowAboveCharacter;
+			// If container is moved to top,
+			// then pop up preview below the character
+			if ( point.iY < iCandidateLabelArray[iSelected]->Rect().iBr.iY )
+				{
+				bottom = ShowBellowCharacter;
+				}
+			rect.Move( 0, (iCandidateLabelArray[iSelected]->Size().iHeight ) * bottom );
+			iPreview->ShowL( rect, *txtLabel );
+			}
+		}
+	else
+		{
+		// do nothing
+		}
+	}
+
+CAknFepPreview* CAknFepPreview::NewL( RWindowTreeNode& aParent )
+	{
+	CAknFepPreview* self = new(ELeave) CAknFepPreview;
+    CleanupStack::PushL(self);
+    self->ConstructL( aParent );
+    CleanupStack::Pop();
+    return self;
+	}
+
+CAknFepPreview::~CAknFepPreview()
+	{
+	delete iPreviewLabel;
+	}
+
+void CAknFepPreview::Draw( const TRect& /*aRect*/ ) const
+	{
+    CWindowGc& gc = SystemGc();
+	
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	TRect outerRect;
+	TRect innerRect;
+	CalculateFrameRects( outerRect, innerRect );
+	gc.SetBrushColor( KRgbGray );
+	// draw the whole frame background according to the containing context, which in this case
+	// is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre
+	MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
+	AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
+							  KAknsIIDQsnFrInputCharPreview, KAknsIIDDefault ); 	
+	}
+
+void CAknFepPreview::SizeChanged()
+	{
+    TRect rect = Rect();
+    TAknTextLineLayout candidateLayout = AknLayoutScalable_Avkon::cell_hyb_candi_pane_t1(0);
+    // Get preview rect and font. 
+    TAknLayoutText layoutText;
+    layoutText.LayoutText( rect, candidateLayout );
+    TRect rectText = layoutText.TextRect();
+    const CFont* font = layoutText.Font();
+
+    iPreviewLabel->SetRect( rectText );
+    iPreviewLabel->SetFont( font );
+    // override with skin text color
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    
+    TRgb labelTextColor;
+    AknsUtils::GetCachedColor( skin, labelTextColor, 
+                               KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
+
+    TRAP_IGNORE( 
+    		iPreviewLabel->OverrideColorL(EColorLabelText, labelTextColor);	 )
+	}
+
+void CAknFepPreview::ShowL( TRect& aRect, const TDesC& aCharacter )
+	{
+	SetRect( aRect );
+
+	iPreviewLabel->SetTextL( aCharacter );
+	MakeVisible( ETrue );
+	RWindow& window = Window();
+	window.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 100 );
+	DrawNow();
+	}
+
+void CAknFepPreview::HideL()
+	{
+	MakeVisible( EFalse );
+	iPreviewLabel->SetTextL( KNullDesC );
+	DrawNow();
+	}
+
+TInt CAknFepPreview::CountComponentControls() const
+	{
+    CCoeControl* controls[] = 
+        {
+        iPreviewLabel
+        };
+    TInt count = 0;
+    for ( TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)); ii++ )
+        {
+        if ( controls[ii] )
+            {
+            count++;
+            }   
+        }
+
+    return count ;
+	}
+
+CCoeControl* CAknFepPreview::ComponentControl(TInt aIndex) const
+	{
+    CCoeControl* controls[] = 
+        {
+        iPreviewLabel
+        };
+
+    for ( TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)); ii++ )
+        {
+        if ( controls[ii] && aIndex-- == 0 )
+            {
+            return controls[ii];
+            }
+        }
+    // shouldn't be called while no components.
+    return NULL ;
+	}
+
+CAknFepPreview::CAknFepPreview()
+	{
+	}
+
+void CAknFepPreview::ConstructL( RWindowTreeNode& /*aParent */)
+	{
+	RWindowGroup& wg = CCoeEnv::Static()->RootWin();
+	CreateWindowL( wg );
+	RWindow& window = Window();
+	iPreviewLabel = new( ELeave ) CEikLabel;
+	iPreviewLabel->SetContainerWindowL( window );
+	iPreviewLabel->SetLabelAlignment( ELayoutAlignCenter );	
+	iPreviewLabel->SetMopParent( this );
+	window.SetRequiredDisplayMode( EColor16MA );
+	window.SetTransparencyAlphaChannel();
+	window.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 100 );
+	window.SetFaded( EFalse, RWindowTreeNode::EFadeIncludeChildren ); 
+	// Enable receive drag event.
+	Window().PointerFilter( EPointerFilterDrag, 0 );
+	MakeVisible( EFalse );
+	ActivateL();
+	}
+
+void CAknFepPreview::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
+	{
+	TRect windowRect = Rect();
+
+	TAknLayoutRect topLeft;
+	topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2());
+
+	TAknLayoutRect bottomRight;
+	bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5());
+
+	aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
+	aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
+	}
+
+CAknFepUICtrlCandidateScroll* CAknFepUICtrlCandidateScroll::NewL(
+							RWindowTreeNode& aParent, MAknFepUIEventObserver* aObserver )
+	{
+	CAknFepUICtrlCandidateScroll* self = new(ELeave) CAknFepUICtrlCandidateScroll;
+    CleanupStack::PushL(self);
+    self->ConstructL( aParent, aObserver );
+    CleanupStack::Pop();
+    return self;
+	}
+
+CAknFepUICtrlCandidateScroll::~CAknFepUICtrlCandidateScroll()
+	{
+	// delete bitmaps
+	delete iScrollCloseBitmap;
+	delete iScrollCloseBitmapMask; 
+    delete iNaviArrowBitmapUp;
+    delete iNaviArrowBitmapUpMask;
+    delete iNaviArrowBitmapDown;
+    delete iNaviArrowBitmapDownMask;
+	}
+
+void CAknFepUICtrlCandidateScroll::SizeChanged()
+	{
+	LayoutIcon();
+	}
+
+void CAknFepUICtrlCandidateScroll::Draw( const TRect& /*aRect*/ ) const
+	{
+    CWindowGc& gc = SystemGc();
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+	// draw the whole frame background according to the containing context, which in this case
+	// is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre
+	MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
+	TRect rect = Rect();
+	
+	// Draw scroll background
+	AknsDrawUtils::DrawBackground( skin, cc, this, gc,
+								   rect.iTl, rect, KAknsDrawParamDefault );
+
+	// Draw close Rects
+	if ( iShowClose )
+		{
+		TRect outerRect;
+		TRect innerRect;
+		CalculateCloseRects( outerRect, innerRect );
+		AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
+								  KAknsIIDQsnFrKeypadButtonFrNormal, KAknsIIDDefault ); 
+		// Draw close bitmap
+		iIndiFepClose.DrawImage( gc, 
+								 iScrollCloseBitmap, 
+								 iScrollCloseBitmapMask );
+		}
+	
+	// Draw Up arrow & Down arrow
+	if ( iShowVerticalScrollArrows )
+	    {
+	    if ( iShowUpScrollArrows )
+	        {
+	        iIndiFepArrowUp.DrawImage( gc,
+	                                   iNaviArrowBitmapUp, 
+	                                   iNaviArrowBitmapUpMask );
+	        }
+	            
+	    if ( iShowDownScrollArrows )
+	        {
+	        iIndiFepArrowDown.DrawImage( gc, 
+	                                     iNaviArrowBitmapDown, 
+	                                     iNaviArrowBitmapDownMask );
+	        }
+	    }
+	}
+
+void CAknFepUICtrlCandidateScroll::HandlePointerEventL( const TPointerEvent & aPointerEvent )
+	{
+	// Close area is click will close the container
+	if ( iObServer != NULL && iIndiFepClose.Rect().Contains( aPointerEvent.iPosition ))
+		{
+		iObServer->FepUIClosePressed();
+		}
+	}
+
+void CAknFepUICtrlCandidateScroll::ShowUpScrollArrows(TBool aValue)
+    {
+	// Update the up arrow if needed
+    if ( iShowUpScrollArrows != aValue )
+        {
+        iShowUpScrollArrows = aValue;
+        TRect rect = iIndiFepArrowUp.Rect();
+        Window().Invalidate(rect);
+        }
+    }
+    
+void CAknFepUICtrlCandidateScroll::ShowDownScrollArrows( TBool aValue )
+    {
+	// Update the down arrow if needed
+    if ( iShowDownScrollArrows != aValue )
+        {
+        iShowDownScrollArrows = aValue;
+        TRect rect = iIndiFepArrowDown.Rect();
+        Window().Invalidate(rect);
+        }        
+    }
+
+void CAknFepUICtrlCandidateScroll::ShowVerticalScrollArrows( TBool aValue )
+    {
+    // If the state is changed, the arrows will be redrawn in the new state.
+    if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue))
+        {
+        iShowVerticalScrollArrows = aValue;
+        //TRect rect = iIndiFepArrowUp.Rect();
+        DrawDeferred();
+        //rect = iIndiFepArrowDown.Rect();
+        //Window().Invalidate(rect);
+        }
+    }
+
+TBool CAknFepUICtrlCandidateScroll::IsShowVerticalScrollArrows() const
+    {
+    return iShowVerticalScrollArrows;
+    }
+
+void CAknFepUICtrlCandidateScroll::ConstructL( RWindowTreeNode& aParent, 
+											   MAknFepUIEventObserver* aObserver )
+	{
+    CreateWindowL( aParent );
+    ConstructBitmapsL();    
+    iObServer = aObserver; 
+    
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
+    // Dibert will not need close button
+    iShowClose = rect.Height() == DibertHeight ? EFalse : ETrue;
+    
+	}
+
+void CAknFepUICtrlCandidateScroll::ConstructBitmapsL()
+	{
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();  
+    
+    TFileName bmpFile;
+    bmpFile.Copy(_L("z:"));
+    bmpFile.Append( KDC_BITMAP_DIR );
+    bmpFile.Append( KFepUiControlsBitmapFile );  
+
+    // Create close bitmap
+    AknsUtils::CreateColorIconL( skin,
+ 							     KAknsIIDQgnGrafFepCandiListClose,
+ 							     KAknsIIDQsnIconColors,
+ 							     EAknsCIQsnIconColorsCG20,
+ 							     iScrollCloseBitmap,
+ 							     iScrollCloseBitmapMask,
+ 							     bmpFile,
+ 							     EMbmAknfepuictrlsQgn_indi_input_candi_list_close,
+ 							     EMbmAknfepuictrlsQgn_indi_input_candi_list_close_mask,
+ 							     AKN_LAF_COLOR( 0 )); 
+    
+    // Create Up bitmap
+    AknsUtils::CreateColorIconL( skin,
+                                 KAknsIIDQgnIndiFepArrowUp,
+                                 KAknsIIDQsnIconColors,
+                                 EAknsCIQsnIconColorsCG20,
+                                 iNaviArrowBitmapUp,
+                                 iNaviArrowBitmapUpMask,
+                                 bmpFile,
+                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_up,
+                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask,
+                                 AKN_LAF_COLOR( 0 ));
+    
+    // Create Down bitmap
+    AknsUtils::CreateColorIconL( skin,
+                                 KAknsIIDQgnIndiFepArrowDown,
+                                 KAknsIIDQsnIconColors,
+                                 EAknsCIQsnIconColorsCG20,
+                                 iNaviArrowBitmapDown,
+                                 iNaviArrowBitmapDownMask,
+                                 bmpFile,
+                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_down,
+                                 EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask,
+                                 AKN_LAF_COLOR( 0 )); 
+	}
+
+CAknFepUICtrlCandidateScroll::CAknFepUICtrlCandidateScroll()
+: iShowVerticalScrollArrows(EFalse),
+  iShowUpScrollArrows(ETrue),
+  iShowDownScrollArrows(ETrue),
+  iShowClose(ETrue)
+	{	
+	}
+
+void CAknFepUICtrlCandidateScroll::LayoutIcon()
+	{
+    TRect rect = Rect();
+    // layout arrow up
+    TAknWindowLineLayout arrowUpLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g1(0);
+    iIndiFepArrowUp.LayoutRect( rect, arrowUpLayout );    
+    AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size());
+    
+    // layout arrow down
+    TAknWindowLineLayout arrowDownLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g2(0);
+    iIndiFepArrowDown.LayoutRect( rect, arrowDownLayout );    
+    AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size());
+    
+    // layout close
+    TAknWindowLineLayout closeLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g3(0);
+    iIndiFepClose.LayoutRect( rect, closeLayout );
+    AknIconUtils::SetSize( iScrollCloseBitmap, iIndiFepClose.Rect().Size());   
+    }
+
+void CAknFepUICtrlCandidateScroll::CalculateCloseRects(TRect& aOuterRect, TRect& aInnerRect) const
+	{
+	TRect windowRect = iIndiFepClose.Rect();
+
+	TAknLayoutRect topLeft;
+	topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2());
+
+	TAknLayoutRect bottomRight;
+	bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5());
+
+	aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
+	aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
+	}
+
 // End of file
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidateSelected.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,309 +0,0 @@
-/*
-* Copyright (c) 2002-2004 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""
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:           
-*       Provides the CAknFepUICtrlCandidateSelected methods.
-*
-*/
-
-
-
-
-
-
-
-
-
-
-
-#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include <uikon/eikdefmacros.h>
-#endif
-#include <eiklabel.h>
-#include <AknUtils.h>
-#include <AknsDrawUtils.h>
-#include "AknFepUIAvkonCtrlCandidateSelected.h"
-#include "AknFepUIAvkonCtrlPinyinPopup.h"
-#include "AknFepUiInterfacePanic.h"
-#include <skinlayout.cdl.h>
-
-class CEikLabel;
-
-CAknFepUICtrlCandidateSelected* CAknFepUICtrlCandidateSelected::NewL(RWindowTreeNode& aParent)
-    {
-    CAknFepUICtrlCandidateSelected* self = new(ELeave) CAknFepUICtrlCandidateSelected;
-    CleanupStack::PushL(self);
-    self->ConstructL(aParent);
-    CleanupStack::Pop();
-    return self;
-    }
-
-CAknFepUICtrlCandidateSelected::~CAknFepUICtrlCandidateSelected()
-    {
-    delete iOrdinalLabel;
-    delete iCandidateLabel;
-    }
-
-void CAknFepUICtrlCandidateSelected::SetText(TPtrC aCharacter)
-    {
-    // make sure that we only copy as many characters as we can show
-    TInt textLen = aCharacter.Length();
-    TInt textLength = textLen > EMaxSelectedCandidateLength? EMaxSelectedCandidateLength:textLen;
-    TPtrC newText = aCharacter.Left(textLength);
-    TPtr ptr = iBuffer.Des();
-    if(ptr != newText)
-        {
-        ptr.Copy(newText);
-        // ignore any errors... we have guaranteed that the descriptor already has sufficient characters to avoid a realloc
-        TRAP_IGNORE( iCandidateLabel->SetTextL(iBuffer)); 
-        }
-    }
-
-void CAknFepUICtrlCandidateSelected::SetOrdinal(TInt aOrdinal)
-    {
-    __ASSERT_DEBUG(aOrdinal < CAknFepUICtrlPinyinPopup::EMaxPhraseCandidate, AknFepUiInterfacePanic(EAknFepUiInterfacePanicNewVisibleCountExceedsRange));
-    __ASSERT_DEBUG(aOrdinal >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicNewVisibleCountExceedsRange));
-
-    TBuf<2> buf;
-    buf.Format(_L("%d"), aOrdinal);
-    TRAP_IGNORE(iOrdinalLabel->SetTextL(buf));
-    }
-
-void CAknFepUICtrlCandidateSelected::SetCandidateMode(CAknFepUICtrlCandidatePane::TCandidateMode aMode)
-    {
-    if(iCandidateMode != aMode)
-        {
-        iCandidateMode = aMode;
-        
-        LayoutRects();
-        LayoutContainedControls();
-        DrawDeferred();
-        }
-    }
-
-void CAknFepUICtrlCandidateSelected::SetLayout(CAknFepUICtrlContainerChinese::TPaneLayout aLayout)
-    {
-    iPaneLayout = aLayout;
-    }
-
-void CAknFepUICtrlCandidateSelected::ShowOrdinal(TBool aValue)
-	{
-	if(!COMPARE_BOOLS(iShowOrdinal,aValue))
-		{
-		iShowOrdinal = aValue;
-		UpdateLabelVisibility();
-		}
-	}
-
-void CAknFepUICtrlCandidateSelected::SizeChanged()
-    {
-    LayoutRects();
-    LayoutContainedControls();
-    }
-
-TInt CAknFepUICtrlCandidateSelected::CountComponentControls() const
-    {
-    CCoeControl* controls[] = 
-        {
-        iOrdinalLabel,
-        iCandidateLabel
-        } ;
-
-    TInt count = 0 ;
-    for (TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
-        if(controls[ii])
-            count++ ;
-    return count ;
-    }
-
-CCoeControl* CAknFepUICtrlCandidateSelected::ComponentControl(TInt aIndex) const 
-    {
-    CCoeControl* controls[] = 
-        {
-        iOrdinalLabel,
-        iCandidateLabel
-        } ;
-
-    for (TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
-        if (controls[ii] && aIndex-- == 0)
-            return controls[ii] ;
-    // shouldn't be called while no components.
-    return NULL ;
-    }
-
-void CAknFepUICtrlCandidateSelected::Draw(const TRect& /*aRect*/) const
-    {
-    CWindowGc& gc = SystemGc();
-
-    TBool skinnedDraw = EFalse;
-    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-    TRect outerRect;
-    TRect innerRect;
-    CalculateFrameRects(outerRect, innerRect);
-
-    // draw the whole frame background according to the containing context, which in this case
-    // is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre
-    MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
-    AknsDrawUtils::DrawBackground(skin, cc, this, gc, 
-        outerRect.iTl, outerRect, KAknsDrawParamDefault);
-
-    skinnedDraw = AknsDrawUtils::DrawFrame(skin, gc, outerRect, innerRect,
-        KAknsIIDQsnFrGrid, KAknsIIDQsnFrGridCenter); 
-
-    if(!skinnedDraw)
-        {
-        iRectShadow.DrawRect(gc);
-        iRectHighlight.DrawRect(gc);
-        }
-    }
-
-void CAknFepUICtrlCandidateSelected::ConstructL(RWindowTreeNode& aParent)
-    {
-    CreateWindowL(aParent);
-
-    iOrdinalLabel = new(ELeave) CEikLabel;
-    iOrdinalLabel->SetBufferReserveLengthL(EOneCandidate);
-    iOrdinalLabel->SetContainerWindowL(*this);
-
-    // force label to contain required number of characters from the outset
-    iCandidateLabel = new(ELeave) CEikLabel;
-    iCandidateLabel->SetBufferReserveLengthL(EMaxSelectedCandidateLength); // this will do a realloc now, so no need to later
-    iCandidateLabel->SetContainerWindowL(*this);
-    }
-
-CAknFepUICtrlCandidateSelected::CAknFepUICtrlCandidateSelected()
-    : 
-    iCandidateMode(CAknFepUICtrlCandidatePane::ECandidateModeNormal),
-    iPaneLayout(CAknFepUICtrlContainerChinese::ELayoutCandidate),
-    iShowOrdinal(ETrue)
-    {
-    }
-
-void CAknFepUICtrlCandidateSelected::LayoutRects()
-    {
-    TRect rect = Rect();
-    iRectShadow.LayoutRect(rect, AKN_LAYOUT_WINDOW_Candidate_selection_highlight_Line_1(rect));
-    iRectHighlight.LayoutRect(rect, AKN_LAYOUT_WINDOW_Candidate_selection_highlight_Line_2(rect));
-    }
-
-void CAknFepUICtrlCandidateSelected::LayoutContainedControls()
-    {
-    TRect rect = Rect();
-
-    // layout candidate label
-    TAknTextLineLayout candidateLayout = AKN_LAYOUT_TEXT_Chinese_universal_FEP_candidate_pane_texts_Line_1;
-    TAknTextLineLayout ordinalLayout = AKN_LAYOUT_TEXT_Chinese_universal_FEP_candidate_pane_texts_Line_3; 
-    candidateLayout.il = candidateLayout.il - ordinalLayout.il;
-
-    TAknLayoutText layoutCandidate;
-    layoutCandidate.LayoutText(rect,candidateLayout);
-    
-    const CFont* font = layoutCandidate.Font();
-    TInt labelWidthInPixels = 0;
-    if(font)
-	    {
-	    TInt bufLength = iBuffer.Length();
-	    if(bufLength != 0)
-		    {
-		    TPtrC newChars = iBuffer.Left(bufLength);
-		    labelWidthInPixels = font->TextWidthInPixels(newChars);
-		    }
-	    }
-    TRect rectCandidate = layoutCandidate.TextRect();
-    if(labelWidthInPixels == 0)
-	    {
-	    rectCandidate.iTl.iX = 0;
-	    }
-    rectCandidate.SetWidth(labelWidthInPixels);
-    iCandidateLabel->SetRect(rectCandidate);
-    iCandidateLabel->SetFont(font);
-    
-    // layout ordinal label
-    TBufC16<1> buf;
-    TPtr16 ptr = buf.Des();
-    ptr = (*(iOrdinalLabel->Text())).Left(EOneCandidate);
-
-    TAknLayoutText layoutOrdinal;
-    ordinalLayout.il = 0;
-	
-    layoutOrdinal.LayoutText(rect,ordinalLayout);
-    
-    const CFont* fontOrdinal = layoutOrdinal.Font();
-    
-    TRect ordinalRect = layoutOrdinal.TextRect();
-
-    // inserted in 2006.03.29
-    TPoint ordinalPosition;
-    // end inserting
-    TInt ordinalWidth = fontOrdinal->TextWidthInPixels(ptr);
-    
-    /* removing in 2006.03.29
-    ordinalRect.iTl.iX = rectCandidate.iTl.iX - ordinalWidth;
-    ordinalRect.iTl.iY = rectCandidate.iTl.iY;
-
-    ordinalRect.SetWidth(ordinalWidth);
-    ordinalRect.SetHeight(fontOrdinal->HeightInPixels());
-    */ // end removing
-
-    // inserted in 2006.03.29
-    ordinalPosition.iX = rectCandidate.iTl.iX - ordinalWidth;
-    ordinalPosition.iY = rectCandidate.iTl.iY;
-
-    ordinalRect = TRect(ordinalPosition,
-                        TPoint(ordinalPosition.iX + ordinalRect.Width(),
-                               ordinalPosition.iY + ordinalRect.Height()));
-    // end inserting
-
-    iOrdinalLabel->SetRect(ordinalRect);
-    iOrdinalLabel->SetFont(fontOrdinal);
-
-    // override with skin text color
-    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-    TRgb labelTextColor;
-
-    AknsUtils::GetCachedColor(skin, labelTextColor, 
-                              KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11);
-
-    TRAP_IGNORE( 
-	    iCandidateLabel->OverrideColorL(EColorLabelText, labelTextColor);
-	    iOrdinalLabel->OverrideColorL(EColorLabelText, labelTextColor);
-	    );
-    }
-
-void CAknFepUICtrlCandidateSelected::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
-    {
-    TRect windowRect = Rect();
-
-    TAknLayoutRect topLeft;
-    topLeft.LayoutRect(windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2());
-
-    TAknLayoutRect bottomRight;
-    bottomRight.LayoutRect(windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5());
-
-    aOuterRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
-    aInnerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
-    }
-
-void CAknFepUICtrlCandidateSelected::UpdateLabelVisibility()
-	{
-	if(iShowOrdinal)
-		{
-		iOrdinalLabel->MakeVisible(ETrue);
-		}
-	else
-		{
-		iOrdinalLabel->MakeVisible(EFalse);
-		}
-	}
-
-// End of file
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlContainerChinese.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlContainerChinese.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -42,6 +42,8 @@
 #include <AknsFrameBackgroundControlContext.h>
 #include <skinlayout.cdl.h>
 #include <AknDef.h>
+#include <coemain.h>
+#include "AknFepUiInputStateBase.h"
 
 #include "AknFepUiInterfacePanic.h"
 #include "AknFepUIAvkonCtrlContainerChinese.h"
@@ -110,6 +112,9 @@
             Window().SetOrdinalPosition(0, ECoeWinPriorityFep); // right at the front
             // make sure we are not faded even if a query has appeared
             Window().SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren); 
+            ClaimPointerGrab(ETrue);
+            // Set enable to capture outside pointer down event to close UI.
+            SetPointerCapture( ETrue );
             }
         else
             {
@@ -118,6 +123,9 @@
             iPinyinPopupWindow->Enable(aEnable);
             iEditPane->Enable(aEnable);
             iCandidatePane->Enable(aEnable);
+            ClaimPointerGrab(EFalse);
+        	// Set disable to capture outside pointer event
+            SetPointerCapture( EFalse );
             }
         MakeVisible(aEnable);
         }
@@ -139,6 +147,10 @@
 	    iEditPane->SetChangeState( EFalse );
 #endif
         }
+    else
+    	{
+		Window().Invalidate();
+    	}
     }  
   
 void CAknFepUICtrlContainerChinese::ConstructL()
@@ -146,6 +158,9 @@
     CreateWindowL();
     SetNonFocusing();
     RWindow& window=Window();
+        
+    // Need receive drag events.
+    window.PointerFilter( EPointerFilterDrag, 0 );
     window.SetOrdinalPosition(0, ECoeWinPriorityFep); // right at the front
     MakeVisible(EFalse);
 
@@ -153,7 +168,7 @@
 
     iLafDataMgr = CAknFepUiLayoutDataMgr::NewL();
     iInputPane = CAknFepUICtrlInputPane::NewL(window, CAknFepUICtrlInputPane::ELayoutPhraseInputPane, iLafDataMgr);
-    iCandidatePane = CAknFepUICtrlCandidatePane::NewL(window, iLafDataMgr);
+    iCandidatePane = CAknFepUICtrlCandidatePane::NewL(window, iLafDataMgr, this );
     iPinyinPopupWindow = CAknFepUICtrlPinyinPopup::NewL(window , iLafDataMgr);
     iEditPane = CAknFepUICtrlPinyinEEP::NewL( window, iLafDataMgr );
     iInputPane->SetMopParent(this);
@@ -163,6 +178,7 @@
     iInputPane->SetSizeChangedObserver(this);
     iPinyinPopupWindow->SetSizeChangedObserver(this);
     iPinyinPopupWindow->MakeVisible(EFalse);
+    iPinyinPopupWindow->SetMopParent( this );
     iEditPane->Enable(EFalse);
 
     iCandidatePane->SetPaneLayout(iPaneLayout); // set pane layout
@@ -190,7 +206,7 @@
 
 CAknFepUICtrlContainerChinese::~CAknFepUICtrlContainerChinese()
     {
-    iEikonEnv->EikAppUi()->RemoveFromStack(this);
+    iEikonEnv->EikAppUi()->RemoveFromStack( this );
     delete iLafDataMgr;
     delete iInputPane;
     delete iCandidatePane;
@@ -372,7 +388,7 @@
 
 void CAknFepUICtrlContainerChinese::FocusCandidatePane(TBool aValue)
     {
-    iInputPane->SetHighlighted(!aValue);
+    //iInputPane->SetHighlighted(!aValue);
     iCandidatePane->SetHighlighted(aValue);
     }
 
@@ -397,56 +413,40 @@
 
 void CAknFepUICtrlContainerChinese::LayoutPinyinPopupWindow()
     {
-    TRect popupRect(Position(), Size()); 
-    TRect pinyinRect = popupRect;
-    TAknWindowLineLayout entryHorizLine = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryHorizLineWindow ));
-    TAknWindowLineLayout entryPaneLine = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryPaneWindowLine ));
-    TAknWindowLineLayout eepFirstHorizLine = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEEPFirstHorizLineWindow ));
-    TAknWindowLineLayout eepSecondHorizLine = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEEPSecondHorizLineWindow ));
-    TAknLayoutRect layoutLineEntry, layoutLineEntryPane, layoutLineFirstHorizEEP, layoutLineSecondHorizEEP;
-    TRect layoutLineRectEntry, layoutLineRectEntryPane, layoutLineRectFirstHorizEEP, layoutLineRectSecondHorizEEP;
-    TInt index = ConvertLayoutToIndex();
-    if ( 2 == index )
+	// Use the same rect in Zhuyin input & Phrase creation mode.
+	TRect rect = Rect();
+	TAknWindowLineLayout popupRect;
+	TInt index = ConvertLayoutToIndex();
+    switch ( index )
         {
-        layoutLineFirstHorizEEP.LayoutRect( popupRect, eepFirstHorizLine );
-        layoutLineRectFirstHorizEEP = layoutLineFirstHorizEEP.Rect();
-        layoutLineSecondHorizEEP.LayoutRect( popupRect, eepSecondHorizLine );
-        layoutLineRectSecondHorizEEP = layoutLineSecondHorizEEP.Rect();
-        
-        pinyinRect.iTl.iY = layoutLineRectFirstHorizEEP.iBr.iY;
-        pinyinRect.iBr.iY = layoutLineRectSecondHorizEEP.iTl.iY;
+        case 0:
+        	popupRect = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EECWindowLayout ));
+            break;
+        case 2:
+        	popupRect = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EECPLayout ));
+            break;
+        default:        	
+            break;
         }
-    else
-        {
-        layoutLineEntry.LayoutRect( popupRect, entryHorizLine );
-        layoutLineRectEntry = layoutLineEntry.Rect();
-        layoutLineEntryPane.LayoutRect( popupRect, entryPaneLine );
-        layoutLineRectEntryPane = layoutLineEntryPane.Rect();
-        pinyinRect.iTl.iY = layoutLineRectEntryPane.iTl.iY;
-        pinyinRect.SetHeight(layoutLineRectEntry.iTl.iY - pinyinRect.iTl.iY);
-        }
-    iPinyinPopupWindow->SetRect(pinyinRect);
+	
+    AknLayoutUtils::LayoutControl( iPinyinPopupWindow, rect, popupRect );
     }
 
 void CAknFepUICtrlContainerChinese::LayoutPinyinEEPWindow()
     {
     TRect rect = Rect();  
-    TAknWindowLineLayout EEPWindowLayout;
+    TAknWindowLineLayout layoutEEPWindow;
     if ( iPaneLayout == ELayoutPhraseCreation )
     	{
-    	EEPWindowLayout =
-    	    CAknFepChineseUIDataConv::AnyToWindowLine(iLafDataMgr->RequestData(EEEPWindowLayout));
+		layoutEEPWindow =
+    	    CAknFepChineseUIDataConv::AnyToWindowLine(iLafDataMgr->RequestData(EEntryCPLayout));
     	}
     else
     	{
-    	EEPWindowLayout =
-    	    	    CAknFepChineseUIDataConv::AnyToWindowLine(iLafDataMgr->RequestData(EEntryPaneWindowLine));
+		layoutEEPWindow =
+    	    	    CAknFepChineseUIDataConv::AnyToWindowLine(iLafDataMgr->RequestData(EEntryCLayout));
     	}       
-    AknLayoutUtils::LayoutControl(iEditPane, rect, EEPWindowLayout);
+    AknLayoutUtils::LayoutControl(iEditPane, rect, layoutEEPWindow);
     }
 
 void CAknFepUICtrlContainerChinese::SetControlVisibility()
@@ -496,40 +496,35 @@
 
 void CAknFepUICtrlContainerChinese::SetContainerPosition(TPoint aCurPos, TInt aHeight)
     {
-    TRect parentRect;
-    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, parentRect);
+    TRect rect;
+    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect);
     TInt windowHeight = 0;
     TInt index = ConvertLayoutToIndex();
-    
-    if ( index != 2 )
+    switch ( index )
         {
-        windowHeight = 
-            CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEntry ));
-        isPCLPosed = EFalse;
-        }
-    else
-        {
-        windowHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEEP ));
-        isPCLPosed = ETrue;
+    	// Zhuyin input & phrase creation use the same rect
+        case 2:
+        	windowHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEEP ));
+        	isPCLPosed = ETrue;
+            break;
+        case 1:
+        	windowHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEntry ));
+        	isPCLPosed = EFalse;
+            break;
+        default:
+        	windowHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEP ));
+        	isPCLPosed = EFalse;
+            break;
         }
-    // Laf comments: In case there is enough space on the main pane to show the window under the entry,
-    // the window is placed 3 pixels below the text baseline of the entry. In case there is no space on 
-    // the main pane to show the window fully under the entry, the window is placed 17(16 pixel font) or
-    // 13(12 pixel font) pixels above the baseline of the entry.
-    if(aCurPos.iY + 3 + windowHeight < parentRect.iBr.iY) 
-        {
-        iContainerPosition.iY = aCurPos.iY + 3; 
-        }
+    // If cursor is covered by the container, move it to the top
+    if( aCurPos.iY > rect.iBr.iY - windowHeight )
+    	{
+        iContainerPosition.iY = aCurPos.iY - windowHeight - aHeight;
+    	}
     else
-        {
-        iContainerPosition.iY = aCurPos.iY - windowHeight - (aHeight + 1); 
-        }
-    if ((( iContainerPosition.iY + windowHeight ) > parentRect.iBr.iY ) ||
-        ( iContainerPosition.iY < parentRect.iTl.iY ))
-    {
-    iContainerPosition.iY = parentRect.iBr.iY - ( parentRect.iBr.iY - 
-                            parentRect.iTl.iY ) / 2 - windowHeight / 2;
-    }
+    	{
+        iContainerPosition.iY = rect.iBr.iY - windowHeight ;
+    	}
     LayoutContainer();
     }
 
@@ -546,47 +541,62 @@
 void CAknFepUICtrlContainerChinese::LayoutInputPane()
     {
     TRect rect = Rect();
-    TAknWindowLineLayout entryPaneWindowLine = 
-        CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryPaneWindowLine ));
+    TAknWindowLineLayout entryPaneWindowLine;
     TInt index = ConvertLayoutToIndex();
-    if ( index == 2)
+    switch ( index )
         {
-        TInt eepPopupHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEEP ));
-        TInt entryPopupHeight = CAknFepChineseUIDataConv::AnyToInt( iLafDataMgr->RequestData( EPopupHeightEntry ));
-        rect.iTl.iY = rect.iTl.iY + eepPopupHeight - entryPopupHeight;
+        case 2:
+        	entryPaneWindowLine = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EECPLayout ));
+            break;
+        case 1:
+        	entryPaneWindowLine = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EECWindowLayout ));
+            break;
+        default:
+        	entryPaneWindowLine = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EECWindowLayout ));
+            break;
         }
-    AknLayoutUtils::LayoutControl(iInputPane, rect, entryPaneWindowLine);
+    AknLayoutUtils::LayoutControl(iInputPane, rect, entryPaneWindowLine );
     }
 
 void CAknFepUICtrlContainerChinese::LayoutContainedControls()
     {
     LayoutInputPane();
     // layout candidate pane
-    TAknWindowLineLayout candidatePaneWindowLine = 
-                CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( ECandidatePaneWindowLine ));
-    TInt index = ConvertLayoutToIndex();
+    TAknWindowLineLayout candidatePaneWindowLine ;    
+    TInt index = ConvertLayoutToIndex();    
+    switch ( index )
+        {
+        case 2:
+        	candidatePaneWindowLine = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEPCandidateLayout ));
+            break;
+        case 1:
+        	candidatePaneWindowLine = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( ECandidateLayout ));
+            break;
+        default:
+        	candidatePaneWindowLine = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EECandidateLayout ));
+            break;
+        }
+    // Layout candidate pane.
+    AknLayoutUtils::LayoutControl( iCandidatePane, Rect(), candidatePaneWindowLine );
+    
     if (index == 2)
         {
         if ( isPCLPosed )
             {
-            iEditPane->Enable( ETrue );      
-            AknLayoutUtils::LayoutControl( iCandidatePane, Rect(), candidatePaneWindowLine );
+            iEditPane->Enable( ETrue ); 
             LayoutPinyinPopupWindow();
             LayoutPinyinEEPWindow();
             }
         }
     else if ( index == 0 || index == 1 ) 
         {
-        TRect rect = Rect();
         iEditPane->Enable(EFalse);
-        AknLayoutUtils::LayoutControl(iCandidatePane, rect, candidatePaneWindowLine);
         LayoutPinyinPopupWindow();
         }
     else
         {
         iEditPane->Enable(ETrue);
         iPinyinPopupWindow->Enable(EFalse);
-        AknLayoutUtils::LayoutControl(iCandidatePane, Rect(), candidatePaneWindowLine);
         LayoutPinyinEEPWindow();
         }
     }
@@ -601,15 +611,16 @@
             rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEEP ));
             break;
         case 1:
-            rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectCandatate ));
-            break;
-        default:
             rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEntry ));
             break;
+        default:
+            rect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectCandatate ));
+            break;
         }
-    TInt rectHeight = rect.iBr.iY - rect.iTl.iY;
-    rect.iTl.iY = iContainerPosition.iY;
-    rect.iBr.iY = iContainerPosition.iY + rectHeight;
+
+    // Set container rect.
+    rect.iBr.iY = iContainerPosition.iY + rect.Height();
+    rect.iTl.iY = iContainerPosition.iY;    
     SetRect(rect); 
     }
 
@@ -690,3 +701,58 @@
     {
     iFepMan = aFepMan;
     }
+
+void CAknFepUICtrlContainerChinese::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+	{	
+	CCoeControl::HandlePointerEventL(aPointerEvent);
+	TRect rect = Rect();
+	// If click out of the container, close container.
+	if (( aPointerEvent.iType == TPointerEvent::EButton1Down )  
+	 && ( !rect.Contains( aPointerEvent.iPosition )))
+		{
+		CloseUI();
+		// simulation pointer event to application.
+		Window().SetOrdinalPosition(-1);
+		User::After(50000);
+		TRawEvent eventDown;   
+		eventDown.Set( TRawEvent::EButton1Down, 
+				       aPointerEvent.iParentPosition.iX, 
+				       aPointerEvent.iParentPosition.iY );
+		CCoeEnv::Static()->WsSession().SimulateRawEvent( eventDown );
+		User::After(1000);
+		TRawEvent eventUp; 
+		eventUp.Set( TRawEvent::EButton1Up, 
+				     aPointerEvent.iParentPosition.iX, 
+				     aPointerEvent.iParentPosition.iY );
+		CCoeEnv::Static()->WsSession().SimulateRawEvent( eventUp );		
+		}	
+	return;
+	}
+
+void CAknFepUICtrlContainerChinese::CloseUI()
+	{
+	// Hide container
+	if( iFepUiState )
+		{
+		iFepUiState->CloseUI();
+		}
+	}
+
+void CAknFepUICtrlContainerChinese::SetFepUiStateCtrl( MAknFepUiStateCtrl* aFepUiState )
+    {
+    iFepUiState = aFepUiState;
+    }
+
+void CAknFepUICtrlContainerChinese::SubmitSelectedTextL(const TDesC& aText)
+    {
+	// Commit text
+    if ( iFepUiState )
+        {
+		iFepUiState->SubmitTextL( aText );
+        }
+    }
+
+void CAknFepUICtrlContainerChinese::CloseContainer()
+	{
+	CloseUI();
+	}
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlInputPane.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlInputPane.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -41,6 +41,7 @@
 #include "aknfepchineseuidataconv.h"
 #include "aknfepuilayoutdatamgr.h"
 
+
 CAknFepUICtrlInputPane* CAknFepUICtrlInputPane::NewL(RWindow& aParent, 
                                                      TInputPaneLayout aPaneLayout,
                                                      CAknFepUiLayoutDataMgr* aLafDataMgr )
@@ -70,7 +71,7 @@
     // make sure that we only copy as many characters as we can show
     if(iLayout == ELayoutPhraseInputPane)
         {
-        TPtrC newText = aDes.Right(CalculateMaxTextLength(aDes));        
+        TPtrC newText = aDes.Right( EMaxInputCharsInputPane );        
         TPtr ptr = iBuffer->Des();
 
         if(ptr != newText)
@@ -116,7 +117,7 @@
         iHighlighted = aHighlighted;
         // need to change highlight colors
         LayoutContainedControls();
-        DrawDeferred();
+        DrawNow();
         }
     }
 
@@ -198,12 +199,27 @@
 
 TInt CAknFepUICtrlInputPane::LabelTextWidthInPixels() const
     {
-    TAknLayoutText layoutText = 
-            CAknFepChineseUIDataConv::AnyToLayoutText( iLafDataMgr->RequestData( ELayoutInputPaneText ));
+    TAknTextLineLayout textLayout;
+    if ( iLayout == ELayoutPhraseInputPane )
+		{
+		textLayout = 
+		        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
+        
+        }
+    else if( iLayout == ELayoutPhrasePinyinPopupPane ) 
+		{
+		textLayout = 
+		        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EInputTextLayout ));
+		}
+    
+    TAknLayoutText layoutText;
+    layoutText.LayoutText( Rect(), textLayout );
+    
+    // Get the text font
     const CFont* font = layoutText.Font();
 
     TInt labelWidthInPixels = 0;
-    if(font)
+    if ( font )
         {
         TBufC<EMaxInputCharsInputPane> buf1;
         TPtr ptr1 = buf1.Des();
@@ -214,8 +230,6 @@
         labelWidthInPixels = font->TextWidthInPixels(ptr1); 
         labelWidthInPixels += font->TextWidthInPixels(ptr2);
         }
-    TInt maxWidth = layoutText.TextRect().Width(); 
-    labelWidthInPixels = labelWidthInPixels > maxWidth? maxWidth:labelWidthInPixels;
     return labelWidthInPixels;
     }
 
@@ -268,18 +282,20 @@
     CWindowGc& gc = SystemGc();
 
     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-    if(iHighlighted)
+    TRect outerRect;
+    TRect innerRect;
+    CalculateFrameRects(outerRect, innerRect);
+    if ( iHighlighted )
         {
-        TRect outerRect;
-        TRect innerRect;
-        CalculateFrameRects(outerRect, innerRect);
-        skinnedDraw = AknsDrawUtils::DrawFrame(
-            skin, gc, outerRect, innerRect, KAknsIIDQsnFrList, KAknsIIDQsnFrListCenter); // or KAknsIIDDefault?
+		// Highlight state
+        skinnedDraw = AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, 
+												KAknsIIDQsnFrKeypadButtonFrPressed, KAknsIIDDefault ); // or KAknsIIDDefault?
         }
     else
         {
-        MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
-        skinnedDraw = AknsDrawUtils::Background(skin, cc, this, gc, Rect());
+		// Normal state
+        skinnedDraw = AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect, 
+												KAknsIIDQsnFrKeypadButtonFrNormal, KAknsIIDDefault );
         }
 
     if(!skinnedDraw)
@@ -344,28 +360,20 @@
     combinedPtr.Copy(*iBuffer);
     combinedPtr.Append(iToneMarkBuffer);
 
-    TRect rect = Rect();
-    if(iLayout == ELayoutPhrasePinyinPopupPane)
-        {
-        TAknLayoutRect layoutLineRectEntryPane = 
-                CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ELayoutLineRectEntryPane ));
-        rect = layoutLineRectEntryPane.Rect();
-        }
-    // avoid accessing text layout member data
-    TAknLayoutRect labelRect;
+    TRect layoutRect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectCandatate ));
+    TAknWindowLineLayout layoutLineRectEntryPane = 
+                    CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryCLayout ));
+    TAknLayoutRect layoutRectEntryPane;
+    layoutRectEntryPane.LayoutRect( layoutRect, layoutLineRectEntryPane );
     
-    TAknWindowLineLayout layoutEntryItem = 
-            CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutEntryItem));
-    labelRect.LayoutRect(rect, layoutEntryItem);
+    TAknTextLineLayout layoutLineText = 
+                        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));    
+   
     TAknLayoutText layoutText;
-    TAknTextLineLayout entryTextLine = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EEntryTextLayout));
-    layoutText.LayoutText(labelRect.Rect(),entryTextLine);
-    TInt maxWidth = layoutText.TextRect().Width(); 
+    layoutText.LayoutText( layoutRectEntryPane.Rect(), layoutLineText );
     
-    TAknLayoutText layoutText1 = 
-            CAknFepChineseUIDataConv::AnyToLayoutText( iLafDataMgr->RequestData( ELayoutInputPaneText ));
-    const CFont* font = layoutText1.Font();
+    TInt maxWidth = layoutText.TextRect().Width();    
+    const CFont* font = layoutText.Font();
 
     TInt labelWidthInPixels = 0;
     if(font)
@@ -407,36 +415,42 @@
 void CAknFepUICtrlInputPane::LayoutContainedControls()
     {
     TRect rect = Rect();
+    TAknWindowLineLayout layoutEntryItem;
+    TAknTextLineLayout textLayout;
     if(iLayout == ELayoutPhraseInputPane)
 		{
-	    TAknWindowLineLayout layoutEntryItem = 
-	            CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutEntryItem));
-        iUnselectedStringHighlight.LayoutRect(rect, layoutEntryItem);
+		layoutEntryItem = 
+	            CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EEntryCLayout ));
+		
+		textLayout = 
+		        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
+        
         }
     else if(iLayout == ELayoutPhrasePinyinPopupPane) 
 		{
-        iUnselectedStringHighlight.LayoutRect(rect, AKN_LAYOUT_WINDOW_Input_highlight_Line_1(rect));
-        }
-
-    // layout spelling label    
-    TAknTextLineLayout textLayout = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EEntryTextLayout));
+		layoutEntryItem = 
+    	            CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EInputLayout ));
+		textLayout = 
+		        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EInputTextLayout ));
+		}
+    
+    iUnselectedStringHighlight.LayoutRect(rect, layoutEntryItem);
+    
     TAknLayoutText layoutText;
-    TRect rectHighlight = iUnselectedStringHighlight.Rect();
     TRect textRect;
     
-    layoutText.LayoutText(rectHighlight,textLayout);
+    layoutText.LayoutText(rect,textLayout);
     textRect = layoutText.TextRect();
     TRgb labelTextColor = layoutText.Color();
 
     TInt labelWidth = LabelTextWidthInPixels();
-    if(textRect.Width() > labelWidth)
+    if ( textRect.Width() < labelWidth )
         {
-        textRect.SetWidth(labelWidth);
+        textRect.SetWidth( labelWidth );
         }
-    iLabel->SetRect(textRect);
+    iLabel->SetRect( textRect );
     const CFont* font = layoutText.Font();
-    iLabel->SetFont(font);
+    iLabel->SetFont( font );
     
     // layout tone mark label
     TRgb labelToneMarkTextColor = labelTextColor;
@@ -449,8 +463,8 @@
     toneMarkRect.iTl.iY = textRect.iTl.iY;
     toneMarkRect.iBr.iY = textRect.iBr.iY;
     toneMarkRect.SetWidth(labelWidth - toneMarkOffset);
-    iLabelToneMark->SetRect(toneMarkRect);
-    iLabelToneMark->SetFont(font);
+    iLabelToneMark->SetRect( toneMarkRect );
+    iLabelToneMark->SetFont( font );
     
     // once we have layed out the labels from LAF, override the colours from the skin if necessary
     // as the skin utils will only return RGB values, not colour ids.
@@ -486,23 +500,22 @@
 void CAknFepUICtrlInputPane::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
     {
     TRect windowRect = Rect();
-    TRect entryRect = 
-        CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData(EEntryPaneRect));
-    
-    windowRect.SetHeight(entryRect.iBr.iY - entryRect.iTl.iY);
-    
-    TAknLayoutRect topLeft;
-    topLeft.LayoutRect(windowRect,SkinLayout::Submenu_skin_placing_Line_2());
-
-    TAknLayoutRect bottomRight;
-    bottomRight.LayoutRect(windowRect, SkinLayout::Submenu_skin_placing_Line_5());
-
-    aOuterRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
-    aInnerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
-    if (aInnerRect.Width() <= 4)
-        {
-        aInnerRect.SetWidth(5);
+    TAknTextLineLayout textLayout;
+    if ( iLayout == ELayoutPhraseInputPane )
+		{
+		textLayout = 
+		        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
+        
         }
+    else if( iLayout == ELayoutPhrasePinyinPopupPane ) 
+		{
+		textLayout = 
+		        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EInputTextLayout ));
+		}
+    TAknLayoutText layoutInputPaneText;
+    layoutInputPaneText.LayoutText( windowRect, textLayout );
+    aInnerRect = layoutInputPaneText.TextRect();
+    aOuterRect = windowRect;
     }
 
 TInt CAknFepUICtrlInputPane::CalculateMaxTextLength(const TDesC& aDes) const
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlPinyinPopup.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlPinyinPopup.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -45,8 +45,6 @@
 
 #include "data_caging_path_literals.hrh"
 
-_LIT(KFepUiControlsBitmapFile, "aknfepuictrls.mbm");
-
 CAknFepUICtrlPinyinPopup* CAknFepUICtrlPinyinPopup::NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr )
     {
     CAknFepUICtrlPinyinPopup* self = new(ELeave) CAknFepUICtrlPinyinPopup( aLafDataMgr );
@@ -62,10 +60,6 @@
     iPages.Reset();
     delete iSpellingArray;
     delete iSpellingIndexArray;
-    delete iNaviArrowBitmapLeft;
-    delete iNaviArrowBitmapLeftMask;
-    delete iNaviArrowBitmapRight;
-    delete iNaviArrowBitmapRightMask;
     delete iBgContext;
     delete iKeystrokeArray;
     delete iInEffectKeystrokeArray;
@@ -213,7 +207,7 @@
         TAknWindowLineLayout layoutEntryItem = 
                 CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutEntryItem));
         TAknTextLineLayout entryTextLine = 
-            CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EEntryTextLayout));
+            CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EEEPTextLine));
         TInt layoutLinePrevLeft = 0;
         TInt layoutLinePrevWidth = 0;
 
@@ -225,7 +219,7 @@
         layoutText.LayoutText(rectEntryItem,entryTextLine);
         TRect rectText = layoutText.TextRect();
         
-        TInt rightLimit = iIndiFepArrowRight.Rect().iTl.iX;
+        TInt rightLimit = rectText.iBr.iX;
         // value is 3 for 176*208 resolution
         TInt distance = rectText.iTl.iX - rectEntryItem.iTl.iX + rectEntryItem.iBr.iX - rectText.iBr.iX;
         
@@ -291,9 +285,9 @@
         TInt spellingLeftNum = aCount - index > EMaxCandidates? EMaxCandidates:aCount - index;
  
         TAknWindowLineLayout layoutEntryItem = 
-                CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutEntryItem));
+                CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EInputLayout ));
         TAknTextLineLayout entryTextLine = 
-            CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EEntryTextLayout));
+            CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EInputTextLayout ));
         TInt layoutLinePrevLeft = 0;
         TInt layoutLinePrevWidth = 0;
 
@@ -703,19 +697,6 @@
         iRectOutlineFrameInput.DrawRect(gc);
         iRectInsideAreaInput.DrawRect(gc);
         }
-
-    if((iVisibleCount >= 1) && (iPages.Count() > 1))
-        {
-        if(iCurDisplayPage != 0)
-            {
-            iIndiFepArrowLeft.DrawImage(gc, iNaviArrowBitmapLeft, iNaviArrowBitmapLeftMask);
-            }
-
-        if (iPages.Count() > iCurDisplayPage + 1)
-            {
-            iIndiFepArrowRight.DrawImage(gc, iNaviArrowBitmapRight, iNaviArrowBitmapRightMask);
-            }
-	    }
     }
 
 TTypeUid::Ptr CAknFepUICtrlPinyinPopup::MopSupplyObject(TTypeUid aId)
@@ -725,16 +706,14 @@
     return CCoeControl::MopSupplyObject(aId);
     }
 
-void CAknFepUICtrlPinyinPopup::ConstructL(RWindow& /*aParent*/)
+void CAknFepUICtrlPinyinPopup::ConstructL( RWindow& aParent )
     {
-    CreateWindowL();
-    ConstructBitmapsL();
-    RWindow& window = Window();
+    CreateWindowL( aParent );
 
     for(TInt i = 0; i < EMaxPhraseCandidate; i++)
         {
         CAknFepUICtrlInputPane* inputPane = 
-            CAknFepUICtrlInputPane::NewL(window, CAknFepUICtrlInputPane::ELayoutPhrasePinyinPopupPane, iLafDataMgr);
+            CAknFepUICtrlInputPane::NewL(aParent, CAknFepUICtrlInputPane::ELayoutPhrasePinyinPopupPane, iLafDataMgr);
         inputPane->SetMopParent(this);
         CleanupStack::PushL(inputPane);
         // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack
@@ -766,8 +745,6 @@
     iZhuyinSymbolsForChineseCharsDisped = new(ELeave)CDesCArrayFlat(1);
     
     SetNonFocusing();
-    window.SetOrdinalPosition(0, ECoeWinPriorityFep); // right at the front
-    window.SetNonFading(ETrue);
 
     TRect outerRect = TRect();
     TRect innerRect = TRect();
@@ -778,40 +755,6 @@
     MakeVisible(EFalse);
     }
 
-void CAknFepUICtrlPinyinPopup::ConstructBitmapsL()
-    {
-    MAknsSkinInstance* skin = AknsUtils::SkinInstance();    
-    
-    TFileName bmpFile;
-    bmpFile.Copy(_L("z:"));
-    bmpFile.Append(KDC_BITMAP_DIR);
-    bmpFile.Append(KFepUiControlsBitmapFile);      
-    
-    AknsUtils::CreateColorIconL( skin,
-                                     KAknsIIDQgnIndiFepArrowLeft,
-                                     KAknsIIDQsnIconColors,
-                                     EAknsCIQsnIconColorsCG20,
-                                     iNaviArrowBitmapLeft,
-                                     iNaviArrowBitmapLeftMask,
-                                     bmpFile,
-                                     EMbmAknfepuictrlsQgn_indi_fep_arrow_left,
-                                     EMbmAknfepuictrlsQgn_indi_fep_arrow_left_mask,
-                                     AKN_LAF_COLOR( 0 )
-                                 );  
-
-    AknsUtils::CreateColorIconL( skin,
-                                     KAknsIIDQgnIndiFepArrowRight,
-                                     KAknsIIDQsnIconColors,
-                                     EAknsCIQsnIconColorsCG20,
-                                     iNaviArrowBitmapRight,
-                                     iNaviArrowBitmapRightMask,
-                                     bmpFile,
-                                     EMbmAknfepuictrlsQgn_indi_fep_arrow_right,
-                                     EMbmAknfepuictrlsQgn_indi_fep_arrow_right_mask,
-                                     AKN_LAF_COLOR( 0 )
-                                 );    
-    }
-
 CAknFepUICtrlPinyinPopup::CAknFepUICtrlPinyinPopup( CAknFepUiLayoutDataMgr* aLafDataMgr )
     : 
     iSelected(0),
@@ -835,16 +778,6 @@
 
 void CAknFepUICtrlPinyinPopup::LayoutRects()
     {
-    // left arrow
-    iIndiFepArrowLeft = 
-        CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( EIndiFepArrowLeft ));
-    AknIconUtils::SetSize( iNaviArrowBitmapLeft, iIndiFepArrowLeft.Rect().Size());
-
-    // right arrow
-    iIndiFepArrowRight = 
-        CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( EIndiFepArrowRight ));
-    AknIconUtils::SetSize( iNaviArrowBitmapRight, iIndiFepArrowRight.Rect().Size());
-
     // cover main pane
     iRectCoverMainPaneInput = 
         CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( ERectCoverMainPaneInput ));
@@ -878,30 +811,41 @@
 
     CAknFepUICtrlInputPane* inputPane = iInputPaneArray[aIndex];
     TAknWindowLineLayout layoutEntryItem = 
-            CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutEntryItem));
+           CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData( EInputLayout ));
     TAknTextLineLayout layoutLineText = 
-        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EEntryTextLayout));
+        CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EInputTextLayout ));
     TAknLayoutRect layoutRectEntryItem;
-    layoutRectEntryItem.LayoutRect(rect,layoutEntryItem);
+    layoutRectEntryItem.LayoutRect( rect, layoutEntryItem );
     TRect rectEntryItem = layoutRectEntryItem.Rect();
     
     TAknLayoutText layoutText;
-    layoutText.LayoutText(rectEntryItem,layoutLineText);
+    layoutText.LayoutText( rectEntryItem, layoutLineText );
+    
+    // Get text rect
     TRect rectText = layoutText.TextRect();
+    TInt minWidth = rectText.Width();
     
     // value is 3 for 176*208 resolution
     TInt distance = rectText.iTl.iX - rectEntryItem.iTl.iX + rectEntryItem.iBr.iX - rectText.iBr.iX;
     
-    if( aIndex > 0)
+    if ( aIndex > 0 )
         {
         CAknFepUICtrlInputPane* inputPanePrev = iInputPaneArray[aIndex - 1];
         rectText.iTl.iX = inputPanePrev->Rect().iBr.iX;
         }
-    rectText.SetWidth(inputPane->LabelTextWidthInPixels() + distance);
-    rectText.SetHeight(rect.Height());
+    
+    TInt width = inputPane->LabelTextWidthInPixels();
+    // Only there has text that need the distance.
+    if ( width > 0 ) 
+    	{
+		width = width > minWidth ? width : minWidth;
+		width += distance;
+    	}
+    rectText.SetWidth( width );
+    rectText.SetHeight( rect.Height());
 
-    inputPane->SetRect(rectText);
-    inputPane->SetHighlighted(aIndex == iSelected);
+    inputPane->SetRect( rectText );
+    inputPane->SetHighlighted( aIndex == iSelected );
     }
 
 void CAknFepUICtrlPinyinPopup::SetInputPaneVisibility()
@@ -945,7 +889,7 @@
 void CAknFepUICtrlPinyinPopup::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
     {
     TRect windowRect = 
-        CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEntry ));
+        CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEEP ));
     TInt rectHeight = windowRect.iBr.iY - windowRect.iTl.iY;
     TInt rectWidth = windowRect.Width();
     windowRect.iTl.iX = 0;
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrleepcontrol.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrleepcontrol.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -112,9 +112,8 @@
     textrect.SetWidth( Rect().Width( )- Rect().Width( )*KLROffset/KDenominator * 2 ) ;
 
         TAknLayoutText layoutText;
-        TAknTextLineLayout
-            textLayout=
-            AKN_LAYOUT_TEXT_Chinese_universal_FEP_entry_pane_texts_Line_1( 0);
+        TAknTextLineLayout textLayout = 
+                    CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData( EEEPTextLine ));
         layoutText.LayoutText( textrect, textLayout ) ;
         const CFont* font = layoutText.Font( );
         gc.UseFont( font ) ;
@@ -706,31 +705,9 @@
 void CAknFepUICtrlEEPControl::CalculateFrameRects( TRect& aOuterRect,
     TRect& aInnerRect ) const
     {
-    TRect windowRect = CAknFepChineseUIDataConv::AnyToRect( iLafDataMgr->RequestData( EPopupRectEEP ));
-    TAknLayoutRect eepFirstHorizLineLayoutRect = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( EEEPFirstHorizLine ));
-    TAknLayoutRect eepSecondHorizLineLayoutRect = CAknFepChineseUIDataConv::AnyToLayoutRect( iLafDataMgr->RequestData( EEEPSecondHorizLine ));
-    TRect eepFirstHorizLineRect = eepFirstHorizLineLayoutRect.Rect();
-    TRect eepSecondHorizLineRect = eepSecondHorizLineLayoutRect.Rect();
-    TInt rectHeight = eepFirstHorizLineRect.iTl.iY - windowRect.iTl.iY;
-    //TInt rectHeight = eepSecondHorizLineRect.iTl.iY - windowRect.iTl.iY - 1;
-    TInt rectWidth = windowRect.Width( );
-    windowRect.iTl.iX = 0;
-    windowRect.iTl.iY = 0;
-    windowRect.SetHeight( rectHeight ) ;
-    windowRect.SetWidth( rectWidth ) ;
-    TAknLayoutRect topLeft;
-    topLeft.LayoutRect( windowRect,
-        SkinLayout::Submenu_skin_placing_Line_2( ) ) ;
-
-    TAknLayoutRect bottomRight;
-    bottomRight.LayoutRect( windowRect,
-        SkinLayout::Submenu_skin_placing_Line_5( ) ) ;
-   
-    aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr ) ;
-    aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl ) ;
-//    aOuterRect.SetHeight();
-//    aInnerRect = aOuterRect;
-    aInnerRect.iBr.iY = aOuterRect.iBr.iY;
+	aOuterRect = Rect();
+	aInnerRect = aOuterRect;
+	aInnerRect.Shrink( 3, 3 );
     }
 
 // End of file
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrlpinyineep.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuictrlpinyineep.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -846,9 +846,6 @@
 //
 void CAknFepUICtrlPinyinEEP::LayoutContainedControls()
     {
-    TRect outerRect;
-    TRect innerRect;
-    CalculateFrameRects( outerRect, innerRect );
     TRect rect = Rect();
     iEditableEntryPane->SetRect( rect );
     }
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuilayoutdatamgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/aknfepuilayoutdatamgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -50,58 +50,85 @@
     }
 
 void CAknFepUiLayoutDataMgr::ReadLafInfo()
-    {
-    // Screen
+    {	
+	// Screen
     TRect rect;
-    AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect);
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
     iScreenSize = rect.Size();
 
     iLandScape = iScreenSize.iWidth < iScreenSize.iHeight ? EFalse : ETrue;
     
-    TAknWindowLineLayout layoutLineEntry, layoutLineCandidate, layoutLineEEP;
-    TAknLayoutRect layoutRectEntry, layoutRectCandidate, layoutRectEEP;
-    
-    layoutLineEntry = AKN_LAYOUT_WINDOW_popup_fep_china_uni_window(0,0);
-    layoutRectEntry.LayoutRect(iScreenSize,layoutLineEntry);
-    iPopupRectEntry = layoutLineEntry.Rect();
+    // 1. Container With Candidate list
+    TAknWindowLineLayout layoutLineEntry;
+    TAknLayoutRect layoutRectEntry;
+      
+    // Get container Rect & height
+    layoutLineEntry = AknLayoutScalable_Avkon::popup_hyb_candi_window(0);
+    layoutRectEntry.LayoutRect( rect, layoutLineEntry );    
+    iPopupRectEntry = layoutRectEntry.Rect();
     iPopupHeightEntry = layoutLineEntry.iH;
     
-    //PinyinPopupWindowRect
-    iEntryPaneWindowLine = AKN_LAYOUT_WINDOW_fep_china_uni_entry_pane;
-    iLayoutEntryItem = AKN_LAYOUT_WINDOW_fep_entry_item_pane;
+    // Candidate layout
+    iCandidate = AknLayoutScalable_Avkon::grid_hyb_candi_pane(0);
+    
+    // Scroll layout
+    iScrollLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane(0); 
+   
+    // Up arrow & down arrow & close in scroll pane
+    iUpArrowLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g1_aid(0);   
+    iDownArrowLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g2_aid(0);    
+    iCloseLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g3(0);
     
-    iLayoutLineRectEntryPane.LayoutRect(iPopupRectEntry, iEntryPaneWindowLine);
+    // Character in candidate pane
+    iCharacterLineLayout = AknLayoutScalable_Avkon::cell_hyb_candi_pane(0);    
+    iCharacterTextLayout = AknLayoutScalable_Avkon::cell_hyb_candi_pane_t1(0);
+    iEntryPaneWindowLine = AknLayoutScalable_Avkon::input_focus_pane_cp06( 0 );
+    iEntryPaneWindowLine.il = 3;
+    iEntryPaneWindowLine.it = 3;
+    iEntryPaneWindowLine.ir = 5;
+    iEntryPaneWindowLine.iH = 30;
+    iLayoutEntryItem = AKN_LAYOUT_WINDOW_fep_entry_item_pane;    
+    iLayoutLineRectEntryPane.LayoutRect( iPopupRectEntry, iEntryPaneWindowLine );
     
-    layoutLineCandidate = AKN_LAYOUT_WINDOW_popup_fep_china_uni_window(0,1);
-    layoutRectCandidate.LayoutRect(iScreenSize,layoutLineCandidate);
-    iPopupRectCandidate = layoutLineCandidate.Rect();
+    // 2. EC( With Candidate list & Entry )
+    TAknWindowLineLayout layoutLineCandidate;
+    TAknLayoutRect layoutRectCandidate, layoutEC;
+    
+    // Container Rect & height
+    layoutLineCandidate = AknLayoutScalable_Avkon::popup_hyb_candi_window(1);
+    layoutRectCandidate.LayoutRect( rect,layoutLineCandidate );
+    iPopupRectCandidate = layoutRectCandidate.Rect();
+    iPopupRectCandidateHeight = layoutLineCandidate.iH;
     
-    layoutLineEEP = AKN_LAYOUT_WINDOW_popup_fep_china_uni_window(0,2);//need updated
-    layoutRectEEP.LayoutRect(iScreenSize,layoutLineEEP);
-    iPopupRectEEP = layoutLineEEP.Rect();
+    // Candidate layout
+    iECandidate = AknLayoutScalable_Avkon::grid_hyb_candi_pane(1);    
+    iEntryCLayout = AknLayoutScalable_Avkon::entry_hyb_candi_pane(0);
+    
+    // Phrase pane layout
+    iECWindowLayout = AknLayoutScalable_Avkon::grid_hyb_phrase_pane(0);     
+       
+    // 3. ECP( With Candidate list & Entry & PopUp )
+    TAknWindowLineLayout layoutLineEEP;
+    TAknLayoutRect layoutEEP, layoutRectEEP;
+    
+    // Container Rect & height
+    layoutLineEEP = AknLayoutScalable_Avkon::popup_hyb_candi_window(2);
+    layoutRectEEP.LayoutRect(rect,layoutLineEEP);
+    iPopupRectEEP = layoutRectEEP.Rect();
     iPopupHeightEEP = layoutLineEEP.iH;
     
-    
-    iCandidatePaneWindowLine = AKN_LAYOUT_WINDOW_fep_china_uni_candidate_pane( 0 );
-    
-    //Candidate
+    //Entry
+    iEntryCPLayout = AknLayoutScalable_Avkon::entry_hyb_candi_pane(1);
+    iEntryWithCandidateAndPopUp = AknLayoutScalable_Avkon::grid_hyb_phrase_pane(1);
+
+    // Candidate layout
+    iEPCandidate = AknLayoutScalable_Avkon::grid_hyb_candi_pane(2);
+       
+    //EEP
+    iEEPWindowLayout = AknLayoutScalable_Avkon::grid_hyb_phrase_pane(1);     
+    layoutEEP.LayoutRect( iPopupRectEEP, iEEPWindowLayout );
+    iEEPWindowRect = layoutEEP.Rect();
     
-    iCandidatePaneTextLine = AKN_LAYOUT_TEXT_Chinese_universal_FEP_candidate_pane_texts_Line_1;
-    iOrdinalCandidateTextLayout = AKN_LAYOUT_TEXT_Chinese_universal_FEP_candidate_pane_texts_Line_3;
-    iCandidateWindowLine1 = AKN_LAYOUT_WINDOW_Chinese_universal_FEPcandidate_pane_elements_Line_1;
-    iCandidateWindowLine2 = AKN_LAYOUT_WINDOW_Chinese_universal_FEPcandidate_pane_elements_Line_2;
-    iCandidateWindowLine3 = AKN_LAYOUT_WINDOW_Chinese_universal_FEPcandidate_pane_elements_Line_3;
-    iCandidateWindowLine4 = AKN_LAYOUT_WINDOW_Chinese_universal_FEPcandidate_pane_elements_Line_4;
-    
-    iLayoutCandidateItem = AKN_LAYOUT_WINDOW_fep_candidate_item_pane;
-    
-    //EEP   
-    TAknWindowComponentLayout EEPWindowComponentLayout = AknLayoutScalable_Avkon::fep_china_uni_eep_pane();     
-    iEEPWindowLayout = EEPWindowComponentLayout.LayoutLine();
-    TAknLayoutRect EEPLayout;
-    EEPLayout.LayoutRect( iPopupRectEEP, iEEPWindowLayout );
-    iEEPWindowRect = EEPLayout.Rect();
-    //
     iRectCoverMainPaneInputEntry.LayoutRect(iPopupRectEntry, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_1(iPopupRectEntry));
     iRectFirstShadowInputEntry.LayoutRect(iPopupRectEntry, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_2(iPopupRectEntry));
     iRectOutlineFrameInputEntry.LayoutRect(iPopupRectEntry, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_3(iPopupRectEntry));
@@ -116,59 +143,53 @@
     iRectInsideAreaInputCandidate.LayoutRect(iPopupRectCandidate, 
                                              AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_4(iPopupRectCandidate));
     
+  
     iRectCoverMainPaneInputEEP.LayoutRect(iPopupRectEEP, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_1(iPopupRectEEP));
     iRectFirstShadowInputEEP.LayoutRect(iPopupRectEEP, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_2(iPopupRectEEP));
     iRectOutlineFrameInputEEP.LayoutRect(iPopupRectEEP, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_3(iPopupRectEEP));
     iRectInsideAreaInputEEP.LayoutRect(iPopupRectEEP, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_4(iPopupRectEEP));    
-       
-    //HorizLine
-
+    
     iEntryHorizLineWindow = AknLayoutScalable_Avkon::popup_fep_china_uni_window_g(0,0).LayoutLine();
     iEEPSecondHorizLineWindow = AknLayoutScalable_Avkon::popup_fep_china_uni_window_g(0,1).LayoutLine();
     iEEPFirstHorizLineWindow = AknLayoutScalable_Avkon::popup_fep_china_uni_window_g(1,0).LayoutLine();
     iHorizLine.LayoutRect(iPopupRectEntry, iEntryHorizLineWindow);
     iEEPFirstHorizLine.LayoutRect(iPopupRectEEP, iEEPFirstHorizLineWindow);
     iEEPSecondHorizLine.LayoutRect(iPopupRectEEP, iEEPSecondHorizLineWindow);
+    iEntryPaneRect = iLayoutLineRectEntryPane.Rect( );
 
-    iEntryPaneRect = iLayoutLineRectEntryPane.Rect( );
-    iEntryTextLayout
-        = AKN_LAYOUT_TEXT_Chinese_universal_FEP_entry_pane_texts_Line_1(0);
     TAknLayoutRect labelRect;
-    labelRect.LayoutRect( iEntryPaneRect,
-        AKN_LAYOUT_WINDOW_fep_entry_item_pane );
+    labelRect.LayoutRect( iEntryPaneRect, AknLayoutScalable_Avkon::entry_hyb_candi_pane(0));
+    iEntryTextLayout = AknLayoutScalable_Avkon::entry_hyb_candi_pane_t1( 0 );
     iLayoutInputPaneText.LayoutText( labelRect.Rect( ), iEntryTextLayout );
 
     TRect windowRect = layoutRectEntry.Rect();    
     TInt height = windowRect.Height();
     TInt width = windowRect.Width();
+    
     windowRect.iTl.iY = 0;
     windowRect.iTl.iX = 0;
     windowRect.SetHeight(height);
     windowRect.SetWidth(width);
-    
+      
     TAknLayoutRect layoutLineRectEntryPane;
     layoutLineRectEntryPane.LayoutRect(windowRect, iEntryPaneWindowLine);
     TRect entryPane = layoutLineRectEntryPane.Rect();
-    // left and right arrow
-    TAknWindowLineLayout leftArrowLayoutLine, rithgArrowLayoutLine;	
-    leftArrowLayoutLine = AKN_LAYOUT_WINDOW_Chinese_universal_FEP_entry_pane_elements_Line_1;
-    iIndiFepArrowLeft.LayoutRect(entryPane,leftArrowLayoutLine);
-    rithgArrowLayoutLine = AKN_LAYOUT_WINDOW_Chinese_universal_FEP_entry_pane_elements_Line_2;
-    iIndiFepArrowRight.LayoutRect(entryPane,rithgArrowLayoutLine);   	
-    
+     
     iRectCoverMainPaneInput.LayoutRect(windowRect, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_1(windowRect));
     iRectFirstShadowInput.LayoutRect(windowRect, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_2(windowRect));
     iRectOutlineFrameInput.LayoutRect(windowRect, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_3(windowRect));
     iRectInsideAreaInput.LayoutRect(windowRect, AKN_LAYOUT_WINDOW_Chinese_universal_FEP_pop_up_window_graphics_Line_4(windowRect));
-    
+      
     //eep text
-    TAknTextComponentLayout textLayout = AknLayoutScalable_Avkon::fep_china_uni_eep_pane_t1();
+    TAknTextComponentLayout textLayout = AknLayoutScalable_Avkon::entry_hyb_candi_pane_t1(0);
     iEEPTextLine = textLayout.LayoutLine();
     TAknLayoutText eepTextLayout;
     eepTextLayout.LayoutText( iEEPWindowRect, iEEPTextLine );
     iEEPTextColor = eepTextLayout.Color();
     const CFont* font = AknLayoutUtils::FontFromId(iEEPTextLine.FontId());
     iEEPCursorHeight = font->HeightInPixels();    
+    iInputLayout = AknLayoutScalable_Avkon::cell_hyb_phrase_pane(0);
+    iInputTextLayout = AknLayoutScalable_Avkon::cell_hyb_phrase_pane_t1(0);
     }
 
 TAny* CAknFepUiLayoutDataMgr::RequestData(TInt aDataType)
@@ -189,22 +210,8 @@
             return &iEntryPaneWindowLine;
         case ECandidatePaneWindowLine:
             return &iCandidatePaneWindowLine;
-        case ECandidatePaneTextLine:
-            return &iCandidatePaneTextLine;
-        case ECandidateWindowLine1:
-            return &iCandidateWindowLine1;
-        case ECandidateWindowLine2:
-            return &iCandidateWindowLine2;
-        case ECandidateWindowLine3:
-            return &iCandidateWindowLine3;
-        case ECandidateWindowLine4:
-            return &iCandidateWindowLine4;
-        case ELayoutCandidateItem:
-            return &iLayoutCandidateItem;
         case ELayoutEntryItem:
             return &iLayoutEntryItem;
-        case EOrdinalCandidateTextLayout:
-            return &iOrdinalCandidateTextLayout;
         case EEEPWindowRect:
             return &iEEPWindowRect;
         case EEEPWindowLayout:
@@ -241,10 +248,6 @@
             return &iEntryTextLayout;
         case EEntryPaneRect:
             return &iEntryPaneRect;
-        case EIndiFepArrowLeft:
-            return &iIndiFepArrowLeft;
-        case EIndiFepArrowRight:
-            return &iIndiFepArrowRight;
         case ERectCoverMainPaneInput:
             return &iRectCoverMainPaneInput;
         case ERectFirstShadowInput:
@@ -271,6 +274,38 @@
             return &iEEPFirstHorizLineWindow;
         case EEEPTextColor:
             return &iEEPTextColor;
+        case EECPLayout:
+        	return &iEntryWithCandidateAndPopUp;//Rect;
+        case ECandidateLayout:
+        	return &iCandidate;
+        case EECandidateLayout:
+        	return &iECandidate;
+        case EEPCandidateLayout:
+        	return &iEPCandidate;
+        case ECharacterLayout:
+        	return &iCharacterLineLayout;
+        case ECharacterTextLayout:
+        	return &iCharacterTextLayout;
+        case EPopupHeightEP:
+        	return &iPopupRectCandidateHeight;
+        case EUpArrowLayout:
+        	return &iUpArrowLayout;
+        case EDownArrowLayout:
+        	return &iDownArrowLayout;
+        case EScrollLayout:
+        	return &iScrollLayout;
+        case EEntryCLayout:
+        	return &iEntryCLayout;
+        case EEntryCPLayout:
+        	return &iEntryCPLayout;
+        case EECWindowLayout:
+        	return &iECWindowLayout;
+        case ECloseLayout:
+        	return &iCloseLayout;
+        case EInputLayout:
+        	return &iInputLayout;
+        case EInputTextLayout:
+        	return &iInputTextLayout;
         default:
             break;
         }
--- a/fep/aknfep/UiPlugins/AknFepUiInterface/inc/AknFepUiCtrlContainerChinese.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/inc/AknFepUiCtrlContainerChinese.h	Wed Sep 15 12:34:44 2010 +0300
@@ -36,7 +36,7 @@
 class MAknFepUICtrlPinyinPopup;
 class MAknFepUICtrlEditPane;
 class MAknFepManagerUIInterface;
-
+class MAknFepUiStateCtrl;
 class MAknFepUICtrlContainerChinese
 {
 
@@ -181,6 +181,8 @@
      * @return if not enabled, return EFalse
      */
     virtual void SetFepMan( MAknFepManagerUIInterface* aFepMan ) = 0;
+    
+    virtual void SetFepUiStateCtrl( MAknFepUiStateCtrl* aFepUiState ) = 0;
 
 	};
 #endif  // __AKN_FEP_UI_CONTAINER_CHINESE_H__
--- a/fep/aknfep/group/AknFep.mmp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/group/AknFep.mmp	Wed Sep 15 12:34:44 2010 +0300
@@ -215,6 +215,8 @@
 SOURCE          AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.cpp
 SOURCE          AknFepUIInputStateEntryMiniQwertyCangJie.cpp
 SOURCE          aknfepuiinputminiqwertypinyinphrasebase.cpp 
+SOURCE          aknfepuiinputminiqwertysogoupinyinphraseplugin.cpp
+SOURCE          aknfepuiinputminiqwertysogoustrokephraseplugin.cpp
 SOURCE          aknfepuiinputminiqwertystrokephrasebase.cpp 
 SOURCE          aknfepuiinputstateminiqwertystrokephrase.cpp
 SOURCE          aknfepinputstateminiqwertyzhuyinkeymap.cpp  
--- a/fep/aknfep/group/Iconlist.txt	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/group/Iconlist.txt	Wed Sep 15 12:34:44 2010 +0300
@@ -2,3 +2,4 @@
 /c8,1 qgn_indi_fep_arrow_right.bmp
 /c8,1 qgn_indi_fep_arrow_up.bmp
 /c8,1 qgn_indi_fep_arrow_down.bmp
+/c8,8 qgn_indi_input_candi_list_close.svg
--- a/fep/aknfep/group/bld.inf	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/group/bld.inf	Wed Sep 15 12:34:44 2010 +0300
@@ -104,6 +104,6 @@
 START EXTENSION s60/mifconv
 OPTION TARGETFILE aknfepuictrls.mif
 OPTION HEADERFILE aknfepuictrls.mbg
-OPTION SOURCES -c8,1 qgn_indi_fep_arrow_left.bmp -c8,1 qgn_indi_fep_arrow_right.bmp -c8,1 qgn_indi_fep_arrow_up.bmp -c8,1 qgn_indi_fep_arrow_down.bmp
+OPTION SOURCEFILE iconlist.txt
 END
 // End of file
--- a/fep/aknfep/inc/AknFepManager.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepManager.h	Wed Sep 15 12:34:44 2010 +0300
@@ -267,7 +267,9 @@
         /* Flag to set decide when to set multiple observer for FEP. Set this flag whenever a FEP aware dialog is launched */
         EExtendedFlagFepAwareDialogLaunched               =0x00000020,
         /* Flag to specify that pointer event type EDrag has happened */ 
-        EExtendedFlagPointerEventTypeEDrag                =0x00000040
+        EExtendedFlagPointerEventTypeEDrag                =0x00000040,
+        /* Flag to specify that Fn key will be set as lock mode when long press occurs*/ 
+        EExtendedFlagFnKeyNeedLockMode                    =0x00000080
     	};		
 
     //public constants
@@ -622,6 +624,15 @@
     */
     virtual void HandleIndicCaseL();
 #endif
+    /*
+     * This function judge whether the texts inputted 
+     * exceed the max length of the editor. 
+     * 
+     * @since Symbian^3
+     * @param aNewInlineTextLenght the length of the current inline texts
+     * @return ETrue if the texts inputted exceed the max length of the editor. 
+     */ 
+    TBool IsTextExceedLeghthEditor(TInt aNewInlineTextLenght);
 
 public: //interface to the key catcher
     /**
@@ -2463,6 +2474,8 @@
     
     inline TBool IsMfneEditor() const;
     
+    inline TBool IsNoT9Editor() const;
+    
     inline TBool IsFindPaneEditor() const;
     inline TBool IsSupportedAdaptiveSearch() const;
     //for japanese
@@ -2930,7 +2943,7 @@
     /**
     * Notify mfne editor to toggle AM or PM for 12-hour time
     */
-    void ChangeMfneAmPm();
+    void ChangeMfneAmPmL();
 private:        
     TBool NumericResourceMultiTapTimerTimeoutL();    
     
@@ -2964,6 +2977,19 @@
      *      aMenuPane : pointer to the menu pane to be checked for the resource id
      */
     void AddInputOptionsMenuItemL( CAknFepUiInterfaceMenuPane* aMenuPane );
+    
+    /**
+     * CAknFepManager::MenuItemExist
+     * To check if the menuitem with the CascadeId exist in menupane
+     * Params -
+     *      aMenuPane : the current menu pane
+     *      aCascadeId : the menuitem cascadeID
+     *      aPosition : if the menuitem exist, this is the index
+     * return -
+     *      exist : true
+     *      not exist : false
+     */
+    TBool MenuItemExistL( CAknFepUiInterfaceMenuPane* aMenuPane, TInt aCascadeId, TInt &aPosition );
         
 private:        
     CChrMultiTapTimer* iNumericResourceTimer;
@@ -3143,6 +3169,11 @@
     return EditorType() == CAknExtendedInputCapabilities::EMFNEBased;
     }
 
+inline TBool CAknFepManager::IsNoT9Editor() const
+    {
+    return iAknEditorFlags & EAknEditorFlagNoT9;
+    }
+
 inline TBool CAknFepManager::IsFindPaneEditor() const
     {
     return iAknEditorFlags & EAknEditorFlagFindPane;
--- a/fep/aknfep/inc/AknFepPluginManager.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepPluginManager.h	Wed Sep 15 12:34:44 2010 +0300
@@ -113,7 +113,8 @@
     public CBase,
     public MAknFepPenSupportInterface,
     public MPeninputServerEventHandler,
-    public MEikEdwinObserver
+    public MEikEdwinObserver,
+    public MPenUiActivationHandler
     { 
 public:
 	
@@ -1139,6 +1140,28 @@
      * Indicate whether portrait FSQ feature is enabled
      */    
     TBool iPortraitFSQEnabled;
+
+    private:
+    // From MPenUiActivationHandler
+        
+        /** 
+         * From MPenUiActivationHandler
+         * Called when pen input UI is about to be closed
+         */    
+        void OnPeninputUiDeactivated();
+        
+        /** 
+         * From MPenUiActivationHandler
+         * Called when pen input UI is about to be open
+         */        
+        void OnPeninputUiActivated();  
+    private:
+        /**
+         * Indicate if plugin manager initiate to close input ui.
+         * This flag is used to avoid incursive calling 
+         */                 
+        TBool iInitiateCloseInputUi;
+    
     };
 
 class CConnectAo : public CActive
--- a/fep/aknfep/inc/AknFepUIInputStateEntryMiniQwertyCangJie.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUIInputStateEntryMiniQwertyCangJie.h	Wed Sep 15 12:34:44 2010 +0300
@@ -48,6 +48,9 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+
+    void SubmitTextL( const TDesC& aText );
+
     };
 
 
--- a/fep/aknfep/inc/AknFepUIInputStateEntryMiniQwertyPinyinPhrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUIInputStateEntryMiniQwertyPinyinPhrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -69,6 +69,10 @@
       * @param aCommandId Command ID value
       */
      void HandleCommandL( TInt aCommandId );
+     
+     
+     void SubmitTextL( const TDesC& aText );
+
     };
 
 /**
@@ -107,6 +111,9 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+    
+    void SubmitTextL( const TDesC& aText );
+    
     };
 
 #endif __AKN_FEP_UI_INPUT_STATE_ENTRY_MINIQWERTY_PINYINPHRASE_H__
\ No newline at end of file
--- a/fep/aknfep/inc/AknFepUiInputStateBase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStateBase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -39,6 +39,14 @@
 
 #include <PtiObserver.h> // MPtiObserver
 
+class MAknFepUiStateCtrl 
+	{
+public:
+    virtual void SubmitTextL( const TDesC& aText ) = 0;
+    
+    virtual void CloseUI() = 0;
+	};
+
 // CONSTANTS
 
 // MACROS
@@ -58,7 +66,8 @@
  *  @lib AknFep.lib
  *  @since 2.6
  */
-class TAknFepInputStateBase : public MPtiObserver
+class TAknFepInputStateBase : public MPtiObserver,
+							  public MAknFepUiStateCtrl
     {
 public: // Constructors and destructor
     /**
@@ -93,6 +102,10 @@
      * @since 2.6
      */
     virtual void FirstWordInSelectionList();
+    
+    virtual void SubmitTextL( const TDesC& aText );
+    
+    virtual void CloseUI();
 
 public: // New functions
     /**
@@ -123,11 +136,6 @@
      */
     virtual TUIState State() const;
 
-    /**
-     * Processing of Closeing UI
-     * @since 2.6
-     */
-    virtual void CloseUI();
 
     /**
      * Initialize state
--- a/fep/aknfep/inc/AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -71,6 +71,8 @@
      */
     void HandleCommandL( TInt aCommandId );
     
+    void SubmitTextL( const TDesC& aText );
+
 protected:
 
     /**
--- a/fep/aknfep/inc/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -63,6 +63,8 @@
      */
     void HandleCommandL( TInt aCommandId );
     
+    void SubmitTextL( const TDesC& aText );
+    
 protected:
 
     /**
@@ -117,6 +119,8 @@
      * 
      */
     TInt GetIndexOfToneMark( const TDesC& aText);
+    
+    void RefreshUI( TBool aRefresh );
     };
 
 #endif __AKN_FEP_UI_INPUT_STATE_CANDIDATE_MINIQWERTY_ZHUYINPHRASE_H__
--- a/fep/aknfep/inc/AknFepUiInputStateChineseBase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStateChineseBase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -38,6 +38,9 @@
 #include "AknFepUiInputStateBase.h"
 #include "AknFepUiCtrlContainerChinese.h"
 
+#include "aknfepuiinputminiqwertysogoupinyinphraseplugin.h"
+#include "aknfepuiinputminiqwertysogoustrokephraseplugin.h"
+
 // CONSTANTS
 
 // FORWARD DECLARATIONS
@@ -88,12 +91,33 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+    
+    /**
+     * Set plugin to state machine.
+     * This Method is called by CAknFepUIManagerChinese.
+     *
+     * @param aPlugin the plugin for sogou core
+     */
+    void SetPlugin( TAknFepInputMiniQwertySogouPinyinPhrasePlugin aPlugin );
+    
+    /**
+     * Set stroke plugin to state machine.
+     * This Method is called by CAknFepUIManagerChinese.
+     *
+     * @param aPlugin the stroke plugin for sogou core
+     */
+    void SetStrokePlugin( TAknFepInputMiniQwertySogouStrokePhrasePlugin aPlugin );
 
 protected:
     MAknFepUICtrlContainerChinese* iUIContainer;
     
    TBool iUseforResourcechange;    
-      
+   
+   // The plugin for sogou core.
+   TAknFepInputMiniQwertySogouPinyinPhrasePlugin iPlugin;
+   
+   // The stroke plugin for sogou core
+   TAknFepInputMiniQwertySogouStrokePhrasePlugin iStrokePlugin;
     };
 #endif//__AKN_FEP_UI_INPUTSTATE_CHINESE_BASE_H__
 // End of file
--- a/fep/aknfep/inc/AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -53,6 +53,9 @@
     
     TBool HandleKeyForHalfAndCustomQwertyL( TInt aKey,
         TKeyPressLength aLength );
+
+    void SubmitTextL( const TDesC& aText );
+
 public: // Functions from MPtiObserver interface
     void KeyTimerExpired();
 private:
--- a/fep/aknfep/inc/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -58,6 +58,9 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+    
+    void SubmitTextL( const TDesC& aText );
+
 protected:
 
     /**
--- a/fep/aknfep/inc/AknFepUiInputStatePredictiveInputMiniQwertyChinesePhrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiInputStatePredictiveInputMiniQwertyChinesePhrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -47,6 +47,9 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+     
+    void SubmitTextL( const TDesC& aText );
+
     };
 
 #endif T_AKNFEPUIINPUTSTATEPREDINPUTCHINESEPHRASE_H_
--- a/fep/aknfep/inc/AknFepUiManagerBase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiManagerBase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -145,6 +145,8 @@
      * @since 2.6
      */
     void CloseUI();
+    
+    void CloseUIIn();
 
     /**
      * From MAknFepManagerInterface
--- a/fep/aknfep/inc/AknFepUiManagerChinese.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/AknFepUiManagerChinese.h	Wed Sep 15 12:34:44 2010 +0300
@@ -104,6 +104,8 @@
      * @since 2.6
      */
     void CloseUI();
+    
+    void CloseUIIn();
 
     /**
      * From CAknFepUIManagerBase
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fep/aknfep/inc/aknfepuiinputminiqwertysogoupinyinphraseplugin.h	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2008 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:           
+*      Provides the TAknFepInputMiniQwertySogouPinyinPhrasePlugin declaration.
+*
+*/
+
+
+#ifndef T_AKNFEPUIINPUTMINIQWERTYSOGOUPINYINPHRASEPLUGIN_H
+#define T_AKNFEPUIINPUTMINIQWERTYSOGOUPINYINPHRASEPLUGIN_H
+
+class TAknFepInputMiniQwertySogouPinyinPhrasePlugin
+    {
+public:
+    
+    /**
+     * C++ default constructor
+     *
+     * @since S60 v3.2.3
+     * @param aOwner Pointer to UI manager state interface
+     * @param aUIContainer Pointer to Chinese UI container
+     * @param aState current state machine
+     */
+    TAknFepInputMiniQwertySogouPinyinPhrasePlugin(
+        MAknFepUIManagerStateInterface* aOwner,
+        MAknFepUICtrlContainerChinese* aUIContainer,
+        TUIState aState
+        );
+    
+    /**
+     * A patch to force the vtable to be copied during an assignment.
+     * 
+     * @param aState
+     */
+    void operator=(const TAknFepInputMiniQwertySogouPinyinPhrasePlugin& aPlugin);
+    
+public:       
+        /**
+         * Add phrase pinyin to the core.
+         *  
+         * @since S60 v3.2.3.
+         * @param aPhraseAdd that need to be added to the UDB.
+         * @return None.
+         */ 
+        void AddPhrasePinyinToPti(); 
+        
+        /**
+         * Analyse spelling after user press key.
+         * 
+         * @since S60 v3.2.3
+         * @param None.
+         * @return None.
+         */
+        void AnalyseL();
+        
+        /**
+         * Commint text to EEP or editor
+         *
+         * @since S60 V3.2.3
+         * @param aDes Text had been select from candidate pane
+         * @return ETrue if keep state, otherwise need to change to pridictive or editor
+         */
+        TBool CommitInlineEEPL( const TDesC& aDes );    
+        
+        /**
+         * Enable or disable the plugin.
+         *
+         * @since S60 v3.2.3
+         * @param aValid ETrue: enable the plugin, EFalse: disable the plugin.
+         * @return None
+         */
+        void Enable( TBool aValid );
+        
+        /**
+         * Detect whether the plugin enable or not.
+         *
+         * @since S60 v3.2.3
+         * @param None
+         * @return ETrue if the plugin is enable, others return EFalse.
+         */
+        TBool IsEnable();    
+        
+        /**
+         * Get the candidate info.
+         * 
+         * @since S60 v3.2.3.
+         * @param None.
+         * @return none.
+         */            
+        void GetCandidateL();
+        
+        /**
+         * Set whether to convert all stroke.
+         * 
+         * @since S60 v3.2.3.
+         * @param None.
+         * @return none.
+         */            
+        void CanConvertAll( TBool aEnable );
+        
+        /**
+         * Set the convert count.
+         * 
+         * @since S60 v3.2.3.
+         * @param None.
+         * @return none.
+         */            
+        void ConvertCount( TInt aCount );
+        
+private:
+        /**
+         * Check the delimiter of spelling.
+         * 
+         * @since S60 v3.2.3.
+         * @param aKeystroke the keystroke.
+         * @return ETrue if the param is delimiter, EFalse others.
+         */         
+        TBool CheckSpellingDLT( const TDesC& aKeystroke );
+        
+        /**
+         * Clear Keystroke of PtiEngine.
+         *
+         * @since S60 v3.2.3.
+         * @param None.
+         * @return None.
+         */
+        void ClearPtiEngineKeystroke();
+        
+        /**
+         * Get pinyin tone mark.
+         * 
+         * @since S60 v3.2.3.
+         * @param aKeystroke,The tone mark.
+         * @return pinyin tone mark.
+         */         
+        TInt ToneMark( const TDesC& aKeystroke );
+        
+        /**
+         * Check the spelling after add tone mark to the PTI.
+         * 
+         * @since S60 v3.2.3.
+         * @param aToneMark,The tone mark.
+         * @return ETue,if the splling is not phrase spelling,EFalse others.
+         */         
+        TBool CheckSpellingAddToneMarkToPTIL( const TInt aToneMark );        
+        
+        /**
+         * get the key code.
+         * 
+         * @since S60 v3.2.3
+         * @param aKey, the keycode.
+         * @param aKeystroke, the show keystroke.
+         * @return none.
+         */
+        void GetKeystrokeCode( TInt& aKey, const TDesC& aKeystroke );
+        
+        /**
+         * get the spell of least delimiter
+         *
+         * @since S60 v3.2.3
+         * @return the spell of least delimiter
+         */
+        TPtrC getCurrentLeastDLTSpell();    
+        
+        /**
+         * check result of tonemark.
+         *
+         * @since S60 v3.2.3
+         * @param aDes The result of tonemark
+         * @param aIndex The index
+         * @return NULL
+         */
+        void CheckResultOfToneMark( const TDesC16& aDes,
+                                    TInt& aIndex );
+        
+private:
+        /**
+         * The ui manager
+         */        
+        MAknFepUIManagerStateInterface* iOwner;
+                
+        /**
+         * The ui container.
+         */
+        MAknFepUICtrlContainerChinese* iUIContainer;
+        
+        /**
+         * The machine state
+         */           
+        TUIState iState;
+        
+        /**
+         * The flag for judge the plugin enable or not
+         */               
+        TBool iValid;
+        
+        /**
+         * The flag for adding DLT at the first index.
+         */ 
+        TBool iNeedAddDLT;
+        
+        /**
+         * The flag for convert all stroke.
+         */ 
+        TBool iCanConvertAll;
+        
+        /**
+         * The count of stroke need to be convert.
+         */ 
+        TInt iConvertCount;
+    };		
+
+#endif //T_AKNFEPUIINPUTMINIQWERTYSOGOUPINYINPHRASEPLUGIN_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fep/aknfep/inc/aknfepuiinputminiqwertysogoustrokephraseplugin.h	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2008 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:           
+*      Provides the TAknFepInputMiniQwertySogouStrokePhrasePlugin declaration.
+*
+*/
+
+
+#ifndef T_AKNFEPUIINPUTMINIQWERTYSOGOUSTROKEPHRASEPLUGIN_H
+#define T_AKNFEPUIINPUTMINIQWERTYSOGOUSTROKEPHRASEPLUGIN_H
+
+class TAknFepInputMiniQwertySogouStrokePhrasePlugin
+    {
+public:
+    
+    /**
+     * C++ default constructor
+     *
+     * @since S60 v3.2.3
+     * @param aOwner Pointer to UI manager state interface
+     * @param aUIContainer Pointer to Chinese UI container
+     * @param aState current state machine
+     */
+    TAknFepInputMiniQwertySogouStrokePhrasePlugin(
+        MAknFepUIManagerStateInterface* aOwner,
+        MAknFepUICtrlContainerChinese* aUIContainer,
+        TUIState aState
+        );
+    
+    /**
+     * A patch to force the vtable to be copied during an assignment.
+     * 
+     * @param aState
+     */
+    void operator=(const TAknFepInputMiniQwertySogouStrokePhrasePlugin& aPlugin);
+    
+public:       
+        
+        /**
+         * Add phrase pinyin to the core.
+         *  
+         * @since S60 v3.2.3.
+         * @param aPhraseAdd that need to be added to the UDB.
+         * @return None.
+         */ 
+        void AddPhrasePinyinToPti(); 
+        
+        /**
+         * Commint text to EEP or editor
+         *
+         * @since S60 V3.2.3
+         * @param aDes Text had been select from candidate pane
+         * @return ETrue if keep state, otherwise need to change to pridictive or editor
+         */
+        TBool CommitInlineEEPL( const TDesC& aDes );        
+        
+        /**
+         * Enable or disable the plugin.
+         *
+         * @since S60 v3.2.3
+         * @param aValid ETrue: enable the plugin, EFalse: disable the plugin.
+         * @return None
+         */
+        void Enable( TBool aValid );
+        
+        /**
+         * Detect whether the plugin enable or not.
+         *
+         * @since S60 v3.2.3
+         * @param None
+         * @return ETrue if the plugin is enable, others return EFalse.
+         */
+        TBool IsEnable();        
+        
+private:
+        /**
+         * The ui manager
+         */        
+        MAknFepUIManagerStateInterface* iOwner;
+        
+        /**
+         * The ui container.
+         */
+        MAknFepUICtrlContainerChinese* iUIContainer;
+        
+        /**
+         * The machine state
+         */           
+        TUIState iState;
+        
+        /**
+         * The flag for judge the plugin enable or not
+         */               
+        TBool iValid;
+    };		
+
+#endif //T_AKNFEPUIINPUTMINIQWERTYSOGOUSTROKEPHRASEPLUGIN_H
+
+// End of file
--- a/fep/aknfep/inc/aknfepuiinputstateminiqwertystrokephrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/aknfepuiinputstateminiqwertystrokephrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -72,6 +72,9 @@
       * @param aCommandId Command ID value
       */
      void HandleCommandL( TInt aCommandId );
+     
+     void SubmitTextL( const TDesC& aText );
+
     };
 
 /**
@@ -112,6 +115,8 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+    
+    void SubmitTextL( const TDesC& /*aText*/ );
     };
 
 /**
@@ -143,6 +148,9 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
+    
+    void SubmitTextL( const TDesC& aText );
+
 protected:
 
     /**
@@ -155,6 +163,7 @@
      * @return ETrue if handle, otherwise this class do not handle this key
      */
     TBool HandleKeyL(TInt aKey, TKeyPressLength aLength);
+
     };
 
 #endif /*__AKN_FEP_UI_INPUT_STATE_MINIQWERTY_STROKEPHRASECREATION_H__*/
--- a/fep/aknfep/inc/aknfepuiinputstateminiqwertyzhuyinphrase.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/inc/aknfepuiinputstateminiqwertyzhuyinphrase.h	Wed Sep 15 12:34:44 2010 +0300
@@ -174,6 +174,18 @@
       * @return None.
       */
      void ShowEEPInfo();
+     
+     /**
+       * Submit text
+       * @param aText text
+       */
+     void SubmitTextL( const TDesC& aText );
+     
+protected:
+     void CommitCandidateL();
+     
+     TInt GetIndexOfToneMark( const TDesC& aText);
+
     };
 
 /**
@@ -206,8 +218,18 @@
      * @param aCommandId Command ID value
      */
     void HandleCommandL( TInt aCommandId );
-
+    
+    /**
+      * Submit text
+      * @param aText text
+      */
+    void SubmitTextL( const TDesC& aText );
+    
 private:
+    
+    void CommitCandidateL();
+    
+    TInt GetIndexOfToneMark( const TDesC& aText);
     /**
      * From TAknFepInputStateCandidateBasePhrase
      * Handle system key press
@@ -288,6 +310,12 @@
      * @since S60 v3.2
      */
     TInt GetIndexOfToneMark( const TDesC& aText);
+    
+    /**
+      * Submit text
+      * @param aText text
+      */
+    void SubmitTextL( const TDesC& aText );
     };
 
 #endif /*AKNFEPUIINPUTSTATEMINIQWERTYZHUYINPHRASE_H_*/
--- a/fep/aknfep/src/AknFepKeyCatcher.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepKeyCatcher.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -456,7 +456,8 @@
 	// block the subsequent long key press also	
 	if ( length == EShortKeyPress && !iFepMan.EditorHasFreeSpace() 
 		&& iFepMan.PtiEngine()->IsValidKey((TPtiKey)aKeyEvent.iScanCode)   
-		&& !iFepMan.IsFlagSet(CAknFepManager::EFlagInsideMultitapInlineEditingTransaction) ) 
+		&& !iFepMan.IsFlagSet(CAknFepManager::EFlagInsideMultitapInlineEditingTransaction)
+        && (iFepMan.InputMode() != EHangul ) ) 
     	{
     	SetFlag(EFlagBlockAllLongKeyPressEvents); // block the subsequent long key press also
     	return EKeyWasNotConsumed;
--- a/fep/aknfep/src/AknFepManager.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepManager.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -1692,13 +1692,34 @@
                     //This condition is added for Hindi language in case of multitapping of EKey1 to get 
                     //a numeral value "1" because of a clasical case of Halant and ZWS getting added 
                     //before numeral 1 which may affect incase of limited space in editor   
-                        
-                    if (( EditorHasFreeSpace()
-                        || (!WesternPredictive() && !EditorHasFreeSpace() && 
-                           (TAknFepUiIndicInputManager::IsIndicLangauge(
-                            TLanguage(iLanguageCapabilities.iInputLanguageCode)))) 
-                        || IsFlagSet(EFlagInsideMultitapInlineEditingTransaction)
-                        || (IsFlagSet(EFlagInsideInlineEditingTransaction) && aLength == ELongKeyPress)))
+                    
+
+
+
+
+                    // Is the language Indic?
+                    TBool isIndicLanguage = TAknFepUiIndicInputManager::IsIndicLangauge(
+                                               TLanguage(iLanguageCapabilities.iInputLanguageCode)); 
+
+                    // Is the state in Multitap of the Inline Text   
+                    TBool  isFlagInsideMultitapInlineEditingTransaction = 
+                                                 IsFlagSet(EFlagInsideMultitapInlineEditingTransaction);
+
+                    // Is the state of the text inline when long pressing key event occurs
+                    TBool  isInlineEditorTransactionLongKeyPress = IsFlagSet(EFlagInsideInlineEditingTransaction)
+                                                               && ( aLength == ELongKeyPress );
+
+                    // Is the state of the text inline when current mode is Koeran.
+                    TBool isInlineEditorTranscationKoreanMode = IsFlagSet(EFlagInsideInlineEditingTransaction)
+                                                                && ( iMode == EHangul ); 
+
+                    // Don't check the free space of the editor 
+                    // when current mode is Hangul and current editor state is inline state.
+                    if ( EditorHasFreeSpace()
+                        || (!WesternPredictive() && !EditorHasFreeSpace() && isIndicLanguage )
+                        || isFlagInsideMultitapInlineEditingTransaction
+                        || isInlineEditorTransactionLongKeyPress  
+                        || isInlineEditorTranscationKoreanMode )
                         {
                         ClearFlag(EFlagEditorFull);
 
@@ -5578,6 +5599,29 @@
         AddInputLanguageItemL(aMenuPane, posToInsertItem);
         }
     }
+
+// -----------------------------------------------------------------------------
+// To check if the menu with the CascadeId exist in menupane
+// -----------------------------------------------------------------------------
+TBool CAknFepManager::MenuItemExistL( CAknFepUiInterfaceMenuPane* aMenuPane, 
+									 TInt aCascadeId, TInt &aPosition )
+    {
+    TInt numOfMenuItems = aMenuPane->NumberOfItemsInPane();
+    CEikMenuPane* menuPane = aMenuPane->GetMenuPane();
+
+    TInt index;
+    for( index = 0; index < numOfMenuItems ; ++index )
+        {
+        CEikMenuPaneItem::SData& itemData = menuPane->ItemDataByIndexL( index );
+        if( itemData.iCascadeId == aCascadeId )
+            {
+            aPosition = index;
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
 #endif // RD_INTELLIGENT_TEXT_INPUT
 
 
@@ -5614,7 +5658,10 @@
     if (iRememberLength > 0 || (iEditorCcpuStatus & ECcpuStatusFlagCanPaste))
         {
 		if (aMenuPane->MenuItemExists(EAknCmdEditItemPlaceHolder, index) ||
-				aMenuPane->MenuItemExists(EAknCmdInputLanguage, index) ||
+#ifdef RD_INTELLIGENT_TEXT_INPUT
+            MenuItemExistL( aMenuPane, R_AKNFEP_PRED_INPUT_OPTIONS_SUBMENU, index ) ||
+#endif //RD_INTELLIGENT_TEXT_INPUT 
+            aMenuPane->MenuItemExists(EAknCmdInputLanguage, index) ||
 		    aMenuPane->MenuItemExists(EAknCmdHelp, index) || 
             aMenuPane->MenuItemExists(EAknCmdExit, index))  
             {
@@ -20007,7 +20054,19 @@
 			switch(aEventCode)
 				{
 				case EEventKeyDown:
-					ActivateFnkeyPressMonitor();
+					{
+					  //if current state of fn key is EFnKeyNone or EFnKeyNext..., EFnKeyLock will be set;
+					  //otherwise, EFnKeyNone will be set.
+				      if ( iFnKeyManager->FnKeyState() ==  CAknFepFnKeyManager::EFnKeyLock )
+				    	  {
+			                ClearExtendedFlag( EExtendedFlagFnKeyNeedLockMode );
+				    	  }
+				      else
+				    	  {
+			                SetExtendedFlag( EExtendedFlagFnKeyNeedLockMode );
+				    	  }
+					  ActivateFnkeyPressMonitor();
+					}
 					break;
 				case EEventKeyUp:
 					{
@@ -20015,6 +20074,10 @@
 					   {
 					    //when long pressing event occurrs,
                         //event has been already handled in HandleFnKeyPressMonitorCallback()
+						if ( !IsExtendedFlagSet ( EExtendedFlagFnKeyNeedLockMode ))
+							{
+							 iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyNone);
+							}
 						return EKeyWasConsumed;
 					   }
 					//when short pressing event occurs, 
@@ -20807,7 +20870,7 @@
     	}       
     return EFalse;    
     }    
-void CAknFepManager::ChangeMfneAmPm()
+void CAknFepManager::ChangeMfneAmPmL()
     {
 	//trigger when touch at "AM" or "PM" in ICF
     if (iInputCapabilities.FepAwareTextEditor() && IsMfneEditor() )
@@ -20979,6 +21042,47 @@
 	TRAP_IGNORE( SendEventsToPluginManL( EPluginHideTooltip ));
 	}
 
+//========================================================================
+//
+// This function judge whether the texts inputted exceed 
+// the max length of the editor. 
+// 
+//========================================================================
+TBool CAknFepManager::IsTextExceedLeghthEditor( TInt aNewInlineTextLenght )
+	{
+    
+    // Get the length of the newest text that contains uncommitted texts 
+	TInt curPos = iUncommittedText.iAnchorPos + aNewInlineTextLenght;
+    
+    // Get the length of the text that is newly increased in uncommitted texts.
+	TInt deltaCur = curPos - iUncommittedText.iCursorPos;
+	
+    // Get the max length of the editor
+	TInt maxEdSize = iInputCapabilities.FepAwareTextEditor()->DocumentMaximumLengthForFep();
+
+    // Get the length of current the texts in the editor. The texts contain committed and uncomitted.    
+	TInt docLength = iInputCapabilities.FepAwareTextEditor()->DocumentLengthForFep();
+	
+      // DeltaCur is greater than zero.
+      if((maxEdSize > 0) && ( deltaCur > 0 ) 
+							&& (( docLength + deltaCur) > maxEdSize ) )
+         {
+         return ETrue;
+         }
+      // DeltaCur is negative. For example uncommitted texts contain candidate words.
+      else if ( (maxEdSize > 0) && (curPos > maxEdSize) )
+          {
+          return ETrue;
+          }
+        else
+          {
+
+          // Not exceeding the max length of editor
+          return EFalse;
+          }
+	}
+
+
 TBool CAknFepManager::IsExactWordPopUpShown()
 	{
 #ifdef RD_SCALABLE_UI_V2 
@@ -21247,23 +21351,12 @@
 // ---------------------------------------------------------------------------
 //
 void CAknFepManager::HandleFnKeyPressMonitor()
-	{
-	DeactivateFnkeyPressMonitor();
-	
-	//if previous state of fn key is EFnKeyNone or EFnKeyNext, EFnKeyLock will be set;
-	//otherwise, if previous state is EFnKeyLock, EFnKeyNone will be set.
-	switch(iFnKeyManager->FnKeyState())
-		{
-		case CAknFepFnKeyManager::EFnKeyPressed:
-		case CAknFepFnKeyManager::EFnKeyPressedAgain:
-			 iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyLock);
-			break;
-		case CAknFepFnKeyManager::EFnKeyDown:
-			 iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyNone);
-			 break;
-		default:
-			break;
-		}
+	{	
+	 DeactivateFnkeyPressMonitor();
+	 if (IsExtendedFlagSet ( EExtendedFlagFnKeyNeedLockMode ) )
+		 {
+	      iFnKeyManager->SetFnKeyState(CAknFepFnKeyManager::EFnKeyLock);
+		 }
 	}
 
 // ---------------------------------------------------------------------------
@@ -21274,7 +21367,12 @@
 void CAknFepManager::ActivateFnkeyPressMonitor()
 	{
 	 if( iFnKeypressMonitor )
-		 {
+		 {	      
+	      if ( iFnKeypressMonitor->IsActive() )
+	    	  {
+	           iFnKeypressMonitor->Cancel();
+	    	  }
+	      
 		  iFnKeypressMonitor->Start(KFnKeyLongPressTimeout, KFnKeyLongPressTimeout, 
 							   TCallBack(HandleFnKeyPressMonitorCallback, this));
 		 }
--- a/fep/aknfep/src/AknFepPluginManager.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepPluginManager.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -221,6 +221,7 @@
     
     if( iPenInputSvrConnected )
         {
+        iPenInputServer.RemovePenUiActivationHandler( this );
         iPenInputServer.Close();
         iPenInputSvrConnected = EFalse;
         }
@@ -531,7 +532,7 @@
                 break;  
             case ESignalChangeAmPm:
                 {
-                iFepMan.ChangeMfneAmPm();
+                iFepMan.ChangeMfneAmPmL();
                 }
                 break;
             case ESignalSetAppEditorCursor:
@@ -1006,6 +1007,12 @@
             {
             iForegroundChange = ETrue;   
             iLaunchHelp = EFalse;    
+
+            // Remove pen ui activation observer
+            if (iPenInputSvrConnected && !aEventData )
+                {
+                iPenInputServer.RemovePenUiActivationHandler( this );
+                }            
             
             if (!aEventData && IsInGlobleNoteEditor())
                 {
@@ -1402,6 +1409,15 @@
                 }
             }
         }
+    else if( aSuggestMode == EPluginInputModePortraitFSQ  )
+    	{
+		// If current input languge is Chinese or Korean, use EPluginInputModeItut instead.
+		if ( iPortraitFSQEnabled && 
+				( iFepMan.IsChineseInputLanguage() || iFepMan.IsKoreanInputLanguage() ))
+			{
+			  aSuggestMode = EPluginInputModeItut;
+			}
+    	}
     else if ( iOrientationChanged )
         {
         iFepMan.SetNotifyPlugin( EFalse );
@@ -1410,6 +1426,9 @@
         iOrientationChanged = EFalse;
         }
     
+    // Add pen ui activation observer
+    iPenInputServer.AddPenUiActivationHandler( this, EPluginInputModeAll );    
+    
     TBool isSplit = IsEditorSupportSplitIme();
     TInt inputLang = iFepMan.InputLanguageCapabilities().iInputLanguageCode;
     // temp code for Chinese split view
@@ -1593,6 +1612,8 @@
 //
 void CAknFepPluginManager::ClosePluginInputUiL(TBool aResetState)
     {
+    iInitiateCloseInputUi = ETrue;
+    
     // For addition of ITI features on FSQ, 
     // need to restore some values stored before opening FSQ    
     
@@ -1617,6 +1638,7 @@
                 }
             else
                 {
+                NotifyAppUiImeTouchWndStateL( EFalse ); //this change is under testing 
                 iCurrentPluginInputFepUI->CloseUI();
                 }
             if( aResetState )
@@ -1659,13 +1681,15 @@
         } 
         
     // Notify editor the touch window has been closed
-    NotifyAppUiImeTouchWndStateL( EFalse );
+    //NotifyAppUiImeTouchWndStateL( EFalse );//this change is under testing
     
     iCharStartPostion = KInvalidValue;
     
     // Set the KAknFepTouchInputActive PS to 0, 
     // it means that touch input is inactive now.
     RProperty::Set( KPSUidAknFep, KAknFepTouchInputActive, 0 );
+    
+    iInitiateCloseInputUi = EFalse;    
     }
 
 // ---------------------------------------------------------------------------
@@ -1874,19 +1898,25 @@
                     }
                     break;
                 case EPeninputCmdFSQ:
+                	{
+                	if ( iPortraitFSQEnabled )
+                		{
+                        TPixelsTwipsAndRotation size; 
+                        CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size);
+                        TBool landscape = size.iPixelSize.iWidth > size.iPixelSize.iHeight;
+                        ProcessChangingInputModeCmdL( landscape ? EPluginInputModeFSQ : EPluginInputModePortraitFSQ );
+                		}
+                	else
+                		{
+                	    ProcessChangingInputModeCmdL(EPluginInputModeFSQ);
+                		}
+                	}
+                	break;
                 // "Edit portrait" menu - switch to portrait FSQ
                 case EPeninputCmdPortraitEditor:
                     {
-                    if ( iPortraitFSQEnabled )
-                        {
-                        ProcessChangingInputModeCmdL(EPluginInputModePortraitFSQ);          
-                        }
-                    else 
-                        {
-                        ProcessChangingInputModeCmdL(EPluginInputModeFSQ);
-                        }
+                    ProcessChangingInputModeCmdL(EPluginInputModePortraitFSQ);          
                     }
-
                     break;
                 // "Edit landscape" menu - switch to landscape FSQ
                 case EPeninputCmdLandscapeEditor:
@@ -2295,17 +2325,30 @@
         {
         // "QWERTY keyboard" - EPeninputCmdFSQ menu is shown in these conditions
         // if portrait FSQ feature flag is enabled
-        // 1) Non-Chinese language
-        // 2) Current input mode is not portrait FSQ and also the mode is not disabled
-        // 3) Current orientation is portrait
-        if ( !isKorean && !isChinese
-            && ( curInputMode != EPluginInputModePortraitFSQ ) 
-            && !( disabledInputMode & EPluginInputModePortraitFSQ ) 
-            && isPortrait )
-        {
-        aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
-        }
-        
+        if ( !isKorean && !isChinese )
+        	{
+            // 1) Non-Chinese language and non-Korean language   
+            if ( isPortrait )
+            	{
+                // 2) On portrait screen, current input mode is not portrait FSQ 
+                //    and also the mode is not disabled
+                if ( curInputMode != EPluginInputModePortraitFSQ 
+                	 && !( disabledInputMode & EPluginInputModePortraitFSQ ) )
+                	{
+                    aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
+                	}                	
+            	}
+            else
+            	{
+                // 3) On landscape screen, current input mode is not FSQ 
+                // and also the mode is not disabled
+                if ( curInputMode != EPluginInputModeFSQ 
+                   	 && !( disabledInputMode & EPluginInputModeFSQ ) )
+                	{
+                    aMenuPane->SetItemDimmed( EPeninputCmdFSQ, EFalse );
+                	}
+            	}        
+        	}
         }
     else
         {
@@ -6057,7 +6100,8 @@
          && iFepMan.InputLanguageCapabilities().iSupportsWesternQwertyPredictive
          && !iSharedData.QwertyInputMode()
          // No need to support in dialer application.
-         && RProcess().SecureId().iId != KPhoneSecureId )
+         && RProcess().SecureId().iId != KPhoneSecureId && 
+         !iFepMan.IsNoT9Editor() )
         {
         return ETrue;
         }        
@@ -6510,6 +6554,29 @@
     iCurEditor = NULL;
     }
 
+// -----------------------------------------------------------------------------
+// CAknFepPluginManager::OnPeninputUiDeactivated
+// Called when pen input UI is about to be closed
+// -----------------------------------------------------------------------------
+//
+void CAknFepPluginManager::OnPeninputUiDeactivated()
+    {
+    if( !iInitiateCloseInputUi )
+        {
+        TRAP_IGNORE( ClosePluginInputUiL( ETrue ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CAknFepPluginManager::OnPeninputUiActivated
+// Called when pen input UI is about to be open
+// -----------------------------------------------------------------------------
+//
+void CAknFepPluginManager::OnPeninputUiActivated()
+    {
+    }
+
+
 CConnectAo::CConnectAo(CAknFepPluginManager* aClient) 
                 : CActive(CActive::EPriorityStandard),
                   iClient(aClient)
--- a/fep/aknfep/src/AknFepUIInputStateEntryMiniQwertyCangJie.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUIInputStateEntryMiniQwertyCangJie.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -162,7 +162,6 @@
         {
         if ( candidatePane->VisibleCandidateCount() != 1 )
 	        {
-	        iOwner->ChangeState( ECandidate );  
 	    	candidatePane->SelectNext(); 	
 	    	UpdateIndicator();
 	        }    	
@@ -171,8 +170,7 @@
     	{
     	if ( candidatePane->VisibleCandidateCount()!= 1 )
 	    	{
-	    	iOwner->ChangeState( ECandidate );  
-	        candidatePane->SelectLastPhrase();	
+	        candidatePane->SelectPrev();	
 	        UpdateIndicator();
 	    	}
     	}     
@@ -260,4 +258,24 @@
             break;
         }
     }
+void TAknFepInputStateEntryMiniQwertyCangJie::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepManagerUIInterface* fepMan = iOwner->FepMan( );
+	if ( aText.Length( ) )
+	   {
+	   fepMan->NewTextL( aText );
+	   fepMan->CommitInlineEditL( );
+	   iOwner->PtiEngine()->SetPredictiveChineseChar( aText );
+	   if ( fepMan->IsFlagSet( CAknFepManager::EFlagEditorFull ) )
+	      {
+	      fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
+	      iOwner->FepMan()->TryCloseUiL( );
+	      }
+	   else
+	       {
+	       iOwner->ChangeState( EPredictiveCandidate );
+	       }
+	    }
+	}
+
 // End of file
--- a/fep/aknfep/src/AknFepUIInputStateEntryMiniQwertyPinyinPhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUIInputStateEntryMiniQwertyPinyinPhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -57,8 +57,8 @@
     iOwner->PtiEngine()->SetInputMode( EPtiEnginePinyinPhraseQwerty );
     iOwner->PtiEngine()->SetCase( EPtiCaseLower );
     UIContainer()->SetLayout( MAknFepUICtrlContainerChinese::ELayoutKeystroke );
-    UIContainer()->FocusCandidatePane( ETrue );
     UIContainer()->CandidatePane()->SelectFirstPhrase();
+    UIContainer()->FocusCandidatePane( ETrue );    
     UIContainer()->CandidatePane()->ShowCandidateOrdinals( EFalse );
     UIContainer()->EditPaneWindow()->DeactiveCursor();
     UIContainer()->SetFepMan( iOwner->FepMan() );
@@ -124,7 +124,6 @@
             {
             if ( candidatePane->VisibleCandidateCount()!= 1 )
                 {
-                iOwner->ChangeState( ECandidate );
                 candidatePane->SelectNext();
                 UpdateIndicator();
                 }
@@ -134,9 +133,7 @@
             {
             if ( candidatePane->VisibleCandidateCount()!= 1 )
                 {
-                iOwner->ChangeState( ECandidate );
-                TInt numbertotal = UIContainer()->CandidatePane()->VisibleCandidateCount();
-                UIContainer()->CandidatePane()->SelectIndex( numbertotal - 1 );
+                UIContainer()->CandidatePane()->SelectPrev();
                 UpdateIndicator();
                 }
             break;
@@ -259,7 +256,7 @@
             if ( 0 != candidatePane->VisibleCandidateCount() )
                 {
                 uiContainer->EditPaneWindow()->SetChangeState( ETrue );
-                iOwner->ChangeState( ECandidate );
+                iOwner->ChangeState( EEntry );
                 }
             break;
             }
@@ -308,6 +305,40 @@
         }
     return ret;
     }
+
+void TAknFepInputStateEditinigMiniQwertyPinyinPhrase::SubmitTextL( const TDesC& aText )
+	{
+	 if ( aText.Length() )
+		 {
+		 if ( !CommitInlineEEPL( aText ) )
+			{
+			DoActionAfterCommit();
+			}
+		else
+			{
+			if ( CheckFirstGroupStroke() )
+				{
+				//stroke to be shown
+                if ( iPlugin.IsEnable())
+                    {
+                    iPlugin.AnalyseL();
+                    }
+				RefreshUI( EFalse );
+				UIContainer()->CandidatePane()->SelectFirstPhrase();
+				}
+			else
+				{
+				//stroke to be shown
+                if ( iPlugin.IsEnable())
+                    {
+                    iPlugin.AnalyseL();
+                    }
+				UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate );
+				iOwner->ChangeState( EMiniQwertyEdit );
+				}
+			}
+		}
+	}
 // ---------------------------------------------------------------------------
 // TAknFepInputStateEntryMiniQwertyPinyinPhrase::HandleCommandL
 // Handling Command
@@ -354,5 +385,42 @@
     {
     TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommandL( aCommandId );
     }
+
+void TAknFepInputStateEntryMiniQwertyPinyinPhrase::SubmitTextL( const TDesC& aText  )
+	{
+    MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    if ( aText.Length() )
+        {
+        if ( !CommitInlineEEPL( aText ) )
+            {
+            DoActionAfterCommit();
+            }
+        else
+            {
+            if ( CheckFirstGroupStroke() )
+               {
+                //stroke to be shown
+                if ( iPlugin.IsEnable())
+                    {
+                    iPlugin.AnalyseL();
+                    }
+               RefreshUI();
+               uiContainer->CandidatePane()->SelectFirstPhrase();
+               }
+           else
+               {
+               //stroke to be shown
+               if ( iPlugin.IsEnable())
+                   {
+                   iPlugin.AnalyseL();
+                   }
+               uiContainer->EditPaneWindow()->SetAutoChangeStateFlag(
+                            EAutoChangeStateFromCandidate );
+               iOwner->ChangeState( EMiniQwertyEdit );
+               }
+            }
+       }
+	}
+
 // End Of File
 
--- a/fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUIInputStatePredictiveInputMiniQwertyChinesePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -127,7 +127,25 @@
             fepMan->NewTextL(text);
             fepMan->CommitInlineEditL();
             iOwner->PtiEngine()->SetPredictiveChineseChar(text);
-            if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
+            
+            // For sogou core, the predictive is not endless, so when there
+            // is no predictive candidates, we should call TryCloseUiL().
+            TBool noCandidates = EFalse;
+            if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
+                {
+                // Get the predictive candidates.
+                CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
+                CleanupStack::PushL ( phraseCandidates );
+                phraseCandidates->Reset();
+                iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+                if ( phraseCandidates->Count() == 0 )
+                    {
+                    noCandidates = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( phraseCandidates );
+                }
+            // If no candidates, call TryCloseUiL().
+            if ( fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
                 {
                 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
                 iOwner->FepMan()->TryCloseUiL();
@@ -209,4 +227,44 @@
         break;
     }
 }
+
+void TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
+	if ( aText.Length() )
+	   {
+	   fepMan->NewTextL( aText );
+	   fepMan->CommitInlineEditL();
+	   iOwner->PtiEngine()->SetPredictiveChineseChar( aText );
+      
+       // For sogou core, the predictive is not endless, so when there
+       // is no predictive candidates, we should call TryCloseUiL().
+       TBool noCandidates = EFalse;
+       
+       if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
+           {
+           // Get the predictive candidates.
+           CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
+           CleanupStack::PushL ( phraseCandidates );
+           phraseCandidates->Reset();
+           iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+           if ( phraseCandidates->Count() == 0 )
+               {
+               noCandidates = ETrue;
+               }
+           CleanupStack::PopAndDestroy( phraseCandidates );
+           }
+       
+       if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
+	      {
+	      fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
+	      iOwner->FepMan()->TryCloseUiL();
+	      }
+	   else
+	      {
+	      iOwner->ChangeState( EPredictiveCandidate );
+	      }
+	    }
+	}
+	
 // End of file
--- a/fep/aknfep/src/AknFepUiInputStateBase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateBase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -30,6 +30,7 @@
 // INCLUDE FILES
 #include "AknFepUiInputStateBase.h"
 #include "AknFepPanic.h"
+#include "AknFepUIManagerStateInterface.h"
 
 // CONSTANTS
 
@@ -121,15 +122,22 @@
     {
     return iState;
     }
-
+void TAknFepInputStateBase::SubmitTextL( const TDesC& /*aText*/ )
+	{
+	
+	}
 // ---------------------------------------------------------------------------
 // TAknFepUiInputStateJapaneseBase::CloseUI
 // 
 // ---------------------------------------------------------------------------
 //
 void TAknFepInputStateBase::CloseUI()
-    {
-    }
+	{
+	if ( iOwner )
+		{
+		TRAP_IGNORE( iOwner->FepMan()->TryCloseUiL());
+		}
+	}
 
 // ---------------------------------------------------------------------------
 // TAknFepUiInputStateJapaneseBase::InitializeStateL
--- a/fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -30,6 +30,7 @@
 #include <PtiEngine.h>  
 #include <PtiUserDicEntry.h>
 #include <aknnotewrappers.h> //CAknWarningNote 
+#include "AknFepUiManagerBase.h"
 
 const TInt KMinCandidateCount = 1;
 // User includes
@@ -42,6 +43,7 @@
 #include "AknFepUIManagerStateInterface.h"  
 #include "AknFepManager.h" 
 #include <aknfep.rsg>                 
+#include "AknFepUiManagerChinese.h"
 
 // ---------------------------------------------------------------------------
 // AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::
@@ -206,11 +208,21 @@
                     {
                     if ( CheckFirstGroupStroke() )
                         {
+                        //stroke to be shown
+                        if ( iPlugin.IsEnable())
+                            {
+                            iPlugin.AnalyseL();
+                            }
                         RefreshUI( EFalse );
                         UIContainer()->CandidatePane()->SelectFirstPhrase();
                         }
                     else
                         {
+                        //stroke to be shown
+                        if ( iPlugin.IsEnable())
+                            {
+                            iPlugin.AnalyseL();
+                            }
                         UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate );
                         iOwner->ChangeState( EMiniQwertyEdit );
                         }
@@ -278,5 +290,36 @@
             break;
         }
     }
-
+void TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase::SubmitTextL( const TDesC& aText )
+	{
+	 if ( aText.Length() )
+		 {
+		 if ( !CommitInlineEEPL( aText ) )
+			{
+			DoActionAfterCommit();
+			}
+		else
+			{
+			if ( CheckFirstGroupStroke() )
+				{
+                //stroke to be shown
+                if ( iPlugin.IsEnable())
+                    {
+                    iPlugin.AnalyseL();
+                    }
+				RefreshUI( EFalse );
+				UIContainer()->CandidatePane()->SelectFirstPhrase();
+				}
+			else
+				{
+                if ( iPlugin.IsEnable())
+			        {
+			        iPlugin.AnalyseL();
+			        }
+				UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate );
+				iOwner->ChangeState( EMiniQwertyEdit );
+				}
+			}
+		}
+	}
 // End of file
--- a/fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -89,8 +89,22 @@
     uiContainer->CandidatePane()->ShowCandidateOrdinals( ETrue );
     uiContainer->CandidatePane()->SelectFirstPhrase();
     UpdateIndicator();
+    RefreshUI( ETrue );
+    }
 
-    }
+void TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::RefreshUI( TBool aRefresh )
+	{
+    MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    // get cursor position
+    TPoint baseLine;
+    TInt height(0);
+    TInt ascent(0);
+    TRAPD(ret,iOwner->FepMan()->GetScreenCoordinatesL(baseLine,height,ascent));
+    if (ret == KErrNone)
+        {
+        uiContainer->SetContainerPosition(baseLine, height);    
+        }    
+	}
 
 // ---------------------------------------------------------------------------
 // AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyL
@@ -443,6 +457,19 @@
         {
         return ETrue;
         }
+	else if ( iOwner->FepMan()->IsFlagSet( CAknFepManager::EFlagShiftKeyDepressed )
+        || iOwner->FepMan()->IsFlagSet( CAknFepManager::EFlagQwertyChrKeyDepressed )
+        || ((aKey == EStdKeyLeftFunc) && aLength == EShortKeyPress) )
+        {
+        iOwner->FepMan()->TryCloseUiL();
+        return EFalse;
+        }
+    else if ( aKey == EKeyLeftShift || aKey ==EKeyLeftCtrl || aKey
+        == EKeyRightCtrl || aKey ==EKeyRightFunc )
+        {
+        iOwner->FepMan()->TryCloseUiL();
+        return EFalse;
+        } 
     else if ( aKey == EStdKeyDevice1 )
         {
         iOwner->FepMan()->TryCloseUiL();
@@ -519,11 +546,10 @@
         }
     else
         {
-        TInt index = 0;
-        TBool isIndex = MapKeyToIndexSelectCandidate( aKey, index );
+        //TInt index = 0;
+        //TBool isIndex = MapKeyToIndexSelectCandidate( aKey, index );
         if ( aLength == EShortKeyPress && 
-            ( ( isIndex && UIContainer()->CandidatePane()->SelectIndex( index ) ) ||
-                aKey == EStdKeyDevice0 || 
+            (   aKey == EStdKeyDevice0 || 
                 aKey == EStdKeyDevice3 ) )
             {
             editPane->SetNeedClearDeliberateSelection( ETrue );
@@ -575,4 +601,24 @@
         }
     }
 
+void TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::SubmitTextL( const TDesC& aText )
+	{
+	if ( aText.Length( ) )
+	   {
+	   MAknFepManagerUIInterface* fepMan = iOwner->FepMan( );
+	   fepMan->NewTextL( aText );
+	   fepMan->CommitInlineEditL( );
+	   iOwner->PtiEngine()->SetPredictiveChineseChar( aText );
+	   if ( fepMan->IsFlagSet( CAknFepManager::EFlagEditorFull ) )
+	      {
+	      fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
+	      iOwner->FepMan()->TryCloseUiL( );
+	      }
+	   else
+	      {
+	      iOwner->ChangeState( EPredictiveCandidate );
+	      }
+	    }
+	}
+
 // End of file
--- a/fep/aknfep/src/AknFepUiInputStateCandidateQwertyBaseChinesePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateCandidateQwertyBaseChinesePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -55,7 +55,6 @@
 
     else if(!( HandleVerticalNavigation(aKey) || HandleHorizontalNavigation(aKey) ))
         {
-        TInt index = 0;
 #ifdef RD_INTELLIGENT_TEXT_INPUT
         // it may be one of the 'valid' numbers..
         TPtiKeyboardType keyboardtype = iOwner->FepMan()->KeyboardLayout();
@@ -86,7 +85,6 @@
                     
                        &&(aKey == numKeyBind.iKey))
                     	{
-                    	index = numKeyBind.iChar - EPtiKey0 -1;
                     	validnumkey = ETrue;
                     	break;
                     	}
@@ -101,16 +99,10 @@
             	}
                 
             }
-        else
-            {
-#endif
-            index = MapKeyToIndex(aKey);
-#ifdef RD_INTELLIGENT_TEXT_INPUT
-            }             
 #endif
         MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane();
 
-        if(candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey == EStdKeyEnter)
+        if( aKey == EStdKeyDevice3 || aKey == EStdKeyEnter)
             {
             TPtrC text = candidatePane->CurrentPhraseCandidate();
             if(text.Length())
--- a/fep/aknfep/src/AknFepUiInputStateChineseBase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateChineseBase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -53,7 +53,9 @@
 TAknFepInputStateChineseBase::
 TAknFepInputStateChineseBase(MAknFepUIManagerStateInterface* aOwner,
                                 MAknFepUICtrlContainerChinese* aUIContainer)
-    :TAknFepInputStateBase(aOwner)
+    :TAknFepInputStateBase(aOwner),
+     iPlugin( NULL, NULL, ENull ),
+     iStrokePlugin( NULL, NULL, ENull )
     {
     iUIContainer = aUIContainer;
 
@@ -83,6 +85,10 @@
 void TAknFepInputStateChineseBase::operator=(const TAknFepInputStateChineseBase& aState)
     {
     Mem::Copy(this, &aState, sizeof(TAknFepInputStateChineseBase));
+    if( UIContainer())
+    	{
+		UIContainer()->SetFepUiStateCtrl( this );
+    	}
     }
 
 // ---------------------------------------------------------------------------
@@ -119,4 +125,29 @@
 			break;
 		}    	
  	}
+
+// ---------------------------------------------------------------------------
+// TAknFepInputStateChineseBase::SetPlugin
+// Set plugin to state machine
+// ---------------------------------------------------------------------------
+//
+void TAknFepInputStateChineseBase::SetPlugin( 
+            TAknFepInputMiniQwertySogouPinyinPhrasePlugin aPlugin )
+    {
+    iPlugin = aPlugin;
+    iPlugin.Enable( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// TAknFepInputStateChineseBase::SetStrokePlugin
+// Set plugin to state machine
+// ---------------------------------------------------------------------------
+//
+void TAknFepInputStateChineseBase::SetStrokePlugin( 
+            TAknFepInputMiniQwertySogouStrokePhrasePlugin aPlugin )
+    {
+    iStrokePlugin = aPlugin;
+    iStrokePlugin.Enable( ETrue );
+    }
+
 // End of file
--- a/fep/aknfep/src/AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -509,6 +509,7 @@
     MAknFepUICtrlInputPane* inputPane = uiContainer->InputPane();
     MAknFepUICtrlPinyinPopup* popup = uiContainer->PinyinPopupWindow();
     MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
+    MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane();
     CDesCArrayFlat* keystroke = editPane->KeystrokeArray();
     RArray<TInt>* keycodeArray = editPane->KeycodeArray();
     TInt keystrokeLength = keystroke->Count();
@@ -677,6 +678,7 @@
                 {
                 popup->Enable( EFalse );
                 }
+            candidatePane->SelectFirst();
             iOwner->ChangeState( ECandidate );
             }
         else
@@ -1005,5 +1007,43 @@
             break;
         }
     }
+
+void TAknFepInputStateEntryMiniQwertyZhuyinPhrase::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+	MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
+	MAknFepUICtrlPinyinPopup* popup = uiContainer->PinyinPopupWindow();
+	CDesCArrayFlat* keystroke = editPane->KeystrokeArray();
+	CPtiEngine* ptiengine = iOwner->PtiEngine();
+    
+    TInt keystrokeLength = keystroke->Count();
+    if ( !(editPane->GetEffictiveLength() == keystroke->Count()
+        && ptiengine->PhoneticSpellingCount() > popup->CurrentSelection())
+        && (!( keystrokeLength > 0 && keystroke->MdcaPoint( 0 )[0] == KSai )))
+        {
+		editPane->SetChangeState( ETrue );
+        ClearDeliberateSelection();
+        editPane->SetNeedClearDeliberateSelection( ETrue );
+        iOwner->ChangeState( EZhuyinSpelling );
+        return;
+        }
+	if ( aText.Length( ) )
+	   {
+	   MAknFepManagerUIInterface* fepMan = iOwner->FepMan( );
+	   fepMan->NewTextL( aText );
+	   fepMan->CommitInlineEditL( );
+	   iOwner->PtiEngine()->SetPredictiveChineseChar( aText );
+	   if ( fepMan->IsFlagSet( CAknFepManager::EFlagEditorFull ) )
+	      {
+	      fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
+	      iOwner->FepMan()->TryCloseUiL( );
+	      }
+	   else
+	      {
+	      iOwner->ChangeState( EPredictiveCandidate );
+	      }
+	    }
+	}
+
 // End of file   
 
--- a/fep/aknfep/src/AknFepUiInputStateEntryQwertyBaseChinesePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateEntryQwertyBaseChinesePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -56,9 +56,10 @@
     iOwner->PtiEngine()->SetCandidatePageLength(KMaxPhraseCount);
     uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows); 
     uiContainer->ShowVerticalScrollArrows(multiplePages);
+    candidatePane->SelectFirstPhrase();
     uiContainer->FocusCandidatePane(ETrue);
     candidatePane->SetHighlighted(ETrue);
-    candidatePane->SelectFirstPhrase();
+    
     candidatePane->ShowCandidateOrdinals(ETrue);
     uiContainer->SetLayout(MAknFepUICtrlContainerChinese::ELayoutInput);
     UpdateIndicator();
--- a/fep/aknfep/src/AknFepUiInputStateEntryThaiPredictive.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateEntryThaiPredictive.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -111,7 +111,29 @@
             }
         else
             {
-            response = HandleStandardNumericKeysL(aKey, aLength);
+			MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
+			TBool isInlineStateOn = EFalse;
+			TBool isInNoMatchState = EFalse;
+			
+			if ( fepMan )
+				{
+			    // Get the editor Inline state
+				isInlineStateOn = fepMan->IsFlagSet( 
+						CAknFepManager::EFlagInsideInlineEditingTransaction );
+				// Get the editor No Matches state
+				isInNoMatchState = fepMan->IsFlagSet( 
+						CAknFepManager::EFlagNoMatches );
+				}
+			
+			// If editor is in inline state and no candidate words are matched
+			if ( isInlineStateOn && isInNoMatchState )
+				{
+				response = HandleStarKeyL( aLength );
+				}
+			else
+				{
+				response = HandleStandardNumericKeysL( aKey, aLength );
+				}
             }
         break;
     case EKeyDownArrow:
--- a/fep/aknfep/src/AknFepUiInputStateInitialKoreanMultitap.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStateInitialKoreanMultitap.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -89,14 +89,28 @@
             	}
             else
             	{
+                     
             	if (!(fepMan->IsFlagSet(CAknFepManager::EFlagInsideInlineEditingTransaction)))
                 	{ // 'new' inline edit
              	  	ptiengine->ClearCurrentWord();
                 	fepMan->StartInlineEditL();
                 	fepMan->SetInlineEditingCursorVisibilityL(ETrue);
                 	}
-                      	   	             
+                 
             	TPtrC aText = ptiengine->AppendKeyPress((TPtiKey)aKey);
+            	
+                // Get Fep manager pointer
+            	CAknFepManager* fepManager = static_cast<CAknFepManager*>(fepMan);
+            
+               // When reaching the max length of the editor in the Hangul mode, 
+               // the current texts will be committed.     
+            	if( fepManager->IsTextExceedLeghthEditor(aText.Length()))
+            		{
+					fepMan->CommitInlineEditL();
+					ptiengine->ClearCurrentWord();
+					return ETrue;
+            		}
+            	
             	fepMan->UpdateInlineEditL(aText, aText.Length());	
    						
             	// Force commit	when buffer length is 511. Needs to be commited in order to 
--- a/fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -151,7 +151,27 @@
                 fepMan->NewTextL(text);
                 fepMan->CommitInlineEditL();
                 iOwner->PtiEngine()->SetPredictiveChineseChar(text);
-                if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
+                
+                // For sogou core, the predictive is not endless, so when there
+                // is no predictive candidates, we should call TryCloseUiL().
+                TBool noCandidates = EFalse;
+                
+                if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
+                    {
+                    // Get the predictive candidates.
+                    CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
+                    CleanupStack::PushL ( phraseCandidates );
+                    phraseCandidates->Reset();
+                    iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+                    if ( phraseCandidates->Count() == 0 )
+                        {
+                        noCandidates = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( phraseCandidates );
+                    }
+                
+                // If no candidates, call TryCloseUiL().
+                if ( fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
                     {
                     fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
                     iOwner->FepMan()->TryCloseUiL();
@@ -165,13 +185,11 @@
         }
     else if(aKey == EStdKeyRightArrow )
         {
-    	iOwner->ChangeState(EPredictiveInput);  
     	UIContainer()->CandidatePane()->SelectNext(); 
         }
     else if (aKey == EStdKeyLeftArrow)  
     	{
-    	iOwner->ChangeState(EPredictiveInput);  
-        UIContainer()->CandidatePane()->SelectLastPhrase();
+        UIContainer()->CandidatePane()->SelectPrev();
     	}    
     else if(iOwner->IsValidChineseInputKeyQwerty(aKey))
         {
@@ -281,4 +299,47 @@
             break;
         }
     }
+void TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase::SubmitTextL( const TDesC& aText )
+	{
+	if( aText.Length())
+	    {            
+	    MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
+	    CPtiEngine* engine = iOwner->PtiEngine();
+	    fepMan->NewTextL(aText);
+	    fepMan->CommitInlineEditL();
+	    engine->SetPredictiveChineseChar(aText);
+	                    
+        // For sogou core, the predictive is not endless, so when there
+        // is no predictive candidates, we should call TryCloseUiL().
+        TBool noCandidates = EFalse;
+        
+        if ( iPlugin.IsEnable() || iStrokePlugin.IsEnable())
+            {
+            // Get the predictive candidates.
+            CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat(1);
+            CleanupStack::PushL ( phraseCandidates );
+            phraseCandidates->Reset();
+            iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+            if ( phraseCandidates->Count() == 0 )
+                {
+                noCandidates = ETrue;
+                }
+            CleanupStack::PopAndDestroy( phraseCandidates );
+            }
+	    
+	    if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) || noCandidates )
+	       {
+	        fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
+	        fepMan->TryCloseUiL();
+	        }
+	    else
+	        {
+	    if( iOwner )
+	    	{
+	        iOwner->ChangeState(EPredictiveCandidate);
+	    	}
+	        }           
+	    }
+	}
+
 // End of file
--- a/fep/aknfep/src/AknFepUiInputStatePredictiveInputQwertyChinesePhrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiInputStatePredictiveInputQwertyChinesePhrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -49,15 +49,16 @@
     TPoint baseLine = TPoint(0,0);
     TInt height = 0;
     TInt ascent = 0;
+
+    uiContainer->FocusCandidatePane(ETrue);
+    uiContainer->SetLayout(MAknFepUICtrlContainerChinese::ELayoutCandidate);
+    
     TRAPD(ret,iOwner->FepMan()->GetScreenCoordinatesL(baseLine,height,ascent));
     if (ret == KErrNone)
         {
         uiContainer->SetContainerPosition(baseLine, height);    
         }
 
-    uiContainer->FocusCandidatePane(ETrue);
-    uiContainer->SetLayout(MAknFepUICtrlContainerChinese::ELayoutCandidate);
-
     CPtiEngine* ptiengine = iOwner->PtiEngine();
     MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane();
     
--- a/fep/aknfep/src/AknFepUiManagerChinese.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/AknFepUiManagerChinese.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -123,6 +123,9 @@
 #include <avkon.rsg>        //phrase creation
 #include <aknfep.rsg>
 
+#include "aknfepuiinputminiqwertysogoupinyinphraseplugin.h"
+#include "aknfepuiinputminiqwertysogoustrokephraseplugin.h"
+
 // CONSTANTS
 const TInt16 KStrokeHorizontalValue = 0x4e00; 
 const TInt16 KStrokeVerticalValue = 0x4e28;
@@ -140,6 +143,9 @@
 const TInt16 KChineseTone3 = 0x02c7; 
 const TInt16 KChineseTone4 = 0x02cb;
 const TInt16 KChineseTone0 = 0x02d9;
+
+const TUid KPtiSogouCoreUid = { 0x20031DD6 };
+
 /**
 *  CAknFepUIManagerChinese class.
 * 
@@ -1168,6 +1174,11 @@
 #ifdef RD_INTELLIGENT_TEXT_INPUT        
     TPtiKeyboardType kbdType = iFepMan->KeyboardLayout();    
 #endif    
+    
+    // Get current core id. It is used to judge whether sogou core is in use.
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+
     switch(aState)
         {
         case EQwerty:
@@ -1300,6 +1311,14 @@
                             {
                             iFepUiState = TAknFepInputStateEntryMiniQwertyStrokePhrase(
                                                                   this, iContainerPane);
+                            // If sogou core is in use, set plugin to the state
+                            // machine and enable the plugin.
+                            if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                                {
+                                TAknFepInputMiniQwertySogouStrokePhrasePlugin plugin( this, iContainerPane, EEntry );
+                                plugin.Enable( ETrue );
+                                iFepUiState.SetStrokePlugin( plugin );
+                                }
                         	}
                         else if (EPtiKeyboardHalfQwerty == kbdType)
                             {
@@ -1402,7 +1421,15 @@
                              EPtiKeyboardCustomQwerty == kbdType)                    	
                         	{
                             iFepUiState = TAknFepUiInputStateCandidateMiniQwertyStrokePhrase(this, iContainerPane);
-                            }
+                            // If sogou core is in use, set plugin to the state
+                            // machine and enable the plugin.
+                            if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                                {
+                                TAknFepInputMiniQwertySogouStrokePhrasePlugin plugin( this, iContainerPane, ECandidate );
+                                plugin.Enable( ETrue );
+                                iFepUiState.SetStrokePlugin( plugin );
+                                }                        
+                        	}
                         else if ( EPtiKeyboardHalfQwerty == kbdType )
                             {
                             iFepUiState=TAknFepUiInputStateCandidateHalfQwertyChinesePhrase( this, iContainerPane);
@@ -1469,6 +1496,15 @@
                         {
                         iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
                                                                              this, iContainerPane);
+
+                        // If sogou core is in use, set plugin to the state
+                        // machine and enable the plugin.                        
+                        if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                            {
+                            TAknFepInputMiniQwertySogouPinyinPhrasePlugin plugin( this, iContainerPane, EPredictiveCandidate );
+                            plugin.Enable( ETrue );
+                            iFepUiState.SetPlugin( plugin );
+                            }                       
                         }
 #ifdef __HALF_QWERTY_KEYPAD
                     else if( EPtiKeyboardHalfQwerty == kbdType )
@@ -1490,6 +1526,14 @@
                             iFepUiState = 
                                    TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
                                                                           this, iContainerPane);
+                            // If sogou core is in use, set plugin to the state
+                            // machine and enable the plugin.
+                            if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                                {
+                                TAknFepInputMiniQwertySogouStrokePhrasePlugin plugin( this, iContainerPane, EPredictiveCandidate );
+                                plugin.Enable( ETrue );
+                                iFepUiState.SetStrokePlugin( plugin );
+                                }                   	
                         	}
 #ifdef __HALF_QWERTY_KEYPAD
                     else if( EPtiKeyboardHalfQwerty == kbdType )
@@ -1530,6 +1574,15 @@
                              EPtiKeyboardCustomQwerty == kbdType)                    	
                             {
                             iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase/*TAknFepInputStatePredictiveInputQwertyPinyinPhrase*/(this, iContainerPane);
+                            
+                            // If sogou core is in use, set plugin to the state
+                            // machine and enable the plugin.                            
+                            if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                                {
+                                TAknFepInputMiniQwertySogouPinyinPhrasePlugin plugin( this, iContainerPane, EPredictiveInput );
+                                plugin.Enable( ETrue );
+                                iFepUiState.SetPlugin( plugin );
+                                }                         
                             }
                         else
                             {
@@ -1557,7 +1610,15 @@
                       	   {
                            iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase(
                                                                              this, iContainerPane);
-                       	   }
+                           // If sogou core is in use, set plugin to the state
+                           // machine and enable the plugin.
+                           if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                               {
+                               TAknFepInputMiniQwertySogouStrokePhrasePlugin plugin( this, iContainerPane, EPredictiveInput );
+                               plugin.Enable( ETrue );
+                               iFepUiState.SetStrokePlugin( plugin );
+                               }                      	   
+                      	   }
                         else
          	               {
 #endif
@@ -1672,6 +1733,15 @@
                                 TAknFepInputStateEditingMiniQwertyStrokePhrase(
                                                               this, 
                                                               iContainerPane);
+
+                            // If sogou core is in use, set plugin to the state
+                            // machine and enable the plugin.
+                            if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                                {
+                                TAknFepInputMiniQwertySogouStrokePhrasePlugin plugin( this, iContainerPane, EMiniQwertyEdit );
+                                plugin.Enable( ETrue );
+                                iFepUiState.SetStrokePlugin( plugin );
+                                }                             
                             }
 #endif
                         }
--- a/fep/aknfep/src/aknfepuiinputminiqwertypinyinphrasebase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/aknfepuiinputminiqwertypinyinphrasebase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -121,6 +121,8 @@
     {0x02D9, 5}
     };
 
+const TUid KPtiSogouCoreUid = { 0x20031DD6 };
+
 // ---------------------------------------------------------------------------
 // TAknFepInputStateStrokePhraseCreationBase::TAknFepInputStateStrokePhraseCreationBase
 // C++ default constructor
@@ -139,6 +141,18 @@
     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
     TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage());
     uiContainer->ShowVerticalScrollArrows(multiplePages);
+    
+    // If sogou core is in use, set plugin to the state
+    // machine and enable the plugin.
+    // Get current core id. It is used to judge whether sogou core is in use.
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        TAknFepInputMiniQwertySogouPinyinPhrasePlugin plugin( aOwner, aUIContainer, iState );
+        plugin.Enable( ETrue );
+        SetPlugin( plugin );
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -386,11 +400,42 @@
                 }
             }
         GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) );
-        stringBeforeLength = getCurrentLeastDLTSpell().Length();
+        
+        // dltBeforeCount is the dlt count before append the key.
+        // dltAfterCount is the dlt count after append the key.
+        // In sogou core, after appending a new key, the spell length
+        // may be the same, but the dlt count will change.
+        // In this situation, the appended key is valid.
+        TInt dltBeforeCount = 0;
+        TInt dltAfterCount = 0;
+        TPtrC stringBefore = getCurrentLeastDLTSpell();
+        stringBeforeLength = stringBefore.Length();
+        for ( TInt k = 0; k < stringBefore.Length(); k++ )
+            {
+            if ( CheckSpellingDLT( stringBefore.Mid( k )))
+                {
+                dltBeforeCount++;
+                }
+            }
+        
+        // Append the key.
         ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
-        stringAfterLength = getCurrentLeastDLTSpell().Length();
-        //the keystroke is invalid.
-        if (stringBeforeLength == stringAfterLength)
+        
+        // Get the dlt count after appending the key.
+        TPtrC stringAfter = getCurrentLeastDLTSpell();
+        stringAfterLength = stringAfter.Length();
+        for ( TInt l = 0; l < stringAfter.Length(); l++ )
+            {
+            if ( CheckSpellingDLT( stringAfter.Mid( l )))
+                {
+                dltAfterCount++;
+                }
+            }
+
+        // If the spell length is the same and the dlt count is 
+        // the same, the keystroke is invalid
+        if (( stringBeforeLength == stringAfterLength ) &&
+            ( dltAfterCount == dltBeforeCount ))
             {
             return EFalse;
             }
@@ -415,7 +460,23 @@
     TInt count = 0;
     TBuf<1> autoDLT;
     autoDLT.Append(KAutoDLT);
-
+    
+    // If this method is called in construction of the state machine,
+    // the plugin is not set. If sogou core is in use now, the phraseCount
+    // should be the same as the phrase characters count.
+    // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        CDesCArrayFlat* phraseArray = editPane->PhraseArray();
+        phraseCount = 0;
+        for ( TInt i = 0; i < phraseArray->Count(); i++ )
+            {
+            phraseCount += (*phraseArray)[i].Length();
+            }
+        }
+    
     if ( 0 == index)
         {
         pos = phraseCount;
@@ -517,6 +578,26 @@
     manualDLT.Append( KManualDLT );
     autoDLT.Append( KAutoDLT );
     
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        CDesCArrayFlat* phrase = editPane->PhraseArray();
+        phraseCount = 0;
+        for ( TInt j = 0;  j < phrase->Count(); j++ )
+            {
+            phraseCount += phrase->MdcaPoint(j).Length();;
+            }
+        }
+    
+    if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount )
+        {
+        iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone);
+        return;
+        }
+    
     TBool firstGroup = CheckFirstGroupStroke();
 
     keystrokeArray->InsertL(index, manualDLT);
@@ -873,6 +954,12 @@
 //
 void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseL()
     {
+    // If sogou core is actived, use the plugin.
+    if ( iPlugin.IsEnable())
+        {
+        iPlugin.AnalyseL();
+        return;
+        }
     CPtiEngine* ptiengine = iOwner->PtiEngine();
     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
     MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
@@ -978,7 +1065,7 @@
         if ( ( showKeyCount > 0 ) && (cdtCount > 0 ) )
             {
             UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
-            iOwner->ChangeState(ECandidate);
+            iOwner->ChangeState(EEntry);
             return;
             }
 
@@ -1049,17 +1136,15 @@
                 {
                 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromCandidate);
                 }
+            //stroke to be shown
+            if ( iPlugin.IsEnable())
+                {
+                iPlugin.AnalyseL();
+                }
             iOwner->ChangeState(EMiniQwertyEdit);
             return;
             }
-        else
-            {
-            if ( iState == EEntry )
-                {
-                UIContainer()->EditPaneWindow()->SetChangeState( ETrue );
-                iOwner->ChangeState( ECandidate );
-                }
-            }
+
         AnalyseL();
         RefreshUI();
         }
@@ -1220,9 +1305,31 @@
     CDesCArrayFlat* phrase = editPane->PhraseArray();
     TBuf<KMaxKeystrokeCount> showInfo;
     TBuf<KMaxKeystrokeCount> keyBuf;
+    
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    TInt phraseCount = 0;
+    
     for (TInt i = 0; i < phrase->Count(); ++i)
         {
-        showInfo.Append(phrase->MdcaPoint(i) );
+        // If this method is called in construction of the state machine,
+        // the plugin is not set. If sogou core is in use now, we should append 
+        // each characters to showInfo.
+        // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
+        if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+            {
+            for ( TInt k = 0; k < phrase->MdcaPoint(i).Length(); k++ )
+                {
+                showInfo.Append( phrase->MdcaPoint(i)[k] );
+                }
+            phraseCount += phrase->MdcaPoint(i).Length();
+            }
+        else
+            {
+            // If cpicore is in use, just append the element of phrase
+            showInfo.Append(phrase->MdcaPoint(i) );
+            }
         }
 
     for (TInt ii = 0; ii < showKeystroke->Count(); ++ii)
@@ -1234,9 +1341,22 @@
         {
         keyBuf.Append(keystrokeArray->MdcaPoint(j) );
         }
-
-    editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phrase->Count(),
+    
+    // If this method is called in construction of the state machine,
+    // the plugin is not set. If sogou core is in use now, the phraseCount
+    // should be the same as the phrase characters count.
+    // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phraseCount,
+                        keyBuf, editPane->GetCursorIndexOfKeystroke() );
+        }
+    else
+        {
+        // If cpicore is in use, phraseCount is the same as phrase->Count()
+        editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phrase->Count(),
         keyBuf, editPane->GetCursorIndexOfKeystroke() );
+        }
 
     if (iState == ECandidate)
         {
@@ -1536,6 +1656,11 @@
 void TAknFepInputMiniQwertyPinyinPhraseBase::AddPhraseToDB(
     const TDesC& aPhraseAdd)
     {
+    if ( iPlugin.IsEnable())
+        {
+        iPlugin.AddPhrasePinyinToPti();
+        return;
+        }
     TPtiUserDictionaryEntry addUdbEntry(aPhraseAdd);
     //Add the phrase to the DB by PTI Engine
     iOwner->PtiEngine()->AddUserDictionaryEntry(addUdbEntry);
@@ -1588,6 +1713,12 @@
 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CommitInlineEEPL(
     const TDesC& aDes)
     {
+    // If sogou core is actived, use the plugin.
+    if ( iPlugin.IsEnable())
+        {
+        return iPlugin.CommitInlineEEPL( aDes );
+        }
+
     TInt charCount = aDes.Length();
     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
     MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow();
@@ -1695,6 +1826,20 @@
     TInt index = editPane->GetCursorIndexOfKeystroke();
     TBuf<1> keystroke;
     
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        CDesCArrayFlat* phrase = editPane->PhraseArray();
+        phraseCount = 0;
+        for ( TInt j = 0;  j < phrase->Count(); j++ )
+            {
+            phraseCount += phrase->MdcaPoint(j).Length();;
+            }
+        }
+    
     if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount )
         {
         return EFalse;
@@ -1707,6 +1852,7 @@
         {
         return EFalse;
         }
+    
     if ( index >= keystrokeArray->Count() )
         {
         keystrokeArray->AppendL(keystroke);
@@ -1839,6 +1985,12 @@
 //
 void TAknFepInputMiniQwertyPinyinPhraseBase::GetCandidateL()
     {
+    if ( iPlugin.IsEnable())
+        {
+        iPlugin.GetCandidateL();
+        return;
+        }
+    
     CPtiEngine* ptiengine = iOwner->PtiEngine();
     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
     MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
@@ -1860,7 +2012,7 @@
         return;
         }
 
-    if ( CheckAllGroupStroke() && ( phraseCount == 0 ) )
+    if (( phraseCount == 0 ) && CheckAllGroupStroke())
         {
         getCurrentLeastDLTSpell();
         ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); 
@@ -1975,7 +2127,13 @@
     keystrokeArray->Compress();
     phrase->Compress();
     phraseStroke->Compress();
-
+    
+    TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID );
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        // Notify sogoucore that last phrase is cancelled
+        iOwner->PtiEngine()->HandleCommandL( EPtiCommandCancelSelectElement );
+        }
     }
 
 // ---------------------------------------------------------
@@ -2001,6 +2159,11 @@
         {
         editPane->SetHighlight(aPhraseCount + aIndex, aPhraseCount
                 + aIndex + aCount - 1 );
+        if ( iPlugin.IsEnable())
+            {
+            iPlugin.CanConvertAll( EFalse );
+            iPlugin.ConvertCount( aIndex );
+            }
         }
     else
         {
@@ -2025,6 +2188,11 @@
             {
             editPane->SetHighlight( aPhraseCount + aIndex, aPhraseCount
                     + aIndex + aCount - 1);
+            if ( iPlugin.IsEnable())
+                {
+                iPlugin.CanConvertAll( EFalse );
+                iPlugin.ConvertCount( aIndex );
+                }
             }
         }
     ClearPtiEngineKeystroke();
@@ -2049,26 +2217,68 @@
     TInt start = 0;
     TInt keyCode = 0;
     TInt toneMark = KInvalidToneMark;
+    
+    if ( iPlugin.IsEnable())
+        {
+        iPlugin.CanConvertAll( ETrue );
+        }
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        CDesCArrayFlat* phrase = editPane->PhraseArray();
+        phraseCount = 0;
+        for ( TInt j = 0;  j < phrase->Count(); j++ )
+            {
+            phraseCount += phrase->MdcaPoint(j).Length();;
+            }
+        }
 
     if (showKeystroke->Count() == 0)
         {
         return;
         }
 
-    if (CheckAllGroupStroke() )
+    if ( TUid::Uid( coreID ) != KPtiSogouCoreUid )
         {
-        return;
+        if ( CheckAllGroupStroke())
+            {
+            return;
+            }
         }
+
     ClearPtiEngineKeystroke();
     if (CheckSpellingDLT(showKeystroke->MdcaPoint( 0) ) || (KInvalidToneMark
             != ToneMark(showKeystroke->MdcaPoint( 0) ) ))
         {
         start = 1;
         editPane->SetHighlight(phraseCount, phraseCount);
+
+        if ( iPlugin.IsEnable())
+            {
+            iPlugin.CanConvertAll( EFalse );
+            iPlugin.ConvertCount( index );
+            }
+        
         index = 1;
         }
+    
+    TInt end = showKeystroke->Count();
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        for ( TInt j = showKeystroke->Count() - 1; j >= 0; j-- )
+            {
+            if ( KAutoDLT == showKeystroke->MdcaPoint(j)[0] )
+                {
+                end = j + 1;
+                break;
+                }
+            }
+        }
 
-    for ( TInt i = start; i < showKeystroke->Count(); ++i )
+    for ( TInt i = start; i < end; ++i )
         {
         count = count + 1;
         // tone mark
@@ -2096,6 +2306,11 @@
                     {
                     editPane->SetHighlight(phraseCount + index, phraseCount
                             + index + count - 1);
+                    if ( iPlugin.IsEnable())
+                        {
+                        iPlugin.CanConvertAll( EFalse );
+                        iPlugin.ConvertCount( index );
+                        }
                     }
                 ClearPtiEngineKeystroke();
                 index = i + 1;
@@ -2107,10 +2322,42 @@
                 if ( valid )
                     {
                     GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) );
-                    stringBeforeLength = getCurrentLeastDLTSpell().Length();
-                    ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
-                    stringAfterLength = getCurrentLeastDLTSpell().Length();
-                    if ( stringBeforeLength == stringAfterLength )//the keystroke is invalid
+                    
+                    // dltBeforeCount is the dlt count before append the key.
+                    // dltAfterCount is the dlt count after append the key.
+                    // In sogou core, after appending a new key, the spell length
+                    // may be the same, but the dlt count will change.
+                    // In this situation, the appended key is valid.
+                    TInt dltBeforeCount = 0;
+                    TInt dltAfterCount = 0;
+                    TPtrC stringBefore = getCurrentLeastDLTSpell();
+                    stringBeforeLength = stringBefore.Length();
+                    for ( TInt j = 0; j < stringBefore.Length(); j++ )
+                        {
+                        if ( CheckSpellingDLT( stringBefore.Mid( j )))
+                            {
+                            dltBeforeCount++;
+                            }
+                        }
+                    
+                    // Append the key.
+                    ptiengine->AppendKeyPress(( TPtiKey )keyCode ).Length();
+                    
+                    // Get the dlt count after appending the key.
+                    TPtrC stringAfter = getCurrentLeastDLTSpell();
+                    stringAfterLength = stringAfter.Length();
+                    for ( TInt k = 0; k < stringAfter.Length(); k++ )
+                        {
+                        if ( CheckSpellingDLT( stringAfter.Mid( k )))
+                            {
+                            dltAfterCount++;
+                            }
+                        }
+                    
+                    // If the spell length is the same and the dlt count is 
+                    // the same, the keystroke is invalid
+                    if (( stringBeforeLength == stringAfterLength ) && 
+                        ( dltAfterCount == dltBeforeCount ))
                         {
                         ClearPtiEngineKeystroke();
                         valid = EFalse;
@@ -2123,6 +2370,13 @@
             editPane->SetHighlight(
                                 phraseCount + index, 
                                 phraseCount + index + count - 1 );
+
+            if ( iPlugin.IsEnable())
+                {
+                iPlugin.CanConvertAll( EFalse );
+                iPlugin.ConvertCount( index );
+                }
+
             ClearPtiEngineKeystroke();
             }
         }
@@ -2178,8 +2432,28 @@
     CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray();
     TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count();
     TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke();
-    TInt cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
-
+    
+    TInt cursorPos = 0;
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    TInt phraseCount = 0;
+    
+    // For Sogou core, maybe on element of PhraseArray() contains two or 
+    // more characters.
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        for ( TInt l = 0; l < editPane->PhraseArray()->Count(); l++ )
+            {
+            phraseCount += editPane->PhraseArray()->MdcaPoint( l ).Length();
+            }
+        cursorPos = editPane->GetCursor() - phraseCount;
+        }
+    else
+        {
+        cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
+        }
+    
     TBuf<1> autoDLT;
     autoDLT.Append(KAutoDLT);
     const TInt offset = 2;
@@ -2233,7 +2507,28 @@
     CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray();
     TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count();
     TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke();
-    TInt cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
+     
+    TInt cursorPos = 0;
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    TInt phraseCount = 0;
+    
+    // For Sogou core, maybe on element of PhraseArray() contains two or 
+    // more characters.
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        for ( TInt l = 0; l < editPane->PhraseArray()->Count(); l++ )
+            {
+            phraseCount += editPane->PhraseArray()->MdcaPoint( l ).Length();
+            }
+        cursorPos = editPane->GetCursor() - phraseCount;
+        }
+    else
+        {
+        cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count();
+        }
+    
     TBuf<1> autoDLT;
     autoDLT.Append(KAutoDLT);
     const TInt offset = 2;
@@ -2484,7 +2779,6 @@
 void TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyFromCandidateL(
     TInt aKey, TKeyPressLength /*aLength*/)
     {
-    TInt index = 0;
 #ifdef RD_INTELLIGENT_TEXT_INPUT
     // it may be one of the 'valid' numbers..
     TPtiKeyboardType keyboardtype = iOwner->FepMan()->KeyboardLayout();
@@ -2512,7 +2806,6 @@
                 if ( (numKeyBind.iChar >= 0x31 && numKeyBind.iChar <= 0x36)
                         &&(aKey == numKeyBind.iKey))
                     {
-                    index = numKeyBind.iChar - EPtiKey0 -1;
                     validnumkey = ETrue;
                     break;
                     }
@@ -2526,16 +2819,10 @@
             return;
             }
         }
-    else
-        {
-#endif
-        index = MapKeyToIndex(aKey);
-#ifdef RD_INTELLIGENT_TEXT_INPUT
-        }
 #endif
     MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane();
 
-    if (candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey
+    if ( aKey == EStdKeyDevice3 || aKey
             == EStdKeyEnter)
         {
         TPtrC text = candidatePane->CurrentPhraseCandidate();
@@ -2632,10 +2919,42 @@
                 return EFalse;
                 }
             GetKeystrokeCode(keyCode, keystroke->MdcaPoint(i) );
-            stringBeforeLength = getCurrentLeastDLTSpell().Length();
-            ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
-            stringAfterLength = getCurrentLeastDLTSpell().Length();
-            if ( stringBeforeLength == stringAfterLength )
+            
+            // dltBeforeCount is the dlt count before append the key.
+            // dltAfterCount is the dlt count after append the key.
+            // In sogou core, after appending a new key, the spell length
+            // may be the same, but the dlt count will change.
+            // In this situation, the appended key is valid.
+            TInt dltBeforeCount = 0;
+            TInt dltAfterCount = 0;
+            TPtrC stringBefore = getCurrentLeastDLTSpell();
+            stringBeforeLength = stringBefore.Length();
+            for ( TInt k = 0; k < stringBefore.Length(); k++ )
+                {
+                if ( CheckSpellingDLT( stringBefore.Mid( k )))
+                    {
+                    dltBeforeCount++;
+                    }
+                }
+
+            // Append the key.
+            ptiengine->AppendKeyPress(( TPtiKey )keyCode );
+            
+            // Get the dlt count after appending the key.
+            TPtrC stringAfter = getCurrentLeastDLTSpell();
+            stringAfterLength = stringAfter.Length();
+            for ( TInt l = 0; l < stringAfter.Length(); l++ )
+                {
+                if ( CheckSpellingDLT( stringAfter.Mid( l )))
+                    {
+                    dltAfterCount++;
+                    }
+                }
+            
+            // If the spell length is the same and the dlt count is 
+            // the same, the keystroke is invalid
+            if (( stringBeforeLength == stringAfterLength ) && 
+                ( dltAfterCount == dltBeforeCount ))
                 {
                 return EFalse;
                 }
@@ -2690,8 +3009,27 @@
             }
         else
             {
+            // For sogou core, the predictive is not endless, so when there
+            // is no predictive candidates, we should call TryCloseUiL().
+            TBool noCandidates = EFalse;
+            
+            TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID );
+            if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+                {
+                // Get the predictive candidates.
+                CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat( 1 );
+                CleanupStack::PushL ( phraseCandidates );
+                phraseCandidates->Reset();
+                iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+                if ( phraseCandidates->Count() == 0 )
+                    {
+                    noCandidates = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( phraseCandidates );
+                }
+        
             UIContainer()->EditPaneWindow()->ResetAllArray();
-            if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() )
+            if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() && !noCandidates )
                 {
                 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse);
                 UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fep/aknfep/src/aknfepuiinputminiqwertysogoupinyinphraseplugin.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,761 @@
+/*
+* Copyright (c) 2008 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:           
+ *      Provides the TAknFepInputMiniQwertySogouPinyinPhrasePlugin definition.
+ *
+*/
+
+// System includes
+#include <e32cmn.h>
+#include <PtiEngine.h>
+#include <PtiDefs.h>
+#include <avkon.rsg>
+#include <aknfep.rsg>
+#include <PtiUserDicEntry.h>
+#include <aknnotewrappers.h> //CAknWarningNote 
+// User includes
+#include "AknFepUIManagerStateInterface.h"
+#include "AknFepUICtrlInputPane.h"
+#include "AknFepUICtrlPinyinPopup.h"        //Pinyin phrase
+#include "aknfepuictrleditpane.h"           //pinyin phrase creation
+#include "AknFepUICtrlCandidatePane.h"
+#include "AknFepManager.h"
+
+#include "aknfepuiinputminiqwertysogoupinyinphraseplugin.h"
+#include "AknFepUiInputStateCandidateQwertyBaseChinesePhrase.h"
+
+// Constant definition
+const TInt KMaxPhraseCreationCount = 10;
+const TInt KMaxKeystrokeCount = 31;
+const TInt KMaxShowKeystrokeCount = 255;
+const TInt KInvalidToneMark = -1;
+const TUint16 KAutoDLT = 0x002E;
+const TUint16 KManualDLT = 0x0027;
+const TUint16 KPYa = 0x0061;
+const TUint16 KPYb = 0x0062;
+const TUint16 KPYc = 0x0063;
+const TUint16 KPYd = 0x0064;
+const TUint16 KPYe = 0x0065;
+const TUint16 KPYf = 0x0066;
+const TUint16 KPYg = 0x0067;
+const TUint16 KPYh = 0x0068;
+const TUint16 KPYi = 0x0069;
+const TUint16 KPYj = 0x006A;
+const TUint16 KPYk = 0x006B;
+const TUint16 KPYl = 0x006C;
+const TUint16 KPYm = 0x006D;
+const TUint16 KPYn = 0x006E;
+const TUint16 KPYo = 0x006F;
+const TUint16 KPYp = 0x0070;
+const TUint16 KPYq = 0x0071;
+const TUint16 KPYr = 0x0072;
+const TUint16 KPYs = 0x0073;
+const TUint16 KPYt = 0x0074;
+const TUint16 KPYu = 0x0075;
+const TUint16 KPYv = 0x0076;
+const TUint16 KPYw = 0x0077;
+const TUint16 KPYx = 0x0078;
+const TUint16 KPYy = 0x0079;
+const TUint16 KPYz = 0x007A;
+
+const TMiniQwertyKeyMap StrokeMap[] =
+    {
+    {KPYa, EPtiKeyQwertyA},
+    {KPYb, EPtiKeyQwertyB},
+    {KPYc, EPtiKeyQwertyC},
+    {KPYd, EPtiKeyQwertyD},
+    {KPYe, EPtiKeyQwertyE},
+    {KPYf, EPtiKeyQwertyF},
+    {KPYg, EPtiKeyQwertyG},
+    {KPYh, EPtiKeyQwertyH},
+    {KPYi, EPtiKeyQwertyI},
+    {KPYj, EPtiKeyQwertyJ},
+    {KPYk, EPtiKeyQwertyK},
+    {KPYl, EPtiKeyQwertyL},
+    {KPYm, EPtiKeyQwertyM},
+    {KPYn, EPtiKeyQwertyN},
+    {KPYo, EPtiKeyQwertyO},
+    {KPYp, EPtiKeyQwertyP},
+    {KPYq, EPtiKeyQwertyQ},
+    {KPYr, EPtiKeyQwertyR},
+    {KPYs, EPtiKeyQwertyS},
+    {KPYt, EPtiKeyQwertyT},
+    {KPYu, EPtiKeyQwertyU},
+    {KPYv, EPtiKeyQwertyV},
+    {KPYw, EPtiKeyQwertyW},
+    {KPYx, EPtiKeyQwertyX},
+    {KPYy, EPtiKeyQwertyY},
+    {KPYz, EPtiKeyQwertyZ},
+    {KManualDLT, EPtiKeyQwertySpace}
+    };
+
+const TMiniQwertyToneMap PinyinToneMap[] =
+    {
+    {0x02C9, 1},
+    {0x02CA, 2},
+    {0x02C7, 3},
+    {0x02CB, 4},
+    {0x02D9, 5}
+    };
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::TAknFepInputMiniQwertySogouPinyinPhrasePlugin
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+TAknFepInputMiniQwertySogouPinyinPhrasePlugin::TAknFepInputMiniQwertySogouPinyinPhrasePlugin(
+    MAknFepUIManagerStateInterface* aOwner,
+    MAknFepUICtrlContainerChinese* aUIContainer,
+    TUIState aState )
+    : iOwner( aOwner ),
+      iUIContainer( aUIContainer ),
+      iState( aState ),
+      iValid( EFalse ),
+      iNeedAddDLT( EFalse ),
+      iCanConvertAll( ETrue ),
+      iConvertCount( -1 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::operator=
+// 
+// ---------------------------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::operator=( const 
+        TAknFepInputMiniQwertySogouPinyinPhrasePlugin& aPlugin )
+    {
+    Mem::Copy( this, &aPlugin, sizeof(TAknFepInputMiniQwertySogouPinyinPhrasePlugin));
+    }
+
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::AnalyseL
+// Analyse key storke.
+// ---------------------------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::AnalyseL()
+    {
+    CPtiEngine* ptiengine = iOwner->PtiEngine();
+    MAknFepUICtrlEditPane* editPane = iUIContainer->EditPaneWindow();
+    
+    //user pressed keystroke sequence
+    CDesCArrayFlat* keystroke = editPane->KeystrokeArray();
+    
+    //stroke to be shown
+    CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray();
+    TInt start = 0;
+    TInt toneMarkCount = KInvalidToneMark;
+//    TInt delimiterPosition = 0;
+    showKeystroke->Reset();
+    TBuf<1> atuoDLT;
+    TBuf<1> manualDLT;
+    atuoDLT.Append( KAutoDLT );
+    manualDLT.Append( KManualDLT );
+    TBuf<KMaxKeystrokeCount> keyTmp;
+
+    if ( keystroke->Count() == 0 )
+        {
+        return;
+        }
+    
+    ClearPtiEngineKeystroke();
+    
+    TInt phraseCount = 0;
+    CDesCArrayFlat* phrase = editPane->PhraseArray();
+    for ( TInt j = 0;  j < phrase->Count(); j++ )
+        {
+        phraseCount += phrase->MdcaPoint(j).Length();;
+        }
+    
+    // Analysis every keystroke
+    TInt firstIsTonemark = EFalse;
+    TBool lastOneIsTonemark = EFalse;
+    for ( TInt i = start; i < keystroke->Count(); ++i )
+        {
+        // Detect which tonemark the keystroke is.
+        toneMarkCount = ToneMark( keystroke->MdcaPoint( i ));
+
+        // current keystroke is tonemark
+        if ( KInvalidToneMark != toneMarkCount )
+            {
+            if ( i == 0 )
+                {
+                firstIsTonemark = ETrue;
+                }
+            // Analysis and add the tonemark
+            TBool checkTonemark = CheckSpellingAddToneMarkToPTIL( toneMarkCount );
+            if ( !checkTonemark || lastOneIsTonemark )
+                {
+                if ( lastOneIsTonemark && checkTonemark )
+                    {
+                    ptiengine->IncrementToneMark( ETrue );
+                    }
+                TPtrC ptr = getCurrentLeastDLTSpell();
+                TBuf<1> tonemark;
+                if ( ptr.Length() > 0 )
+                    {
+                    tonemark.Append( ptr[ ptr.Length() - 1 ] );
+                    if ( lastOneIsTonemark )
+                        {
+                        keystroke->Delete( i - 1, 2 );
+                        keystroke->InsertL( i - 1, tonemark );
+                        i = i - 1;
+                        }
+                    else
+                        {
+                        keystroke->Delete( i );
+                        keystroke->InsertL( i, tonemark );
+                        }
+                    }
+                else if ( lastOneIsTonemark )
+                    {
+                    toneMarkCount = ToneMark( keystroke->MdcaPoint( i )) + 
+                            ToneMark( keystroke->MdcaPoint( i - 1 ));
+                    toneMarkCount = toneMarkCount % 
+                            ( sizeof(PinyinToneMap ) / ( sizeof(PinyinToneMap[0])));
+                    if ( toneMarkCount == 0 )
+                        {
+                        toneMarkCount = 5;
+                        }
+                    tonemark.Append( PinyinToneMap[toneMarkCount - 1].iValue );
+                    keystroke->Delete( i - 1, 2 );
+                    keystroke->InsertL( i - 1, tonemark );
+                    i = i - 1;
+                    }
+                    
+                }
+            lastOneIsTonemark = ETrue;
+            ptiengine->HandleCommandL( EPtiCommandResetToneMark );
+            }
+        else
+            {
+            if ( lastOneIsTonemark )
+                {
+                lastOneIsTonemark = EFalse;
+                }
+            TInt keyCode = 0;
+            GetKeystrokeCode( keyCode, keystroke->MdcaPoint( i ));
+            ptiengine->AppendKeyPress(( TPtiKey )keyCode );
+            }
+        
+        // If the last keystroke is appended, get the spell from core and
+        // add it to show keystroke.
+        if ( i == keystroke->Count() - 1 )
+            {
+            TPtrC spell = getCurrentLeastDLTSpell();
+            TInt dltCount = 0;
+            for ( TInt j = 0; j < spell.Length(); j++ )
+                {
+                showKeystroke->AppendL( spell.Mid( j, 1 ));
+                if ( KAutoDLT == spell[j] )
+                    {
+                    dltCount++;
+                    }
+                }
+            TInt tmp = 0;
+            if ( firstIsTonemark )
+                {
+                tmp = 1;
+                }
+            if ( spell.Length() - dltCount + start + tmp < keystroke->Count())
+                {
+                if ( spell.Length() != 0 )
+                    {
+                    showKeystroke->AppendL( atuoDLT );
+                    }
+                for ( TInt k = spell.Length() - dltCount; k < keystroke->Count(); k++ )
+                    {
+                    showKeystroke->AppendL( keystroke->MdcaPoint( k ));
+                    }
+                }
+            else if ( spell.Length() - dltCount + start < keystroke->Count())
+                {
+                showKeystroke->InsertL( 0, keystroke->MdcaPoint( 0 ));
+                }
+            
+            ClearPtiEngineKeystroke();
+            }
+
+        if ( phraseCount + showKeystroke->Count() > KMaxKeystrokeCount )
+            {
+            showKeystroke->Delete( KMaxKeystrokeCount - phraseCount, 
+                  phraseCount + showKeystroke->Count() - KMaxKeystrokeCount );
+            if ( CheckSpellingDLT( showKeystroke->MdcaPoint( 
+                                      KMaxKeystrokeCount - phraseCount - 1 )))
+                {
+                showKeystroke->Delete( KMaxKeystrokeCount - phraseCount - 1 );
+                }
+            break;
+            }
+        }
+    if ( iNeedAddDLT )
+        {
+        iNeedAddDLT = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::ClearPtiEngineKeystroke
+// clear the ptiengine keystroke;
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::ClearPtiEngineKeystroke()
+    {
+    iOwner->PtiEngine()->ClearCurrentWord();
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::GetKeystrokeCode
+// get Code of the key stroke. 
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::GetKeystrokeCode( TInt& aKey,
+    const TDesC& aKeystroke )
+    {
+    TInt count = sizeof(StrokeMap) / sizeof(StrokeMap[0]);
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TBuf<1> buf;
+        buf.Append( StrokeMap[i].iValue );
+        if ( 0 == aKeystroke.Compare( buf ))
+            {
+            aKey = StrokeMap[i].iKeyCode;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::getCurrentLeastDLTSpell
+// get current spell which contains the least DLT.
+// ---------------------------------------------------------
+//
+TPtrC TAknFepInputMiniQwertySogouPinyinPhrasePlugin::getCurrentLeastDLTSpell()
+    {
+    CPtiEngine* ptiengine = iOwner->PtiEngine();
+    CDesC16ArrayFlat* allSpell = new CDesC16ArrayFlat( 1 );
+    TPtrC  currentSpell;
+    TBuf<1> delimiter;
+    TBuf<KMaxKeystrokeCount> preDltPosizeArr;
+    TBuf<KMaxKeystrokeCount> curDltPosizeArr;
+    preDltPosizeArr.FillZ( KMaxKeystrokeCount );
+    preDltPosizeArr.SetLength( KMaxKeystrokeCount );
+    curDltPosizeArr.FillZ( KMaxKeystrokeCount );
+    curDltPosizeArr.SetLength( KMaxKeystrokeCount );
+    
+    TInt index = 1;
+    delimiter.Append( KManualDLT );
+    TRAP_IGNORE( ptiengine->GetPhoneticSpellingsL( *allSpell ));
+    TInt allCount = ptiengine->PhoneticSpellingCount();
+    
+    
+    for( TInt i = 0; i < allCount; i++ )
+        {
+        currentSpell.Set(allSpell->MdcaPoint( i ));
+        TInt dltIndex = 0;
+        curDltPosizeArr.FillZ(KMaxKeystrokeCount);
+        curDltPosizeArr.SetLength(KMaxKeystrokeCount);
+        TInt preIndex = 0;
+        for ( TInt j = 0; j < currentSpell.Length(); j++ )
+            {
+            if ( currentSpell.Mid( j, 1 ).Compare( delimiter ) == 0 )
+                {   
+                curDltPosizeArr[dltIndex] = j - preIndex - 1;
+                preIndex = j;
+                dltIndex++;
+                }
+            else if (( j + 1 ) == currentSpell.Length())
+                {
+                curDltPosizeArr[dltIndex] = j - preIndex;
+                }
+            }
+        
+        for ( TInt k = 0; k < KMaxKeystrokeCount; k++ )
+            {
+            
+            if ( preDltPosizeArr[k] < curDltPosizeArr[k] )
+                {
+                preDltPosizeArr.Copy( curDltPosizeArr );
+                index = i + 1;
+                break;
+                }
+            else if ( preDltPosizeArr[k] > curDltPosizeArr[k] )
+                {
+                break;
+                }
+            }
+        }
+    
+    // Pop and destroy allSpell
+    if ( allSpell )
+        {
+        delete allSpell;
+        }
+    
+    ptiengine->SelectPhoneticSpelling( index );
+    return ptiengine->GetPhoneticSpelling( index ); 
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CheckSpellingDLT
+// Check the delimiter of spelling.
+// ---------------------------------------------------------
+//
+TBool TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CheckSpellingDLT(
+    const TDesC& aKeystroke )
+    {
+    if ( aKeystroke.Length() == 0 )
+        {
+        return EFalse;
+        }
+    
+    if (( KAutoDLT == aKeystroke[0] ) || ( KManualDLT == aKeystroke[0] ))
+        {
+        return ETrue;
+        }
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::ToneMark
+// Get pinyin tone mark.
+// ---------------------------------------------------------
+//
+TInt TAknFepInputMiniQwertySogouPinyinPhrasePlugin::ToneMark( 
+        const TDesC& aKeystroke )
+    {
+    if ( aKeystroke.Length() == 0 )
+        {
+        return KInvalidToneMark;
+        }
+    TInt numOfToneMark = sizeof(PinyinToneMap) / sizeof(PinyinToneMap[0]);
+    for ( TInt i = 0; i < numOfToneMark; i++ )
+        {
+        if ( PinyinToneMap[i].iValue == aKeystroke[0] )
+            {
+            return PinyinToneMap[i].iInputTone;
+            }
+        }
+    return KInvalidToneMark;
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CheckSpellingAddToneMarkToPTIL
+// Check spell after add the tonemark to ptiEngine.
+// ---------------------------------------------------------
+//
+TBool TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CheckSpellingAddToneMarkToPTIL(
+                                                        const TInt aToneMark )
+    {
+    CPtiEngine* ptiengine = iOwner->PtiEngine();
+    MAknFepUICtrlEditPane* editPane = iUIContainer->EditPaneWindow();
+    TBuf<1> toneMark;
+    TBuf<1> delimiter;
+    
+    toneMark.Append( PinyinToneMap[aToneMark - 1].iValue );
+    delimiter.Append( KManualDLT );
+    
+    for ( TInt i = 0; i < aToneMark; ++i )
+        {
+        ptiengine->IncrementToneMark( ETrue );
+        TPtrC ptr = getCurrentLeastDLTSpell();
+        
+        // Some tonemarks are invalid for some pinyin stroke, so we need check
+        // the tonemark.
+        if ( ptr.Length() == 0 )
+            {
+            break;
+            }
+        TBuf<1> tonemarkResult;
+        tonemarkResult.Append( ptr.Mid( ptr.Length() - 1, 1 ));
+        if ( i != aToneMark - 1 )
+            {
+            CheckResultOfToneMark( tonemarkResult , i );
+            }
+
+        if (( 0 == ptr.Mid( ptr.Length() - 1, 1 ).Compare( toneMark )) &&
+            ( KErrNotFound == ptr.Find( delimiter ))
+            )
+            {
+            return ETrue;
+            }
+        }
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CheckResultOfToneMark
+// Check the tonemark result.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CheckResultOfToneMark( 
+                                            const TDesC16& aDes, TInt& aIndex )
+    {
+    TInt tonemarkIndex = 0;
+    TInt num = sizeof(PinyinToneMap )/( sizeof(PinyinToneMap[0]));
+    for ( tonemarkIndex = 0; tonemarkIndex < num; ++tonemarkIndex )
+        {
+        TBuf<1> toneMark;
+        toneMark.Append( PinyinToneMap[tonemarkIndex].iValue );
+        if ( aDes.Compare( toneMark ) == 0 )
+            {
+            break;
+            }
+        }
+    aIndex = tonemarkIndex;
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::Enable
+// Enable or disable the plugin.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::Enable( TBool aValid )
+    {
+    iValid = aValid;
+    }
+        
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::IsEnable
+// Get the state of the plugin.
+// ---------------------------------------------------------
+//
+TBool TAknFepInputMiniQwertySogouPinyinPhrasePlugin::IsEnable()
+    {
+    return iValid;
+    }
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CommitInlineEEPL
+// Commint text to EEP or editor
+// ---------------------------------------------------------------------------
+//
+TBool TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CommitInlineEEPL(
+    const TDesC& aDes )
+    {
+    TInt charCount = aDes.Length();
+    MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
+    MAknFepUICtrlEditPane* editpane = iUIContainer->EditPaneWindow();
+    CDesCArrayFlat* showkeyStoke = editpane->ShowKeystrokeArray();
+    CDesCArrayFlat* keyStoke = editpane->KeystrokeArray();
+    CDesCArrayFlat* phraseArray = editpane->PhraseArray();
+    CDesCArrayFlat* phraseShowKeyStroke = editpane->PhraseShowKeyStrokeArray();
+    TBuf<KMaxKeystrokeCount> buf;
+    TBuf<1> autoDLT;
+    autoDLT.Append( KAutoDLT );
+
+    if (phraseArray->Count() == 0)
+        {
+        editpane->SetPhraseCreationFlag(EFalse);
+        }
+    phraseArray->AppendL( aDes );
+
+    // Calculate the count of show keystroke which need to be deleted.   
+    TInt delCount = 0;
+    for ( TInt i = 0; i < showkeyStoke->Count() && charCount
+            && keyStoke->Count() != 0; i++ )
+        {
+        TPtrC showptr = showkeyStoke->MdcaPoint(i);
+        TPtrC ptr = keyStoke->MdcaPoint( 0);
+        if ( CheckSpellingDLT( showptr ) || ( KInvalidToneMark
+                != ToneMark( showptr )))
+            {
+            // If the previous show key stroke is DLT or tonemark too, break.
+            if ( i > 0 && 
+                 ( CheckSpellingDLT( showkeyStoke->MdcaPoint( i - 1 )) || 
+                 ( KInvalidToneMark != ToneMark( showkeyStoke->MdcaPoint( i - 1 )))))
+                {
+                break;
+                }
+
+            charCount--;
+            }
+        if ( showptr.Compare( autoDLT ) != 0 )
+            {
+            buf.Append( ptr );
+            keyStoke->Delete( 0 );
+            }
+        delCount++;
+        }
+    
+    // Delete the show keystroke
+    for (TInt j = 0; j < delCount; j++)
+        {
+        showkeyStoke->Delete( 0 );
+        }
+    
+    // Record the keystrokes relative with the commit word
+    phraseShowKeyStroke->AppendL( buf );
+    
+    // For Sogou core, maybe one element of PhraseArray() contains two or
+    // more characters.
+    TInt phraseCount = 0;
+    for ( TInt l = 0; l < phraseArray->Count(); l++ )
+        {
+        phraseCount += phraseArray->MdcaPoint(l).Length();
+        }
+
+    // Tell sogou core which phrase is selected. It is used for phrase creation.
+    TBuf<KMaxPhraseCreationCount> phraseSelected;
+    phraseSelected.FillZ();
+    if ( aDes.Length() <= KMaxPhraseCreationCount )
+        {
+        phraseSelected.Append( aDes );
+        iOwner->PtiEngine()->HandleCommandL( EPtiCommandSelectElement, 
+            ( TAny* )( &phraseSelected ));
+        }
+    
+    // If there is no keystroke left or character count reach the limitation
+    if ( keyStoke->Count() == 0 /*|| phraseCount == KMaxPhraseCreationCount */)
+        {
+        // Though maybe one element of PhraseArray() contains two or more characters,
+        // here we do not need to get the characters count. Because we will handle
+        // the phrase here, not character.
+        HBufC* phraseCreated = HBufC::NewLC( phraseCount );
+        TPtr keyPtr = phraseCreated->Des();
+        phraseCount = phraseArray->Count();
+        
+        for ( TInt ii = 0; ii < phraseCount; ++ii )
+            {
+            TPtrC ptrZi = phraseArray->MdcaPoint( ii );
+            keyPtr.Append( ptrZi );
+            }
+        fepMan->NewTextL( phraseCreated->Des());
+        fepMan->CommitInlineEditL();
+        
+        // Tell sogou core the phrase pinyin
+        AddPhrasePinyinToPti();
+        iOwner->PtiEngine()->SetPredictiveChineseChar( phraseCreated->Des());
+        CleanupStack::PopAndDestroy();
+        return EFalse;
+        }
+
+    editpane->SetCursorIndexOfKeystroke( 0 );
+    editpane->DisableCursor();
+    editpane->SetPhraseCreationFlag( ETrue );
+    return ETrue;
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertyPinyinPhraseBase::AddPhrasePinyinToPti
+// Add phrase to DB.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::AddPhrasePinyinToPti()
+    {
+    MAknFepUICtrlEditPane* editpane = iUIContainer->EditPaneWindow();
+    CDesCArrayFlat* phraseShowKeyStroke = editpane->PhraseShowKeyStrokeArray();
+    TBuf<KMaxShowKeystrokeCount> phraseCreatedPinYin;
+    phraseCreatedPinYin.FillZ();
+    for ( TInt i = 0; i < phraseShowKeyStroke->Count(); i++ )
+        {
+        TPtrC ptrPinYin = phraseShowKeyStroke->MdcaPoint(i);
+        phraseCreatedPinYin.Append(ptrPinYin);
+        }
+    //Add the phrase pinyin to the DB by PTI Engine
+    TRAP_IGNORE( iOwner->PtiEngine()->HandleCommandL( 
+            EPtiCommandSetPinyinForLearnWord, (TAny*)( &phraseCreatedPinYin )));
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::GetCandidateL
+// Get the candidate info.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::GetCandidateL()
+    {
+    CPtiEngine* ptiengine = iOwner->PtiEngine();
+    MAknFepUICtrlEditPane* editPane = iUIContainer->EditPaneWindow();
+    CDesCArrayFlat* phraseCandidates = 
+            iUIContainer->CandidatePane()->CandidateArray();
+    CDesCArrayFlat* keystroke = editPane->KeystrokeArray();
+    CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray();
+    TInt phraseCount = editPane->PhraseArray()->Count();
+    phraseCandidates->Reset();
+    TBuf<KMaxKeystrokeCount> buf;
+    TBuf<1> delimiter;
+    delimiter.Append( KManualDLT );
+    TInt keyCode;
+    TInt count = KInvalidToneMark;
+    ClearPtiEngineKeystroke();
+    
+    if ( showKeystroke->Count() == 0 )
+        {
+        return;
+        }
+    
+    // If all strokes are valid
+    if ( iCanConvertAll )
+        {
+        AnalyseL();
+        ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); 
+        return;
+        }
+
+    // If some characters are invalid, we only need to get the candidates of 
+    // the strokes before the invalid character.
+    ClearPtiEngineKeystroke();
+    TInt autoDLT = 0;
+    for ( TInt j = 0; j < iConvertCount; j++ )
+        {
+        if ( showKeystroke->MdcaPoint( j )[0] == KAutoDLT )
+            {
+            autoDLT++;
+            }
+        }
+    for ( TInt i = 0; i < iConvertCount - autoDLT/*showKeystroke->Count()*/; ++i )
+        {
+        count = ToneMark( keystroke->MdcaPoint( i ) );
+        if ( KInvalidToneMark != count )
+            {
+            for ( TInt j = 0; j < count; ++j )
+                {
+                ptiengine->IncrementToneMark( ETrue );
+                }
+            }
+        else
+            {
+            GetKeystrokeCode( keyCode, keystroke->MdcaPoint( i ) );
+            ptiengine->AppendKeyPress((TPtiKey)keyCode);
+            }
+        }
+
+    getCurrentLeastDLTSpell();
+    ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates );
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CanConvertAll
+// Set flag for convert all stroke.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::CanConvertAll( TBool aEnable )
+    {
+    iCanConvertAll = aEnable;
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouPinyinPhrasePlugin::ConvertCount
+// Set convert count.
+// ---------------------------------------------------------
+//           
+void TAknFepInputMiniQwertySogouPinyinPhrasePlugin::ConvertCount( TInt aCount )
+    {
+    iConvertCount = aCount;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fep/aknfep/src/aknfepuiinputminiqwertysogoustrokephraseplugin.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2008 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:           
+ *      Provides the TAknFepInputMiniQwertySogouStrokePhrasePlugin definition.
+ *
+*/
+
+// System includes
+#include <e32cmn.h>
+#include <PtiEngine.h>
+#include <PtiDefs.h>
+#include <avkon.rsg>
+#include <aknfep.rsg>
+#include <PtiUserDicEntry.h>
+#include <aknnotewrappers.h> //CAknWarningNote 
+// User includes
+#include "AknFepUIManagerStateInterface.h"
+#include "AknFepUICtrlInputPane.h"
+#include "AknFepUICtrlPinyinPopup.h"        //Pinyin phrase
+#include "aknfepuictrleditpane.h"           //pinyin phrase creation
+#include "AknFepUICtrlCandidatePane.h"
+#include "AknFepManager.h"
+
+#include "aknfepuiinputminiqwertysogoustrokephraseplugin.h"
+#include "AknFepUiInputStateCandidateQwertyBaseChinesePhrase.h"
+
+// Constant definition
+const TInt KMaxShowKeystrokeCount = 255;
+const TInt KMaxPhraseCreationCount = 10;
+const TInt KMaxKeystrokeCount = 31;
+const TInt16 KStrokeDelimiter = 0x2022;
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouStrokePhrasePlugin::TAknFepInputMiniQwertySogouStrokePhrasePlugin
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+TAknFepInputMiniQwertySogouStrokePhrasePlugin::TAknFepInputMiniQwertySogouStrokePhrasePlugin(
+    MAknFepUIManagerStateInterface* aOwner,
+    MAknFepUICtrlContainerChinese* aUIContainer,
+    TUIState aState )
+    : iOwner( aOwner ),
+      iUIContainer( aUIContainer ),
+      iState( aState ),
+      iValid( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouStrokePhrasePlugin::operator=
+// 
+// ---------------------------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouStrokePhrasePlugin::operator=( const 
+        TAknFepInputMiniQwertySogouStrokePhrasePlugin& aPlugin )
+    {
+    Mem::Copy( this, &aPlugin, sizeof(TAknFepInputMiniQwertySogouStrokePhrasePlugin));
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouStrokePhrasePlugin::Enable
+// Enable or disable the plugin.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouStrokePhrasePlugin::Enable( TBool aValid )
+    {
+    iValid = aValid;
+    }
+        
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertySogouStrokePhrasePlugin::IsEnable
+// Get the state of the plugin.
+// ---------------------------------------------------------
+//
+TBool TAknFepInputMiniQwertySogouStrokePhrasePlugin::IsEnable()
+    {
+    return iValid;
+    }
+
+// ---------------------------------------------------------------------------
+// TAknFepInputMiniQwertySogouStrokePhrasePlugin::CommitInlineEEPL
+// Commint text to EEP or editor
+// ---------------------------------------------------------------------------
+//
+TBool TAknFepInputMiniQwertySogouStrokePhrasePlugin::CommitInlineEEPL(
+    const TDesC& aDes )
+    {
+    TInt charCount = aDes.Length();
+    MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
+    MAknFepUICtrlEditPane* editpane = iUIContainer->EditPaneWindow();
+    CDesCArrayFlat* keyStoke = editpane->KeystrokeArray();
+    RArray<TInt>* keycode = editpane->KeycodeArray();
+    CDesCArrayFlat* phraseArray = editpane->PhraseArray();
+    CDesCArrayFlat* phraseShowKeyStroke = editpane->PhraseShowKeyStrokeArray();
+    RArray<TInt>* phraseKeycode = editpane->PhraseKeycodeArray();
+    TBuf<KMaxKeystrokeCount> buf;
+    TBuf<1> strokeDLT;
+    strokeDLT.Append( KStrokeDelimiter );
+
+    phraseArray->AppendL( aDes );
+
+    TInt phraseCount = phraseArray->Count();
+    TInt index = 0;
+    TInt isFound = -1;
+    
+    TInt strokeDLTCount = 0;
+    for ( TInt j = 0; j < keyStoke->Count(); j++ )
+        {
+        if ( keyStoke->MdcaPoint( j ) == strokeDLT )
+            {
+            strokeDLTCount++;
+            if ( strokeDLTCount == charCount )
+                {
+                index = j;
+                }
+            isFound = 0;
+            }
+        }
+    
+    TInt phraseCharacterCount = 0;
+    for ( TInt m = 0; m < phraseCount; m++ )
+        {
+        phraseCharacterCount += (*phraseArray)[m].Length();
+        }
+
+    //phrase creation state
+    if ( phraseCount > 1 || ( 0 == isFound && charCount <= strokeDLTCount ))
+        {
+        editpane->SetPhraseCreationFlag( ETrue );
+
+        // Tell sogou core which phrase is selected. It is used for phrase creation.
+        TBuf<KMaxPhraseCreationCount> phraseSelected;
+        phraseSelected.FillZ();
+        if ( aDes.Length() <= KMaxPhraseCreationCount )
+            {
+            phraseSelected.Append( aDes );
+            iOwner->PtiEngine()->HandleCommandL( EPtiCommandSelectElement, 
+                    ( TAny* )( &phraseSelected ));
+            }
+        
+        if ( 0 == isFound && index < keyStoke->Count() - 1 )
+            {
+            for ( TInt i = 0; i <= index; i++ )
+                {
+                TPtrC ptr = keyStoke->MdcaPoint( 0 );
+                buf.Append( ptr );
+                keyStoke->Delete( 0);
+                phraseKeycode->AppendL( (*keycode)[0]);
+                keycode->Remove( 0 );
+                }
+            phraseShowKeyStroke->AppendL( buf );
+            editpane->SetCursorIndexOfKeystroke( 0 );
+            editpane->DisableCursor();          
+            return ETrue;
+            }
+        else
+            {
+            HBufC* phraseCreated = HBufC::NewLC( phraseCharacterCount );
+            TPtr keyPtr = phraseCreated->Des();
+            for ( TInt ii = 0; ii < phraseCount; ++ii )
+                {
+                TPtrC ptrZi = phraseArray->MdcaPoint( ii );
+                keyPtr.Append( ptrZi );
+                }
+
+            AddPhrasePinyinToPti();
+
+            if ( 0 != isFound || ( 0 == isFound && index == keyStoke->Count() - 1 ) )
+                {
+                editpane->ResetAllArray();
+                }
+            fepMan->NewTextL( phraseCreated->Des());
+            fepMan->CommitInlineEditL();
+            fepMan->PtiEngine()->CommitCurrentWord();
+            CleanupStack::PopAndDestroy();
+            return EFalse;
+            }
+        }
+    else
+        {
+        HBufC* phraseCreated = HBufC::NewLC( phraseCharacterCount );
+        TPtr keyPtr = phraseCreated->Des();
+        for ( TInt ii = 0; ii < phraseCount; ++ii )
+            {
+            TPtrC ptrZi = phraseArray->MdcaPoint( ii );
+            keyPtr.Append( ptrZi );
+            }
+        editpane->ResetAllArray();
+        editpane->SetPhraseCreationFlag( EFalse );
+        fepMan->NewTextL( phraseCreated->Des());
+        fepMan->CommitInlineEditL();
+        iOwner->PtiEngine()->SetPredictiveChineseChar( phraseCreated->Des());
+        CleanupStack::PopAndDestroy();
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------
+// TAknFepInputMiniQwertyPinyinPhraseBase::AddPhrasePinyinToPti
+// Add phrase to DB.
+// ---------------------------------------------------------
+//
+void TAknFepInputMiniQwertySogouStrokePhrasePlugin::AddPhrasePinyinToPti()
+    {
+    MAknFepUICtrlEditPane* editpane = iUIContainer->EditPaneWindow();
+    CDesCArrayFlat* phraseShowKeyStroke = editpane->PhraseShowKeyStrokeArray();
+    CDesCArrayFlat* keyStoke = editpane->KeystrokeArray();
+    TBuf<KMaxShowKeystrokeCount> phraseCreatedStroke;
+    phraseCreatedStroke.FillZ();
+    for ( TInt i = 0; i < phraseShowKeyStroke->Count(); i++ )
+        {
+        TPtrC ptrPhraseKeyStroke = phraseShowKeyStroke->MdcaPoint(i);
+        phraseCreatedStroke.Append(ptrPhraseKeyStroke);
+        }
+    for ( TInt j = 0; j < keyStoke->Count(); j++ )
+        {
+        TPtrC ptrKeyStroke = keyStoke->MdcaPoint(j);
+        phraseCreatedStroke.Append(ptrKeyStroke);
+        }
+    //Add the phrase pinyin to the DB by PTI Engine
+    TRAP_IGNORE( iOwner->PtiEngine()->HandleCommandL( 
+            EPtiCommandSetPinyinForLearnWord, (TAny*)( &phraseCreatedStroke )));
+    }
+
+// End of file
--- a/fep/aknfep/src/aknfepuiinputminiqwertystrokephrasebase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/aknfepuiinputminiqwertystrokephrasebase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -55,6 +55,8 @@
 const TInt16 KKey1 = 0x31;
 const TInt16 KKey6 = 0x36;
 
+const TUid KPtiSogouCoreUid = { 0x20031DD6 };
+
 _LIT( KMaxPhraseNote,"\x8BCD\x7EC4\x6700\x957F\x4E3A\x4E03\x5B57" );
 
 // ---------------------------------------------------------------------------
@@ -229,6 +231,8 @@
             ptiengine->GetPhoneticSpelling(1).Length();
         stringAfterLength = 
             ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
+        stringAfterLength = ptiengine->GetPhoneticSpelling(1).Length();
+
         //the keystroke is invalid.
         if ( stringBeforeLength == stringAfterLength )
             {
@@ -264,7 +268,7 @@
         if ( cdtCount > 0 )
             {
             UIContainer()->EditPaneWindow()->SetChangeState( ETrue );
-            iOwner->ChangeState( ECandidate );            
+            iOwner->ChangeState( EEntry );            
             return;
             }
         
@@ -467,17 +471,50 @@
     TInt index = editPane->GetCursorIndexOfKeystroke();
     TBuf<KMaxKeystrokeCount> showInfo;
     
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    TInt phraseCount = 0;
+    
     for ( TInt i = 0; i < phrase->Count(); ++i )
         {
-        showInfo.Append( phrase->MdcaPoint( i ) );
+        // If this method is called in construction of the state machine,
+        // the plugin is not set. If sogou core is in use now, we should append 
+        // each characters to showInfo.
+        // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
+        if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+            {
+            for ( TInt k = 0; k < phrase->MdcaPoint(i).Length(); k++ )
+                {
+                showInfo.Append( phrase->MdcaPoint(i)[k] );
+                }
+            phraseCount += phrase->MdcaPoint(i).Length();
+            }
+        else
+            {
+            // If cpicore is in use, just append the element of phrase
+            showInfo.Append(phrase->MdcaPoint(i) );
+            }
         }
 
     for ( TInt ii = 0; ii < keystroke->Count(); ++ii )
         {
         showInfo.Append( keystroke->MdcaPoint( ii ) );
         }
-    
-    editPane->SetText( showInfo, index + phrase->Count() );
+
+    // If this method is called in construction of the state machine,
+    // the plugin is not set. If sogou core is in use now, the phraseCount
+    // should be the same as the phrase characters count.
+    // For Sogou core, maybe one element of PhraseArray() contains two or more characters.
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        editPane->SetText( showInfo, index + phraseCount );
+        }
+    else
+        {
+        // If cpicore is in use, phraseCount is the same as phrase->Count()
+        editPane->SetText( showInfo, index + phrase->Count() );
+        }
     
     switch ( iState )
         {
@@ -702,6 +739,12 @@
 void TAknFepInputMiniQwertyStrokePhraseBase::AddPhraseToDB( 
                                                      const TDesC& aPhraseAdd )
     {   
+    // If sogou core is actived, use the plugin.
+    if ( iStrokePlugin.IsEnable())
+        {
+        iStrokePlugin.AddPhrasePinyinToPti();
+        return;
+        }
     TPtiUserDictionaryEntry addUdbEntry( aPhraseAdd );
     //Add the phrase to the DB by PTI Engine
     iOwner->PtiEngine()->AddUserDictionaryEntry( addUdbEntry );
@@ -752,6 +795,11 @@
 //
 TBool TAknFepInputMiniQwertyStrokePhraseBase::CommitInlineEEPL( const TDesC& aDes )
     {
+    // If sogou core is actived, use the plugin.
+    if ( iStrokePlugin.IsEnable())
+        {
+        return iStrokePlugin.CommitInlineEEPL( aDes );
+        }
     TInt charCount = aDes.Length();
 	MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
 	MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow();
@@ -846,7 +894,21 @@
     TInt phraseCount = editPane->PhraseArray()->Count();
     TInt keystrokeCount = keystrokeArray->Count();
     TInt index = editPane->GetCursorIndexOfKeystroke();
+
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
     
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        CDesCArrayFlat* phrase = editPane->PhraseArray();
+        phraseCount = 0;
+        for ( TInt j = 0;  j < phrase->Count(); j++ )
+            {
+            phraseCount += phrase->MdcaPoint(j).Length();;
+            }
+        }
+
     if ( phraseCount + keystrokeCount >= KMaxKeystrokeCount )
         {
         return EFalse;
@@ -917,7 +979,17 @@
                                                           )
     {
     CPtiEngine* ptiEngine = iOwner->PtiEngine();
-    TBuf<KMaxName> lowerdata;   
+    TBuf<KMaxName> lowerdata;
+    
+    // If the key is EPtiKeyQwertySpace, just append a KStrokeDelimiter.
+    if ( aKey == EPtiKeyQwertySpace )
+        {
+        TBuf<1> strokeDLT;
+        strokeDLT.Append( KStrokeDelimiter );
+        aKeystroke.Copy( strokeDLT );
+        return;
+        }
+
     ptiEngine->MappingDataForKey((TPtiKey)aKey, lowerdata, EPtiCaseLower);  
     TInt StrokeUnicodePosition =0;
    
@@ -990,6 +1062,13 @@
     keystrokeArray->Compress();
     phrase->Compress();
     phraseStroke->Compress();
+
+    TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID );
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        // Notify sogoucore that last phrase is cancelled
+        iOwner->PtiEngine()->HandleCommandL( EPtiCommandCancelSelectElement );
+        }
     }
 
 // ---------------------------------------------------------
@@ -1015,6 +1094,20 @@
     TBuf<1> delimiter;
     delimiter.Append( KStrokeDelimiter );
     
+    // Get the current core id
+    TInt coreID = 0;
+    TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ));
+    
+    if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+        {
+        CDesCArrayFlat* phrase = editPane->PhraseArray();
+        phraseCount = 0;
+        for ( TInt j = 0;  j < phrase->Count(); j++ )
+            {
+            phraseCount += phrase->MdcaPoint(j).Length();;
+            }
+        }
+    
     //set warning color stroke after 7th group when it's more than 7 groups.
     if ( 0 == keystrokeCount )
         {
@@ -1038,22 +1131,29 @@
         if ( EPtiKeyQwertySpace == keyCode )
             {
             delimiterCount = delimiterCount + 1;
-            if ( delimiterCount == KMaxPhraseCreationCount )
+
+            // For Sogou core, there is no need to limit characters count to 
+            // KMaxPhraseCreationCount.
+            if ( TUid::Uid( coreID ) != KPtiSogouCoreUid )
                 {
-                if ( !valid )
+                if ( delimiterCount == KMaxPhraseCreationCount )
                     {
-                    editPane->SetHighlight( 
-                            phraseCount + index, 
-                            phraseCount + keystrokeCount - 1 );
+                    if ( !valid )
+                        {
+                        editPane->SetHighlight( 
+                                phraseCount + index, 
+                                phraseCount + keystrokeCount - 1 );
+                        }
+                    else
+                        {
+                        editPane->SetHighlight( 
+                                phraseCount + i, 
+                                phraseCount + keystrokeCount - 1 );
+                        }
+                    break;
                     }
-                else
-                    {
-                    editPane->SetHighlight( 
-                            phraseCount + i, 
-                            phraseCount + keystrokeCount - 1 );
-                    }
-                break;
                 }
+
             if ( ( !valid ) || ( 0 == i ) )
                 {
                 editPane->SetHighlight( 
@@ -1079,6 +1179,8 @@
             stringBeforeLength = ptiengine->GetPhoneticSpelling(1).Length();
             stringAfterLength = 
                 ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
+            stringAfterLength = ptiengine->GetPhoneticSpelling(1).Length();
+
             if ( stringBeforeLength == stringAfterLength )
                 {
                 valid = EFalse;
@@ -1360,6 +1462,8 @@
         stringBeforeLength = ptiengine->GetPhoneticSpelling(1).Length();
         stringAfterLength = 
             ptiengine->AppendKeyPress((TPtiKey)keyCode).Length();
+        stringAfterLength = ptiengine->GetPhoneticSpelling(1).Length();
+
         if ( stringBeforeLength == stringAfterLength )
             {
             editPane->SetAllValidFlag( EFalse );
@@ -1412,7 +1516,26 @@
         {
 #ifdef RD_INTELLIGENT_TEXT_INPUT
         TBool isEditorFull = iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagEditorFull);
-        if ( !isEditorFull )
+
+        // For sogou core, the predictive is not endless, so when there
+        // is no predictive candidates, we should call TryCloseUiL().
+        TBool noCandidates = EFalse;
+        
+        TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID );
+        if ( TUid::Uid( coreID ) == KPtiSogouCoreUid )
+            {
+            // Get the predictive candidates.
+            CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat( 1 );
+            CleanupStack::PushL ( phraseCandidates );
+            phraseCandidates->Reset();
+            iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates );
+            if ( phraseCandidates->Count() == 0 )
+                {
+                noCandidates = ETrue;
+                }
+            CleanupStack::PopAndDestroy( phraseCandidates );
+            }
+        if ( !isEditorFull && !noCandidates )
             {
             iOwner->ChangeState( EPredictiveCandidate );
             UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
--- a/fep/aknfep/src/aknfepuiinputstateminiqwertystrokephrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/aknfepuiinputstateminiqwertystrokephrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -127,7 +127,6 @@
             if ( candidatePane->VisibleCandidateCount()!= 1 )
                 {
                 uiContainer->EditPaneWindow()->SetCandidateRefreshFlag( ETrue );
-                iOwner->ChangeState( ECandidate );
                 candidatePane->SelectNext();
                 }
             break;
@@ -137,9 +136,7 @@
             if ( candidatePane->VisibleCandidateCount()!= 1 )
                 {
                 uiContainer->EditPaneWindow()->SetCandidateRefreshFlag( ETrue );
-                iOwner->ChangeState( ECandidate );
-                TInt numbertotal = UIContainer()->CandidatePane()->VisibleCandidateCount();
-                UIContainer()->CandidatePane()->SelectIndex( numbertotal-1 );
+                candidatePane->SelectPrev();
                 }
             break;
             }
@@ -157,7 +154,7 @@
                     {
                     if ( CheckFirstGroupStroke() )
                         {
-                        iOwner->ChangeState( ECandidate );
+                        iOwner->ChangeState( EEntry );
                         }
                     else
                         {
@@ -191,6 +188,31 @@
     return ret;
     }
 
+void TAknFepInputStateEntryMiniQwertyStrokePhrase::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+
+	if ( aText.Length())
+	   {
+	   if ( !CommitInlineEEPL( aText ) )
+	      {
+	      DoActionAfterCommit();
+	      }
+	      else
+	          {
+	          if  ( CheckFirstGroupStroke() )
+	              {
+	              iOwner->ChangeState( EEntry );
+	              }
+	          else
+	              {
+	              uiContainer->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromInput );
+	              iOwner->ChangeState( EMiniQwertyEdit );
+	              }
+	          }
+	     }
+	}
+
 // ---------------------------------------------------------------------------
 // TAknFepInputStateEditingMiniQwertyStrokePhrase::TAknFepInputStateEditingMiniQwertyStrokePhrase
 // C++ default constructor
@@ -263,7 +285,7 @@
             if ( 0 != candidatePane->VisibleCandidateCount() )
                 {
                 uiContainer->EditPaneWindow()->SetChangeState( ETrue );
-                iOwner->ChangeState( ECandidate );
+                iOwner->ChangeState( EEntry );
                 }
             break;
             }
@@ -317,9 +339,10 @@
     {
     iState = ECandidate;
     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    uiContainer->CandidatePane()->SelectFirstPhrase();
     uiContainer->FocusCandidatePane( ETrue );
     uiContainer->CandidatePane()->ShowCandidateOrdinals( ETrue );
-    uiContainer->CandidatePane()->SelectFirstPhrase();
+    
     if ( uiContainer->EditPaneWindow()->GetCandidateRefreshFlag() )
         {
         uiContainer->EditPaneWindow()->DisableCursor();
@@ -480,6 +503,31 @@
         }
     }
 
+void TAknFepInputStateEditingMiniQwertyStrokePhrase::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+	if ( aText.Length() )
+	    {
+	    if ( !CommitInlineEEPL( aText ) )
+	        {
+	        DoActionAfterCommit();
+	        }
+	    else
+	        {
+	        if ( CheckFirstGroupStroke() )
+	           {
+	           RefreshUI();
+	           uiContainer->CandidatePane()->SelectFirstPhrase();
+	           }
+	       else
+	           {
+	           uiContainer->EditPaneWindow()->SetAutoChangeStateFlag(
+	                        EAutoChangeStateFromCandidate );
+	           iOwner->ChangeState( EMiniQwertyEdit );
+	           }
+	        }
+	   }
+	}
 
 // ---------------------------------------------------------------------------
 // TAknFepInputStateEntryMiniQwertyStrokePhrase::HandleCommandL
@@ -505,7 +553,7 @@
                     {
                     if ( CheckFirstGroupStroke() )
                         {
-                        iOwner->ChangeState( ECandidate );
+                        iOwner->ChangeState( EMiniQwertyEdit );
                         }
                     else
                         {
@@ -563,3 +611,29 @@
             break;
         }
     }
+
+void TAknFepUiInputStateCandidateMiniQwertyStrokePhrase::SubmitTextL( const TDesC& aText )
+	{
+	MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+	if ( aText.Length() )
+	    {
+	    if ( !CommitInlineEEPL( aText ) )
+	        {
+	        DoActionAfterCommit();
+	        }
+	    else
+	        {
+	        if ( CheckFirstGroupStroke() )
+	           {
+	           RefreshUI();
+	           uiContainer->CandidatePane()->SelectFirstPhrase();
+	           }
+	           else
+	               {
+	               uiContainer->EditPaneWindow()->SetAutoChangeStateFlag(
+	                            EAutoChangeStateFromCandidate );
+	               iOwner->ChangeState( EMiniQwertyEdit );
+	               }
+	            }
+	   }
+	}
--- a/fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/fep/aknfep/src/aknfepuiinputstateminiqwertyzhuyinphrase.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -688,9 +688,10 @@
     iState = EZhuyinSpelling;
 
     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    
     uiContainer->FocusCandidatePane( EFalse );
+    uiContainer->CandidatePane()->SelectFirstPhrase();
     uiContainer->CandidatePane()->ShowCandidateOrdinals( EFalse );
-    uiContainer->CandidatePane()->SelectFirstPhrase();
     uiContainer->ShowVerticalScrollArrows( ETrue );
     uiContainer->ShowHorizontalScrollArrows( EFalse );
     uiContainer->InputPane()->SetOverrideFontId( 0 );
@@ -879,6 +880,114 @@
     RefreshSpellingPane( needClearDeliberateSelection );
     }
 
+void TAknFepInputStateSpellingMiniQwertyZhuyin::SubmitTextL( const TDesC& /*aText*/ )
+	{
+    MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
+    editPane->SetChangeState( EFalse );
+    editPane->SetNeedClearDeliberateSelection( ETrue );
+    CommitCandidateL();
+     }
+
+
+void TAknFepInputStateSpellingMiniQwertyZhuyin::CommitCandidateL()
+    {
+    CDesCArrayFlat* keyStrokeArray = UIContainer()->EditPaneWindow()->KeystrokeArray();
+    CDesCArrayFlat* phraseKeyStrokeArray = UIContainer()->EditPaneWindow()->PhraseShowKeyStrokeArray();
+    CDesCArrayFlat* phraseArray = UIContainer()->EditPaneWindow()->PhraseArray();
+    CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
+    TPtrC candidate = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
+    
+    RArray<TInt>* keyCodeArray = UIContainer()->EditPaneWindow()->KeycodeArray();
+    RArray<TInt>* keyCodePhraseArray = UIContainer()->EditPaneWindow()->PhraseKeycodeArray();
+    TBuf<KMaxKeystrokeCount> spellingText;
+    
+    UIContainer()->InputPane()->GetText( spellingText );
+    
+    //phraseZhuYinSpellingArray must keep same count with phraseArray
+    TInt delCount = phraseZhuYinSpellingArray->Count()-phraseArray->Count();//we can sure delCount>=0,impossible <0
+	if(delCount>0)
+		{
+		phraseZhuYinSpellingArray->Delete(phraseArray->Count(),delCount);//delete from tail 
+		}
+	phraseZhuYinSpellingArray->AppendL(spellingText); 
+    phraseArray->AppendL( candidate );
+    
+    TBuf<KMaxKeystrokeCount> keyStoke;
+    TInt replaceCount = 0;
+    TInt delimiterIndex = spellingText.Find( KDelimiter );
+    if ( KErrNotFound ==delimiterIndex )
+        {
+        delimiterIndex = -1;
+        }
+    TInt indexOfToneMark = GetIndexOfToneMark( spellingText );
+    if ( delimiterIndex != KErrNotFound && indexOfToneMark >= 0 )
+        {
+        replaceCount = Min( delimiterIndex, indexOfToneMark );
+        if ( delimiterIndex > indexOfToneMark )
+            {
+            replaceCount++;
+            }
+        }
+    else if ( delimiterIndex != KErrNotFound && indexOfToneMark == -1 )
+        {
+        replaceCount = delimiterIndex;
+        }
+    else if ( delimiterIndex == KErrNotFound && indexOfToneMark != -1 )
+        {
+        replaceCount = indexOfToneMark + 1;
+        }
+    else
+        {
+        replaceCount = spellingText.Length();
+        } 
+    for (TInt i = 0; i < replaceCount; i++ )
+        {
+        TPtrC ptr = keyStrokeArray->MdcaPoint( 0 );
+        keyStoke.Append( ptr );
+        keyStrokeArray->Delete( 0 );
+        // added for the keycode
+        TInt keyCodeValue = ( *keyCodeArray )[0];
+        keyCodePhraseArray->AppendL( keyCodeValue );
+        keyCodeArray->Remove( 0 );
+        }
+    phraseKeyStrokeArray->AppendL( keyStoke );
+
+    if ( GetValidKeystroke() )
+        {
+        iOwner->ChangeState( EZhuyinSpelling );
+        }
+    else
+        {
+        iOwner->ChangeState( EMiniQwertyEdit );
+        }
+    UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
+    RefreshSpellingPane();
+    RefreshCandidatePane();
+    ChangeCbaL();
+    }
+
+
+TInt TAknFepInputStateSpellingMiniQwertyZhuyin::GetIndexOfToneMark( const TDesC& aText)
+    {
+    TInt indexOfToneMark = -1;
+    TInt num = sizeof(ZhuyinToneMap )/( sizeof(ZhuyinToneMap[0]));
+    TInt len = aText.Length();
+    for( TInt j = 0; j< len ;j++ )
+        {
+        indexOfToneMark = j;
+        TBuf<1> keyStorkeBuf = aText.Mid( j ,1 );
+        for (TInt i = 0; i<num; i++ )
+            {
+            if (  keyStorkeBuf[0] == ZhuyinToneMap[i].iValue  )
+                {
+                return indexOfToneMark;
+                }
+            }
+        }
+    return -1;
+    }
+
 // ---------------------------------------------------------
 // TAknFepInputStateSpellingMiniQwertyZhuyin::RefreshUI
 // Refresh vaild key stroke length
@@ -899,6 +1008,7 @@
     TInt currentLength = ptr.Length();
     editPane->SetEffictiveLength( currentLength );
     }
+
 // ---------------------------------------------------------------------------
 // TAknFepInputStateCanindateSelectingMiniQwertyZhuyin::TAknFepInputStateCanindateSelectingMiniQwertyZhuyin
 // C++ default constructor
@@ -1044,17 +1154,8 @@
                 iOwner->FepMan()->PlaySound(EAvkonSIDDefaultSound);
                 break;
                 }
-            if ( SelectCandidate( aKey ) ) // is 1-6 key 
-                {
-                editPane->SetNeedClearDeliberateSelection( ETrue );
-                CommitCandidateL();
-                }
-            else
-                {
-                return TAknFepInputMiniQwertyZhuyinPhraseBase::HandleKeyL(
+            return TAknFepInputMiniQwertyZhuyinPhraseBase::HandleKeyL(
                     aKey, aLength );
-                }
-            break;
         }
     return ret;
     }
@@ -1205,6 +1306,16 @@
     keybinding.Reset();
     return validnumkey;
     }
+
+void TAknFepInputStateCanindateSelectingMiniQwertyZhuyin::SubmitTextL( const TDesC& /*aText*/ )
+	{
+    MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
+    editPane->SetChangeState( EFalse );
+    editPane->SetNeedClearDeliberateSelection( ETrue );
+    CommitCandidateL();
+	}
+
 // ---------------------------------------------------------------------------
 // TAknFepInputStateEditingMiniQwertyZhuyinPhrase::HandleCommandL
 // Handling Command
@@ -1242,6 +1353,118 @@
         }
     }
 
+void TAknFepInputStateEditingMiniQwertyZhuyinPhrase::SubmitTextL( const TDesC& aText )
+	{
+    MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
+    MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
+    editPane->SetChangeState( EFalse );
+	CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
+	if( phraseZhuYinSpellingArray->Count() >= 7 )
+		{
+		HandleCommitL();
+		return;
+		}
+    editPane->SetNeedClearDeliberateSelection( ETrue );
+    CommitCandidateL();
+	}
+
+void TAknFepInputStateEditingMiniQwertyZhuyinPhrase::CommitCandidateL()
+    {
+    CDesCArrayFlat* keyStrokeArray = UIContainer()->EditPaneWindow()->KeystrokeArray();
+    CDesCArrayFlat* phraseKeyStrokeArray = UIContainer()->EditPaneWindow()->PhraseShowKeyStrokeArray();
+    CDesCArrayFlat* phraseArray = UIContainer()->EditPaneWindow()->PhraseArray();
+    CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
+    TPtrC candidate = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
+    
+    RArray<TInt>* keyCodeArray = UIContainer()->EditPaneWindow()->KeycodeArray();
+    RArray<TInt>* keyCodePhraseArray = UIContainer()->EditPaneWindow()->PhraseKeycodeArray();
+    TBuf<KMaxKeystrokeCount> spellingText;
+    
+    UIContainer()->InputPane()->GetText( spellingText );
+    
+    //phraseZhuYinSpellingArray must keep same count with phraseArray
+    TInt delCount = phraseZhuYinSpellingArray->Count()-phraseArray->Count();//we can sure delCount>=0,impossible <0
+	if(delCount>0)
+		{
+		phraseZhuYinSpellingArray->Delete(phraseArray->Count(),delCount);//delete from tail 
+		}
+	phraseZhuYinSpellingArray->AppendL(spellingText); 
+    phraseArray->AppendL( candidate );
+    
+    TBuf<KMaxKeystrokeCount> keyStoke;
+    TInt replaceCount = 0;
+    TInt delimiterIndex = spellingText.Find( KDelimiter );
+    if ( KErrNotFound ==delimiterIndex )
+        {
+        delimiterIndex = -1;
+        }
+    TInt indexOfToneMark = GetIndexOfToneMark( spellingText );
+    if ( delimiterIndex != KErrNotFound && indexOfToneMark >= 0 )
+        {
+        replaceCount = Min( delimiterIndex, indexOfToneMark );
+        if ( delimiterIndex > indexOfToneMark )
+            {
+            replaceCount++;
+            }
+        }
+    else if ( delimiterIndex != KErrNotFound && indexOfToneMark == -1 )
+        {
+        replaceCount = delimiterIndex;
+        }
+    else if ( delimiterIndex == KErrNotFound && indexOfToneMark != -1 )
+        {
+        replaceCount = indexOfToneMark + 1;
+        }
+    else
+        {
+        replaceCount = spellingText.Length();
+        } 
+    for (TInt i = 0; i < replaceCount; i++ )
+        {
+        TPtrC ptr = keyStrokeArray->MdcaPoint( 0 );
+        keyStoke.Append( ptr );
+        keyStrokeArray->Delete( 0 );
+        // added for the keycode
+        TInt keyCodeValue = ( *keyCodeArray )[0];
+        keyCodePhraseArray->AppendL( keyCodeValue );
+        keyCodeArray->Remove( 0 );
+        }
+    phraseKeyStrokeArray->AppendL( keyStoke );
+
+    if ( GetValidKeystroke() )
+        {
+        iOwner->ChangeState( EZhuyinSpelling );
+        }
+    else
+        {
+        iOwner->ChangeState( EMiniQwertyEdit );
+        }
+    UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
+    RefreshSpellingPane();
+    RefreshCandidatePane();
+    ChangeCbaL();
+    }
+
+TInt TAknFepInputStateEditingMiniQwertyZhuyinPhrase::GetIndexOfToneMark( const TDesC& aText)
+    {
+    TInt indexOfToneMark = -1;
+    TInt num = sizeof(ZhuyinToneMap )/( sizeof(ZhuyinToneMap[0]));
+    TInt len = aText.Length();
+    for( TInt j = 0; j< len ;j++ )
+        {
+        indexOfToneMark = j;
+        TBuf<1> keyStorkeBuf = aText.Mid( j ,1 );
+        for (TInt i = 0; i<num; i++ )
+            {
+            if (  keyStorkeBuf[0] == ZhuyinToneMap[i].iValue  )
+                {
+                return indexOfToneMark;
+                }
+            }
+        }
+    return -1;
+    }
+
 // ---------------------------------------------------------------------------
 // TAknFepInputStateSpellingMiniQwertyZhuyin::HandleCommandL
 // Handling Command
--- a/inputmethods_plat/aknfep_pen_support_api/inc/aknfeppeninputenums.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/inputmethods_plat/aknfep_pen_support_api/inc/aknfeppeninputenums.h	Wed Sep 15 12:34:44 2010 +0300
@@ -235,7 +235,19 @@
     //Abc
     ECaseText = 4,
     //aBC
-    ECaseInverseText = 8
+    ECaseInverseText = 8,
+    // Paging 1/1 for number & special characters
+    ECaseNumberSpecialPaging11 = 0x10,
+    // Paging 1/2 for number & special characters    
+    ECaseNumberSpecialPaging12 = 0x20,
+    // Paging 2/2 for number & special characters
+    ECaseNumberSpecialPaging22 = 0x40,
+    // Paging 1/1 for number & special characters
+    ECaseNumberSpecialPagingArabic11 = 0x80,
+    // Paging 1/2 for number & special characters    
+    ECaseNumberSpecialPagingArabic12 = 0x100,
+    // Paging 2/2 for number & special characters
+    ECaseNumberSpecialPagingArabic22 = 0x200
     };
       
       
--- a/inputmethods_pub/ptiengine_iti_api/inc/PtiDefs.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/inputmethods_pub/ptiengine_iti_api/inc/PtiDefs.h	Wed Sep 15 12:34:44 2010 +0300
@@ -621,7 +621,13 @@
     EPtiCommandUserActionSetIndexOfActiveCandidate,
     EPtiCommandAddWordToUDBWithoutPunctMark,
     EPtiCommandGetSecondaryCandidate,   
-    EPtiCommandAutoCompletionOnToOff        //to signify that autocompletion is set from on to off in between typing  
+    EPtiCommandAutoCompletionOnToOff,        //to signify that autocompletion is set from on to off in between typing  
+    EPtiCommandSelectElement,                // Add for sogou learn word
+    EPtiCommandCancelSelectElement,          // Add for sogou learn word
+    EPtiCommandSetPinyinForLearnWord,        // Add for sogou learn word
+    EPtiCommandGetCoreID,                    // Add for get the current core id
+    EPtiCommandSetFuzzy,                     // Add to set fuzzy pinyin
+    EPtiCommandAddPhonebookEntry             // Add to learn phone book entry
     };
 
 /**
--- a/textinput/peninputarc/bwins/peninputlayoutcontrolU.DEF	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/bwins/peninputlayoutcontrolU.DEF	Wed Sep 15 12:34:44 2010 +0300
@@ -607,4 +607,13 @@
 	?HandleResourceChange@CFepLayoutPopupWnd@@UAEXH@Z @ 606 NONAME ; void CFepLayoutPopupWnd::HandleResourceChange(int)
 	?DisableLayoutDrawing@CFepUiLayout@@QAEXH@Z @ 607 NONAME ; void CFepUiLayout::DisableLayoutDrawing(int)
 	?BkMaskBmp@CFepUiBaseCtrl@@IAEPAVCFbsBitmap@@XZ @ 608 NONAME ; class CFbsBitmap * CFepUiBaseCtrl::BkMaskBmp(void)
+	??0CPopupBubbleCtrl@@IAE@ABVTRect@@PAVCFepUiLayout@@H@Z @ 609 NONAME ; CPopupBubbleCtrl::CPopupBubbleCtrl(class TRect const &, class CFepUiLayout *, int)
+	?SetBitmapParamL@CPopupBubbleCtrl@@QAEXPAVCFbsBitmap@@0VTAknsItemID@@11@Z @ 610 NONAME ; void CPopupBubbleCtrl::SetBitmapParamL(class CFbsBitmap *, class CFbsBitmap *, class TAknsItemID, class TAknsItemID, class TAknsItemID)
+	?Move@CPopupBubbleCtrl@@UAEXABVTPoint@@@Z @ 611 NONAME ; void CPopupBubbleCtrl::Move(class TPoint const &)
+	?SetTextL@CPopupBubbleCtrl@@QAEXABVTDesC16@@@Z @ 612 NONAME ; void CPopupBubbleCtrl::SetTextL(class TDesC16 const &)
+	?Hide@CPopupBubbleCtrl@@UAEXH@Z @ 613 NONAME ; void CPopupBubbleCtrl::Hide(int)
+	?NewL@CPopupBubbleCtrl@@SAPAV1@ABVTRect@@PAVCFepUiLayout@@H@Z @ 614 NONAME ; class CPopupBubbleCtrl * CPopupBubbleCtrl::NewL(class TRect const &, class CFepUiLayout *, int)
+	?SetTextFormat@CPopupBubbleCtrl@@QAEXVTAknTextLineLayout@@@Z @ 615 NONAME ; void CPopupBubbleCtrl::SetTextFormat(class TAknTextLineLayout)
+	?Draw@CPopupBubbleCtrl@@UAEXXZ @ 616 NONAME ; void CPopupBubbleCtrl::Draw(void)
+	??1CPopupBubbleCtrl@@UAE@XZ @ 617 NONAME ; CPopupBubbleCtrl::~CPopupBubbleCtrl(void)
 
--- a/textinput/peninputarc/eabi/peninputlayoutcontrolU.DEF	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/eabi/peninputlayoutcontrolU.DEF	Wed Sep 15 12:34:44 2010 +0300
@@ -741,4 +741,18 @@
 	_ZN14CFepUiBaseCtrl9BkMaskBmpEv @ 740 NONAME
 	_ZN16CVirtualKeyboard20HandleResourceChangeEi @ 741 NONAME
 	_ZN18CFepLayoutPopupWnd20HandleResourceChangeEi @ 742 NONAME
+	_ZN16CPopupBubbleCtrl13SetTextFormatE18TAknTextLineLayout @ 743 NONAME
+	_ZN16CPopupBubbleCtrl15SetBitmapParamLEP10CFbsBitmapS1_11TAknsItemIDS2_S2_ @ 744 NONAME
+	_ZN16CPopupBubbleCtrl4DrawEv @ 745 NONAME
+	_ZN16CPopupBubbleCtrl4HideEi @ 746 NONAME
+	_ZN16CPopupBubbleCtrl4MoveERK6TPoint @ 747 NONAME
+	_ZN16CPopupBubbleCtrl4NewLERK5TRectP12CFepUiLayouti @ 748 NONAME
+	_ZN16CPopupBubbleCtrl8SetTextLERK7TDesC16 @ 749 NONAME
+	_ZN16CPopupBubbleCtrlC1ERK5TRectP12CFepUiLayouti @ 750 NONAME
+	_ZN16CPopupBubbleCtrlC2ERK5TRectP12CFepUiLayouti @ 751 NONAME
+	_ZN16CPopupBubbleCtrlD0Ev @ 752 NONAME
+	_ZN16CPopupBubbleCtrlD1Ev @ 753 NONAME
+	_ZN16CPopupBubbleCtrlD2Ev @ 754 NONAME
+	_ZTI16CPopupBubbleCtrl @ 755 NONAME
+	_ZTV16CPopupBubbleCtrl @ 756 NONAME
 
--- a/textinput/peninputarc/group/bld.inf	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/group/bld.inf	Wed Sep 15 12:34:44 2010 +0300
@@ -92,6 +92,9 @@
 
 ../inc/peninputlayoutcontrolinc/peninputaknvkbpreviewbubblerenderer.h   |../../../inc/peninputaknvkbpreviewbubblerenderer.h
 ../inc/peninputlayoutcontrolinc/peninputvkbpreviewbubblerenderer.h      |../../../inc/peninputvkbpreviewbubblerenderer.h
+
+../inc/peninputlayoutcontrolinc/peninputpopupbubble.h                   |../../../inc/peninputpopupbubble.h
+
 //inline file
 ../inc/peninputlayoutcontrolinc/peninputlayout.inl                      |../../../inc/peninputlayout.inl
 ../inc/peninputlayoutcontrolinc/peninputlayoutbasecontrol.inl           |../../../inc/peninputlayoutbasecontrol.inl
--- a/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutbubblectrl.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutbubblectrl.h	Wed Sep 15 12:34:44 2010 +0300
@@ -177,7 +177,10 @@
 
 inline void CBubbleCtrl::GetText( TDes& aText )
     {
-    aText.Copy( *iText );
+    if (iText)
+        {
+        aText.Copy( *iText );
+        }
     }
 
 inline void CBubbleCtrl::SetLangCode( TInt aLangCode )
--- a/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutmultilineicf.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutmultilineicf.h	Wed Sep 15 12:34:44 2010 +0300
@@ -506,13 +506,19 @@
                            
     inline TBool TextSelectionOn();
 
-    void SetInlineStateL(TBool aInline, 
+    /**
+     * @return ETrue if redraw is required.
+     */
+    TBool SetInlineStateL(TBool aInline, 
                          TInt aStartPos = 0, 
                          TInt aEndPos = 0, 
                          TBool aNoMatchState = EFalse, 
                          const TDesC& aNoMatchText = KNullDesC);
 
-    void SetAutoCompleteStateL(TBool aAutoComplete, 
+    /**
+     * @return ETrue if redraw is required.
+     */
+    TBool SetAutoCompleteStateL(TBool aAutoComplete, 
                                TInt aStartPos = 0, 
                                TInt aMidPos = 0,
                                TInt aEndPos = 0);
@@ -562,13 +568,22 @@
     
     TBool IsTextPosValid(TInt aPos);
     
-    void UpdateTextL(const TFepInputContextFieldData& aData);
+    /**
+     * @return ETrue if text was updated.
+     */
+    TBool UpdateTextL(const TFepInputContextFieldData& aData);
     
     static TInt UpdateSecretTextL(TAny* aEditArea);
     
-    void SetSelectionL(TCursorSelection aCurSel);
+    /**
+     * @return ETrue if redraw is required.
+     */
+    TBool SetSelectionL(TCursorSelection aCurSel);
 
-    void UpdateNoMatchTextL(TInt aPos, const TDesC& aNoMatchText, TBool aNoMatchState);
+    /**
+     * @return ETrue if text was modified.
+     */
+    TBool UpdateNoMatchTextL(TInt aPos, const TDesC& aNoMatchText, TBool aNoMatchState);
     
     void RemoveOverlappedCtrlIfNeeded();
 
@@ -604,11 +619,19 @@
     
     void ResetApplyFont();
     
-    void TryDisplayMaxTextL(TInt aCursorPos);
+    /**
+     * Scrolls text so that cursor becomes visible.
+     * 
+     * @return ETrue if text was scrolled.
+     */
+    TBool TryDisplayMaxTextL(TInt aCursorPos);
     
     TBool MoveCursorL( const TPoint& aPt, TInt& aCursorPos );
     
-    void ResetViewHeightL();
+    /**
+     * @return ETrue if redraw is required.
+     */
+    TBool ResetViewHeightL();
     
     void SetMfneTextL(const TFepInputContextFieldData& aData);
     
@@ -624,7 +647,7 @@
     
     TBool HighlightOverlapWithBubble( const TRect& aRect );
     
-    void AdjustSelectionL( const TCursorSelection& aCurSel );
+    TBool AdjustSelectionL( const TCursorSelection& aCurSel );
     
     void ApplyLineSpaceFormatL( TInt aLineHeight );
     void CalcPromptTextRectL();        
--- a/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvirtualkeyctrl.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvirtualkeyctrl.h	Wed Sep 15 12:34:44 2010 +0300
@@ -174,7 +174,7 @@
      *
      * @since S60 V5.0     
      */            
-    void DrawKeyText(CFbsBitGc* aGc);
+    void DrawKeyText(CFbsBitGc* aGc, const TRect& aRect);
     
     /**
      * Redraw and update the key
--- a/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.h	Wed Sep 15 12:34:44 2010 +0300
@@ -455,6 +455,43 @@
     inline void SetKeySkinId(TVirtualKeyBmpType aBmpType, TAknsItemID aSkinId);
     inline TAknsItemID KeySkinId(TVirtualKeyBmpType aBmpType);
     inline void SetTextLineLayout(TAknTextLineLayout aTextLine, TVirtualKeyTextPos aPos);
+    
+    /**
+     * Set the star icon rect
+     *
+     * @since S60 V5.0
+     * @param aRect the rect of the star icon
+     * @return none
+     */
+    inline void SetStarIconRect( const TRect& aRect );
+    
+    /**
+     * Set the shift icon rect
+     *
+     * @since S60 V5.0
+     * @param aRect the rect of the shift icon
+     * @return none
+     */
+    inline void SetShiftIconRect( const TRect& aRect );
+    
+    /**
+     * Get the star icon rect
+     *
+     * @since S60 V5.0
+     * @param none
+     * @return the rect of the star icon
+     */
+    inline TRect StarIconRect();
+    
+    /**
+     * Get the shift icon rect
+     *
+     * @since S60 V5.0
+     * @param none
+     * @return the rect of the shift icon
+     */
+    inline TRect ShiftIconRect();
+    
     inline TAknTextLineLayout TextLineLayout(TVirtualKeyTextPos aPos);
     inline void SetTextLineLayout(TAknTextLineLayout aTextLine);
     inline TAknTextLineLayout TextLineLayout();
@@ -911,7 +948,16 @@
      */    
     CFepUiKeyboardExt* iExt;
 
-
+    /**
+     * The star icon rect
+     */
+    TRect iStarIconRect;
+    
+    /**
+     * The shift icon rect
+     */
+    TRect iShiftIconRect;
+    
 protected:
     //void HandleResourceChange(TInt aType);
     virtual IMPORT_C void HandleResourceChange(TInt aType);
--- a/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.inl	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.inl	Wed Sep 15 12:34:44 2010 +0300
@@ -148,6 +148,50 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// CVirtualKeyboard::SetStarIconRect
+// Set the rect of the star icon
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+inline void CVirtualKeyboard::SetStarIconRect( const TRect& aRect )
+	{
+	iStarIconRect = aRect;
+	}
+
+// ---------------------------------------------------------------------------
+// CVirtualKeyboard::SetShiftIconRect
+// Set the rect of the shift icon
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+inline void CVirtualKeyboard::SetShiftIconRect( const TRect& aRect )
+	{
+	iShiftIconRect = aRect;
+	}
+
+// ---------------------------------------------------------------------------
+// CVirtualKeyboard::StarIconRect
+// Get the rect of the star icon
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+inline TRect CVirtualKeyboard::StarIconRect()
+	{
+	return iStarIconRect;
+	}
+
+// ---------------------------------------------------------------------------
+// CVirtualKeyboard::ShiftIconRect
+// Get the rect of the shift icon
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+inline TRect CVirtualKeyboard::ShiftIconRect()
+	{
+	return iShiftIconRect;
+	}
+
 inline TAknTextLineLayout CVirtualKeyboard::TextLineLayout(TVirtualKeyTextPos aPos)
     {
     if (aPos >= 0 && aPos <= EPosLast)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputpopupbubble.h	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2005-2005 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file of CPopupBubbleCtrl
+*
+*/
+
+#ifndef C_CPOPUPBUBBLECTRL_H
+#define C_CPOPUPBUBBLECTRL_H
+
+#include <peninputlayoutbasecontrol.h>
+#include <AknsConstants.h>
+#include <AknsItemID.h>
+#include <AknLayout2Def.h>
+#include <coecntrl.h>
+#include <aknsskininstance.h>
+#include <e32cmn.h>
+
+class CPopupBubbleCtrl;
+
+/**
+ *  CPopupBubbleWnd
+ *  
+ *  CCoeControl based class used for drawing
+ * 
+ */
+NONSHARABLE_CLASS(CPopupBubbleWnd) : public CCoeControl
+    {
+public:
+    /**
+     * Destructor.        
+     */
+    virtual ~CPopupBubbleWnd();
+
+    /**
+     * Symbian constructor.        
+     *
+     * @param aRect control rect
+     * @param aParent parent control
+     * @return An instance of CPopupBubbleWnd class        
+     */     
+    static CPopupBubbleWnd* NewL(const TRect& aRect, CPopupBubbleCtrl& aParent);
+    
+    /**
+     * Symbian constructor.       
+     *
+     * @param aRect control rect
+     * @param aParent parent control
+     * @return An instance of CPopupBubbleWnd class        
+     */
+    static CPopupBubbleWnd* NewLC(const TRect& aRect, CPopupBubbleCtrl& aParent);
+
+    /**
+     * Draw control.       
+     *
+     * @param aRect control rect     
+     */    
+    void Draw(const TRect& aRect) const;
+    
+    /**
+     * Test transparency support.       
+     *
+     * @return ETrue if transparency is supported, otherwise EFalse.     
+     */    
+    inline TBool SupportTransparent() const
+        {
+        return iSupportTransparent;
+        };
+    
+    /**
+     * Handle size change.       
+     */  
+    void SizeChanged();
+    
+    /**
+     * Handle resource change.       
+     * @param aType resource change event.
+     */ 
+    void HandleResourceChange(TInt aType);
+    
+protected:
+    
+    /**
+    * Symbian OS 2nd phase constructor 
+    */
+    void ConstructL(const TRect& aRect);
+    
+    /**
+    * C++ constructor
+    * @param aParent CPopupBubbleCtrl parent control
+    */
+    CPopupBubbleWnd(CPopupBubbleCtrl& parent);
+ 
+    /**
+    * Size images used for drawing
+    * @param aId Skin item Id
+    * @param aRect Rect to be used for sizing
+    * @param aBitmap Bitmap to be sized 
+    * @param aDevice BitmapDevice to be used for sizing
+    * @param aBitGc BitGc to be used for sizing
+    */    
+    void SizeImage(TAknsItemID aId, TRect aRect, CFbsBitmap* aBitmap, CFbsBitmapDevice* aDevice, CFbsBitGc* aBitGc );
+    
+private:
+    /**
+     * Draw transparent background.       
+     *
+     * @param aRect control rect     
+     */    
+    void DrawTransparentBackground(const TRect& aRect) const;    
+    
+private:
+    
+    enum TItems
+        {
+        ETempItem = 0,
+        ELeftItem,
+        ERightItem,
+        EMiddleItem,
+        ELastItem
+        };
+    
+    RPointerArray<CFbsBitmap> iBitmap;
+    RPointerArray<CFbsBitmapDevice> iDevice;
+    RPointerArray<CFbsBitGc> iBitGc; 
+    TRect iRect[ELastItem];
+    
+    CPopupBubbleCtrl& iParent;
+    TBool iSupportTransparent;
+    };
+
+/**
+ *  CPopupBubbleCtrl
+ *  
+ *  Bubble with own window
+ * 
+ */
+class CPopupBubbleCtrl: public CFepUiBaseCtrl
+    {
+public: 
+    //constructor and destructor
+    /**
+     * Destructor.        
+     */                  
+    IMPORT_C virtual ~CPopupBubbleCtrl();
+    /**
+     * Symbian constructor.        
+     *
+     * @param aRect The rectangle area for this control
+     * @param aUiLayout Ui layout who contains this control. Ownership not transferred
+     * @param aControlId control Id
+     * @return An instance of CPopupBubbleCtrl class        
+     */
+    IMPORT_C static CPopupBubbleCtrl* NewL(const TRect& aRect,
+                             CFepUiLayout* aUiLayout,
+                             TInt aCtrlId);
+    
+    
+    /**
+     * SetIconOffsetAndSize
+     *
+     * @param aOffset The offset to be moved
+     * @param aOffset The size to be set
+     */    
+    inline void SetIconOffsetAndSize( 
+            const TSize& aOffset, const TSize& aSize );
+    
+    /**
+     * Draw the control
+     *
+     */      
+    IMPORT_C void Draw();
+    
+    
+    /**
+     * Move the control
+     *
+     * @param aOffset The offset to be moved
+     */    
+    IMPORT_C void Move(const TPoint& aOffset);
+
+    /**
+     * Set bitmap parameters
+     *
+     * @param aBmpId Bitmap to be used. Can be NULL
+     * @param aMaskBmpId Mask to be used. Can be NULL
+     * @param aFirstBmpId Skin Bitmap id.
+     * @param aMiddleBmpId Skin Bitmap id.
+     * @param aLastBmpId Skin Bitmap id.
+     */    
+    IMPORT_C void SetBitmapParamL(
+                        CFbsBitmap* aBmpId,
+                        CFbsBitmap* aMaskBmpId,
+                        TAknsItemID aFirstBmpId,
+                        TAknsItemID aMiddleBmpId,
+                        TAknsItemID aLastBmpId);                            
+
+    /**
+     * Hide the control
+     *    
+     * @param aShowFlag visibility flag. ETrue if hidden, otherwise EFalse
+     */
+    IMPORT_C void Hide(TBool aShowFlag); 
+
+    /**
+     * Set text format used for text drawing
+     *    
+     * @param aTextFormat bubble text format
+     */    
+    IMPORT_C void SetTextFormat(TAknTextLineLayout aTextFormat);
+
+    /**
+     * Set bubble text
+     *    
+     * @param aText descriptor containing bubble text
+     */        
+    IMPORT_C void SetTextL(const TDesC& aText );
+
+    /**
+     * Get bubble text
+     *    
+     * @param aText descriptor to be filled in with data
+     */     
+    inline void GetText( TDes& aText );
+    
+    /**
+     * Check if text is set
+     *    
+     * @return ETrue is text was set. Otherwise EFalse.
+     */     
+    inline TBool HasText();
+
+    /**
+     * Set text color index used for drawing
+     *    
+     * @param aTxtClrIndex Color index.
+     */     
+    inline void SetTextColorIndex( TInt aTxtClrIndex );
+
+    /**
+     * Get text color index used for drawing
+     *    
+     * @return Color index.
+     */         
+    inline TInt TextColorIndex() const;
+protected:
+    
+    /**
+     * C++ constructor.        
+     *
+     * @param aRect The rectangle area for this control
+     * @param aUiLayout Ui layout who contains this control. Ownership not transferred
+     * @param aControlId control Id
+     */    
+    IMPORT_C CPopupBubbleCtrl(const TRect& aRect,
+                CFepUiLayout* aUiLayout,
+                TInt aCtrlId);
+private:
+    CFbsBitmap* iForgroundBmp;
+    CFbsBitmap* iForgroundBmpMask;
+    
+    TAknsItemID iFirstBmpId;
+    TAknsItemID iMiddleBmpId;
+    TAknsItemID iLastBmpId;
+      
+    HBufC* iText;
+    TAknTextLineLayout iTextFormat;
+    TInt iTextColorIndex;
+
+    TSize iIconOffset;
+    TSize iIconSize;    
+    
+    friend class CPopupBubbleWnd;
+    };
+   
+inline void CPopupBubbleCtrl::SetTextColorIndex( TInt aTxtClrIndex )
+    {
+    iTextColorIndex = aTxtClrIndex; 
+    }
+
+inline void CPopupBubbleCtrl::SetIconOffsetAndSize( 
+        const TSize& aOffset, const TSize& aSize )
+    {
+    iIconOffset = aOffset;
+    iIconSize = aSize;
+    }
+
+inline void CPopupBubbleCtrl::GetText( TDes& aText )
+    {
+    if (iText)
+        {
+        aText.Copy( *iText );
+        }
+    }
+
+inline TBool CPopupBubbleCtrl::HasText()
+    {
+    TBool ret = EFalse;
+
+    if (iText && iText->Length() > 0)
+        {
+        ret = ETrue;
+        }
+
+    return ret;
+    }
+
+/******************************************************************************/
+
+#endif //C_CPOPUPBUBBLECTRL_H
--- a/textinput/peninputarc/inc/pensrvcliinc/peninputsrvobserver.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/inc/pensrvcliinc/peninputsrvobserver.h	Wed Sep 15 12:34:44 2010 +0300
@@ -104,7 +104,17 @@
      */
     TInt RunError(TInt aError);
 private:
-    virtual TBool HandleServerEventL(TInt aEventId);	
+    virtual TBool HandleServerEventL(TInt aEventId);
+
+    /**
+     * Stop the server
+     *
+     * @since Symbian^3
+     *
+     * @param none
+     * @return void
+     */
+    void HandleServerTerminatedL();
 
 public:
     /**
--- a/textinput/peninputarc/src/peninputclient/penclientimpl.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputclient/penclientimpl.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -992,6 +992,16 @@
 TInt RPeninputServerImpl::AddPenUiActivationHandler(
                       MPenUiActivationHandler* aHandler,TInt aType)
     {
+    // To avoid add repeatedly
+    for (TInt i=0; i<iPenUiNotificationHandler.Count(); i++)
+        {
+        TUiNotificationHandler handler = iPenUiNotificationHandler[ i ];
+        if( handler.iHandler == aHandler )
+            {
+            return KErrNone;
+            }
+        }
+    
     iPenUiNotificationHandler.Append(TUiNotificationHandler(aHandler,aType));
     return KErrNone;            
     }
@@ -1262,6 +1272,15 @@
     
     if(iStatus.Int() < 0)
         {
+        
+        // the pen input server has been terminated, so there is no need to post message again
+        // just notify the handler the message of ESignalServerExit      
+        if ( iStatus.Int() == KErrServerTerminated )
+            {
+            HandleServerTerminatedL();
+            return;
+            }
+        
         //check server status
         RThread srvThread;
         TInt err = srvThread.Open(iSrvThreadId);
@@ -1274,9 +1293,7 @@
             }
         if(err != KErrNone || exitReason != 0) //server has exited
             {
-            iServerExit  = ETrue;
-            iPeninputServer->HandleServerExit();             
-            iHandler->HandleServerEventL(ESignalServerExit);
+            HandleServerTerminatedL();
             return;
             }
         }
@@ -1301,6 +1318,26 @@
     }
 
 // ---------------------------------------------------------------------------
+// CPeninputServerObserver::HandleServerTerminatedL()
+// ---------------------------------------------------------------------------
+//    
+void CPeninputServerObserver::HandleServerTerminatedL()
+    {
+    iServerExit  = ETrue;
+        
+    if ( iPeninputServer )
+        {
+        iPeninputServer->HandleServerExit();                 
+        }
+        
+    if ( iHandler )
+        {
+        iHandler->HandleServerEventL( ESignalServerExit ); 
+        }
+
+    }    
+    
+// ---------------------------------------------------------------------------
 // CPeninputServerObserver::RunError
 // ---------------------------------------------------------------------------
 //
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbubblectrl.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutbubblectrl.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -102,7 +102,9 @@
 		
     iForgroundBmp = aBmpId;
     iForgroundBmpMask = aMaskBmpId;
-    iBgSkinId = aBgSkinId;    
+    iBgSkinId = aBgSkinId;
+    
+    iNeedRedraw = ETrue;
     }
 
 EXPORT_C void CBubbleCtrl::Popup(const TRect& aRect)
@@ -276,7 +278,9 @@
     iForgroundBmpMask = aMaskBmpId;
     iFirstBmpId = aFirstBmpId;
     iMiddleBmpId =  aMiddleBmpId;
-    iLastBmpId = aLastBmpId;    
+    iLastBmpId = aLastBmpId;
+    
+    iNeedRedraw = ETrue;    
     }
 
 EXPORT_C void CBubbleCtrl::Close()
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutcontrol.mmp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutcontrol.mmp	Wed Sep 15 12:34:44 2010 +0300
@@ -59,6 +59,7 @@
 SOURCE                  peninputfloatbubble.cpp 
 SOURCE                  peninputaknvkbpreviewbubblerenderer.cpp
 SOURCE                  peninputtapsettingmanager.cpp
+SOURCE                  peninputpopupbubble.cpp
 
 userinclude             ../../inc/peninputlayoutcontrolinc
 
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutmultilineicfeditor.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -643,9 +643,11 @@
     	
     iLeadingEdge = icfdata.iLeadingEdge;
 
+    TInt draw = icfdata.iCmd == EPeninputICFSetCurSel ? 0 : 1;
+    
     if (icfdata.iFlag != EFepICFDataInlineNoMatch && iNoMatchState)
         {
-        UpdateNoMatchTextL(iPreInlineEndPos, KNullDesC, EFalse);
+        draw += UpdateNoMatchTextL(iPreInlineEndPos, KNullDesC, EFalse);
         }
 
     switch (icfdata.iCmd)
@@ -683,7 +685,7 @@
             RecalcualteTextPositionL();
             //SetMsgBubbleRect();
             SetMsgBubbleRectAccordingToLanguage();
-            Draw();
+//            Draw();
             }
             break;
         case EPeninputICFReplace:
@@ -744,13 +746,13 @@
             }
         }
         
-    UpdateTextL(icfdata);    
+    draw += UpdateTextL(icfdata);    
     
     // Need to set selection visible before set selection for textview
     SetCursorSelVisibility( icfdata.iCursorSelVisible );    
     
-    SetSelectionL(icfdata.iCurSel);
-    ResetViewHeightL();
+    draw += SetSelectionL(icfdata.iCurSel);
+    draw += ResetViewHeightL();
     
     if (icfdata.iMidPos == 0)
         {
@@ -759,13 +761,13 @@
         // set to inline state
         if (icfdata.iText.Locate(KParagraphSeperator) == KErrNotFound)
             {
-            SetAutoCompleteStateL(EFalse);
+            draw += SetAutoCompleteStateL(EFalse);
             icfdata.iFlag == EFepICFDataInlineNoMatch ? 
-                                                      SetInlineStateL(ETrue, icfdata.iStartPos, 
-                                                                      icfdata.iCurSel.iCursorPos, 
-                                                                      ETrue, icfdata.iText) :
-                                                      SetInlineStateL(ETrue, icfdata.iStartPos, 
-                                                                      icfdata.iCurSel.iCursorPos);
+                    draw += SetInlineStateL( ETrue, icfdata.iStartPos, 
+                                             icfdata.iCurSel.iCursorPos, 
+							                 ETrue, icfdata.iText) :
+                    draw += SetInlineStateL(ETrue, icfdata.iStartPos, 
+                                            icfdata.iCurSel.iCursorPos);
             }
         }
     else if (icfdata.iMidPos > 0)
@@ -773,7 +775,7 @@
         // auto complete state
         // Q: does insertion point need to be shown when auto complete?
         // on the assumption that insertion point do not shown
-        SetAutoCompleteStateL( ETrue, icfdata.iStartPos, 
+        draw += SetAutoCompleteStateL( ETrue, icfdata.iStartPos, 
                                icfdata.iStartPos + icfdata.iText.Length() - icfdata.iMidPos, 
                                icfdata.iCurSel.iCursorPos );
         }
@@ -781,47 +783,52 @@
         {
         // icfdata.iMidPos < 0, normal state
         //
-        SetInlineStateL(EFalse, icfdata.iStartPos, icfdata.iCurSel.iCursorPos);
-        SetAutoCompleteStateL(EFalse);
-        
+        draw += SetInlineStateL(EFalse, icfdata.iStartPos, icfdata.iCurSel.iCursorPos);
+        draw += SetAutoCompleteStateL(EFalse);
         }    
 
     // after inline adjust, cusor position may be updated
     if( bScroll )
         {
-        TryDisplayMaxTextL(iCursorSel.iCursorPos);
+        draw += TryDisplayMaxTextL(iCursorSel.iCursorPos);
         }
-    
-    iTextView->DrawL(iViewRect);    
-    //if(iMsgBubble)    
-//        iMsgBubble->Draw();   
 
     iInsertionPoint->SetVisible( EFalse ); 
 
     SetCursorVisible(icfdata.iCursorVisibility);
     
-    if (AbleToDraw())
+    if ( AbleToDraw() )
         {
-        UpdateAreaImmed(Rect(),EFalse);    
+        if(draw > 0)
+        	{
+            iTextView->DrawL(iViewRect);        	
+        	}
+        	
+        UpdateAreaImmed(iViewRect,EFalse);    
         }
     }
 
-void CFepLayoutMultiLineIcfEditor::SetSelectionL(TCursorSelection aCurSel)
+TBool CFepLayoutMultiLineIcfEditor::SetSelectionL(TCursorSelection aCurSel)
     {
+    TBool changed = EFalse;
+    
     if ( !IsTextPosValid(aCurSel.LowerPos()) || 
          !IsTextPosValid(aCurSel.HigherPos()) )
         {
-        return;
+        return changed;
         }
     
-    AdjustSelectionL( aCurSel );
+    changed = AdjustSelectionL( aCurSel );
     
     if ( iLayout->FirstLineInBand() != 0 && iLineMaxCount > 1 &&
         iPromptTextLen > 0 && aCurSel.iCursorPos == iPromptTextLen )
     	{
-        iTextView->SetViewLineAtTopL( 1 );	
+        if ( iTextView->SetViewLineAtTopL( 1 ) != TPoint( 0, 0 ) )
+            {
+            changed = ETrue;
+            }
     	}
-        
+
     RecalcualteTextPositionL();
     
     if ( iCursorSel.Length() > 0 )
@@ -841,7 +848,9 @@
         //SetMsgBubbleRect();
 		SetMsgBubbleRectAccordingToLanguage();
         SetInfoBubbleRect();
-        }    
+        }   
+    
+    return changed;
     }
 
 TBool CFepLayoutMultiLineIcfEditor::HighlightOverlapWithBubble( const TRect& aRect )
@@ -892,11 +901,11 @@
     }
     
 // for secret editor
-void CFepLayoutMultiLineIcfEditor::UpdateTextL(const TFepInputContextFieldData& aData)
+TBool CFepLayoutMultiLineIcfEditor::UpdateTextL(const TFepInputContextFieldData& aData)
     {
     if (!iTextIsSecret)
         {
-        return;
+        return EFalse;
         }
 
     switch (aData.iCmd)
@@ -915,7 +924,7 @@
             iTextView->HandleInsertDeleteL
                 ( TCursorSelection( iRichText->DocumentLength(), iPromptTextLen ), 0 );
             }
-            break;
+            return ETrue;
         case EPeninputICFReplace:
             {                    
             if (iSecretTextTimer->IsActive())
@@ -961,13 +970,15 @@
                                  aData.iText.Length()>1?KSecretInstantShowTimer:KSecretUpdateTimer,
                                  KSecretUpdateTimer, TCallBack(UpdateSecretTextL, this));
             }
-            break;
+            return ETrue;
         case EPeninputICFSetCurSel:
         default:
             {
             break;
             }
         }
+    
+    return EFalse;
     }
 
 TInt CFepLayoutMultiLineIcfEditor::UpdateSecretTextL(TAny* aEditArea)
@@ -1333,20 +1344,21 @@
     SetMsgBubbleRectAccordingToLanguage();
     }
 
-void CFepLayoutMultiLineIcfEditor::ResetViewHeightL()
+TBool CFepLayoutMultiLineIcfEditor::ResetViewHeightL()
     {
-    const TInt height = iLayout->FormattedHeightInPixels();
     const TInt lineCount=iLayout->NumFormattedLines();
+
     if ( lineCount <= 0 )
         {
-        return;
+        return EFalse;
         }
         
+    const TInt height = iLayout->FormattedHeightInPixels();
     TInt lineHeight = (height+lineCount-1) / lineCount;
     
     if ( iFormatLineHeight == lineHeight )
         {
-        return;
+        return EFalse;
         }
         
     if ( lineHeight > iMaxIcfEditorHeight )
@@ -1380,6 +1392,8 @@
     	iViewRect.iBr.iY -= margin;
     	}
     iTextView->SetViewRect(iViewRect);
+    
+    return ETrue;
     }
 
 void CFepLayoutMultiLineIcfEditor::SetMsgBubbleRectAccordingToLanguage()
@@ -2512,12 +2526,12 @@
     return (aPos >= 0 && aPos <= iRichText->DocumentLength());
     }
 
-void CFepLayoutMultiLineIcfEditor::UpdateNoMatchTextL(TInt aPos, const TDesC& aNoMatchText, 
+TBool CFepLayoutMultiLineIcfEditor::UpdateNoMatchTextL(TInt aPos, const TDesC& aNoMatchText, 
                                                       TBool aNoMatchState)
     {
     if ( iNoMatchState == aNoMatchState )
         {
-        return;
+        return EFalse;
         }
         
     if (aNoMatchState)
@@ -2534,7 +2548,9 @@
         iRichText->DeleteL(aPos, 1);
         iTextView->HandleInsertDeleteL(TCursorSelection(aPos, aPos),1);
         SetSelectionL( TCursorSelection( aPos - 1, aPos - 1 ) );
-        }         
+        }     
+    
+    return ETrue;
     }
 
 void CFepLayoutMultiLineIcfEditor::SetPromptTextFormatL(TInt aPromptTextLen)
@@ -2643,35 +2659,54 @@
         }
     }
 
-void CFepLayoutMultiLineIcfEditor::SetInlineStateL(TBool aInline, 
+TBool CFepLayoutMultiLineIcfEditor::SetInlineStateL(TBool aInline, 
                                              TInt aStartPos, 
                                              TInt aEndPos, 
                                              TBool aNoMatchState, 
                                              const TDesC& aNoMatchText)
     {
-    if (aInline)
+    TInt oldState = iState;
+    
+    if ( aInline )
+        {
         iState = CFepLayoutMultiLineIcf::EIcfInline;
+        }
     else
         {
         iState = CFepLayoutMultiLineIcf::EIcfNormal;
-        UpdateNoMatchTextL(iPreInlineEndPos, KNullDesC, EFalse);
         }
+    
+    TBool changed = ( oldState != iState );
+    
+    if ( changed )
+        {
+        if ( iState == CFepLayoutMultiLineIcf::EIcfNormal )
+            {
+            UpdateNoMatchTextL(iPreInlineEndPos, KNullDesC, EFalse);
+            }
 
-    SetSpecialStateL(aInline, 
-                     aStartPos, 
-                     aEndPos, 
-                     iPreInlineStartPos, 
-                     iPreInlineEndPos, 
-                     EAttFontUnderline, 
-                     aNoMatchState, 
-                     aNoMatchText);
+        SetSpecialStateL(aInline, 
+                         aStartPos, 
+                         aEndPos, 
+                         iPreInlineStartPos, 
+                         iPreInlineEndPos, 
+                         EAttFontUnderline, 
+                         aNoMatchState, 
+                         aNoMatchText);
+        }
+    
+    return changed;
     }
 
-void CFepLayoutMultiLineIcfEditor::SetAutoCompleteStateL(TBool aAutoComplete, 
+TBool CFepLayoutMultiLineIcfEditor::SetAutoCompleteStateL(TBool aAutoComplete, 
                                                    TInt aStartPos, 
                                                    TInt aMidPos,
                                                    TInt aEndPos)
     {
+    TBool changed = ( iAutoComplete != aAutoComplete );
+    // If auto is on, we need draw every time, as grey part is not making the text changed
+    // if we use traditional way to check change, auto part is not turn to black when grey part is there.
+    changed = iAutoComplete; 
     iAutoComplete = aAutoComplete;
     
     if ( aAutoComplete )
@@ -2683,19 +2718,24 @@
         iState = CFepLayoutMultiLineIcf::EIcfNormal;
         }
         
-    SetSpecialStateL(aAutoComplete, 
-                     aStartPos, 
-                     aMidPos, 
-                     iPreInlineStartPos, 
-                     iPreInlineEndPos, 
-                     EAttFontUnderline);
-                     
-    SetSpecialStateL(aAutoComplete, 
-                     aMidPos, 
-                     aEndPos, 
-                     iPreAutoStartPos, 
-                     iPreAutoEndPos, 
-                     EAttColor);
+    if ( changed )
+        {
+        SetSpecialStateL(aAutoComplete, 
+                         aStartPos, 
+                         aMidPos, 
+                         iPreInlineStartPos, 
+                         iPreInlineEndPos, 
+                         EAttFontUnderline);
+                         
+        SetSpecialStateL(aAutoComplete, 
+                         aMidPos, 
+                         aEndPos, 
+                         iPreAutoStartPos, 
+                         iPreAutoEndPos, 
+                         EAttColor);
+        }
+    
+    return changed;
     }
 
 TAknsItemID CFepLayoutMultiLineIcfEditor::BgImgSkinId() const
@@ -2831,8 +2871,10 @@
     TRAP_IGNORE(SetFontL(font));
     }
 
-void CFepLayoutMultiLineIcfEditor::TryDisplayMaxTextL( TInt aCursorPos )
+TBool CFepLayoutMultiLineIcfEditor::TryDisplayMaxTextL( TInt aCursorPos )
     {
+    TBool scrolled = EFalse;
+    
     iTextView->FinishBackgroundFormattingL();
     TInt lineIndex = iLayout->GetLineNumber( aCursorPos );
 
@@ -2843,10 +2885,12 @@
         CalculateCursorPos(cursorPt);
         if ( !iViewRect.Contains( cursorPt ) && ( lineIndex + 1 ) > ( iLineMaxCount - 1 ) )
             {
-            iTextView->SetViewLineAtTopL(( lineIndex + 1 ) - ( iLineMaxCount - 1 ));
-            RecalcualteTextPositionL();
-            //SetMsgBubbleRect();
-            SetMsgBubbleRectAccordingToLanguage();
+            if ( iTextView->SetViewLineAtTopL(( lineIndex + 1 ) - ( iLineMaxCount - 1 )) != TPoint( 0, 0 ) )
+                {
+                scrolled = ETrue;
+                RecalcualteTextPositionL();
+                SetMsgBubbleRectAccordingToLanguage();
+                }
             }
         }
     
@@ -2860,15 +2904,18 @@
                             - iViewRect.iTl.iY) / iFormatLineHeight + 1;
         if( lineCursor < pageCount )
             {
-            
-            iTextView->SetViewLineAtTopL( 
-                                   lineCount - pageCount + 1 < 1 ? 1 : lineCount - pageCount + 1 );
-            
-            RecalcualteTextPositionL();
-            //SetMsgBubbleRect();
-            SetMsgBubbleRectAccordingToLanguage();
+            if ( iTextView->SetViewLineAtTopL(
+                    lineCount - pageCount + 1 < 1 ? 1 : lineCount - pageCount + 1 ) 
+                    != TPoint( 0, 0 ) )
+                {
+                scrolled = ETrue;
+                RecalcualteTextPositionL();
+                SetMsgBubbleRectAccordingToLanguage();
+                }
             }
         }
+    
+    return scrolled;
     }
     
 void CFepLayoutMultiLineIcfEditor::DrawIcfBackground( CFbsBitGc& /*aGc*/, const TRect& aDrawnRect, 
@@ -2892,14 +2939,18 @@
     iRichText->Extract( aBuf, aPos + iPromptTextLen, aLength);
     } 
 
-void CFepLayoutMultiLineIcfEditor::AdjustSelectionL( const TCursorSelection& aCurSel )
+TBool CFepLayoutMultiLineIcfEditor::AdjustSelectionL( const TCursorSelection& aCurSel )
     {
     if (!IsTextPosValid(aCurSel.LowerPos()) || 
     !IsTextPosValid(aCurSel.HigherPos()) )
 		{
-		return;
+		return EFalse;
 		}
-
+    if (iCursorSel.iAnchorPos == aCurSel.iAnchorPos
+        && iCursorSel.iCursorPos == aCurSel.iCursorPos)
+        {
+        return EFalse;
+        }
     iCursorSel = aCurSel;   
    
     if ( BelongToPromptText(aCurSel.iCursorPos) )
@@ -2917,6 +2968,8 @@
  
     iTextView->SetSelectionL( iCursorSel );
     iTextView->SetSelectionVisibilityL( iCursorSelVisible );
+	
+	return ETrue;
     }  
 
 void CFepLayoutMultiLineIcfEditor::ReDrawRect(const TRect& aRect)
--- a/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutvkbkeyctrl.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputlayoutvkbkeyctrl.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -122,7 +122,7 @@
 // (other items were commented in a header).
 // ---------------------------------------------------------------------------
 //        
-void CVirtualKeyCtrl::DrawKeyText(CFbsBitGc* aGc)  
+void CVirtualKeyCtrl::DrawKeyText(CFbsBitGc* aGc, const TRect& aRect)  
     {
     TBool textlineset = EFalse;
 
@@ -136,7 +136,7 @@
             if (iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) != KNullDesC)
                 {
                 TAknLayoutText textLayout;
-                textLayout.LayoutText(GetRect(), 
+                textLayout.LayoutText(aRect, 
                                       iKeyboard->TextLineLayout(TVirtualKeyTextPos(i)));
 				TRgb color( KRgbBlack );  // sane default for nonskinned case			    
 			    if ( AknsUtils::AvkonSkinEnabled() )
@@ -151,10 +151,12 @@
 				if( iKeyboard->ShiftIcon() &&
 					iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyShiftCharacter )
 					{
-					//CFbsBitGc* gc = GetGc();//static_cast<CFbsBitGc*>(BitGc());
+				    // Get the rect of the shift icon
+					TRect shiftIconDrawRect = iKeyboard->ShiftIconRect();
+					shiftIconDrawRect.Move( iKeyboard->Rect().iTl );
 					AknPenInputDrawUtils::DrawColorIcon( iKeyboard->ShiftIcon(),
 														 *aGc,
-														 textLayout.TextRect() );	
+														 shiftIconDrawRect );	
 					}
 				else if(iKeyboard->StarIcon() &&
 						iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter )
@@ -162,7 +164,9 @@
 					// Get the size of the icon
 					TSize starIconSize = iKeyboard->StarIcon()->Bitmap()->SizeInPixels();
 					// Get the rect of draw icon area
-					TRect drawIconRect = textLayout.TextRect();
+					TRect drawIconRect = iKeyboard->StarIconRect();
+					drawIconRect.Move( iKeyboard->Rect().iTl );
+					
 					// When the size of icon is different with the size of draw icon area,
 					// because the icon is drew from the left top coordinate of the draw
 					// icon area, so the icon will not be drew in the center. In this case,
@@ -195,7 +199,7 @@
     if (!textlineset)
         {
 		TAknLayoutText textLayout;
-		textLayout.LayoutText(GetRect(), iKeyboard->iVKBTextLineLayout);
+		textLayout.LayoutText(aRect, iKeyboard->iVKBTextLineLayout);
 	    
 	    //CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc());    
 	    
@@ -323,7 +327,8 @@
     gc->SetPenColor(KRgbBlack);
     gc->SetBrushStyle( CGraphicsContext::ENullBrush );    
     //Draw text again.
-    DrawKeyText(gc); 
+    
+    DrawKeyText(gc,GetRect()); 
     }
 
 // ---------------------------------------------------------------------------
@@ -458,7 +463,7 @@
     gc->SetPenColor( KRgbBlack );
     gc->SetBrushStyle( CGraphicsContext::ENullBrush );    
     gc->SetFaded(EFalse);            
-    DrawKeyText(gc);        
+    DrawKeyText(gc,Rect());        
     }
 
 CFbsBitGc* CVirtualKeyCtrl::GetGc()
@@ -526,11 +531,6 @@
         TBool bHasDrawn = EFalse;
         if(UiLayout()->NotDrawToLayoutDevice())
             {
-            /*TBool ret = iKeyboard->PrepareKeyBmp(iKeyboard->HighightKeyBmp(),
-                                    iKeyboard->HighlightKeyDev(),
-                                    rect,innerrect,
-                                    iKeyboard->KeySkinId(EKeyBmpHighlight), 
-                                    KAknsIIDDefault,Rect());*/
             TBool ret = iKeyboard->PrepareHighlightKeyBmp(rect,innerrect,Rect());                                    
             if(ret)
                 {
@@ -588,12 +588,12 @@
     gc->SetFaded(EFalse);       
     if(UiLayout()->NotDrawToLayoutDevice())
         {
-		DrawKeyText(Keyboard()->HighlightGc());
+        DrawKeyText(Keyboard()->HighlightGc(), GetRect());
         UpdateChangedArea(ETrue);
 		}
     else
         {
-		DrawKeyText(gc);
+        DrawKeyText(gc, Rect());
 		}   
 
     }
@@ -629,7 +629,19 @@
         }
     
     if(iKeyInfo->Latched()||(PointerDown()&&!iKeyInfo->IsLatchKey()))
-        {        
+        { 
+        // If some layout initializes a RootCtrl redraw operation when the key was in a highlighted state, the normal key would not be seen
+        // after key was returned to the normal state, that's because the layout device has been cleaned and redrawn again so when it comes to draw
+        // this highlighted virtual key, it just draws the bitmap on its own device, so the area the highlighted key occupied on the layout device
+        // is totally undrawn with the normal state key bitmap.
+        // So we have to redraw the normal state key first to make sure the normal key was drawn on the layout bitmap.
+        // [use case: Open the chinse VITUT, input some pinyin letter to bring the candidate list to the forground by clicking the virtual key ctrl
+        //  ==> select some chinese words in the candidate list ==> then click and release the virtual key agian]
+        if(UiLayout()->NotDrawToLayoutDevice())
+            {
+            DrawNormalStateKey();
+            }
+        
         DrawHighlightKey();
         
 // remove DrawBubble() into HandlePointerDownEventL()
@@ -714,9 +726,15 @@
         }     
     if(UiLayout()->NotDrawToLayoutDevice())
         {
-        //no need to draw again, just remove the highlight bitmap
-        UpdateChangedArea(EFalse);
-		Draw();
+        if(!iKeyInfo->Latched())
+        	{
+        	//no need to draw again, just remove the highlight bitmap
+            UpdateChangedArea(EFalse);
+        	}
+        
+        // no need to draw the normal key to layout bitmap since the highlighted key bitmap is drawn in a seperate device instead of layout device
+        // so just notify the PEN UI to simply remove the highlighted key bitmap. It will somehow improve the performance and decrease the CPU usage
+		//Draw();
         }
     else
         {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/textinput/peninputarc/src/peninputlayoutcontrol/peninputpopupbubble.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -0,0 +1,492 @@
+/*
+* Copyright (c) 2005-2007 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""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation for CPopupBubbleCtrl
+*
+*/
+
+
+#include <AknIconUtils.h>
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <AknsDrawUtils.h> 
+
+#include "peninputpopupbubble.h"
+#include "peninputlayout.h"
+#include <peninputpluginutils.h>
+#include <imageconversion.h> 
+#include "peninputcmd.h"
+
+const TInt KShrinkSize = 10;
+const TInt KDefaultTextColorIndex = EAknsCIQsnTextColorsCG60;
+const TInt KAlpha = 200;
+
+// ======== MEMBER FUNCTIONS ========
+
+/*****************************************************************************/
+// Implementation of Class CPopupBubbleWnd
+
+// ---------------------------------------------------------------------------
+// c++ constructor
+// ---------------------------------------------------------------------------
+//
+CPopupBubbleWnd::CPopupBubbleWnd(CPopupBubbleCtrl& aParent)
+: iParent(aParent),
+iSupportTransparent(EFalse)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// c++ destructor
+// ---------------------------------------------------------------------------
+//
+CPopupBubbleWnd::~CPopupBubbleWnd()
+    {
+    //delete bitmaps    
+    iBitGc.ResetAndDestroy();
+    iDevice.ResetAndDestroy();
+    iBitmap.ResetAndDestroy();       
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+CPopupBubbleWnd* CPopupBubbleWnd::NewL(const TRect& aRect, CPopupBubbleCtrl& aParent)
+    {
+    CPopupBubbleWnd* self = CPopupBubbleWnd::NewLC(aRect, aParent);
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+CPopupBubbleWnd* CPopupBubbleWnd::NewLC(const TRect& aRect, CPopupBubbleCtrl& aParent)
+    {
+    CPopupBubbleWnd* self = new ( ELeave ) CPopupBubbleWnd(aParent);
+    CleanupStack::PushL( self );
+    self->ConstructL(aRect);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian second-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CPopupBubbleWnd::ConstructL(const TRect& aRect)
+    {
+    RWindowGroup& wg = CCoeEnv::Static()->RootWin();
+    CreateWindowL( wg );
+    SetComponentsToInheritVisibility();
+    Window().SetRequiredDisplayMode( EColor16MA );
+    TInt err = Window().SetTransparencyAlphaChannel();
+    iSupportTransparent = ( KErrNone == err );
+    Window().SetBackgroundColor( TRgb(0,0,0,0) );
+
+    //create bitmaps
+    for(TInt i = 0; i<ELastItem; i++)
+        {
+        CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); // Bitmap
+        CleanupStack::PushL(bitmap);
+        iBitmap.AppendL(bitmap); //take ownership
+        CleanupStack::Pop(bitmap);
+        iBitmap[i]->Create(aRect.Size(), EColor16MA);
+        
+        CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iBitmap[i]); //BitmapDevice
+        CleanupStack::PushL(device);
+        iDevice.AppendL(device); //take ownership
+        CleanupStack::Pop(device);
+        
+        CFbsBitGc* bitgc = CFbsBitGc::NewL(); // GraphicsContext
+        CleanupStack::PushL(bitgc);
+        iBitGc.AppendL(bitgc); //take ownership
+        CleanupStack::Pop(bitgc);
+        }
+    
+    MakeVisible( ETrue );    
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ---------------------------------------------------------------------------
+// Draw this control
+// ---------------------------------------------------------------------------
+//
+void CPopupBubbleWnd::Draw(const TRect& aRect) const
+    {    
+    if ( !iParent.AbleToDraw() )
+        {
+        return;
+        }
+    
+    CWindowGc& gc = SystemGc();
+
+    if ( !SupportTransparent() )
+        {
+        gc.Clear( aRect ); 
+        }    
+    
+    DrawTransparentBackground( aRect );
+
+    if ( iParent.iForgroundBmp )
+        {
+        TRect innerRect = aRect;
+        innerRect.Shrink( KShrinkSize, 0 );
+        
+        TRect iconRect;
+        iconRect.iTl = TPoint( innerRect.iTl.iX + iParent.iIconOffset.iWidth, 
+                innerRect.iTl.iY + iParent.iIconOffset.iHeight );
+        iconRect.SetWidth( iParent.iIconSize.iWidth );
+        iconRect.SetHeight( iParent.iIconSize.iHeight );
+        
+        if( iParent.iForgroundBmp->SizeInPixels() != iconRect.Size() )
+            {
+            AknIconUtils::SetSize( iParent.iForgroundBmp, iconRect.Size(), EAspectRatioNotPreserved );
+            }
+            
+        TRect srcRect( TPoint( 0, 0 ), iParent.iForgroundBmp->SizeInPixels() );
+        
+        if( iParent.iForgroundBmpMask )
+            {
+            if( iParent.iForgroundBmpMask->SizeInPixels() != iconRect.Size() )
+                {
+                AknIconUtils::SetSize( iParent.iForgroundBmpMask, iconRect.Size(), EAspectRatioNotPreserved);
+                }
+                        
+            gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+            gc.BitBltMasked( iconRect.iTl, 
+                              iParent.iForgroundBmp, 
+                              srcRect,
+                              iParent.iForgroundBmpMask,
+                              EFalse);
+            }
+        else
+            {
+            gc.BitBlt( iconRect.iTl,
+                        iParent.iForgroundBmp,
+                        srcRect );
+            }            
+        }
+    
+    if ( iParent.iText && iParent.iText->Length() > 0 )
+        {
+        gc.SetBrushStyle( CGraphicsContext::ENullBrush );
+        TAknLayoutText textLayout;
+        textLayout.LayoutText(Rect(), iParent.iTextFormat);
+        TRgb color( KRgbBlack );  // sane default for nonskinned case
+        if ( AknsUtils::AvkonSkinEnabled() )
+            {
+            AknsUtils::GetCachedColor( AknsUtils::SkinInstance(),
+                                   color, KAknsIIDQsnTextColors, iParent.iTextColorIndex );
+            }
+         textLayout.DrawText(gc, *(iParent.iText), ETrue, color);
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// Resize this control
+// ---------------------------------------------------------------------------
+//
+void CPopupBubbleWnd::SizeChanged()
+    {
+    TRect rect = Rect();        
+    
+    iRect[EMiddleItem] = rect;    
+    
+    iRect[EMiddleItem].Shrink( KShrinkSize, 0 );
+      
+    // horizon
+    if( rect.iTl.iY == iRect[EMiddleItem].iTl.iY && rect.iBr.iY == iRect[EMiddleItem].iBr.iY )
+        {
+        iRect[ELeftItem] = TRect( rect.iTl, TPoint( iRect[EMiddleItem].iTl.iX, iRect[EMiddleItem].iBr.iY ) );
+        iRect[ERightItem] = TRect( TPoint( iRect[EMiddleItem].iBr.iX, iRect[EMiddleItem].iTl.iY), rect.iBr );    
+        }
+    else if( rect.iTl.iX == iRect[EMiddleItem].iTl.iX &&  rect.iBr.iX == iRect[EMiddleItem].iBr.iX )
+        {
+        iRect[ELeftItem] = TRect( rect.iTl, TPoint( iRect[EMiddleItem].iBr.iX, iRect[EMiddleItem].iTl.iY ) );
+        iRect[ERightItem] = TRect( TPoint( iRect[EMiddleItem].iTl.iX, iRect[EMiddleItem].iBr.iY), rect.iBr );            
+        }     
+    
+    SizeImage( iParent.iFirstBmpId, iRect[ELeftItem], iBitmap[ELeftItem], iDevice[ELeftItem], iBitGc[ELeftItem] );
+    SizeImage( iParent.iMiddleBmpId, iRect[EMiddleItem], iBitmap[EMiddleItem], iDevice[EMiddleItem], iBitGc[EMiddleItem] );
+    SizeImage( iParent.iLastBmpId, iRect[ERightItem], iBitmap[ERightItem], iDevice[ERightItem], iBitGc[ERightItem] );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle resource change
+// ---------------------------------------------------------------------------
+//
+void CPopupBubbleWnd::HandleResourceChange( TInt aType )
+    {
+    if ( aType == KAknsMessageSkinChange )
+        {
+        // When skin changes, we need to update local bitmaps
+        SizeChanged();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Size images used for drawing
+// ---------------------------------------------------------------------------
+//
+void CPopupBubbleWnd::SizeImage( TAknsItemID aId, TRect aRect, CFbsBitmap* aBitmap, CFbsBitmapDevice* aDevice, CFbsBitGc* aBitGc )
+    {     
+    MAknsSkinInstance* instance = AknsUtils::SkinInstance();
+    TAknsItemType type = instance->GetCachedItemData( aId )->Type();
+    if ( type == EAknsITMaskedBitmap )
+        {
+        CAknsMaskedBitmapItemData* itemData =
+                static_cast<CAknsMaskedBitmapItemData*> ( instance->GetCachedItemData( aId ) );
+
+        AknIconUtils::SetSize( itemData->Bitmap(), aRect.Size(), EAspectRatioNotPreserved );
+        AknIconUtils::SetSize( itemData->Mask(), aRect.Size(), EAspectRatioNotPreserved );
+
+        TDisplayMode bitmapmode = itemData->Bitmap()->DisplayMode();
+        TDisplayMode maskmode = itemData->Mask()->DisplayMode();
+
+        aBitmap->Resize( aRect.Size() );
+        aDevice->Resize( aRect.Size() );
+        aBitGc->Activate( aDevice );
+
+        TRect entireImage( TPoint(0, 0), itemData->Bitmap()->SizeInPixels() );
+        if (itemData->Mask())
+            {
+            aBitGc->BitBltMasked( TPoint(0, 0), itemData->Bitmap(), entireImage,
+                    itemData->Mask(), ETrue );
+            }
+        else
+            {
+            aBitGc->BitBlt( TPoint(0, 0), itemData->Bitmap() );
+            }
+
+        TInt size = aBitmap->DataSize();
+        TUint32* data = aBitmap->DataAddress();
+        TDisplayMode mode = aBitmap->DisplayMode();
+
+        iBitmap[ETempItem]->Resize( aRect.Size() );
+        iDevice[ETempItem]->Resize( aRect.Size() );
+        iBitGc[ETempItem]->Activate( iDevice[ETempItem] );
+        iBitGc[ETempItem]->BitBlt( TPoint(0, 0), itemData->Mask() );
+        
+        TUint32* mask_data = iBitmap[ETempItem]->DataAddress(); 
+         
+         if (mode == EColor16MA)
+             {
+             for (TInt i = 0; i < size/sizeof( TUint32 ); i++)
+                 {
+                 TRgb colour;
+                 colour.SetInternal( *(mask_data + i) );
+                 if (colour != TRgb( 0x00, 0x00, 0x00, 0xFF ))
+                     {
+                     colour.SetInternal( *(data + i) );
+                     colour.SetAlpha( KAlpha ); //semi transparent
+                     *(data + i) = colour.Internal();
+                     }
+                 else
+                     {
+                     colour.SetInternal( *(data + i) );
+                     colour.SetAlpha( 0x00 ); //fully transparent
+                     *(data + i) = colour.Internal();                   
+                     }
+                 }           
+             }
+        }
+    } 
+
+// ---------------------------------------------------------------------------
+// Draw transparent background
+// ---------------------------------------------------------------------------
+//
+
+void CPopupBubbleWnd::DrawTransparentBackground( const TRect& aRect ) const
+{
+    CWindowGc& gc = SystemGc();
+
+    for( TInt i=0; i<ELastItem; i++ )
+        {
+        if ( i == ETempItem )//skip temporary bitmap
+            {
+            continue;
+            }
+        if ( iBitmap[i] )//draw other bitmaps
+            {
+            gc.BitBlt( iRect[i].iTl, iBitmap[i] );
+            }
+        }
+}
+
+/*****************************************************************************/
+// Implementation of Class CPopupBubbleCtrl
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::NewL
+// Symbian constructor
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//               
+EXPORT_C CPopupBubbleCtrl* CPopupBubbleCtrl::NewL( const TRect& aRect,
+                               CFepUiLayout* aUiLayout,
+                               TInt aCtrlId )
+    {
+    CPopupBubbleCtrl* ctrl = new (ELeave)CPopupBubbleCtrl( aRect,aUiLayout,aCtrlId );
+    CleanupStack::PushL( ctrl );
+    ctrl->BaseConstructL();
+    
+    CleanupStack::Pop( ctrl );
+    return ctrl;
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::CPopupBubbleCtrl
+// C++  constructor
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPopupBubbleCtrl::CPopupBubbleCtrl( const TRect& aRect,
+                         CFepUiLayout* aUiLayout,
+                         TInt aCtrlId )
+    :CFepUiBaseCtrl( aRect,aUiLayout,aCtrlId ),
+     iTextColorIndex( KDefaultTextColorIndex )
+    {
+    SetControlType( ECtrlButton );
+    SetHidenFlag( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::CPopupBubbleCtrl
+// C++  destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CPopupBubbleCtrl::~CPopupBubbleCtrl()
+    {
+    if ( iText )
+        {
+        delete iText;
+        iText = NULL;
+        }      
+    if( iForgroundBmp )
+        {
+        delete iForgroundBmp;
+        iForgroundBmp = NULL;
+        }
+    if( iForgroundBmpMask )
+        {
+        delete iForgroundBmpMask;
+        iForgroundBmpMask = NULL;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::SetBitmapParamL
+// Set bitmap parameters used fot this bubble
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPopupBubbleCtrl::SetBitmapParamL(
+                                    CFbsBitmap* aBmpId,
+                                    CFbsBitmap* aMaskBmpId,     
+                                 TAknsItemID aFirstBmpId,
+                                 TAknsItemID aMiddleBmpId,
+                                 TAknsItemID aLastBmpId)
+    {
+    if( iForgroundBmp )
+        {
+        delete iForgroundBmp;
+        iForgroundBmp = NULL;
+        }
+    if( iForgroundBmpMask )
+        {
+        delete iForgroundBmpMask;
+        iForgroundBmpMask = NULL;
+        }    
+        
+    iForgroundBmp = aBmpId;
+    iForgroundBmpMask = aMaskBmpId;
+    
+    iFirstBmpId = aFirstBmpId;
+    iMiddleBmpId =  aMiddleBmpId;
+    iLastBmpId = aLastBmpId;
+    
+    delete iWndControl;
+    iWndControl = NULL;
+    iWndControl = CPopupBubbleWnd::NewL( Rect(), *this );
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::Hide
+// Hide bubble control
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPopupBubbleCtrl::Hide( TBool aFlag )
+    {
+    if ( iWndControl )
+        {
+        iWndControl->MakeVisible( !aFlag );
+        }
+    CFepUiBaseCtrl::Hide( aFlag );    
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::Draw
+// Draw bubble control
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPopupBubbleCtrl::Draw()
+    {
+    if( !AbleToDraw() )
+        {
+        return;
+        }    
+    
+    if( iWndControl )
+        {
+        iWndControl->DrawDeferred();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::Move
+// Move bubble control
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPopupBubbleCtrl::Move( const TPoint& aOffset )
+    {
+    //leave empty
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::SetTextFormat
+// Set text format used for text drawing
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPopupBubbleCtrl::SetTextFormat( TAknTextLineLayout aTextFormat )
+    {
+    iTextFormat = aTextFormat;                
+    }
+
+// ---------------------------------------------------------------------------
+// CPopupBubbleCtrl::SetTextL
+// Set bubble text
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPopupBubbleCtrl::SetTextL( const TDesC& aText )
+    {
+    delete iText;
+    iText = NULL;
+    iText = aText.AllocL();
+    }
--- a/textinput/peninputarc/src/peninputserverapp/peninputserver.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputserverapp/peninputserver.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -62,6 +62,14 @@
 // is used for both orientation in Pen Input server side code.
 const TInt KPenInputSrvPrtFsqUiId = 0x20026837;
 
+// The UID of the PopupClock application
+const TInt KBigClockUid =  0x2000FDC3;
+
+// The UID of the SreenSaver application
+const TInt KScreenSaverUid =  0x100056CF;
+
+// The UID of the AutoLock application
+const TInt KAutoLockUid = 0x100059B5;
 
 enum TActivationFlag
 	{
@@ -2575,7 +2583,13 @@
                         {			  
                         //fix for fast swap case
                         iInGlobalNotesState = EFalse;                        
-                        if(iPreNonGloebalNotesWndGrpId != focusApp.iUid )
+
+                        // Don't handle switching focus group 
+                        // when current focus of the application is screen saver, auto lock or popup clock.
+                        if ( iPreNonGloebalNotesWndGrpId != focusApp.iUid && 
+                             focusApp.iUid != KScreenSaverUid && 
+                             focusApp.iUid != KAutoLockUid && 
+                             focusApp.iUid != KBigClockUid )
                             {                            
                             iPreNonGloebalNotesWndGrpId = focusApp.iUid;
                             DeactivateSprite(ETrue);//hide pen ui immediately if switched to another application
--- a/textinput/peninputarc/src/peninputserverapp/penuiwndctrl.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputarc/src/peninputserverapp/penuiwndctrl.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -397,6 +397,12 @@
     iCursorWnd->SetCursorVisible(EFalse);
     if (iResourceChange)
         {
+        TInt curPriority = iWndGroup.OrdinalPriority();
+        if ( curPriority == -1 )
+            {
+            // Make sure pen ui must be seen.
+            LiftUpPriority();
+            }
         ActivateL();
         iIncallBubble->SetIncallBubbleFlagsL( EAknStatusBubbleInputShow );
         MakeVisible( ETrue );
@@ -533,6 +539,10 @@
     // Draw is always full-screen in such case. So I change to DrawNow
     // for temprory solution.
     /*********************************************************************/ 
+    if ( !IsVisible() )
+        {
+        return;
+        }
     
     if(iShowPopup)
         {        
--- a/textinput/peninputcommonctrls/bwins/peninputcommonctrlsU.DEF	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonctrls/bwins/peninputcommonctrlsU.DEF	Wed Sep 15 12:34:44 2010 +0300
@@ -359,3 +359,4 @@
 	??1CAknFepCtrlLongPressButton@@UAE@XZ @ 358 NONAME ; CAknFepCtrlLongPressButton::~CAknFepCtrlLongPressButton(void)
 	?HandleTimerOut@CAknFepCtrlLongPressButton@@UAEXPBVCAknFepTimer@@@Z @ 359 NONAME ; void CAknFepCtrlLongPressButton::HandleTimerOut(class CAknFepTimer const *)
 	?CancelTimer@CAknFepCtrlLongPressButton@@QAEXXZ @ 360 NONAME ; void CAknFepCtrlLongPressButton::CancelTimer(void)
+	?ModeIndexByModeId@CAknFepCtrlMultiModeButton@@QAEHH@Z @ 361 NONAME ; int CAknFepCtrlMultiModeButton::ModeIndexByModeId(int)
--- a/textinput/peninputcommonctrls/eabi/peninputcommonctrlsU.DEF	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonctrls/eabi/peninputcommonctrlsU.DEF	Wed Sep 15 12:34:44 2010 +0300
@@ -491,4 +491,5 @@
 	_ZTI26CAknFepCtrlLongPressButton @ 490 NONAME
 	_ZTV26CAknFepCtrlLongPressButton @ 491 NONAME
 	_ZThn804_N26CAknFepCtrlLongPressButton14HandleTimerOutEPK12CAknFepTimer @ 492 NONAME
+	_ZN26CAknFepCtrlMultiModeButton17ModeIndexByModeIdEi @ 493 NONAME
 
--- a/textinput/peninputcommonctrls/inc/peninputbuttons/peninputmultimodebutton.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonctrls/inc/peninputbuttons/peninputmultimodebutton.h	Wed Sep 15 12:34:44 2010 +0300
@@ -249,6 +249,14 @@
     IMPORT_C TInt GetRealCaseByMode(TInt aModeIndex) const; 
     
     /**
+     * Gets the button mode index by button mode id
+     *
+     * @param aModeId button mode id 
+     * @return mode index
+     */
+    IMPORT_C TInt ModeIndexByModeId( TInt aModeId );
+    
+    /**
      * Get range list
      *
      * @since S60 v3.2
--- a/textinput/peninputcommonctrls/src/peninputbuttons/peninputbutton.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonctrls/src/peninputbuttons/peninputbutton.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -1928,6 +1928,22 @@
     return KErrNotFound;    
     }
 
+// ------------------------------------------------
+// CAknFepCtrlMultiModeButton::ModeIndexByModeId
+// ------------------------------------------------
+EXPORT_C TInt CAknFepCtrlMultiModeButton::ModeIndexByModeId( TInt aModeId )
+    {
+    TInt count = NumberOfModes();
+    for ( TInt i = 0; i < count; i++ )
+         {
+         if (iModesList[i]->iModeId == aModeId )
+             {
+             return i;
+             }
+        }
+    return KErrNotFound;
+    }
+
 // -----------------------------------------------------------------------------
 // CAknFepCtrlMultiModeButton::GetRangeListL()
 // (other items were commented in a header).
--- a/textinput/peninputcommonlayout/inc/peninputcommonlayoutglobalenum.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonlayout/inc/peninputcommonlayoutglobalenum.h	Wed Sep 15 12:34:44 2010 +0300
@@ -123,6 +123,9 @@
     //candidate list
     EPentinputHwrCandidateList,    
 	EPeninutWindowCtrlIdMultiRangeBtn,
+	
+	EPeninputWindowCtrlIdSplitIndiBubble,
+	
     EPeninputWindowCtrlIdLastOne,
     
     EPeninutWindowCtrlIdRangeBtn //todo split view
--- a/textinput/peninputcommonlayout/inc/peninputlayoutwindowext.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonlayout/inc/peninputlayoutwindowext.h	Wed Sep 15 12:34:44 2010 +0300
@@ -565,6 +565,25 @@
     HBufC* GetKeyMappingStringL( TInt aKeyMapping, const TInt aLang );
     
     void ResetLastColRow();
+
+    /**
+     * Handle paging button in number and special character mode
+     *     
+     * @param aShifted Indicates whether case is shifted.
+     * @return None.
+	 */    
+    void HandleNumberModePagingL( TBool aShifted );
+    
+    /**
+     *  Gets the button mode id by current language and shift button state
+     *
+     *  @param aShifted current shift key state, press down or not
+     *  @param aLanguage current writing language
+     *  @param aPagingPermitted shift key is dimmed or not
+     *  @return mode id 
+     */
+    TInt CurrentNumberModeId( TBool aShifted, TInt aLanguage, TBool aPagingPermitted );
+     
 protected: // data
 
     /**
@@ -667,5 +686,6 @@
      * Vowel char flag for Viet
      */
     TBool iVowelChar;
+    
     };
 #endif // C_CPeninputLayoutWindowExt_H
--- a/textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputcommonlayout/src/peninputlayoutwindowext.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -406,6 +406,46 @@
                 }
             }
         }
+    else
+    	{
+        // If in virtual QWERTY mode
+		if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ )
+			{
+			TInt lang = CPeninputDataConverter::AnyToInt
+					( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ));
+			TInt curRange = CPeninputDataConverter::AnyToInt
+					( iLayoutContext->RequestData( EPeninputDataTypeCurrentRange ));
+					
+			// When writing language is Vietnamese and range is English
+			if ( lang == ELangVietnamese && curRange == ERangeEnglish )  
+				{
+				TBuf<1> charData;
+				// Get the input character
+				charData.Append( aData.iText );
+				iVowelChar = EFalse;
+				
+                if ( KNullDesC() != charData )
+                    {
+                    // Check whether the input char is in the list of VietVowelList
+                    for ( TUint i = 0; i < sizeof( VietVowelList ) / sizeof( TText ); ++i )
+                        {
+                        TBuf<1> buf;
+                        buf.Append( VietVowelList[i] );
+                        if ( charData == buf )
+                            {
+                            iVowelChar = ETrue;
+                            break;
+                            }
+                        }
+                    }
+                
+                CPeninputVkbCtrlExt* vkbCtrl = static_cast<CPeninputVkbCtrlExt*>
+                    ( Control( EPeninutWindowCtrlIdVkbCtrl ));
+                // Set the dim status of the tone keys
+                vkbCtrl->DimKeySet( iToneSet, !iVowelChar );
+				}
+			}
+    	}
     }  
 
 // ---------------------------------------------------------------------------
@@ -1260,6 +1300,7 @@
     	}
     else
     	{
+        if ( permittedRange != ERangeNumber )
         ChangeVkbLayout( vkbLayout );
     	}
     
@@ -1440,6 +1481,18 @@
         {
         return;
         }
+
+    const TInt range = CPeninputDataConverter::AnyToInt(
+            iLayoutContext->RequestData(EPeninputDataTypeCurrentRange));
+
+    TBool shiftDown = ( aIsShiftCase > 0 );
+
+    if ( range == ERangeNumber || range == ERangeNativeNumber )
+        {
+        TRAP_IGNORE(HandleNumberModePagingL( shiftDown ));
+        }
+    else
+        {
     switch ( aIsCapslockCase * 2 + aIsShiftCase )
         {
         case 1: // text case        
@@ -1460,6 +1513,7 @@
         	button->SetHighlight( EFalse );
             }
             break;
+            }   
 	    }
 	}    								 	
 // ---------------------------------------------------------------------------
@@ -1936,5 +1990,93 @@
 		icf->SetTextAlignmentL( aAlignment, ConfigInfo()->Language() );
 		}
 	}
-	
+
+// ------------------------------------------------
+// CPeninputLayoutWindowExt::CurrentNumberModeId
+// ------------------------------------------------
+TInt CPeninputLayoutWindowExt::CurrentNumberModeId(TBool aShifted,
+        TInt aLanguage, TBool aPagingPermitted)
+    {
+    TInt ret = 0;
+    if (aPagingPermitted)
+        {
+        if (aLanguage == ELangArabic || aLanguage == ELangFarsi || aLanguage
+                == ELangUrdu)
+            {
+            if (aShifted)
+                {
+                ret = ECaseNumberSpecialPagingArabic22;
+                }
+            else
+                {
+                ret = ECaseNumberSpecialPagingArabic12;
+                }
+            }
+        else if (aLanguage == ELangThai)
+            {
+            if (aShifted)
+                {
+                ret = ECaseNumberSpecialPaging12;
+                }
+            else
+                {
+                ret = ECaseNumberSpecialPaging22;
+                }
+            }
+        else
+            {
+             if ( aShifted )
+                {
+                ret = ECaseNumberSpecialPaging22;
+                }
+             else
+                {
+                ret = ECaseNumberSpecialPaging12;
+                }            
+            }
+        }
+    else
+        {
+        if (aLanguage == ELangArabic || aLanguage == ELangFarsi || aLanguage
+                == ELangUrdu)
+            {
+            ret = ECaseNumberSpecialPagingArabic11;
+            }
+        else
+            {
+            ret = ECaseNumberSpecialPaging11;
+            }
+        }
+    return ret;
+    }
+
+void CPeninputLayoutWindowExt::HandleNumberModePagingL( TBool aShifted )
+    {
+    CAknFepCtrlMultiModeButton* button = static_cast<CAknFepCtrlMultiModeButton*> (ControlById( EPeninutWindowCtrlIdShiftBtn ) );
+    
+    if ( !button )
+        {
+        return;
+        }
+    
+    const TInt lang = CPeninputDataConverter::AnyToInt( iLayoutContext->RequestData( EPeninputDataTypeInputLanguage ) );
+    TInt permittedRange = CPeninputDataConverter::AnyToInt
+                     ( iLayoutContext->RequestData( EPeninputDataTypePermittedRange ));
+    TBool isPagingPermitted = EFalse;
+    if ( permittedRange == ERangeNumber || permittedRange == ERangeNativeNumber )
+       {
+       //if latin number only or native number only is permitted do not allow paging
+       isPagingPermitted = EFalse;
+       }
+    else
+       {
+       isPagingPermitted = !button->IsDimmed();
+       }
+          
+    TInt modeId = CurrentNumberModeId( aShifted, lang, isPagingPermitted );
+    TInt index = button ->ModeIndexByModeId( modeId );
+
+    button->SetCurrentModeL( EBtnBmpActive, index );    
+    button->SetHighlight( EFalse );
+    }
 //End Of File
--- a/textinput/peninputfingerhwrar/group/peninputfingerhwrar.mmp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputfingerhwrar/group/peninputfingerhwrar.mmp	Wed Sep 15 12:34:44 2010 +0300
@@ -80,9 +80,9 @@
 
 LIBRARY aknlayout.lib
 LIBRARY aknlayout2.lib
-LIBRARY aknlayout2scalable.lib
-LIBRARY aknicon.lib 
-LIBRARY aknskins.lib
+LIBRARY AknLayout2Scalable.lib
+LIBRARY AknIcon.lib
+LIBRARY AKNSKINS.lib
 LIBRARY avkon.lib
 
 LIBRARY centralrepository.lib 
@@ -93,6 +93,6 @@
 LIBRARY peninputpluginutils.lib
 LIBRARY peninputcommonctrls.lib
 LIBRARY peninputcommonlayout.lib
-LIBRARY ptiengine.lib
+LIBRARY PtiEngine.lib
 
 // End Of File
--- a/textinput/peninputfingerhwrar/src/peninputfingerhwrarengine.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputfingerhwrar/src/peninputfingerhwrarengine.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -23,7 +23,7 @@
 #include <e32property.h>
 #include <peninputcommonlayoutglobalenum.h>
 
-#include "ptidefs.h"
+#include "PtiDefs.h"
 
 //USER INCLUDES
 #include "peninputfingerhwrarengine.h"
--- a/textinput/peninputfingerhwrar/src/peninputfingerhwrarnumsymboltable.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputfingerhwrar/src/peninputfingerhwrarnumsymboltable.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -28,7 +28,7 @@
 #include <AknLayoutDef.h>
 #include <AknUtils.h>
 #include <AknsUtils.h>
-#include <akniconutils.h>
+#include <AknIconUtils.h>
 #include <aknfeppeninputenums.h>
 #include <AknFepGlobalEnums.h>
 
--- a/textinput/peninputfingerhwrar/src/peninputfingerhwrarsymboltable.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputfingerhwrar/src/peninputfingerhwrarsymboltable.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -28,7 +28,7 @@
 #include <AknLayoutDef.h>
 #include <AknUtils.h>
 #include <AknsUtils.h>
-#include <akniconutils.h>
+#include <AknIconUtils.h>
 #include <aknfeppeninputenums.h>
 #include <AknFepGlobalEnums.h>
 
--- a/textinput/peninputfingerhwrar/src/peninputfingerhwrarwnd.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputfingerhwrar/src/peninputfingerhwrarwnd.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -24,7 +24,7 @@
 #include <AknLayoutDef.h>
 #include <AknUtils.h>
 #include <AknsUtils.h>
-#include <akniconutils.h>
+#include <AknIconUtils.h>
 #include <AknFepGlobalEnums.h>
 #include <aknfeppeninputenums.h>
 
--- a/textinput/peninputgenericitut/inc/peninputgenericitutdata.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericitut/inc/peninputgenericitutdata.h	Wed Sep 15 12:34:44 2010 +0300
@@ -104,7 +104,9 @@
     ESpellArrowLeft,
     ESpellArrowLeftInner,
     ESpellArrowRight,
-    ESpellArrowRightInner
+    ESpellArrowRightInner,
+    EStarIconRect,
+    EShiftIconRect
     };
 
 enum TControlId
--- a/textinput/peninputgenericitut/inc/peninputgenericitutdatamgr.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericitut/inc/peninputgenericitutdatamgr.h	Wed Sep 15 12:34:44 2010 +0300
@@ -145,6 +145,15 @@
     
     TBool IsChineseSpellMode();
     	
+    /**
+     * Get the size of the screen
+     *
+     * @since S60 v5.0
+     * @param none
+     * @return the size of the screen
+     */
+    TRect screenSize();
+    
 	TPoint iSelectionTl;
     TSize iSelectionItemSize;
     TInt iSelectionItemMargin;
@@ -170,6 +179,12 @@
 	TInt iIcfTextHeightCn;
 	
 	TRect iShiftIconRect;
+	
+    /**
+     * The star icon rect
+     */
+	TRect iStarIconRect;
+	
 	TInt iIcfTextLeftMarginForPrtWest;
     TInt iIcfTextRightMarginForPrtWest;
     TInt iIcfTextTopMarginForPrtWest;
@@ -178,6 +193,10 @@
     TInt iIcfTextHeightForPrtWest;
     TRect iShiftIconRectForPrtWest;
     TRect iStarIconRectForPrtWest;
+    /**
+     * The star icon rect under number mode 
+     */
+    TRect iStarIconRectInNumModeForPrtWest;
     TInt iSpellIcfTextHeightForPrtWest;
     
 	TInt iSpellIcfTextLeftMarginForPrtWest;
--- a/textinput/peninputgenericitut/src/peninputgenericitutdatamgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericitut/src/peninputgenericitutdatamgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -347,7 +347,13 @@
 								cell_ituss_key_pane_g2( 0 ).LayoutLine();
 				TAknLayoutRect starIconRect;
 				starIconRect.LayoutRect( keyrect, starIcon );                
-				iStarIconRectForPrtWest = starIconRect.Rect();          
+				iStarIconRectForPrtWest = starIconRect.Rect();
+				
+				// Get the star icon rect under number mode
+				starIcon = AknLayoutScalable_Avkon::
+						cell_ituss_key_pane_g2(4).LayoutLine();
+				starIconRect.LayoutRect( keyrect, starIcon );
+				iStarIconRectInNumModeForPrtWest = starIconRect.Rect();
 				}			
 			
 			}
@@ -565,6 +571,17 @@
 	iSpellIndiIconWithoutTextForPrtWest = spellIndiIconRect.Rect();
 	}
 
+// ---------------------------------------------------------------------------
+// Get the size of the screen
+// ---------------------------------------------------------------------------
+//
+TRect CGenericItutDataMgr::screenSize()
+	{
+	TRect rect;
+	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
+	return rect;
+	}
+
 void CGenericItutDataMgr::ReadLafInfo()
     {
     // Screen
@@ -730,6 +747,17 @@
             	shiftIconRect.LayoutRect( cellrect, shiftIcon );				
             	iShiftIconRect = shiftIconRect.Rect();			
             	}
+            
+            // read star icon rect
+            if ( i == 3 &&  j == 0 )
+            	{
+            	TAknWindowLineLayout starIcon =  AknLayoutScalable_Apps::
+            					cell_vitu2_itu_pane_g1( keypadvariety ).LayoutLine();
+            	TAknLayoutRect starIconRect;
+            	starIconRect.LayoutRect( cellrect, starIcon );				
+            	iStarIconRect = starIconRect.Rect();			
+            	}
+            
             itucellrect.LayoutRect(iKeypadRectCn, itucell);
             cellrect = itucellrect.Rect();
             cellrect.Move(-iKeypadRectCn.iTl.iX, -iKeypadRectCn.iTl.iY);
@@ -1378,6 +1406,35 @@
                 return &iKeypadCellRectsForPrtWest;
                 }
             }
+        case EStarIconRect:
+        	{
+        	if ( IsChineseSpellMode())
+        		{
+				return &iStarIconRect;
+        		}
+        	else
+        		{
+				if ( iInputMode == ENumber || iInputMode == ENativeNumber )
+					{
+					return &iStarIconRectInNumModeForPrtWest;
+					}
+				else
+					{
+					return &iStarIconRectForPrtWest;
+					}
+        		}
+        	}
+        case EShiftIconRect:
+        	{
+        	if ( IsChineseSpellMode())
+        		{
+				return &iShiftIconRect;
+        		}
+        	else
+        		{
+				return &iShiftIconRectForPrtWest;
+        		}
+        	}
         case EKeypadLeftTextLine:
             {
             if ( IsChineseSpellMode())
@@ -1820,6 +1877,14 @@
        	        {
        	        return &iImIndiOuterRect;
        	        }
+        case EStarIconRect:
+        	{
+			return &iStarIconRect;
+        	}
+        case EShiftIconRect:
+        	{
+			return &iShiftIconRect;
+        	}
         case EKeypadRect:
         	return IsChinese() ? &iKeypadRectCn : &iKeypadRect;	        	
         case EKeypadCellRects:
--- a/textinput/peninputgenericitut/src/peninputgenericitutwindow.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericitut/src/peninputgenericitutwindow.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -235,6 +235,13 @@
         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
         EPosRight3);
 
+    TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect ));
+    // Set the star icon rect
+    iStandardItutKp->SetStarIconRect( *iconRect );
+    iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect ));
+    // Set the shift icon rect
+    iStandardItutKp->SetShiftIconRect( *iconRect );
+    
     TResourceReader reader;
     CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId);
 
@@ -1583,6 +1590,13 @@
         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
         EPosRight3);
     
+    TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect ));
+    // Set the star icon rect
+    iStandardItutKp->SetStarIconRect( *iconRect );
+    iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect ));
+    // Set the shift icon rect
+    iStandardItutKp->SetShiftIconRect( *iconRect );
+    
     RPointerArray<CVirtualKey>& keys = 
         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
     RArray<TRect>& cellRects = 
@@ -1779,6 +1793,13 @@
         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
         EPosRight3);
     
+    TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect ));
+    // Set the star icon rect
+    iStandardItutKp->SetStarIconRect( *iconRect );
+    iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect ));
+    // Set the shift icon rect
+    iStandardItutKp->SetShiftIconRect( *iconRect );
+    
     RPointerArray<CVirtualKey>& keys = 
         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
     RArray<TRect>& cellRects = 
--- a/textinput/peninputgenericitut/src/peninputitutchnuimgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericitut/src/peninputitutchnuimgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -350,9 +350,16 @@
     if(DataMgr()->IsUpdate())  
     	{
     	DataMgr()->SetUpdate(EFalse);
-    	CGenericItutUiLayout* itutLayout = 
-			static_cast<CGenericItutUiLayout*>( LayoutContext()->UiLayout() );
-		itutLayout->SizeChanged( NULL );
+    	
+    	// Get the screen rect
+    	TRect screenRect = DataMgr()->screenSize();
+    	// If the screen is in portrait mode
+    	if ( screenRect.Width() < screenRect.Height())
+    		{
+			CGenericItutUiLayout* itutLayout = 
+				static_cast<CGenericItutUiLayout*>( LayoutContext()->UiLayout());
+			itutLayout->SizeChanged( NULL );
+    		}
     	}
     
     iCurrentState->OnEntryL();
--- a/textinput/peninputgenericitut/src/peninputitutwesternuimgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericitut/src/peninputitutwesternuimgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -127,9 +127,16 @@
     if(DataMgr()->IsUpdate())  
     	{
     	DataMgr()->SetUpdate(EFalse);
-    	CGenericItutUiLayout* itutLayout = 
-			static_cast<CGenericItutUiLayout*>( LayoutContext()->UiLayout() );
-		itutLayout->SizeChanged( NULL );
+    	
+    	// Get the screen rect
+    	TRect screenRect = DataMgr()->screenSize();
+    	// If the screen is in portrait mode
+    	if ( screenRect.Width() < screenRect.Height())
+    		{
+			CGenericItutUiLayout* itutLayout = 
+				static_cast<CGenericItutUiLayout*>( LayoutContext()->UiLayout());
+			itutLayout->SizeChanged( NULL );
+    		}
     	}
     iCurrentState->OnEntryL();
     }
--- a/textinput/peninputgenericvkb/group/iconlist.txt	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericvkb/group/iconlist.txt	Wed Sep 15 12:34:44 2010 +0300
@@ -40,6 +40,12 @@
 -c8,8 qgn_indi_fep_button_capslock.svg
 -c8,8 qgn_indi_fep_button_capslock_sel.svg
 -c8,8 qgn_indi_fep_button_shift.svg
+-c8,8 qgn_indi_input_page.svg
+-c8,8 qgn_indi_input_page1.svg
+-c8,8 qgn_indi_input_page2.svg
+-c8,8 qgn_indi_input_qwerty_page1_1_ah.svg
+-c8,8 qgn_indi_input_qwerty_page1_2_ah.svg
+-c8,8 qgn_indi_input_qwerty_page2_2_ah.svg
 -c8,8 qgn_indi_fep_button_shift_sel.svg
 -c8,8 qgn_indi_fep_button_hwr.svg
 -c8,8 qgn_indi_fep_button_hwr_sel.svg
--- a/textinput/peninputgenericvkb/inc/peninputgenericvkblayout.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericvkb/inc/peninputgenericvkblayout.h	Wed Sep 15 12:34:44 2010 +0300
@@ -168,6 +168,15 @@
     void HandleVirtualKeyUpL(TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData);
 
     /**
+     * Handle virtual key down event
+     *
+     * @since S60 v5.0
+     * @param None
+     * @return None
+     */
+    void HandleVirtualKeyDown();
+    
+    /**
      * Handle show tooltip command
      *
      *     
--- a/textinput/peninputgenericvkb/inc/peninputgenericvkbwindow.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericvkb/inc/peninputgenericvkbwindow.h	Wed Sep 15 12:34:44 2010 +0300
@@ -309,7 +309,16 @@
     TBool HandleVirtualKeyUpEvent(TInt aEventType, 
                                  CFepUiBaseCtrl* aCtrl, 
                                  const TDesC& aEventData );
-  
+    
+    /**
+     * Handle virtual key down event
+     *
+     * @since S60 v5.0
+     * @param None
+     * @return None
+     */  
+    void HandleVirtualKeyDownEvent();
+    
     virtual void SetLafLayOut(TInt aRows, TInt aColumns);
      /*
      *
--- a/textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -377,6 +377,13 @@
             SignalOwner(ESignalKeyEvent, KDisplaySpace);            
             }
         	break;
+        case EEventVirtualKeyDown:
+        	{
+        	HandleVirtualKeyDown();
+        	CPeninputCommonLayoutExt::HandleControlEvent( aEventType, 
+        			aCtrl, aEventData );
+        	break;
+        	}
         default:
             {
             CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, aEventData);
@@ -533,6 +540,21 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// Handle virtual key down event
+// ---------------------------------------------------------------------------
+//
+void CPeninputGenericVkbLayout::HandleVirtualKeyDown()
+	{
+	CPeninputGenericVkbWindow* window = 
+			static_cast<CPeninputGenericVkbWindow*>( iLayoutWindow );
+	
+	if ( window )
+		{
+		window->HandleVirtualKeyDownEvent();
+		}
+	}
+
 TBool CPeninputGenericVkbLayout::TranslateMirrorUnicode( TUint16 aInputCode, TUint16& aOutputCode )
     {
     TBool isMirrorChar = EFalse;
--- a/textinput/peninputgenericvkb/src/peninputgenericvkbwindow.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericvkb/src/peninputgenericvkbwindow.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -2011,7 +2011,26 @@
     iNewDeadKeyBuf = KNullDesC;
     return EFalse;
     } 
- 
+
+// ---------------------------------------------------------------------------
+// CPeninputGenericVkbWindow::HandleVirtualKeyDownEvent
+// (Handle virtual key down event)
+// ---------------------------------------------------------------------------
+//
+void CPeninputGenericVkbWindow::HandleVirtualKeyDownEvent()
+	{
+    // Get DeadKey state
+    TInt latchedFlag = CPeninputDataConverter::AnyToInt(
+				   iLayoutContext->RequestData( EAkninputDataTypeLatchedSet ));
+    
+    if ( latchedFlag )
+    	{
+		UnLatchDeadKey( iNewDeadKeyBuf );
+	    TBool deadKeyChange = ETrue;
+	    iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
+    	}
+	}
+
  TBool CPeninputGenericVkbWindow::HandleDeadKeyL(TInt aEventType, 
                                                  const TDesC& aEventData )
  	{
--- a/textinput/peninputgenericvkb/srcdata/peninputvkbwindow.rss	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputgenericvkb/srcdata/peninputvkbwindow.rss	Wed Sep 15 12:34:44 2010 +0300
@@ -722,12 +722,48 @@
 		        rangeid=0;
 		        modeid=ECaseUpper;
 		        },
-		   AKN_FEP_BUTTON_MODE
+		    AKN_FEP_BUTTON_MODE
 		        {
 		        modeimage = r_peninput_layout_vkb_range_case_capslock;
 		        rangeid=0;
 		        modeid=ECaseText;
-		        }    
+		        },    
+            AKN_FEP_BUTTON_MODE
+                {
+                modeimage = r_peninput_layout_vkb_range_case_paging_11;
+                rangeid=0;
+                modeid=ECaseNumberSpecialPaging11;
+                } ,   
+            AKN_FEP_BUTTON_MODE
+                 {
+                 modeimage = r_peninput_layout_vkb_range_case_paging_12;
+                 rangeid=0;
+                 modeid=ECaseNumberSpecialPaging12;
+                 },
+            AKN_FEP_BUTTON_MODE
+                 {
+                 modeimage = r_peninput_layout_vkb_range_case_paging_22;
+                 rangeid=0;
+                 modeid=ECaseNumberSpecialPaging22;
+                 },                 		        
+            AKN_FEP_BUTTON_MODE
+                {
+                 modeimage = r_peninput_layout_vkb_range_case_paging_arabic_11;
+                 rangeid=0;
+                 modeid=ECaseNumberSpecialPagingArabic11;
+                },   
+            AKN_FEP_BUTTON_MODE
+                {
+                modeimage = r_peninput_layout_vkb_range_case_paging_arabic_12;
+                rangeid=0;
+                modeid=ECaseNumberSpecialPagingArabic12;
+                },
+            AKN_FEP_BUTTON_MODE
+                {
+                modeimage = r_peninput_layout_vkb_range_case_paging_arabic_22;
+                rangeid=0;
+                modeid=ECaseNumberSpecialPagingArabic22;
+                }	    
 		    };    
 		}
 		
@@ -889,6 +925,138 @@
     disableskinid=EAknsMinorGenericQgnIndiFepButtonSwitch;
     }
 
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_11
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputgenericvkbQgn_indi_input_page;
+    nactivemsk=EMbmPeninputgenericvkbQgn_indi_input_page_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputPage;
+
+    nactivep=EMbmPeninputgenericvkbQgn_indi_input_page;
+    nactivepmsk=EMbmPeninputgenericvkbQgn_indi_input_page_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputPage;
+    
+    active=EMbmPeninputgenericvkbQgn_indi_input_page;
+    activemsk=EMbmPeninputgenericvkbQgn_indi_input_page_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputPage;
+    
+    activep=EMbmPeninputgenericvkbQgn_indi_input_page;
+    activepmsk=EMbmPeninputgenericvkbQgn_indi_input_page_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputPage;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_12
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputgenericvkbQgn_indi_input_page1;
+    nactivemsk=EMbmPeninputgenericvkbQgn_indi_input_page1_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputPage1;
+    
+    nactivep=EMbmPeninputgenericvkbQgn_indi_input_page1;
+    nactivepmsk=EMbmPeninputgenericvkbQgn_indi_input_page1_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputPage1;
+    
+    active=EMbmPeninputgenericvkbQgn_indi_input_page1;
+    activemsk=EMbmPeninputgenericvkbQgn_indi_input_page1_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputPage1;
+    
+    activep=EMbmPeninputgenericvkbQgn_indi_input_page1;
+    activepmsk=EMbmPeninputgenericvkbQgn_indi_input_page1_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputPage1;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_22
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputgenericvkbQgn_indi_input_page2;
+    nactivemsk=EMbmPeninputgenericvkbQgn_indi_input_page2_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputPage2;
+    
+    nactivep=EMbmPeninputgenericvkbQgn_indi_input_page2;
+    nactivepmsk=EMbmPeninputgenericvkbQgn_indi_input_page2_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputPage2;
+    
+    active=EMbmPeninputgenericvkbQgn_indi_input_page2;
+    activemsk=EMbmPeninputgenericvkbQgn_indi_input_page2_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputPage2;
+    
+    activep=EMbmPeninputgenericvkbQgn_indi_input_page2;
+    activepmsk=EMbmPeninputgenericvkbQgn_indi_input_page2_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputPage2;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_arabic_11
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah;
+    nactivemsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+
+    nactivep=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah;
+    nactivepmsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+    
+    active=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah;
+    activemsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+    
+    activep=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah;
+    activepmsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_1_ah_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_arabic_12
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah;
+    nactivemsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    
+    nactivep=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah;
+    nactivepmsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    
+    active=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah;
+    activemsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    
+    activep=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah;
+    activepmsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page1_2_ah_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_arabic_22
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah;
+    nactivemsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    
+    nactivep=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah;
+    nactivepmsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    
+    active=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah;
+    activemsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    
+    activep=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah;
+    activepmsk=EMbmPeninputgenericvkbQgn_indi_input_qwerty_page2_2_ah_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    }       
+
 RESOURCE LBUF r_peninput_vkb_accent1
     {
     txt=qtn_tin_vkb_accented_set1;
--- a/textinput/peninputsplititut/inc/peninputsplititutdata.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/inc/peninputsplititutdata.h	Wed Sep 15 12:34:44 2010 +0300
@@ -89,9 +89,14 @@
     EImIndicatorRect,
     ESpellBackSpcae,
     ESpellBackSpcaeInner,    
-    EIndiPaneWithoutTextRect, 
-    EIndiIconWithoutTextRect,
-    EIndiTextLine
+    ESpellIndiPaneWithoutTextRect, 
+    ESpellIndiIconWithoutTextRect,
+    ESpellIndiTextLine,
+    ESplitIndiPaneRect,
+    ESplitIndiIconRect,
+    ESplitIndiTextLine,
+    EStarIconRect,
+    EShiftIconRect    
     };
 
 enum TControlId
@@ -113,7 +118,8 @@
     ECtrlIdICF,
     ECtrlIdOkBtn,
     ECtrlIdCancelBtn,
-    ECtrlIdLastStdCtrl = ECtrlIdCancelBtn+ 1
+    ECtrlIdSplitIndiBubble,
+    ECtrlIdLastStdCtrl
     };
 
 enum TItutCommand
--- a/textinput/peninputsplititut/inc/peninputsplititutdatamgr.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/inc/peninputsplititutdatamgr.h	Wed Sep 15 12:34:44 2010 +0300
@@ -205,21 +205,34 @@
     inline void SetSpellMode(TBool aSpellMode);
     
     /**
-     * Set Indicator Data
+     * Set Spell Indicator Data
      *
-     * @since S60 v5.0
      * @param aIndicatorData Indicator Data
      * @return void
      */
-    inline void SetIndicatorData(TFepIndicatorInfo &aIndicatorData);
+    inline void SetSpellIndicatorData(TFepIndicatorInfo &aIndicatorData);
+    
+    /**
+     * Get Spell Indicator Data
+     *
+     * @return TFepIndicatorInfo
+     */
+    inline TFepIndicatorInfo SpellIndicatorData();
     
     /**
-     * Get Indicator Data
+     * Set Split Indicator Data
      *
-     * @since S60 v5.0
+     * @param aIndicatorData Indicator Data
+     * @return void
+     */
+    inline void SetSplitIndicatorData(TFepIndicatorInfo &aIndicatorData);
+    
+    /**
+     * Get Split Indicator Data
+     *
      * @return TFepIndicatorInfo
      */
-    inline TFepIndicatorInfo IndicatorData();
+    inline TFepIndicatorInfo SplitIndicatorData();    
     
     /**
      * Set update flag
@@ -353,9 +366,23 @@
      */
     inline TBool IsNumericOnly() const;
 	
+    /**
+     * Get the size of the screen
+     *
+     * @since S60 v5.0
+     * @param none
+     * @return the size of the screen
+     */
+    TRect screenSize();
+    
 	TRect iShiftIconRect;
 	TRect iStarIconRect;
 	
+    /**
+     * The star icon rect under number mode
+     */
+	TRect iStarIconRectInNumMode;
+	
 private:
     /**
      * C++ constructor
@@ -563,13 +590,18 @@
 	TRect iSpellArrowRightRectInner;
 	
     //TRect iIndiPaneRectWithTextForPrtWest;
-    TRect iIndiPaneRectWithoutTextForPrtWest;
+    TRect iSpellIndiPaneRectWithoutTextForPrtWest;
     //TRect iIndiIconRectWithTextForPrtWest;
-    TRect iIndiIconRectWithoutTextForPrtWest;
-    TAknTextLineLayout iIndiTextForPrtWest;
+    TRect iSpellIconRectWithoutTextForPrtWest;
+    TAknTextLineLayout iSpellTextForPrtWest;
+    
+    TRect iSplitIndiPaneRect;
+    TRect iSplitIndiIconRect;    
+    TAknTextLineLayout iSplitIndiText;
 
 	TAknTextLineLayout iSpellBtnTextFormat;
-	TFepIndicatorInfo iIndicatorData;
+	TFepIndicatorInfo iSpellIndicatorData;
+	TFepIndicatorInfo iSplitIndicatorData;
     };
 
 // ---------------------------------------------------------------------------
@@ -636,27 +668,47 @@
     }
  
 // ---------------------------------------------------------------------------
-// CSplitItutDataMgr::SetIndicatorData
+// CSplitItutDataMgr::SetSpellIndicatorData
 // ---------------------------------------------------------------------------
 //
-inline void CSplitItutDataMgr::SetIndicatorData(TFepIndicatorInfo &aIndicatorData)
+inline void CSplitItutDataMgr::SetSpellIndicatorData(TFepIndicatorInfo &aIndicatorData)
     {
-    iIndicatorData.iIndicatorImgID = aIndicatorData.iIndicatorImgID;
-    iIndicatorData.iIndicatorMaskID = aIndicatorData.iIndicatorMaskID;
-    iIndicatorData.iIndicatorTextImgID = aIndicatorData.iIndicatorTextImgID;
-    iIndicatorData.iIndicatorTextMaskID = aIndicatorData.iIndicatorTextMaskID;
+    iSpellIndicatorData.iIndicatorImgID = aIndicatorData.iIndicatorImgID;
+    iSpellIndicatorData.iIndicatorMaskID = aIndicatorData.iIndicatorMaskID;
+    iSpellIndicatorData.iIndicatorTextImgID = aIndicatorData.iIndicatorTextImgID;
+    iSpellIndicatorData.iIndicatorTextMaskID = aIndicatorData.iIndicatorTextMaskID;
     }
  
 // ---------------------------------------------------------------------------
-// CSplitItutDataMgr::IndicatorData
+// CSplitItutDataMgr::SplitIndicatorData
+// ---------------------------------------------------------------------------
+//
+inline TFepIndicatorInfo CSplitItutDataMgr::SplitIndicatorData()
+    {
+    return iSplitIndicatorData;
+    } 
+
+// ---------------------------------------------------------------------------
+// CSplitItutDataMgr::SetSplitIndicatorData
 // ---------------------------------------------------------------------------
 //
-inline TFepIndicatorInfo CSplitItutDataMgr::IndicatorData()
+inline void CSplitItutDataMgr::SetSplitIndicatorData(TFepIndicatorInfo &aIndicatorData)
     {
-    return iIndicatorData;
+    iSplitIndicatorData.iIndicatorImgID = aIndicatorData.iIndicatorImgID;
+    iSplitIndicatorData.iIndicatorMaskID = aIndicatorData.iIndicatorMaskID;
+    iSplitIndicatorData.iIndicatorTextImgID = aIndicatorData.iIndicatorTextImgID;
+    iSplitIndicatorData.iIndicatorTextMaskID = aIndicatorData.iIndicatorTextMaskID;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CSplitItutDataMgr::SpellIndicatorData
+// ---------------------------------------------------------------------------
+//
+inline TFepIndicatorInfo CSplitItutDataMgr::SpellIndicatorData()
+    {
+    return iSpellIndicatorData;
     } 
 
-
 // ---------------------------------------------------------------------------
 // CSplitItutDataMgr::IsValidLanguage
 // ---------------------------------------------------------------------------
--- a/textinput/peninputsplititut/inc/peninputsplititutwesternuistatespelling.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/inc/peninputsplititutwesternuistatespelling.h	Wed Sep 15 12:34:44 2010 +0300
@@ -21,6 +21,7 @@
 #include "peninputsplititutuistatebase.h"
 
 class CFepLayoutMultiLineIcf;
+class CBubbleCtrl;
 class CAknFepCtrlCommonButton;
 
 class CWesternSplitItutUiStateSpelling : public CSplitItutUiStateBase
@@ -53,6 +54,7 @@
 	void ReCalcLayoutL();
 private:
     CFepLayoutMultiLineIcf* iICF;
+    CBubbleCtrl* iSplitIndiBubble;
     CAknFepCtrlCommonButton* iOk;
     CAknFepCtrlCommonButton* iCancel;
     };
--- a/textinput/peninputsplititut/inc/peninputsplititutwindow.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/inc/peninputsplititutwindow.h	Wed Sep 15 12:34:44 2010 +0300
@@ -33,6 +33,7 @@
 class CFepCtrlDropdownList;
 class CAknFepCtrlCommonBgCtrl;
 class CPeninputSyncBitmapRotator;
+class CBubbleCtrl;
 
 const TInt KUnavailableID = -1;
 
@@ -240,36 +241,52 @@
     void SetPromptTextL( TUint8* aData );
     
     /** 
-     * Set bubble
+     * Set split bubble
      *
-     * @since S60 5.0
      * @return None
      */    
-    void SetIndiBubble();
+    void SetSplitIndiBubble();
     
     /** 
-     * Update bubble prompt text
+     * Set spelling bubble
      *
-     * @since S60 5.0
+     * @return None
+     */    
+    void SetSpellIndiBubble();
+    
+    /** 
+     * Update split bubble prompt text
+     *
      * @param aData text
      * @return None
      */
-    void UpdateIndiBubbleL( TUint8* aData );
+    void UpdateSplitIndiBubbleL( TUint8* aData );
+
+    /** 
+     * Update spelling bubble prompt text
+     *
+     * @param aData text
+     * @return None
+     */
+    void UpdateSpellIndiBubbleL( TUint8* aData );    
     
     /** 
      * Set bubble image
      *
-     * @since S60 5.0
+     * @param aBubble bubble control
+     * @param aRect bubble rect
      * @param aImgID1 image ID1
      * @param aMaskID1 mask image id1
      * @param aImgID2 image ID2
      * @param aMaskID2 mask image id2
      * @return None
      */
-    void SetIndiBubbleImageL( const TInt aImgID1,
-						      const TInt aMaskID1,
-                              const TInt aImgID2,
-                              const TInt aMaskID2 );
+    void SetBubbleImageL( CBubbleCtrl& aBubble,
+                          const TRect& aRect,
+                          const TInt aImgID1,
+						  const TInt aMaskID1,
+                          const TInt aImgID2,
+                          const TInt aMaskID2 );
 private:
     /**
      * C++ constructor
@@ -476,6 +493,13 @@
      * @return None
      */
     void CreateICFL();
+	
+    /**
+     * Create split indicator bubble
+     *
+     * @return None
+     */
+    void CreateSplitIndiBubbleL();
      
     /**
      * Check control size change
@@ -626,6 +650,7 @@
     TSize iIndicatorTextSize;
     TBool iImDimensionSet;
     CFepLayoutMultiLineIcf* iICF;
+    CBubbleCtrl* iSplitIndiBubble;        
     };
    
 // ---------------------------------------------------------------------------
--- a/textinput/peninputsplititut/src/peninputsplititutchnuimgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutchnuimgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -327,9 +327,16 @@
     if(DataMgr()->IsUpdate())  
     	{
     	DataMgr()->SetUpdate(EFalse);
-    	CSplitItutUiLayout* itutLayout = 
-			static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout() );
-		itutLayout->SizeChanged( NULL );
+    	
+    	// Get the screen rect
+    	TRect screenRect = DataMgr()->screenSize();
+    	// If the screen is in portrait mode
+    	if ( screenRect.Width() < screenRect.Height())
+    		{
+			CSplitItutUiLayout* itutLayout = 
+				static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout());
+			itutLayout->SizeChanged( NULL );
+    		}
     	}
     
     iCurrentState->OnEntryL();
--- a/textinput/peninputsplititut/src/peninputsplititutdatamgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutdatamgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -165,9 +165,20 @@
     splitpanerect.LayoutRect(spliwndtrect.Rect(), splitpane);   
     
     iLayoutRect = spliwndtrect.Rect();
+
+    // split indi layout
+    TAknWindowLineLayout indiPane = AknLayoutScalable_Avkon::icf_edit_indi_pane(2).LayoutLine();
+    TAknWindowLineLayout indiIconPane = AknLayoutScalable_Avkon::icf_edit_indi_pane_g2(2).LayoutLine();    
+
+    TAknLayoutRect indiRect, indiIconRect;
+    indiRect.LayoutRect(spliwndtrect.Rect(), indiPane);
+    indiIconRect.LayoutRect(spliwndtrect.Rect(), indiIconPane);
+    
+    iLayoutRect.iTl.iY -= indiRect.Rect().Height();//include non ifc indi bubble
+    
     // spell layout rect
     iLayoutRectSpell = rect;
-    iLayoutOffset = spliwndtrect.Rect().iTl;
+    iLayoutOffset = spliwndtrect.Rect().iTl - TPoint(0,indiRect.Rect().Height());//include split indi bubble
     iBackgroundRect = iLayoutRect;
     iBackgroundRect.Move(-iLayoutOffset);
     
@@ -213,13 +224,19 @@
                 }
             
             // read star icon rect
-            if( i == 3 &&  j == 2 )
+            if( i == 3 &&  j == 0 )
                 {
                 TAknWindowLineLayout starIcon =  AknLayoutScalable_Avkon::
                                 cell_ituss_key_pane_g2( 0 ).LayoutLine();
                 TAknLayoutRect starIconRect;
                 starIconRect.LayoutRect( keyrect, starIcon );                
-                iStarIconRect = starIconRect.Rect();          
+                iStarIconRect = starIconRect.Rect();  
+                
+                // Get the star icon rect under number mode
+				starIcon = AknLayoutScalable_Avkon::
+						cell_ituss_key_pane_g2(4).LayoutLine();
+				starIconRect.LayoutRect( keyrect, starIcon );
+				iStarIconRectInNumMode = starIconRect.Rect();
                 }            
             
             }
@@ -262,7 +279,9 @@
     iCloseInnerRect = funcinnerrect.Rect();
     iCloseInnerRect.Move(0, iKeypadRect.iBr.iY );
     iCloseInnerRect.Move(-iLayoutOffset);
-    
+      
+    iCloseInnerRect.Move(-TPoint(0,indiRect.Rect().Height())); //include split indi bubble            
+        
     // arrow left button
     iArrowLeftRect = iCloseRect;     
     iArrowLeftRect.Move(btnWidth, 0);
@@ -394,16 +413,24 @@
 	
 	icfIndiPaneWithoutText = AknLayoutScalable_Avkon::icf_edit_indi_pane(0).LayoutLine();
 	icfIndiPaneRectWithoutText.LayoutRect( focuspaneRect.Rect(), icfIndiPaneWithoutText );
-	iIndiPaneRectWithoutTextForPrtWest = icfIndiPaneRectWithoutText.Rect();
+	iSpellIndiPaneRectWithoutTextForPrtWest = icfIndiPaneRectWithoutText.Rect();
 	
 	TAknWindowLineLayout spellIndiIcon;
 	TAknLayoutRect spellIndiIconRect;
 	spellIndiIcon = AknLayoutScalable_Avkon::icf_edit_indi_pane_g2(0).LayoutLine();
 	spellIndiIconRect.LayoutRect( icfIndiPaneRectWithoutText.Rect(), spellIndiIcon );
-	iIndiIconRectWithoutTextForPrtWest = spellIndiIconRect.Rect();
+	iSpellIconRectWithoutTextForPrtWest = spellIndiIconRect.Rect();
 	
 	indiTextLayout = AknLayoutScalable_Avkon::icf_edit_indi_pane_t1(0).LayoutLine();
-	iIndiTextForPrtWest = indiTextLayout;  
+    iSpellTextForPrtWest = indiTextLayout;
+	
+    // split indicator
+    iSplitIndiPaneRect = indiRect.Rect();
+    iSplitIndiIconRect = indiIconRect.Rect();
+    iSplitIndiIconRect.Move(0, -iSplitIndiPaneRect.iTl.iY + iKeypadRect.iTl.iY - iSplitIndiPaneRect.Height());
+    iSplitIndiPaneRect.Move(0, -iSplitIndiPaneRect.iTl.iY + iKeypadRect.iTl.iY - iSplitIndiPaneRect.Height());
+    indiTextLayout = AknLayoutScalable_Avkon::icf_edit_indi_pane_t1(1).LayoutLine();
+    iSplitIndiText = indiTextLayout;  
     
 	// ICF text line info
     TAknTextLineLayout icftextT1, icftextT2, icftextT3;    
@@ -610,6 +637,21 @@
         		{
 				return &iVkNumText;
         		}
+        case EStarIconRect:
+        	{
+        	if ( iInputMode == ENumber || iInputMode == ENativeNumber )
+				{
+				return &iStarIconRectInNumMode;
+				}
+        	else
+        		{
+				return &iStarIconRect;
+        		}
+        	}
+        case EShiftIconRect:
+        	{
+        	return &iShiftIconRect;
+        	}
         case EKeypadRightTextLine1:
 			if ( iInputMode == ENumber || iInputMode == ENativeNumber )
 				{
@@ -762,12 +804,18 @@
         	return &iSpellBackSpcace;
         case ESpellBackSpcaeInner:
         	return &iSpellBackSpcaceInner;
-        case EIndiPaneWithoutTextRect:
-            return &iIndiPaneRectWithoutTextForPrtWest;
-        case EIndiIconWithoutTextRect:
-            return &iIndiIconRectWithoutTextForPrtWest;
-        case EIndiTextLine:
-            return &iIndiTextForPrtWest;
+        case ESpellIndiPaneWithoutTextRect:
+            return &iSpellIndiPaneRectWithoutTextForPrtWest;
+        case ESpellIndiIconWithoutTextRect:
+            return &iSpellIconRectWithoutTextForPrtWest;
+        case ESpellIndiTextLine:
+            return &iSpellTextForPrtWest;
+        case ESplitIndiPaneRect:
+            return &iSplitIndiPaneRect;
+        case ESplitIndiIconRect:
+            return &iSplitIndiIconRect;            
+        case ESplitIndiTextLine:
+            return &iSplitIndiText;            
         default:
             break;
         }
@@ -1221,4 +1269,15 @@
     return EFalse;
     }
 
+// ---------------------------------------------------------------------------
+// Get the size of the screen
+// ---------------------------------------------------------------------------
+//
+TRect CSplitItutDataMgr::screenSize()
+	{
+	TRect rect;
+	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
+	return rect;
+	}
+
 // End Of File
--- a/textinput/peninputsplititut/src/peninputsplititutlayout.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutlayout.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -30,7 +30,7 @@
 //#include <peninputdropdownlist.h>
 
 #include <s32mem.h>
-//#include <peninputlayoutbubblectrl.h>
+#include <peninputlayoutbubblectrl.h>
 
 #include <peninputdataprovider.h>      
 #include <peninputcommonlayoutglobalenum.h>
@@ -433,6 +433,16 @@
 //
 void CSplitItutUiLayout::OnDeActivate()
     {
+    CBubbleCtrl* bubble = static_cast<CBubbleCtrl *>(Control(ECtrlIdSplitIndiBubble));
+    if (bubble && NotDrawToLayoutDevice())
+        {
+        TBool flag = EFalse;
+        HandleCommand(ECmdPeninputEnableOwnBitmap,reinterpret_cast<TUint8*>(&flag));
+        bubble->Draw();
+        flag = ETrue;
+        HandleCommand(ECmdPeninputEnableOwnBitmap,reinterpret_cast<TUint8*>(&flag));
+        }
+    
     TRAP_IGNORE(UiMgr()->HandleCommandL(ECmdPenInputDeActive, NULL));
 
     CFepUiLayout::OnDeActivate();
--- a/textinput/peninputsplititut/src/peninputsplititutwesternuimgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutwesternuimgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -136,9 +136,16 @@
     if ( DataMgr()->IsUpdate() )  
         {
         DataMgr()->SetUpdate( EFalse );
-        CSplitItutUiLayout* itutLayout = 
-            static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout() );
-        itutLayout->SizeChanged( NULL );
+        
+		CSplitItutUiLayout* itutLayout = 
+			static_cast<CSplitItutUiLayout*>( LayoutContext()->UiLayout());
+    	// Get the screen rect
+    	TRect screenRect = DataMgr()->screenSize();
+    	// If the screen is in portrait mode
+    	if ( screenRect.Width() < screenRect.Height())
+    		{
+			itutLayout->SizeChanged( NULL );
+    		}
 
         iCurrentState->OnEntryL();
         
--- a/textinput/peninputsplititut/src/peninputsplititutwesternuistatespelling.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutwesternuistatespelling.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -19,6 +19,7 @@
 #include <AknFepGlobalEnums.h>
 #include <peninputsplititutnew.rsg>
 #include <peninputlayoutmultilineicf.h>
+#include <peninputlayoutbubblectrl.h>
 #include <StringLoader.h>
 #include <peninputcommonbutton.h>
 #include <peninputlayout.h>
@@ -52,6 +53,7 @@
                                                         :CSplitItutUiStateBase(aOwner)
     {
     iICF = static_cast<CFepLayoutMultiLineIcf*>(iOwner->LayoutContext()->Control(ECtrlIdICF));
+    iSplitIndiBubble = static_cast<CBubbleCtrl*>(iOwner->LayoutContext()->Control(ECtrlIdSplitIndiBubble));    
     }
 
 void CWesternSplitItutUiStateSpelling::ConstructL()
@@ -98,7 +100,8 @@
         }
     //hide bubble in the first place.    
     iICF->HideBubble();
-
+    iSplitIndiBubble->Hide(ETrue);
+    
     // update resource id of keypad    
     iOwner->DataMgr()->NotifyChangeControlLayout(
         MItutPropertySubscriber::EItutPropertyKeypadResourceId, keypadResId);
@@ -139,6 +142,7 @@
     iOwner->DataMgr()->SetSpellMode(EFalse);
     iICF->Hide( ETrue );
     iOwner->LayoutContext()->ShowArrowBtn(0);
+    iSplitIndiBubble->Hide(EFalse); //Show split indi bubble
     }
 
 CSplitItutUiMgrBase::TUiState CWesternSplitItutUiStateSpelling::StateType()
--- a/textinput/peninputsplititut/src/peninputsplititutwindow.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutwindow.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -43,7 +43,6 @@
 #include "peninputcommonbgctrl.h"
 
 _LIT(KBmpFileName, "z:\\resource\\apps\\peninputsplititut.mbm");
-_LIT(KEmptyString, "");
 
 const TInt KImageMajorSkinId = EAknsMajorGeneric;
 const TUint KDefaultSpellTextColor = 0;
@@ -262,6 +261,13 @@
     iStandardItutKp->SetTextLineLayout(
         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
         EPosRight3);
+    
+    TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect ));
+    // Set the star icon rect
+    iStandardItutKp->SetStarIconRect( *iconRect );
+    iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect ));
+    // Set the shift icon rect
+    iStandardItutKp->SetShiftIconRect( *iconRect );
 
     TResourceReader reader;
     CCoeEnv::Static()->CreateResourceReaderLC(reader, aResId);
@@ -785,7 +791,7 @@
     									   KAknsIIDQsnFrInputPreviewSideR );  
     iICF->SetMsgBubbleCtrlSize(TSize(iBubbleSize.iW,iBubbleSize.iH));
     
-    iICF->MsgBubbleCtrl()->SetTextL( KEmptyString );
+    iICF->MsgBubbleCtrl()->SetTextL( KNullDesC );
     
     iICF->SetTextMargin( iDataMgr->iIcfTextLeftMargin,
             			 iDataMgr->iIcfTextRightMargin,
@@ -794,9 +800,28 @@
             					  
     iICF->SetLineSpace( iDataMgr->iIcfTextLineSpaceMargin );    					  
         	 
-    SetIndiBubble();
+    SetSpellIndiBubble();
     iICF->Hide( ETrue );
     }
+
+// ---------------------------------------------------------------------------
+// CSplitItutWindow::CreateSplitIndiBubbleL
+// ---------------------------------------------------------------------------
+//
+void CSplitItutWindow::CreateSplitIndiBubbleL()
+    {
+    // char count bubble
+    TRect bubbleRect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(ESplitIndiPaneRect));
+    iSplitIndiBubble = CBubbleCtrl::NewL(bubbleRect,iLayoutOwner,ECtrlIdSplitIndiBubble);
+    iSplitIndiBubble->SetTextFormat(TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(ESplitIndiTextLine)));
+    iSplitIndiBubble->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
+    iSplitIndiBubble->SetBitmapParam(NULL,
+                            NULL,
+                            KAknsIIDQsnFrInputPreviewSideL,
+                            KAknsIIDQsnFrInputPreviewMiddle,
+                            KAknsIIDQsnFrInputPreviewSideR);
+    AddControlL(iSplitIndiBubble);  
+    }
  
     
 // ---------------------------------------------------------------------------
@@ -809,6 +834,7 @@
     CreateAllButtonL();
     CreateItutKeypadL();
     CreateICFL();
+	CreateSplitIndiBubbleL();
     }
 
 // ---------------------------------------------------------------------------
@@ -948,6 +974,7 @@
     {
     // resize all controls
     SetCtrlRect(iStandardItutKp, EKeypadRect);
+    SetCtrlRect(iSplitIndiBubble, ESplitIndiPaneRect);
 
     iStandardItutKp->SetTextLineLayout(
         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadLeftTextLine)),
@@ -962,6 +989,13 @@
         TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EKeypadRightTextLine3)),
         EPosRight3);
     
+    TRect* iconRect = static_cast<TRect*>( iDataMgr->RequestData( EStarIconRect ));
+    // Set the star icon rect
+    iStandardItutKp->SetStarIconRect( *iconRect );
+    iconRect = static_cast<TRect*>( iDataMgr->RequestData( EShiftIconRect ));
+    // Set the shift icon rect
+    iStandardItutKp->SetShiftIconRect( *iconRect );
+    
     RPointerArray<CVirtualKey>& keys = 
         const_cast<RPointerArray<CVirtualKey>&>(iStandardItutKp->KeyArray());
     RArray<TRect>& cellRects = 
@@ -1456,9 +1490,44 @@
 
     }
 
-void CSplitItutWindow::UpdateIndiBubbleL( TUint8* aData )
+void CSplitItutWindow::UpdateSplitIndiBubbleL( TUint8* aData )
     {  
-	// if icf is hidden, not call updateindibubblel
+    RDesReadStream readStream;
+    TFepIndicatorInfo indicatorData;
+
+    TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) );            
+    readStream.Open(countPtr);
+    CleanupClosePushL(readStream);
+
+    indicatorData.iIndicatorImgID = readStream.ReadInt32L();
+    indicatorData.iIndicatorMaskID = readStream.ReadInt32L();
+    indicatorData.iIndicatorTextImgID = readStream.ReadInt32L();
+    indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L();
+
+    CleanupStack::PopAndDestroy(&readStream);
+
+    if ( indicatorData.iIndicatorImgID != 0 && 
+         indicatorData.iIndicatorMaskID != 0 && 
+         indicatorData.iIndicatorTextImgID != 0 &&
+         indicatorData.iIndicatorTextMaskID != 0)
+        {
+        iDataMgr->SetSplitIndicatorData(indicatorData);
+        iImDimensionSet = ETrue;
+
+        SetBubbleImageL(*iSplitIndiBubble, TItutDataConverter::AnyToRect(
+                iDataMgr->RequestData(ESplitIndiIconRect)),
+                indicatorData.iIndicatorImgID,
+                indicatorData.iIndicatorMaskID,
+                indicatorData.iIndicatorTextImgID,
+                indicatorData.iIndicatorTextMaskID);
+        iSplitIndiBubble->Hide(EFalse);
+        }
+    
+    }
+
+void CSplitItutWindow::UpdateSpellIndiBubbleL( TUint8* aData )
+    {  
+    // if icf is hidden, not call updateindibubblel
     if( iICF->Hiden() )     
     	{
         return;
@@ -1482,13 +1551,16 @@
          indicatorData.iIndicatorTextImgID != 0 &&
          indicatorData.iIndicatorTextMaskID != 0)
         {
-        iDataMgr->SetIndicatorData( indicatorData );
+        iDataMgr->SetSpellIndicatorData( indicatorData );
         iImDimensionSet = ETrue;
 
-        SetIndiBubbleImageL( indicatorData.iIndicatorImgID,
-                             indicatorData.iIndicatorMaskID,
-                             indicatorData.iIndicatorTextImgID,
-                             indicatorData.iIndicatorTextMaskID );
+        SetBubbleImageL(*iICF->MsgBubbleCtrl(),
+                        TItutDataConverter::AnyToRect( 
+                                iDataMgr->RequestData( ESpellIndiIconWithoutTextRect )),
+                        indicatorData.iIndicatorImgID,
+                        indicatorData.iIndicatorMaskID,
+                        indicatorData.iIndicatorTextImgID,
+                        indicatorData.iIndicatorTextMaskID );
             
 		TBuf<KTextLength> text;	
         iICF->MsgBubbleCtrl()->GetText( text );
@@ -1602,10 +1674,12 @@
     }
 
 // ---------------------------------------------------------------------------
-// CSplitItutWindow::SetIndiBubbleImageL
+// CSplitItutWindow::SetBubbleImageL
 // ---------------------------------------------------------------------------
 //
-void CSplitItutWindow::SetIndiBubbleImageL( const TInt aImgID1,
+void CSplitItutWindow::SetBubbleImageL( CBubbleCtrl& aBubble,
+                                            const TRect& aRect,
+                                            const TInt aImgID1,
                                             const TInt aMaskID1,
                                             const TInt aImgID2,
                                             const TInt aMaskID2 )
@@ -1650,10 +1724,7 @@
     
     AknIconUtils::GetContentDimensions( bmp2, iIndicatorTextSize );
     
-    TRect boundRect;
-    boundRect = TItutDataConverter::AnyToRect(
-                iDataMgr->RequestData( EIndiIconWithoutTextRect ));
-    
+    TRect boundRect = aRect;
     TRect imgrect, textrect;
     
     CalIndicatorRect( boundRect, imgrect, textrect, EIndiAlignCenter );
@@ -1665,11 +1736,11 @@
     CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, EColor256);
     CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256);
     
-    iICF->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, 
-                    KAknsIIDQsnFrInputPreviewSideL,
-                    KAknsIIDQsnFrInputPreviewMiddle,
-                    KAknsIIDQsnFrInputPreviewSideR );
-    
+    aBubble.SetBitmapParam( bmp3, mask3, 
+                            KAknsIIDQsnFrInputPreviewSideL,
+                            KAknsIIDQsnFrInputPreviewMiddle,
+                            KAknsIIDQsnFrInputPreviewSideR );
+       
     CleanupStack::PopAndDestroy( mask2 );
     CleanupStack::PopAndDestroy( bmp2 );
     CleanupStack::PopAndDestroy( mask1 );
@@ -1677,17 +1748,43 @@
     }
 
 // ---------------------------------------------------------------------------
-// CSplitItutWindow::SetIndiBubble
+// CSplitItutWindow::SetSplitIndiBubble
 // ---------------------------------------------------------------------------
 //
-void CSplitItutWindow::SetIndiBubble()
+void CSplitItutWindow::SetSplitIndiBubble()
     {
-    if ( iICF )
+    if (iSplitIndiBubble)
+        {
+        TAknTextLineLayout textLine = TItutDataConverter::AnyToTextLine(
+                iDataMgr->RequestData(ESplitIndiTextLine));
+        TRect bubbleRect = TItutDataConverter::AnyToRect(
+                iDataMgr->RequestData(ESplitIndiPaneRect));
+        TRect iconRect = TItutDataConverter::AnyToRect(
+                iDataMgr->RequestData(ESplitIndiIconRect));
+        TSize offset;
+        offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
+        offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
+        TSize size(iconRect.Width(), iconRect.Height());
+    
+        iSplitIndiBubble->SetRect(bubbleRect);
+        iSplitIndiBubble->SetIconOffsetAndSize(offset, size);
+        iSplitIndiBubble->SetTextFormat(textLine);
+        iSplitIndiBubble->SetTextColorIndex(EAknsCIQsnTextColorsCG67);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSplitItutWindow::SetSpellIndiBubble
+// ---------------------------------------------------------------------------
+//
+void CSplitItutWindow::SetSpellIndiBubble()
+    {
+    if (iICF)
         {
         TRect bubbleRect = TItutDataConverter::AnyToRect( 
-                iDataMgr->RequestData( EIndiPaneWithoutTextRect ));
+                iDataMgr->RequestData( ESpellIndiPaneWithoutTextRect ));
         TRect iconRect = TItutDataConverter::AnyToRect( 
-                iDataMgr->RequestData( EIndiIconWithoutTextRect ));
+                iDataMgr->RequestData( ESpellIndiIconWithoutTextRect ));
         
         TSize offset;
         offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
--- a/textinput/peninputsplititut/src/peninputsplititutwindowmanager.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplititut/src/peninputsplititutwindowmanager.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -259,8 +259,18 @@
         	break;
         case ECmdPenInputFingerMatchIndicator:
         	{
-        	iWindow->UpdateIndiBubbleL( aData );
-        	handle = ETrue;
+            if ( iLayoutOwner->UiMgr()->CurrentState() )
+                {
+                if (iLayoutOwner->UiMgr()->CurrentState()->StateType() == CSplitItutUiMgrBase::EStateSpelling )
+                    {
+                    iWindow->UpdateSpellIndiBubbleL( aData );
+                    }
+                else
+                    {
+                    iWindow->UpdateSplitIndiBubbleL( aData );
+                    }
+                handle = ETrue;
+                }
         	}
         	break;
         default:
@@ -328,8 +338,31 @@
 // CSplitItutWindowManager::HandleAppInfoChangeL
 // ---------------------------------------------------------------------------
 //
-void CSplitItutWindowManager::HandleAppInfoChangeL(const TDesC& /*aInfo*/)
+void CSplitItutWindowManager::HandleAppInfoChangeL(const TDesC& aInfo)
     {
+    if ( iWindow )
+        {
+        CBubbleCtrl* splitIndibubble = static_cast<CBubbleCtrl*> 
+                                    (iWindow->Control(ECtrlIdSplitIndiBubble)) ;
+
+        if ( splitIndibubble )
+            { 
+            if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
+                {
+                TRAP_IGNORE(splitIndibubble->SetTextL(aInfo));
+                }
+            else
+                {
+                TRAP_IGNORE(splitIndibubble->SetTextL(KNullDesC));
+                }
+            iWindow->SetSplitIndiBubble();
+            if (splitIndibubble->IsShowing())//make sure we redraw if visible
+                {
+                splitIndibubble->Popup(splitIndibubble->Rect());
+                }
+            }
+        }
+        
     }
 
 // ---------------------------------------------------------------------------
--- a/textinput/peninputsplitqwerty/group/iconlist.txt	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/group/iconlist.txt	Wed Sep 15 12:34:44 2010 +0300
@@ -40,6 +40,12 @@
 -c8,8 qgn_indi_fep_button_capslock.svg
 -c8,8 qgn_indi_fep_button_capslock_sel.svg
 -c8,8 qgn_indi_fep_button_shift.svg
+-c8,8 qgn_indi_input_page.svg
+-c8,8 qgn_indi_input_page1.svg
+-c8,8 qgn_indi_input_page2.svg
+-c8,8 qgn_indi_input_qwerty_page1_1_ah.svg
+-c8,8 qgn_indi_input_qwerty_page1_2_ah.svg
+-c8,8 qgn_indi_input_qwerty_page2_2_ah.svg
 -c8,8 qgn_indi_fep_button_shift_sel.svg
 -c8,8 qgn_indi_fep_button_hwr.svg
 -c8,8 qgn_indi_fep_button_hwr_sel.svg
--- a/textinput/peninputsplitqwerty/inc/peninputsplitqwertylafdatamgr.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/inc/peninputsplitqwertylafdatamgr.h	Wed Sep 15 12:34:44 2010 +0300
@@ -105,6 +105,11 @@
     TPeninputButtonLayoutDataEx iSpaceButtonEx;
     TPeninputButtonLayoutData   iEnterButton;
     TPeninputButtonLayoutData   iRangeButton;
+    TRect iSplitIndiPaneRectWithText;
+    TRect iSplitIndiPaneRectWithoutText;
+    TRect iSplitIndiIconRectWithText;
+    TRect iSplitIndiIconRectWithoutText;
+    TAknTextLineLayout iSplitIndiText;    
     TRect iTitlebarRect;
     TRect iClientRect;
     TRect iQwtRect;
@@ -276,6 +281,40 @@
      */
     TBool IsValid() const;
 
+    /**
+     * Get split indicator rect with text
+     *
+     * @return TRect
+     */
+    const TRect& SplitIndiRectWithText() const;
+    
+    /**
+     * Get split indicator rect without text
+     *
+     * @return TRect
+     */
+    const TRect& SplitIndiRectWithoutText() const;
+    
+    /**
+     * Get split indicator icon rect with text
+     *
+     * @return TRect
+     */    
+    const TRect& SplitIndiIconRectWithText() const;
+    
+    /**
+     * Get split indicator icon rect without text
+     *
+     * @return TRect
+     */        
+    const TRect& SplitIndiIconRectWithoutText() const;
+    
+    /**
+     * Get split indicator text layout
+     *
+     * @return TAknTextLineLayout
+     */        
+    const TAknTextLineLayout& SplitIndiText() const;
 protected:
 
     /**
@@ -589,6 +628,41 @@
     void GetSpaceButtonExLayoutInfo( TRect& aIconsFrameRect,
                                      TRect& aMiddleIconRect ) const;
 
+    /**
+     * Get split indicator rect with text
+     *
+     * @return TRect
+     */
+    const TRect& SplitIndiRectWithText() const;
+    
+    /**
+     * Get split indicator rect without text
+     *
+     * @return TRect
+     */
+    const TRect& SplitIndiRectWithoutText() const;
+    
+    /**
+     * Get split indicator icon rect with text
+     *
+     * @return TRect
+     */    
+    const TRect& SplitIndiIconRectWithText() const;
+    
+    /**
+     * Get split indicator icon rect without text
+     *
+     * @return TRect
+     */        
+    const TRect& SplitIndiIconRectWithoutText() const;
+    
+    /**
+     * Get split indicator text layout
+     *
+     * @return TAknTextLineLayout
+     */        
+    const TAknTextLineLayout& SplitIndiText() const;
+    
 private:
 
     /**
--- a/textinput/peninputsplitqwerty/inc/peninputsplitqwertylayout.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/inc/peninputsplitqwertylayout.h	Wed Sep 15 12:34:44 2010 +0300
@@ -265,6 +265,15 @@
      */
     void HandleVirtualKeyUpL( TInt aEventType, CFepUiBaseCtrl* aCtrl,
                               const TDesC& aEventData );
+    
+    /**
+     * Handle virtual key down event
+     * 
+     * @since since S60 v5.0
+     * @param none
+     * @return none
+     */
+    void HandleVirtualKeyDown();
 
 private:
 
--- a/textinput/peninputsplitqwerty/inc/peninputsplitqwertywindow.h	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/inc/peninputsplitqwertywindow.h	Wed Sep 15 12:34:44 2010 +0300
@@ -33,6 +33,7 @@
 class CPeninputSyncBitmapRotator;
 class CRepository;
 class CFepLayoutScrollableList;
+class CPopupBubbleCtrl;
 
 // Constants
 const TInt KMaxFileLength = 80;
@@ -61,6 +62,13 @@
  */
 class CPeninputSplitQwertyWindow : public CPeninputLayoutWindowExt
     {
+private:
+    enum TIndicatorAlign
+        {
+        EIndiAlignLeft,
+        EIndiAlignCenter,
+        EIndiAlignRight 
+        };    
 public:
     /**
      * Symbian constructor
@@ -290,6 +298,15 @@
      */
     TBool HandleVirtualKeyUpEvent( TInt aEventType, CFepUiBaseCtrl* aCtrl,
                                    const TDesC& aEventData );
+    
+    /**
+     * Handle virtual key down event
+     *
+     * @since S60 v5.0
+     * @param None
+     * @return None
+     */
+    void HandleVirtualKeyDownEvent();
 
     /**
      * Submit dead key
@@ -367,7 +384,70 @@
      */
     void UpdateLayoutPosAndSize();
 
+    /**
+     * Set split indicator bubble size with text
+     * 
+     * @return None
+     */
+    void SetSplitIndiBubbleSizeWithText();
 
+    /**
+     * Set split indicator bubble size without text
+     * 
+     * @return None
+     */    
+    void SetSplitIndiBubbleSizeWithoutText();
+
+    /**
+     * Update split indicator bubble
+     * 
+     * @param aData text
+     * @return None
+     */
+    void UpdateSplitIndiBubbleL( TUint8* aData );
+    
+    /** 
+     * Set bubble image
+     *
+     * @param aImgID1 image ID1
+     * @param aMaskID1 mask image id1
+     * @param aImgID2 image ID2
+     * @param aMaskID2 mask image id2
+     * @return None
+     */    
+    void SetSplitIndiBubbleImageL( const TInt aImgID1,
+                            const TInt aMaskID1,
+                            const TInt aImgID2,
+                            const TInt aMaskID2 );
+
+    /**
+     * Calculate indicator bubble rect
+     *
+     * @param aBoundRect
+     * @param aRealRect1
+     * @param aRealRect2
+     * @param aAlign
+     * @return None
+     */     
+    void CalIndicatorRect(const TRect& aBoundRect,
+                          TRect& aRealRect1,
+                          TRect& aRealRect2,
+                          TIndicatorAlign aAlign);    
+    /**
+     * Get indicator data
+     * 
+     * @return TFepIndicatorInfo indicator info
+     */
+    inline TFepIndicatorInfo SplitIndicatorData();
+
+    /**
+     * Set indicator data
+     * 
+     * @param aIndicatorData Indicator Data
+     * @return None
+     */
+    inline void SetSplitIndicatorData( const TFepIndicatorInfo& aIndicatorData );  
+    
 protected: //from base class CPeninputLayoutWindowExt
     /**
      * Set laf layout type
@@ -631,6 +711,12 @@
     CPeninputCommonChoiceList* iPopupWnd;
 
     /**
+     * Indicator bubble
+     * Not own
+     */
+    CPopupBubbleCtrl* iSplitIndiBubble;
+    
+    /**
      * The resource file name
      */
     TBuf<KMaxFileLength> iResourceFilename;
@@ -739,6 +825,21 @@
     RArray<CFepLayoutChoiceList::SItem> iAccentCmdList;
 
     /**
+     * Indicator bubble size
+     */
+    TSize iSplitIndicatorSize;
+
+    /**
+     * Indicator text size
+     */
+    TSize iSplitIndicatorTextSize;
+
+    /**
+     * Indicator data
+     */
+    TFepIndicatorInfo iSplitIndicatorData;
+    
+    /**
      * Range labels for range list
      */
     TAllRangeLabels iRangeLabels;
@@ -760,6 +861,20 @@
     return ( aLanguage != ELangTest && aLanguage != ELangNone );
     }
 
+inline void CPeninputSplitQwertyWindow::SetSplitIndicatorData( 
+        const TFepIndicatorInfo& aIndicatorData )
+    {
+    iSplitIndicatorData.iIndicatorImgID = aIndicatorData.iIndicatorImgID;
+    iSplitIndicatorData.iIndicatorMaskID = aIndicatorData.iIndicatorMaskID;
+    iSplitIndicatorData.iIndicatorTextImgID = aIndicatorData.iIndicatorTextImgID;
+    iSplitIndicatorData.iIndicatorTextMaskID = aIndicatorData.iIndicatorTextMaskID;
+    }
+    
+inline TFepIndicatorInfo CPeninputSplitQwertyWindow::SplitIndicatorData()
+    {
+    return iSplitIndicatorData;
+    }
+
 inline CAknFepCtrlEventButton* CPeninputSplitQwertyWindow::EventButtonCtrl(
                                                                 TInt aCtrlId )
     {
--- a/textinput/peninputsplitqwerty/src/peninputsplitqwertylafdatamgr.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/src/peninputsplitqwertylafdatamgr.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -202,6 +202,56 @@
     }
 
 // ---------------------------------------------------------------------------
+// Get split indicator rect with text
+// ---------------------------------------------------------------------------
+//
+const TRect& MPeninputLafDataCommon::SplitIndiRectWithText() const
+    {
+    ASSERT( IsValid());
+    return iLayoutDataInfo[iLayoutType]->iSplitIndiPaneRectWithText;
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator rect without text
+// ---------------------------------------------------------------------------
+//
+const TRect& MPeninputLafDataCommon::SplitIndiRectWithoutText() const 
+    {
+    ASSERT( IsValid());
+    return iLayoutDataInfo[iLayoutType]->iSplitIndiPaneRectWithoutText;
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator icon rect with text
+// ---------------------------------------------------------------------------
+//
+const TRect& MPeninputLafDataCommon::SplitIndiIconRectWithText() const
+    {
+    ASSERT( IsValid());
+    return iLayoutDataInfo[iLayoutType]->iSplitIndiIconRectWithText;
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator icon rect without text
+// ---------------------------------------------------------------------------
+//
+const TRect& MPeninputLafDataCommon::SplitIndiIconRectWithoutText() const
+    {
+    ASSERT( IsValid());
+    return iLayoutDataInfo[iLayoutType]->iSplitIndiIconRectWithoutText;
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator text layout
+// ---------------------------------------------------------------------------
+//
+const TAknTextLineLayout& MPeninputLafDataCommon::SplitIndiText() const
+    {
+    ASSERT( IsValid());
+    return iLayoutDataInfo[iLayoutType]->iSplitIndiText;
+    }
+
+// ---------------------------------------------------------------------------
 // Symbian constructor
 // ---------------------------------------------------------------------------
 //        
@@ -493,6 +543,32 @@
     data->iPreviewWndText = keyText;
     data->iPreviewWndRect = layoutrect.Rect();
     data->iPreviewWndInnerRect = layoutInnerect.Rect();
+
+    // bubble indicator
+    TAknWindowLineLayout icfIndiPaneWithText, icfIndiPaneWithoutText, 
+        indiIconWithText, indiIconWithoutText;
+    TAknLayoutRect icfIndiPaneRectWithText, icfIndiPaneRectWithoutText,
+        indiIconRectWithText, indiIconRectWithoutText;
+    TAknTextLineLayout indiTextLayout;
+    
+    icfIndiPaneWithText = AknLayoutScalable_Avkon::icf_edit_indi_pane(1).LayoutLine();
+    icfIndiPaneRectWithText.LayoutRect( rectAppWin, icfIndiPaneWithText );
+    data->iSplitIndiPaneRectWithText = icfIndiPaneRectWithText.Rect();
+    
+    icfIndiPaneWithoutText = AknLayoutScalable_Avkon::icf_edit_indi_pane(0).LayoutLine();
+    icfIndiPaneRectWithoutText.LayoutRect( rectAppWin, icfIndiPaneWithoutText );
+    data->iSplitIndiPaneRectWithoutText = icfIndiPaneRectWithoutText.Rect();
+    
+    indiIconWithText = AknLayoutScalable_Avkon::icf_edit_indi_pane_g2(1).LayoutLine();
+    indiIconRectWithText.LayoutRect( icfIndiPaneRectWithText.Rect(), indiIconWithText );
+    data->iSplitIndiIconRectWithText = indiIconRectWithText.Rect();
+    
+    indiIconWithoutText = AknLayoutScalable_Avkon::icf_edit_indi_pane_g2(0).LayoutLine();
+    indiIconRectWithoutText.LayoutRect( icfIndiPaneRectWithoutText.Rect(), indiIconWithoutText );
+    data->iSplitIndiIconRectWithoutText = indiIconRectWithoutText.Rect();
+    
+    indiTextLayout = AknLayoutScalable_Avkon::icf_edit_indi_pane_t1(0).LayoutLine();
+    data->iSplitIndiText = indiTextLayout;    
     
     return data;
     }
@@ -830,4 +906,54 @@
 void CPeninputSplitQwertyLafMgr::ConstructL()
     {
     }
+
+// ---------------------------------------------------------------------------
+// Get split indicator rect with text
+// ---------------------------------------------------------------------------
+//
+const TRect& CPeninputSplitQwertyLafMgr::SplitIndiRectWithText() const
+    {
+    ASSERT(iLafData);
+    return iLafData->SplitIndiRectWithText();
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator pane rect without text
+// ---------------------------------------------------------------------------
+//
+const TRect& CPeninputSplitQwertyLafMgr::SplitIndiRectWithoutText() const
+    {
+    ASSERT(iLafData);
+    return iLafData->SplitIndiRectWithoutText();
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator icon rect with text
+// ---------------------------------------------------------------------------
+//
+const TRect& CPeninputSplitQwertyLafMgr::SplitIndiIconRectWithText() const
+    {
+    ASSERT(iLafData);
+    return iLafData->SplitIndiIconRectWithText();
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator icon rect without text
+// ---------------------------------------------------------------------------
+//
+const TRect& CPeninputSplitQwertyLafMgr::SplitIndiIconRectWithoutText() const
+    {
+    ASSERT(iLafData);
+    return iLafData->SplitIndiIconRectWithoutText();
+    }
+
+// ---------------------------------------------------------------------------
+// Get split indicator text layout
+// ---------------------------------------------------------------------------
+//
+const TAknTextLineLayout& CPeninputSplitQwertyLafMgr::SplitIndiText() const
+    {
+    ASSERT(iLafData);
+    return iLafData->SplitIndiText();
+    }
 // End Of File
--- a/textinput/peninputsplitqwerty/src/peninputsplitqwertylayout.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/src/peninputsplitqwertylayout.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -31,6 +31,7 @@
 #include <s32mem.h>
 
 #include <peninputrangebar.h>
+#include <peninputpopupbubble.h>
 
 // User includes
 #include "peninputsplitqwerty.hrh"
@@ -203,6 +204,14 @@
             iITIEnabled = CPeninputDataConverter::AnyToInt( aData );
             }            
             break;
+        case ECmdPenInputFingerMatchIndicator:
+            {
+            if ( iLayoutType == EPluginInputModeFSQ )
+                {
+                TRAP_IGNORE( vkbWindow->UpdateSplitIndiBubbleL( aData ));
+                }
+            }
+            break;            
         default:
             {
             }
@@ -227,6 +236,13 @@
             TRAP_IGNORE( HandleVirtualKeyUpL( aEventType, aCtrl, aEventData ) );
             }
             break;
+        case EEventVirtualKeyDown:
+        	{
+        	HandleVirtualKeyDown();
+        	CPeninputCommonLayoutExt::HandleControlEvent( aEventType, 
+        			aCtrl, aEventData );
+        	break;
+        	}
         default:
             {
             CPeninputCommonLayoutExt::HandleControlEvent( aEventType, 
@@ -243,15 +259,6 @@
 TInt CPeninputSplitQwertyLayout::OnAppEditorTextComing( 
                                       const TFepInputContextFieldData& aData )
     {
-    CPeninputSplitQwertyWindow* 
-        win = static_cast<CPeninputSplitQwertyWindow*>(iLayoutWindow);
-        
-    //Suppress ICF related actions
-    if ( win )
-        {
-        return KErrNone;
-        }
-    
     return CPeninputCommonLayoutExt::OnAppEditorTextComing( aData );
     }
 
@@ -278,10 +285,30 @@
 // Inform UI that application infomation changed
 // ---------------------------------------------------------------------------
 //
-void CPeninputSplitQwertyLayout::HandleAppInfoChange( const TDesC& /*aInfo*/, 
-                                                      TPeninputAppInfo /*aType*/ )
+void CPeninputSplitQwertyLayout::HandleAppInfoChange( const TDesC& aInfo, 
+                                                      TPeninputAppInfo aType )
     {
-    //Suppress ICF related actions
+    if ( LayoutWindow() )
+        {
+        CPopupBubbleCtrl* splitIndibubble = static_cast<CPopupBubbleCtrl*> 
+                                    (LayoutWindow()->Control(EPeninputWindowCtrlIdSplitIndiBubble)) ;         
+
+        if ( splitIndibubble && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) )
+            {
+            CPeninputSplitQwertyWindow* window = static_cast<CPeninputSplitQwertyWindow*>(iLayoutWindow);           
+            if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
+                {
+                TRAP_IGNORE(splitIndibubble->SetTextL(aInfo));
+                window->SetSplitIndiBubbleSizeWithText();                
+                }
+            else
+                {
+                TRAP_IGNORE(splitIndibubble->SetTextL(KNullDesC));
+                window->SetSplitIndiBubbleSizeWithoutText();                 
+                }
+            splitIndibubble->Draw();           
+            }
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -425,4 +452,19 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// Handle virtual key down event
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyLayout::HandleVirtualKeyDown()
+	{
+	CPeninputSplitQwertyWindow* window = 
+			static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow );
+	
+	if ( window )
+		{
+		window->HandleVirtualKeyDownEvent();
+		}
+	}
+
 // End Of File
--- a/textinput/peninputsplitqwerty/src/peninputsplitqwertywindow.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/src/peninputsplitqwertywindow.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -55,6 +55,7 @@
 #include "peninputsplitqwertylafdatamgr.h"
 #include "peninputsplitqwertylangmeritpair.h"
 #include "peninputsplitqwertylayout.h"
+#include "peninputpopupbubble.h"
 
 #include <peninputaknvkbpreviewbubblerenderer.h>
 #include <peninputlongpressbutton.h>
@@ -215,7 +216,18 @@
     {
     // Range bar
     AddRangeBarL();
-
+    
+    // char count bubble   
+    iSplitIndiBubble = CPopupBubbleCtrl::NewL(TRect(),UiLayout(),EPeninputWindowCtrlIdSplitIndiBubble);
+    iSplitIndiBubble->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
+    //Change the ID when ID into release
+    iSplitIndiBubble->SetBitmapParamL(NULL,
+                              NULL,
+                              KAknsIIDQsnFrInputPreviewSideL,
+                              KAknsIIDQsnFrInputPreviewMiddle,
+                              KAknsIIDQsnFrInputPreviewSideR);
+    AddControlL(iSplitIndiBubble);
+   
     // Vkb control
     iVkbCtrl = CPeninputVkbCtrlExt::NewL( TRect(), 
                                           UiLayout(), 
@@ -867,6 +879,24 @@
     } 
 
 // ---------------------------------------------------------------------------
+// Handle virtual key down event
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyWindow::HandleVirtualKeyDownEvent()
+	{
+    // Get DeadKey state
+    TInt latchedFlag = CPeninputDataConverter::AnyToInt(
+				   iLayoutContext->RequestData( EAkninputDataTypeLatchedSet ));
+    
+    if ( latchedFlag )
+    	{
+	    UnLatchDeadKey( iNewDeadKeyBuf );
+	    TBool deadKeyChange = ETrue;
+	    iLayoutContext->SetData( EAkninputDataTypeLatchedSet, &deadKeyChange );
+    	}
+	}
+
+// ---------------------------------------------------------------------------
 // Set dead key
 // ---------------------------------------------------------------------------
 //     
@@ -2106,4 +2136,214 @@
     TRAP_IGNORE( UpdateRangeCtrlsL() );
     }
 
+// ---------------------------------------------------------------------------
+// Set split indicator bubble image
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyWindow::SetSplitIndiBubbleImageL( const TInt aImgID1,
+                                              const TInt aMaskID1,
+                                              const TInt aImgID2,
+                                              const TInt aMaskID2 )
+    {
+    MAknsSkinInstance* skininstance = AknsUtils::SkinInstance();
+
+    CFbsBitmap* bmp1 = NULL;
+    CFbsBitmap* mask1 = NULL;
+    
+    TInt colorIndex = EAknsCIQsnIconColorsCG30;
+
+    AknsUtils::CreateColorIconL(skininstance,
+                                KAknsIIDQsnIconColors,
+                                KAknsIIDQsnIconColors,
+                                colorIndex,
+                                bmp1,
+                                mask1,
+                                AknIconUtils::AvkonIconFileName(),
+                                aImgID1,
+                                aMaskID1,
+                                KRgbGray);
+    CleanupStack::PushL( bmp1 );
+    CleanupStack::PushL( mask1 );
+                                
+    AknIconUtils::GetContentDimensions(bmp1, iSplitIndicatorSize);
+
+    CFbsBitmap* bmp2 = NULL;
+    CFbsBitmap* mask2 = NULL;
+    AknsUtils::CreateColorIconL(skininstance,
+                                KAknsIIDQsnIconColors,
+                                KAknsIIDQsnIconColors,
+                                colorIndex,
+                                bmp2,
+                                mask2,
+                                AknIconUtils::AvkonIconFileName(),
+                                aImgID2,
+                                aMaskID2,
+                                KRgbGray);
+ 
+    CleanupStack::PushL( bmp2 );
+    CleanupStack::PushL( mask2 );
+    
+    AknIconUtils::GetContentDimensions(bmp2, iSplitIndicatorTextSize);
+    
+    TRect boundRect;
+    if (iSplitIndiBubble->HasText())
+        {
+        boundRect = iLafMgr->SplitIndiIconRectWithText();
+        }
+    else
+        {
+        boundRect = iLafMgr->SplitIndiIconRectWithoutText();
+        }
+    TRect imgrect, textrect;
+    
+    CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignCenter);
+    AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved);
+    AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved);
+    AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved);
+    AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved);
+
+    CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, bmp1->DisplayMode());
+    CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256);
+    
+    iSplitIndiBubble->SetBitmapParamL( bmp3, mask3, 
+                    KAknsIIDQsnFrInputPreviewSideL,
+                    KAknsIIDQsnFrInputPreviewMiddle,
+                    KAknsIIDQsnFrInputPreviewSideR );
+    
+    CleanupStack::PopAndDestroy( mask2 );
+    CleanupStack::PopAndDestroy( bmp2 );
+    CleanupStack::PopAndDestroy( mask1 );
+    CleanupStack::PopAndDestroy( bmp1 );
+    }
+
+// ---------------------------------------------------------------------------
+// Calculate indicator rect
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyWindow::CalIndicatorRect(const TRect& aBoundRect,
+                                          TRect& aRealRect1,
+                                          TRect& aRealRect2,
+                                          TIndicatorAlign aAlign) 
+    {
+    TInt imgAspectText = iSplitIndicatorTextSize.iWidth / iSplitIndicatorTextSize.iHeight;
+    TInt imgAspectIndi = iSplitIndicatorSize.iWidth / iSplitIndicatorSize.iHeight;
+    TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, 
+                       aBoundRect.Size().iHeight );
+    TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, 
+                               aBoundRect.Size().iHeight );
+    // check if the length of img > bound rect width
+    TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth;
+    if( nTotalWidth > aBoundRect.Size().iWidth )
+        {
+        TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth;
+        imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect;
+        imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth;
+        imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText;
+        // make sure the height of two rect is equal
+        imgSizeIndi.iHeight = imgSizeText.iHeight;
+        }
+    if( aAlign == EIndiAlignRight )
+        {
+        aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY),
+                       imgSizeText);
+        aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY),
+                       imgSizeIndi);
+        }
+    else if( aAlign == EIndiAlignCenter )
+        {
+        TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2;
+        TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2;
+        aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, 
+                                   aBoundRect.iTl.iY + offsetY),
+                            imgSizeText );
+        aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY),
+                       imgSizeIndi );
+        }
+    else if( aAlign == EIndiAlignLeft )
+        {
+        aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi );
+        aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set split indicator bubble size with text
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyWindow::SetSplitIndiBubbleSizeWithText()
+    {
+    if ( iSplitIndiBubble )
+        {
+        TAknTextLineLayout textLine = iLafMgr->SplitIndiText();
+        TRect bubbleRect = iLafMgr->SplitIndiRectWithText();
+        TRect iconRect = iLafMgr->SplitIndiIconRectWithText();
+        TSize offset;
+        offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
+        offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
+        TSize size( iconRect.Width(), iconRect.Height());
+        
+        iSplitIndiBubble->SetRect( bubbleRect );
+        iSplitIndiBubble->SetIconOffsetAndSize( offset, size );
+        iSplitIndiBubble->SetTextFormat( textLine );
+        iSplitIndiBubble->SetTextColorIndex( EAknsCIQsnTextColorsCG67 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set split indicator bubble size without text
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyWindow::SetSplitIndiBubbleSizeWithoutText()
+    {
+    if ( iSplitIndiBubble )
+        {
+        TRect bubbleRect = iLafMgr->SplitIndiRectWithoutText();
+        TRect iconRect = iLafMgr->SplitIndiIconRectWithoutText();
+        TSize offset;
+        offset.iHeight = iconRect.iTl.iY - bubbleRect.iTl.iY;
+        offset.iWidth = iconRect.iTl.iX - bubbleRect.iTl.iX;
+        TSize size( iconRect.Width(), iconRect.Height());
+        
+        iSplitIndiBubble->SetRect( bubbleRect );
+        iSplitIndiBubble->SetIconOffsetAndSize( offset, size );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Update split indicator bubble
+// ---------------------------------------------------------------------------
+//
+void CPeninputSplitQwertyWindow::UpdateSplitIndiBubbleL( TUint8* aData )
+    {
+    RDesReadStream readStream;
+    TFepIndicatorInfo indicatorData;
+
+    TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) );            
+    readStream.Open(countPtr);
+    CleanupClosePushL(readStream);
+
+    indicatorData.iIndicatorImgID = readStream.ReadInt32L();
+    indicatorData.iIndicatorMaskID = readStream.ReadInt32L();
+    indicatorData.iIndicatorTextImgID = readStream.ReadInt32L();
+    indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L();
+
+    CleanupStack::PopAndDestroy(&readStream);
+    
+    if ( indicatorData.iIndicatorImgID != 0 && 
+        indicatorData.iIndicatorMaskID != 0 && 
+        indicatorData.iIndicatorTextImgID != 0 &&
+        indicatorData.iIndicatorTextMaskID != 0 )
+        { 
+        SetSplitIndicatorData( indicatorData );
+        
+
+        SetSplitIndiBubbleImageL( indicatorData.iIndicatorImgID,
+                    indicatorData.iIndicatorMaskID,
+                    indicatorData.iIndicatorTextImgID,
+                    indicatorData.iIndicatorTextMaskID );
+                 
+        iSplitIndiBubble->Hide(EFalse);
+        }
+    }
+
 // End Of File
--- a/textinput/peninputsplitqwerty/srcdata/peninputssqwin.rss	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/peninputsplitqwerty/srcdata/peninputssqwin.rss	Wed Sep 15 12:34:44 2010 +0300
@@ -602,7 +602,43 @@
 		        modeimage = r_peninput_layout_vkb_range_case_capslock;
 		        rangeid=0;
 		        modeid=ECaseText;
-		        }    
+		        },  
+            AKN_FEP_BUTTON_MODE
+                {
+                modeimage = r_peninput_layout_vkb_range_case_paging_11;
+                rangeid=0;
+                modeid=ECaseNumberSpecialPaging11;
+                } ,   
+            AKN_FEP_BUTTON_MODE
+                 {
+                 modeimage = r_peninput_layout_vkb_range_case_paging_12;
+                 rangeid=0;
+                 modeid=ECaseNumberSpecialPaging12;
+                 },
+            AKN_FEP_BUTTON_MODE
+                 {
+                 modeimage = r_peninput_layout_vkb_range_case_paging_22;
+                 rangeid=0;
+                 modeid=ECaseNumberSpecialPaging22;
+                 },                                 
+            AKN_FEP_BUTTON_MODE
+                {
+                 modeimage = r_peninput_layout_vkb_range_case_paging_arabic_11;
+                 rangeid=0;
+                 modeid=ECaseNumberSpecialPagingArabic11;
+                },   
+            AKN_FEP_BUTTON_MODE
+                {
+                modeimage = r_peninput_layout_vkb_range_case_paging_arabic_12;
+                rangeid=0;
+                modeid=ECaseNumberSpecialPagingArabic12;
+                },
+            AKN_FEP_BUTTON_MODE
+                {
+                modeimage = r_peninput_layout_vkb_range_case_paging_arabic_22;
+                rangeid=0;
+                modeid=ECaseNumberSpecialPagingArabic22;
+                }       		        
 		    };    
 		}
 		
@@ -764,6 +800,139 @@
     disableskinid=EAknsMinorGenericQgnIndiFepButtonSwitch;
     }
 
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_11
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputsplitqwertyQgn_indi_input_page;
+    nactivemsk=EMbmPeninputsplitqwertyQgn_indi_input_page_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputPage;
+
+    nactivep=EMbmPeninputsplitqwertyQgn_indi_input_page;
+    nactivepmsk=EMbmPeninputsplitqwertyQgn_indi_input_page_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputPage;
+    
+    active=EMbmPeninputsplitqwertyQgn_indi_input_page;
+    activemsk=EMbmPeninputsplitqwertyQgn_indi_input_page_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputPage;
+    
+    activep=EMbmPeninputsplitqwertyQgn_indi_input_page;
+    activepmsk=EMbmPeninputsplitqwertyQgn_indi_input_page_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputPage;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_12
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputsplitqwertyQgn_indi_input_page1;
+    nactivemsk=EMbmPeninputsplitqwertyQgn_indi_input_page1_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputPage1;
+    
+    nactivep=EMbmPeninputsplitqwertyQgn_indi_input_page1;
+    nactivepmsk=EMbmPeninputsplitqwertyQgn_indi_input_page1_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputPage1;
+    
+    active=EMbmPeninputsplitqwertyQgn_indi_input_page1;
+    activemsk=EMbmPeninputsplitqwertyQgn_indi_input_page1_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputPage1;
+    
+    activep=EMbmPeninputsplitqwertyQgn_indi_input_page1;
+    activepmsk=EMbmPeninputsplitqwertyQgn_indi_input_page1_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputPage1;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_22
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputsplitqwertyQgn_indi_input_page2;
+    nactivemsk=EMbmPeninputsplitqwertyQgn_indi_input_page2_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputPage2;
+    
+    nactivep=EMbmPeninputsplitqwertyQgn_indi_input_page2;
+    nactivepmsk=EMbmPeninputsplitqwertyQgn_indi_input_page2_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputPage2;
+    
+    active=EMbmPeninputsplitqwertyQgn_indi_input_page2;
+    activemsk=EMbmPeninputsplitqwertyQgn_indi_input_page2_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputPage2;
+    
+    activep=EMbmPeninputsplitqwertyQgn_indi_input_page2;
+    activepmsk=EMbmPeninputsplitqwertyQgn_indi_input_page2_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputPage2;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_arabic_11
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah;
+    nactivemsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+
+    nactivep=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah;
+    nactivepmsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+    
+    active=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah;
+    activemsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+    
+    activep=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah;
+    activepmsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_1_ah_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputQwertyPage11Ah;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_arabic_12
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah;
+    nactivemsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    
+    nactivep=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah;
+    nactivepmsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    
+    active=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah;
+    activemsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    
+    activep=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah;
+    activepmsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page1_2_ah_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputQwertyPage12Ah;
+    }       
+
+RESOURCE AKN_FEP_BUTTON_IMAGE r_peninput_layout_vkb_range_case_paging_arabic_22
+    {
+    bmpfile=PENINPUT_LAYOUT_VKB_BMP;
+    imgmajorskinid=EAknsMajorGeneric;
+    
+    nactive=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah;
+    nactivemsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah_mask;
+    nactiveskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    
+    nactivep=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah;
+    nactivepmsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah_mask;
+    nactivepskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    
+    active=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah;
+    activemsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah_mask;
+    activeskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    
+    activep=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah;
+    activepmsk=EMbmPeninputsplitqwertyQgn_indi_input_qwerty_page2_2_ah_mask;
+    activepskinid=EAknsMinorGenericQgnIndiInputQwertyPage22Ah;
+    }       
+
+
 RESOURCE LBUF r_peninput_vkb_accent1
     {
     txt=qtn_tin_vkb_accented_set1;
--- a/textinput/ptienginev2/src/PtiEngineImpl.cpp	Tue Sep 14 21:59:06 2010 +0300
+++ b/textinput/ptienginev2/src/PtiEngineImpl.cpp	Wed Sep 15 12:34:44 2010 +0300
@@ -747,6 +747,19 @@
 			delete oldTextBuf;
 			}
 		}
+     else
+         {
+         // call CPtiKoreanQwertyCore::LoadKeyboards() by OpenLanguageL() again,
+         // make sure that in hardware Qwerty, product keymappings can be used correctly.
+         if ( aNewMode == EPtiEngineQwertyKorean )
+            {    
+              CPtiCore* core = static_cast<CPtiCore*>(iCurrentLanguage->GetCore( aNewMode ));
+              if ( core )
+                  {
+                  TRAP_IGNORE( core->OpenLanguageL( iCurrentLanguage ) );
+                  }
+            }
+          }
 	}
 
 // ---------------------------------------------------------------------------
@@ -2460,13 +2473,25 @@
 //
 void CPtiEngineImpl::LoadCoresInDefaultDirL(TBool aUseDefaultUserDictionary)
 	{
-	TInt i;
-	CArrayFix<TInt>* array = CPtiCore::ListCoresLC();
-	User::LeaveIfNull(array);
-	for (i = 0; i < array->Count(); i++)
-		{
-		AddCoreL(TUid::Uid(array->At(i)), aUseDefaultUserDictionary);
-		}
+    TUid KPtiSogouCoreUid = { 0x20031DD7 };
+    TInt i = 0;
+    TInt postponed = -1;
+    CArrayFix<TInt>* array = CPtiCore::ListCoresLC();
+    User::LeaveIfNull(array);
+    for (i = 0; i < array->Count(); i++)
+        {
+        if (TUid::Uid(array->At(i)) == KPtiSogouCoreUid )
+            {
+            postponed = i;
+            continue;
+            }
+        AddCoreL(TUid::Uid(array->At(i)), aUseDefaultUserDictionary);
+        }
+    
+    if (postponed >= 0)
+        {
+        AddCoreL(TUid::Uid(array->At(postponed)), aUseDefaultUserDictionary);
+        }
 
 	CleanupStack::PopAndDestroy(); // array
 	}