textinput/peninputgenericvkb/src/peninputgenericvkblayout.cpp
changeset 0 eb1f2e154e89
child 7 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  generic VKB layout
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // System includes
       
    20 #include <aknfeppeninputenums.h>    // Command from fep or IME to plugin
       
    21 #include <AknFepGlobalEnums.h>      // Define EPluginInputModeHwr
       
    22 #include <peninputcmd.h>            // Use global signal
       
    23 #include <peninputlayoutchoicelist.h>
       
    24 #include <peninputlayoutbutton.h>
       
    25 #include <peninputdragbutton.h>
       
    26 #include <peninputcommonlayoutglobalenum.h>
       
    27 #include <coemain.h>
       
    28 #include <peninputlayoutbubblectrl.h>
       
    29 #include <peninputlayoutmultilineicf.h>
       
    30 #include <peninputscrollablelist.h>
       
    31 #include <s32mem.h>
       
    32 
       
    33 // User includes
       
    34 #include "peninputgenericvkb.hrh"
       
    35 #include "peninputuistatemgrinterface.h"
       
    36 #include "peninputgenericvkblayout.h"
       
    37 #include "peninputgenericvkbwindow.h"
       
    38 #include "peninputgenericvkbdatamgr.h"
       
    39 #include "peninputgenericvkbuistatestandby.h"
       
    40 #include "peninputgenericvkbuistatepopup.h"
       
    41 #include "peninputdataconverter.h"
       
    42 
       
    43 const TInt KPeriodicTimerIntervalSec(2500000);
       
    44 // ======== MEMBER FUNCTIONS ========
       
    45 const TInt KNumberOfDottedChar = 16; 
       
    46 const TUint16 thaiUnicodeOri[KNumberOfDottedChar] = {0x0E31,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39, 
       
    47                               0x0E3A,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D}; 
       
    48 const TUint16 thaiUnicodeNew[KNumberOfDottedChar] = {0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739, 
       
    49                               0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D}; 
       
    50 
       
    51 
       
    52 _LIT(KDisplaySpace, "\x0020");
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CPeninputGenericVkbLayoutImp::NewL
       
    56 // (other items were commented in a header)
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 CPeninputGenericVkbLayoutImp* CPeninputGenericVkbLayoutImp::NewL( 
       
    60     TAny* /*aInitParams*/ )
       
    61     {
       
    62     CPeninputGenericVkbLayoutImp* self = new ( ELeave ) 
       
    63         CPeninputGenericVkbLayoutImp();
       
    64     CleanupStack::PushL( self );
       
    65     self->Construct( EFalse ); 
       
    66     CleanupStack::Pop( self );
       
    67 
       
    68     return self;
       
    69     }
       
    70 
       
    71 CPeninputGenericVkbLayoutImp* CPeninputGenericVkbLayoutImp::NewFsqL( 
       
    72     TAny* /*aInitParams*/ )
       
    73     {
       
    74     CPeninputGenericVkbLayoutImp* self = new ( ELeave ) 
       
    75         CPeninputGenericVkbLayoutImp();
       
    76     CleanupStack::PushL( self );
       
    77     self->Construct( ETrue ); 
       
    78     CleanupStack::Pop( self );
       
    79 
       
    80     return self;
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CPeninputGenericVkbLayoutImp::~CPeninputGenericVkbLayoutImp
       
    85 // (other items were commented in a header)
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CPeninputGenericVkbLayoutImp::~CPeninputGenericVkbLayoutImp()
       
    89     {
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CPeninputGenericVkbLayoutImp::CPeninputGenericVkbLayoutImp
       
    94 // (other items were commented in a header)
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 CPeninputGenericVkbLayoutImp::CPeninputGenericVkbLayoutImp()
       
    98     {
       
    99     }
       
   100 
       
   101 // ---------------------------------------------------------------------------
       
   102 // CPeninputGenericVkbLayoutImp::ConstructL
       
   103 // (other items were commented in a header)
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 void CPeninputGenericVkbLayoutImp::Construct( TBool aIsFsq )
       
   107     {
       
   108     iIsFsq = aIsFsq;
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // CPeninputGenericVkbLayoutImp::CreateFepUiLayoutL
       
   113 // (other items were commented in a header)
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 CFepUiLayout* CPeninputGenericVkbLayoutImp::CreateFepUiLayoutL( 
       
   117     MLayoutOwner* aLayoutOwner, const TAny* aData )
       
   118     {
       
   119     CPeninputGenericVkbLayout* uiLayout = 
       
   120         CPeninputGenericVkbLayout::NewL( aLayoutOwner, aData, iIsFsq );
       
   121 
       
   122     return uiLayout;
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // CPeninputGenericVkbLayout::NewL
       
   127 // (other items were commented in a header)
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 CPeninputGenericVkbLayout* CPeninputGenericVkbLayout::NewL( 
       
   131     MLayoutOwner* aLayoutOwner, const TAny* aInitData, TBool aIsFsq )
       
   132     {
       
   133     CPeninputGenericVkbLayout* self = 
       
   134         new (ELeave) CPeninputGenericVkbLayout( aLayoutOwner );
       
   135     CleanupStack::PushL( self );
       
   136     self->ConstructL( aInitData, aIsFsq );
       
   137     CleanupStack::Pop( self );
       
   138 
       
   139     return self;  
       
   140     }
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CPeninputGenericVkbLayout::CPeninputGenericVkbLayout
       
   144 // (other items were commented in a header)
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 CPeninputGenericVkbLayout::CPeninputGenericVkbLayout( MLayoutOwner* aLayoutOwner )
       
   148     : CPeninputCommonLayoutExt( aLayoutOwner ), iLayoutType( EPluginInputModeVkb )
       
   149     {
       
   150     iInEditWordQueryDlg = EFalse;
       
   151     }
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // CPeninputGenericVkbLayout::~CPeninputGenericVkbLayout
       
   155 // (other items were commented in a header)
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 CPeninputGenericVkbLayout::~CPeninputGenericVkbLayout()
       
   159     {    
       
   160     if (iInfoTimer)
       
   161         {
       
   162         iInfoTimer->Cancel();
       
   163         }
       
   164        delete iInfoTimer;
       
   165     }        
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // CPeninputGenericVkbLayout::ConstructL
       
   169 // (other items were commented in a header)
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 void CPeninputGenericVkbLayout::ConstructL( const TAny* aInitData, TBool aIsFsq )
       
   173     {
       
   174     // must set layout type first
       
   175     iLayoutType = aIsFsq ? EPluginInputModeFSQ : EPluginInputModeVkb;
       
   176     
       
   177     CPeninputCommonLayoutExt::ConstructL( aInitData );
       
   178     
       
   179     CPeninputUiStateBase* initialState = 
       
   180         CPeninputUiStateBase::NewL( UiStateMgr(), this );  
       
   181     CPeninputUiStateVkbStandby* standbyState = 
       
   182         CPeninputUiStateVkbStandby::NewL( UiStateMgr(), this );   
       
   183 	CPeninputUiStateVkbPopup* popupState = 
       
   184         CPeninputUiStateVkbPopup::NewL( UiStateMgr(), this );
       
   185         
       
   186     UiStateMgr()->AddUiState( initialState, EPeninputVkbUiStateNone );
       
   187     UiStateMgr()->AddUiState( standbyState, EPeninputVkbUiStateStandby );
       
   188     UiStateMgr()->AddUiState( popupState, EPeninputVkbUiStatePopup );
       
   189     UiStateMgr()->SetCurrentUiState( initialState );
       
   190     iInfoTimer = CPeriodic::NewL(CActive::EPriorityStandard);
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // CPeninputGenericVkbLayout::HandleCommand
       
   195 // (other items were commented in a header)
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 TInt CPeninputGenericVkbLayout::HandleCommand( TInt aCmd, TUint8* aData )
       
   199     {
       
   200     CPeninputCommonLayoutExt::HandleCommand( aCmd, aData );
       
   201     CPeninputGenericVkbWindow* vkbWindow = 
       
   202     				static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
       
   203     switch ( aCmd )
       
   204         {
       
   205         case ECmdPenInputWindowOpen:
       
   206             {
       
   207             UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateStandby );
       
   208             }
       
   209             break;
       
   210         case ECmdPenInputWindowClose:
       
   211             {
       
   212             vkbWindow->UnLatchDeadKey();
       
   213             UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateNone );
       
   214             
       
   215             // For Addition of ITI features on FSQ
       
   216             // Close tooltip and candidate list
       
   217             vkbWindow->HideTooltip();
       
   218             vkbWindow->HideCandidateList();
       
   219             }
       
   220             break;
       
   221         case ECmdPenInputLanguage:
       
   222             {
       
   223             vkbWindow->SetSwitchlistLanguage(*aData);
       
   224             vkbWindow->SetDeadKey();
       
   225 			TRAP_IGNORE(vkbWindow->ConstructAccentListL(*aData));
       
   226             }
       
   227             break;
       
   228         case ECmdPenInputIsSecretText:
       
   229             {
       
   230             vkbWindow->SetSwitchlistSecretFlag(*aData);
       
   231             }
       
   232             break;
       
   233         case ECmdPenInputDimArrowKeys:
       
   234             {
       
   235             TBool IsDimArrowKeys = *aData;
       
   236             vkbWindow->DimArrowKeys( IsDimArrowKeys );
       
   237             }
       
   238             break;
       
   239         case ECmdPenInputSetPromptText:
       
   240             {
       
   241             if ( iLayoutType == EPluginInputModeFSQ )
       
   242             TRAP_IGNORE(vkbWindow->SetPromptTextL(aData));
       
   243             }
       
   244             break;
       
   245         case ECmdPenInputCharacterPreview:
       
   246             {
       
   247             vkbWindow->ShowBubble(*aData);    
       
   248             }
       
   249 			break;
       
   250         case ECmdPenInputInEditWordQueryDlg:
       
   251             {
       
   252             iInEditWordQueryDlg = *aData;
       
   253             }
       
   254             break;
       
   255         case ECmdPenInputPopupTooltip:
       
   256             {    
       
   257             TRAP_IGNORE( HandleShowTooltipCmdL( aData ) );
       
   258             }
       
   259             break;
       
   260         case ECmdPenInputHideTooltip:
       
   261             {
       
   262             vkbWindow->HideTooltip();
       
   263             }
       
   264             break;
       
   265         case ECmdPenInputPopupCandidateList:
       
   266             {
       
   267             TRAP_IGNORE( HandleShowCandidateListCmdL( aData ) );
       
   268             }
       
   269             break;
       
   270         case ECmdPenInputHideCandidateList:
       
   271             {
       
   272             vkbWindow->HideCandidateList();
       
   273             }
       
   274             break;
       
   275         case ECmdPeninputITIStatus:
       
   276             {
       
   277             // Set the flag to indicate if FSQ with ITI feature is opened
       
   278             iITIEnabled = CPeninputDataConverter::AnyToInt( aData );
       
   279             }            
       
   280             break;
       
   281         default:
       
   282             {
       
   283             }
       
   284             break;
       
   285         }
       
   286 
       
   287     return KErrNone;    
       
   288     }
       
   289 
       
   290 
       
   291 // ---------------------------------------------------------------------------
       
   292 // CPeninputGenericVkbLayout::HandleControlEvent
       
   293 // (other items were commented in a header)
       
   294 // ---------------------------------------------------------------------------
       
   295 //
       
   296 void CPeninputGenericVkbLayout::HandleControlEvent(
       
   297     TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData )
       
   298     {
       
   299     switch ( aEventType )
       
   300         {
       
   301         case EEventVirtualKeyUp:
       
   302             {
       
   303             TRAP_IGNORE(HandleVirtualKeyUpL(aEventType, aCtrl, aEventData));            
       
   304             }
       
   305             break;
       
   306         case EEventTooltipPointerUp:
       
   307         	{
       
   308         	// Signal to FEP to accept tooltip data 
       
   309         	SignalOwner( ESignalAcceptTooltip );        	
       
   310         	}
       
   311         	break;
       
   312         case EEventPointerDownOnInline:
       
   313             {
       
   314             // add by jiawenjuan 
       
   315             // show candidate list when tap on active words
       
   316             SignalOwner(ESignalShowCandidate );            
       
   317             }
       
   318             break;
       
   319         case EEventInsertSpace:
       
   320             {
       
   321             SignalOwner(ESignalKeyEvent, KDisplaySpace);            
       
   322             }
       
   323         	break;
       
   324         default:
       
   325             {
       
   326             CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, aEventData);
       
   327             }
       
   328             break;       
       
   329         }
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // CPeninputGenericVkbLayout::CreateLayoutWindowL
       
   334 // (other items were commented in a header)
       
   335 // ---------------------------------------------------------------------------
       
   336 //
       
   337 void CPeninputGenericVkbLayout::CreateLayoutWindowL()
       
   338     {
       
   339     iLayoutWindow = CPeninputGenericVkbWindow::NewL( this, this, UiStateMgr() );
       
   340     }
       
   341     
       
   342 // ---------------------------------------------------------------------------
       
   343 // CPeninputGenericVkbLayout::CreateDataMgrL
       
   344 // (other items were commented in a header)
       
   345 // ---------------------------------------------------------------------------
       
   346 //
       
   347 void CPeninputGenericVkbLayout::CreateDataMgrL( const TAny* /*aInitData*/ )
       
   348     {
       
   349     iDataMgr = CPeninputGenericVkbDataMgr::NewL( this );
       
   350     }    
       
   351 
       
   352 // ---------------------------------------------------------------------------
       
   353 // CPeninputGenericVkbLayout::LayoutType
       
   354 // (other items were commented in a header)
       
   355 // ---------------------------------------------------------------------------
       
   356 //    
       
   357 TInt CPeninputGenericVkbLayout::LayoutType()
       
   358     {
       
   359     return iLayoutType;
       
   360     }
       
   361 TInt CPeninputGenericVkbLayout::SizeChanged( const TAny* aData )
       
   362     {
       
   363     (( CPeninputGenericVkbWindow*)iLayoutWindow)->UpdateLafData();
       
   364     return CPeninputCommonLayoutExt::SizeChanged( aData );
       
   365     }
       
   366 void CPeninputGenericVkbLayout::HandleAppInfoChange(const TDesC& aInfo, 
       
   367                                                     TPeninputAppInfo aType)
       
   368     {
       
   369     if ( LayoutWindow() )
       
   370         {
       
   371         CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> 
       
   372                                     (LayoutWindow()->Control(EPeninputWindowCtrlIdMultiLineICF)) ;
       
   373         
       
   374         if ( icf && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) )
       
   375             { 
       
   376             if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
       
   377                 {
       
   378                 icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect());
       
   379                 }
       
   380             else
       
   381                 {
       
   382                 icf->HideBubble();
       
   383                 }
       
   384             }            
       
   385         else 
       
   386             {
       
   387             if ( icf && ( aType == EAppByteWarningMsg ) && (iLayoutType == EPluginInputModeFSQ) )
       
   388                 { 
       
   389                 if (!iInfoTimer->IsActive())
       
   390                     {
       
   391                     iInfoTimer->Start(KPeriodicTimerIntervalSec,
       
   392                                     KPeriodicTimerIntervalSec, 
       
   393                                     TCallBack(CPeninputGenericVkbLayout::HideByteWarningBubble, this));                           
       
   394                     }    
       
   395                     icf->ShowByteWarningBubble(aInfo);                                       
       
   396                 }
       
   397             else 
       
   398                 {
       
   399                 if ( icf && ( aType == EAppMessageTypeChangeMsg ) && (iLayoutType == EPluginInputModeFSQ) )
       
   400                     { 
       
   401                     if (!iInfoTimer->IsActive())
       
   402                         {
       
   403                         if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
       
   404                             {
       
   405                             icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect());
       
   406                             }
       
   407                         iInfoTimer->Start(KPeriodicTimerIntervalSec,
       
   408                                           KPeriodicTimerIntervalSec, 
       
   409                                           TCallBack(CPeninputGenericVkbLayout::HideByteWarningBubble, this));               
       
   410                         }
       
   411                         icf->ShowByteWarningBubble(aInfo);                                           
       
   412                     }
       
   413                 }
       
   414             }
       
   415         }
       
   416     }
       
   417 
       
   418 // ---------------------------------------------------------------------------
       
   419 // CPeninputGenericVkbLayout::SemiTransparencyRequired
       
   420 // .
       
   421 // ---------------------------------------------------------------------------
       
   422 //
       
   423 TBool CPeninputGenericVkbLayout::SemiTransparencyRequired()
       
   424     {
       
   425     return ETrue;
       
   426     }
       
   427 
       
   428 void CPeninputGenericVkbLayout::HandleVirtualKeyUpL(TInt aEventType, 
       
   429                                                    CFepUiBaseCtrl* aCtrl, 
       
   430                                                    const TDesC& aEventData)
       
   431     {
       
   432     TBool flag;
       
   433     flag = static_cast<CPeninputGenericVkbWindow*>
       
   434            (iLayoutWindow)->HandleVirtualKeyUpEvent( aEventType, aCtrl, aEventData );
       
   435     if(!flag)
       
   436         {
       
   437         HBufC* number = HBufC::NewL( 1 );
       
   438         TPtrC eventDataPtr = aEventData;
       
   439         TInt len = aEventData.Length();
       
   440         if ( len > 1)
       
   441             {
       
   442             TVirtualKeyEventData* data = (TVirtualKeyEventData* ) aEventData.Ptr();
       
   443             TUint16 inputCode = data->iKeyEvent.iCode;
       
   444             TUint16 outputCode = inputCode;
       
   445             TBool isDottedChar = EFalse;
       
   446             for (TInt i = 0; i < KNumberOfDottedChar; i++)
       
   447                 {
       
   448                 if (thaiUnicodeNew[i] == inputCode)
       
   449                     {
       
   450                     outputCode = thaiUnicodeOri[i];
       
   451                     isDottedChar = ETrue;
       
   452                     break;
       
   453                     }
       
   454                 }
       
   455             if (isDottedChar)
       
   456                 {
       
   457                 number->Des().Append( outputCode );                    
       
   458                 data->iKeyData.Set(*number);
       
   459                 eventDataPtr.Set(reinterpret_cast<TUint16*>(data),sizeof(*data)/sizeof(TUint16));
       
   460                 }
       
   461             }           
       
   462         CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, eventDataPtr);
       
   463         delete number;
       
   464         }
       
   465     }
       
   466 
       
   467 // ---------------------------------------------------------------------------
       
   468 // Handle show tooltip command.
       
   469 // ---------------------------------------------------------------------------
       
   470 //
       
   471 void CPeninputGenericVkbLayout::HandleShowTooltipCmdL( TUint8* aData )
       
   472     {
       
   473     CPeninputGenericVkbWindow* vkbWindow = 
       
   474     				static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
       
   475     if ( !vkbWindow )
       
   476         {
       
   477         return;
       
   478         }
       
   479     
       
   480     TPtr8 buf8( aData, sizeof(TInt32), sizeof(TInt32) );
       
   481     RDesReadStream readStream;
       
   482     readStream.Open( buf8 );
       
   483     CleanupClosePushL( readStream );
       
   484     TInt dataSize = readStream.ReadInt32L();
       
   485     CleanupStack::PopAndDestroy( &readStream );
       
   486     if ( dataSize > 0 )
       
   487         {
       
   488         TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32) );
       
   489         HBufC* tooltipText = ReadTextInfoHBufCL( dataAddress, 
       
   490                                                  ( dataSize + 1 )/ 2 );
       
   491         if ( tooltipText )
       
   492             {
       
   493             CleanupStack::PushL( tooltipText );
       
   494             vkbWindow->ShowTooltipL( *tooltipText );
       
   495             CleanupStack::PopAndDestroy( tooltipText );
       
   496             }        
       
   497         }     
       
   498     }
       
   499 
       
   500 // ---------------------------------------------------------------------------
       
   501 // Handle show candidate list command.
       
   502 // ---------------------------------------------------------------------------
       
   503 //
       
   504 void CPeninputGenericVkbLayout::HandleShowCandidateListCmdL( TUint8* aData )
       
   505     {
       
   506     CPeninputGenericVkbWindow* vkbWindow 
       
   507              = static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
       
   508     if ( !vkbWindow || !IsEnableITIOnFSQ() )
       
   509         {
       
   510         return;
       
   511         }
       
   512         
       
   513     // Read candidate data from a block of memory staring from aData
       
   514     // The format is activeIndex | count of candiates | 
       
   515     // length 1 | text 1 | length 2 | text 2 |...
       
   516     TPtr8 buf8( aData, sizeof( TInt32 )*2, sizeof( TInt32 )*2 );
       
   517     RDesReadStream readStream;
       
   518     readStream.Open( buf8 );
       
   519     CleanupClosePushL( readStream );
       
   520     // Get activeIndex
       
   521     TInt activeIndex = readStream.ReadInt32L();
       
   522     // Get coutn of candidates
       
   523     TInt count = readStream.ReadInt32L();    
       
   524     CleanupStack::PopAndDestroy( &readStream );
       
   525     
       
   526     CDesCArray* itemArray = NULL;
       
   527     if ( count > 0 )
       
   528         {        
       
   529         TUint8* curPointer = aData + sizeof(TInt) * 2;
       
   530         itemArray = new (ELeave) CDesCArrayFlat( count );
       
   531         CleanupStack::PushL( itemArray );
       
   532         for ( TInt i = 0; i < count; i++ )
       
   533             {
       
   534             // Get length
       
   535             buf8.Set( curPointer, sizeof( TInt32 ), sizeof( TInt32 ) );
       
   536             readStream.Open( buf8 );
       
   537             CleanupClosePushL( readStream );
       
   538             TInt32 textSize = 0;
       
   539             textSize = readStream.ReadInt32L();            
       
   540             CleanupStack::PopAndDestroy( &readStream );
       
   541             if ( textSize > 0 )
       
   542                 {
       
   543                 // Get text
       
   544                 curPointer += sizeof( TInt32 );
       
   545                 HBufC* itemText = ReadTextInfoHBufCL
       
   546                                       ( (TUint16*)curPointer, 
       
   547                                         ( textSize + 1 )/ 2 );
       
   548                 if ( itemText )
       
   549                     {
       
   550                     CleanupStack::PushL( itemText );
       
   551                     itemArray->AppendL( *itemText );                    
       
   552                     CleanupStack::PopAndDestroy( itemText ); 
       
   553                     }     
       
   554                 curPointer += textSize;
       
   555                 }
       
   556             }
       
   557         vkbWindow->ShowCandidateListL( itemArray, activeIndex );
       
   558         CleanupStack::PopAndDestroy( itemArray );
       
   559         }
       
   560     else
       
   561         {
       
   562         // Open empty candidate list.
       
   563         vkbWindow->ShowCandidateListL( NULL, activeIndex );        
       
   564         }    
       
   565     }
       
   566 
       
   567 
       
   568 // ---------------------------------------------------------------------------
       
   569 // Handle show candidate list command.
       
   570 // ---------------------------------------------------------------------------
       
   571 //
       
   572 HBufC* CPeninputGenericVkbLayout::ReadTextInfoHBufCL( TUint16* aStartPtr, 
       
   573                                                       TInt aLength )
       
   574     {
       
   575     HBufC* itemText = NULL;
       
   576     if ( aLength > 0 )
       
   577         {
       
   578         itemText = HBufC::NewLC( aLength );
       
   579         TPtr itemTextPtr = itemText->Des();
       
   580         itemTextPtr.Copy( aStartPtr, aLength ); 
       
   581         CleanupStack::Pop( itemText ); 
       
   582         }    
       
   583     return itemText;
       
   584     }
       
   585 
       
   586 TInt CPeninputGenericVkbLayout::HideByteWarningBubble(TAny* aPointer)
       
   587     {
       
   588     CPeninputGenericVkbLayout* layout = static_cast<CPeninputGenericVkbLayout*>(aPointer);
       
   589     layout->HideByteWarningBubble();
       
   590     return KErrNone;
       
   591     }
       
   592 void CPeninputGenericVkbLayout::HideByteWarningBubble()
       
   593     {
       
   594     if (!iInfoTimer)
       
   595         {
       
   596         return;
       
   597         }
       
   598     CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> 
       
   599                                  (LayoutWindow()->Control(EPeninputWindowCtrlIdMultiLineICF));
       
   600     if (iInfoTimer->IsActive())
       
   601         {
       
   602         iInfoTimer->Cancel();
       
   603         icf->HideInfoBubble();
       
   604         }
       
   605     }    
       
   606 // End Of File