textinput/GSLangPlugin/src/GSLangContainer.cpp
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 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:  Container for GSLangPlugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "GSLangContainer.h"
       
    21 #include    "GSLangPlugin.h"
       
    22 #include    "GSLangPlugin.hrh"
       
    23 #include    "GSLangModel.h"
       
    24 #include    <gslistbox.h> // CGSListBoxItemTextArray
       
    25 #include    <gscommon.hrh>
       
    26 #include    <GSLangPluginRsc.rsg>
       
    27 
       
    28 #include    <bldvariant.hrh>
       
    29 
       
    30 #include    <aknappui.h>
       
    31 #include    <AknFepGlobalEnums.h>
       
    32 #include    <AknFepInternalCRKeys.h>
       
    33 #include    <aknlists.h>
       
    34 #include    <akntitle.h> 
       
    35 //#include    <ApProtHandler.h> // CApProtHandler
       
    36 //#include    <aputils.h> // CApUtils
       
    37 #include    <commdb.h> // CCommsDatabase
       
    38 //#include    <csxhelp/cp.hlp.hrh>
       
    39 #include    <gsfwviewuids.h>
       
    40 #include    <eikspane.h>
       
    41 #include    <featmgr.h>
       
    42 #include    <syslangutil.h>
       
    43 #include    <AknFepInternalCRKeys.h>
       
    44 #include    <AvkonInternalCRKeys.h>
       
    45 
       
    46 // CONSTANTS
       
    47 
       
    48 // ========================= MEMBER FUNCTIONS ================================
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CGSLangContainer::CGSLangContainer
       
    52 // C++ default constructor can NOT contain any code, that
       
    53 // might leave.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CGSLangContainer::CGSLangContainer()
       
    57     {
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // CGSLangContainer::ConstructL(const TRect& aRect)
       
    62 // Symbian OS two phased constructor
       
    63 //
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 void CGSLangContainer::ConstructL( const TRect& aRect )
       
    67     {
       
    68     iModel = CGSLangModel::NewL( this );
       
    69     iUpdateITL = EFalse;
       
    70     iListBox = new( ELeave ) CAknSettingStyleListBox;
       
    71     BaseConstructL( aRect, R_GS_LANG_PLUGIN_TITLE, R_LANG_LBX );
       
    72     }
       
    73 
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // CGSLangContainer::ConstructListBoxL(TInt aResLbxId)
       
    77 // Construct the listbox items
       
    78 //
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void CGSLangContainer::ConstructListBoxL( TInt aResLbxId )
       
    82     {
       
    83     iListBox->ConstructL( this, EAknListBoxSelectionList );
       
    84 
       
    85     iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId,
       
    86         *iListBox, *iCoeEnv );
       
    87     iListBox->Model()->SetItemTextArray( iListboxItemArray );
       
    88     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
    89 
       
    90     // Set up UI language arrays - Display Text Language Construction
       
    91     CArrayFixFlat<TInt>* systemEpocLanguageCodes = 0;
       
    92     // This creates the list itself
       
    93     TInt error = SysLangUtil::GetInstalledLanguages( systemEpocLanguageCodes );
       
    94     if ( error != KErrNone )
       
    95         {
       
    96         delete systemEpocLanguageCodes;
       
    97         User::Leave( error );
       
    98         }
       
    99     CleanupStack::PushL( systemEpocLanguageCodes );
       
   100 
       
   101     delete iDtLanguagesCodes;
       
   102     iDtLanguagesCodes = 0;
       
   103     iDtLanguagesCodes = new (ELeave)CArrayFixFlat<TInt>(10);
       
   104     iDtLanguagesCodes->AppendL(0); // This is the code for "Automatic"
       
   105 
       
   106     delete iDtLanguageItems;
       
   107     iDtLanguageItems = 0;
       
   108     iDtLanguageItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   109         R_DISPLAY_TEXT_LANGUAGE_SETTING_PAGE_LBX);
       
   110 
       
   111     //This is for display text language
       
   112     iModel->GetLanguagesFromPtiL( systemEpocLanguageCodes,
       
   113                                   iDtLanguagesCodes, iDtLanguageItems );
       
   114 
       
   115     CleanupStack::PopAndDestroy(); // systemEpocLanguageCode
       
   116 
       
   117     // Input Text Language Constrution
       
   118     iWtLanguagesCodes = new(ELeave)CArrayFixFlat<TInt>(10);
       
   119     iWtLanguageItems = new(ELeave)CDesCArrayFlat(10);
       
   120 
       
   121     //This is for input text language
       
   122     iModel->GetLanguagesFromPtiL( NULL, iWtLanguagesCodes, iWtLanguageItems );
       
   123 
       
   124     //Number modes
       
   125     iAHNumberModeItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   126         R_AH_DEFAULT_INPUT_METHOD_LBX );
       
   127 
       
   128     iHindiNumberModeItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   129         R_HI_DEFAULT_INPUT_METHOD_LBX );
       
   130         
       
   131     // Predictive Text Language Construction
       
   132     iOnOffItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   133         R_T9_ON_OFF_SETTING_PAGE_LBX );
       
   134     iOnOffNotAvailable =
       
   135         iCoeEnv->AllocReadResourceL( R_T9_ONOFF_NOT_AVAILABLE );
       
   136 
       
   137     //Japanese specific features
       
   138     iJapPredTxtOnOffItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   139         R_T9_ON_OFF_SETTING_PAGE_LBX );        
       
   140     iKeypressTimeoutItems = iCoeEnv->ReadDesC16ArrayResourceL( 
       
   141         R_KEYPRESS_TIMEOUT_SETTING_PAGE_LBX );
       
   142     iJapQwertyCommaItems = iCoeEnv->ReadDesC16ArrayResourceL( 
       
   143         R_JAP_QWERTY_COMMA_SETTING_PAGE_LBX );
       
   144     iJapQwertyPeriodItems = iCoeEnv->ReadDesC16ArrayResourceL( 
       
   145         R_JAP_QWERTY_PERIOD_SETTING_PAGE_LBX );
       
   146     iJapQwertyWidthOfSpaceItems = iCoeEnv->ReadDesC16ArrayResourceL( 
       
   147         R_JAP_QWERTY_WIDTH_FULL_HALF_SETTING_PAGE_LBX );
       
   148     
       
   149     iChiCangJieItems = iCoeEnv->ReadDesC16ArrayResourceL( 
       
   150         R_CHI_CANGJIE_SETTING_PAGE_LBX );
       
   151 	// Word Autocompletion
       
   152 	iPredictiveModeItems = iCoeEnv->ReadDesC16ArrayResourceL( 
       
   153         R_PREDICTIVE_MODE_SETTING_PAGE_LBX );
       
   154     iInputMethodItems = 0;
       
   155 
       
   156     CreateListBoxItemsL();
       
   157     }
       
   158 
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // CGSLangContainer::CreateListBoxItemsL
       
   162 //
       
   163 //
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 void CGSLangContainer::CreateListBoxItemsL()
       
   167     {
       
   168     MakeDTLItemL();
       
   169 
       
   170     const TInt uiLang = iModel->LanguageL( CGSLangModel::EGSUiLanguage );
       
   171     if (( uiLang == ELangArabic || User::Language() == ELangArabic ) ||
       
   172         ( uiLang == ELangUrdu || User::Language() == ELangUrdu ) || 
       
   173         (uiLang == ELangFarsi || User::Language() == ELangFarsi) && iElaf )
       
   174         {
       
   175         MakeAHNumberModeItemL();
       
   176         }
       
   177     if ( uiLang == ELangHindi || User::Language() == ELangHindi ||
       
   178          uiLang == ELangMarathi || User::Language() == ELangMarathi )
       
   179         {
       
   180         MakeHindiNumberModeItemL();
       
   181         }
       
   182     // if Japanese language variant is flashed
       
   183     if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   184         {
       
   185         MakeEngPredTxtItemL();
       
   186         MakeResetATOKDictionaryItemL();
       
   187         MakeJnpPredTxtItemL();
       
   188         MakeKeypressTimeoutItemL();
       
   189         if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) )
       
   190             {
       
   191             MakeJapQwertyItemL( EGSLangIdJQC );
       
   192             MakeJapQwertyItemL( EGSLangIdJQP );
       
   193             MakeJapQwertyItemL( EGSLangIdJQWSP );
       
   194             }
       
   195         }
       
   196     else
       
   197         {
       
   198         MakeITLItemL();    //because we don't need this item in japanese
       
   199         MakeT9LItemL();
       
   200 #ifndef RD_INTELLIGENT_TEXT_INPUT
       
   201         MakePredictiveModeItemL();
       
   202 #else
       
   203         MakePredictiveOptionsItemL();
       
   204 #endif
       
   205         }
       
   206 
       
   207     const TInt inputLang = iModel->LanguageL( CGSLangModel::EGSInputLanguage );
       
   208     if( FeatureManager::FeatureSupported( KFeatureIdChinese ) &&
       
   209         ( inputLang == ELangPrcChinese || inputLang == ELangHongKongChinese ||
       
   210         inputLang == ELangTaiwanChinese ) )
       
   211         {
       
   212         MakeDIMItemL();
       
   213         }
       
   214     
       
   215     // check for input language even if it is done also in CheckDictionary...
       
   216     // CangJie is only supported for HK Chinese variant
       
   217     if ( iModel->DefaultInputMethodL() == ECangJie && 
       
   218             iModel->CheckCangjieSupportL( inputLang ) )
       
   219         {
       
   220         MakeCangJieItemL();
       
   221         }
       
   222     }
       
   223 
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CGSLangContainer::~CGSLangContainer
       
   227 // Destructor.
       
   228 //
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 CGSLangContainer::~CGSLangContainer()
       
   232     {
       
   233     if( iModel )
       
   234         {
       
   235         delete iModel;
       
   236         }
       
   237     if ( iDtLanguageItems )
       
   238         {
       
   239         delete iDtLanguageItems;
       
   240         }
       
   241     if ( iDtLanguagesCodes )
       
   242         {
       
   243         delete iDtLanguagesCodes;
       
   244         }
       
   245     if ( iWtLanguageItems )
       
   246         {
       
   247         delete iWtLanguageItems;
       
   248         }
       
   249     if ( iWtLanguagesCodes )
       
   250         {
       
   251         delete iWtLanguagesCodes;
       
   252         }
       
   253     if ( iAHNumberModeItems )
       
   254         {
       
   255         delete iAHNumberModeItems;
       
   256         }
       
   257     if ( iHindiNumberModeItems )
       
   258         {
       
   259         delete iHindiNumberModeItems;
       
   260         }
       
   261     if ( iInputMethodItems )
       
   262         {
       
   263         delete iInputMethodItems;
       
   264         }
       
   265     if ( iOnOffItems )
       
   266         {
       
   267         delete iOnOffItems;
       
   268         }
       
   269     if ( iOnOffNotAvailable )
       
   270         {
       
   271         delete iOnOffNotAvailable;
       
   272         }
       
   273     if ( iListboxItemArray )
       
   274         {
       
   275         delete iListboxItemArray;
       
   276         }
       
   277     if ( iJapPredTxtOnOffItems )
       
   278         {
       
   279         delete iJapPredTxtOnOffItems;
       
   280         }
       
   281     if ( iKeypressTimeoutItems )
       
   282         {
       
   283         delete iKeypressTimeoutItems;
       
   284         }
       
   285     if ( iJapQwertyCommaItems )
       
   286         {
       
   287         delete iJapQwertyCommaItems;
       
   288         }
       
   289     if ( iJapQwertyPeriodItems )
       
   290         {
       
   291         delete iJapQwertyPeriodItems;
       
   292         }
       
   293     if ( iJapQwertyWidthOfSpaceItems )
       
   294         {
       
   295         delete iJapQwertyWidthOfSpaceItems;
       
   296         }
       
   297     if ( iChiCangJieItems )
       
   298         {
       
   299         delete iChiCangJieItems;
       
   300         }
       
   301     delete iPredictiveModeItems;
       
   302     }
       
   303 
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // CGSLangContainer::CountComponentControls
       
   307 //
       
   308 //
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 TInt CGSLangContainer::CountComponentControls() const
       
   312     {
       
   313     return 1;
       
   314     }
       
   315 
       
   316 
       
   317 // -----------------------------------------------------------------------------
       
   318 // CGSLangContainer::ComponentControl
       
   319 //
       
   320 //
       
   321 // -----------------------------------------------------------------------------
       
   322 //
       
   323 CCoeControl* CGSLangContainer::ComponentControl( TInt /*aIndex*/ ) const
       
   324     {
       
   325     return iListBox;
       
   326     }
       
   327 
       
   328 
       
   329 // -----------------------------------------------------------------------------
       
   330 // CGSLangContainer::UpdateListBoxL
       
   331 //
       
   332 //
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 void CGSLangContainer::UpdateListBoxL( TInt aFeatureId )
       
   336     {
       
   337     const TInt uiLang = iModel->LanguageL( CGSLangModel::EGSUiLanguage );
       
   338     switch ( aFeatureId )
       
   339         {
       
   340         case EGSLangIdDTL:
       
   341             {
       
   342             MakeDTLItemL();
       
   343             if ( uiLang != 0 )
       
   344                 {
       
   345                 iUpdateITL = ETrue;
       
   346                 }
       
   347             }
       
   348             break;
       
   349         case EGSLangIdITL:
       
   350             if ( !FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   351                 {
       
   352                 MakeITLItemL();
       
   353                 }
       
   354             break;
       
   355         case EGSLangAHNumberMode:
       
   356             if( iElaf )
       
   357                 {
       
   358                 MakeAHNumberModeItemL();
       
   359                 }
       
   360             break;
       
   361         case EGSLangHindiNumberMode:
       
   362             if ( uiLang == ELangHindi || User::Language() == ELangHindi ||
       
   363                  uiLang == ELangMarathi || User::Language() == ELangMarathi )
       
   364                 {
       
   365                 MakeHindiNumberModeItemL();
       
   366                 }
       
   367             break;
       
   368         case EGSLangIdT9L:
       
   369             if ( !FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   370                 {
       
   371                 MakeT9LItemL();
       
   372 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   373                 MakePredictiveOptionsItemL();
       
   374 #else
       
   375                 MakePredictiveModeItemL();
       
   376 #endif
       
   377                 }
       
   378             break;
       
   379         case EGSLangIdEPT:
       
   380             if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   381                 {
       
   382                 MakeEngPredTxtItemL();
       
   383                 }
       
   384             break;
       
   385         case EGSLangIdResetAtokDict:
       
   386             if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   387                 {
       
   388                 MakeResetATOKDictionaryItemL();
       
   389                 }
       
   390             break;
       
   391         case EGSLangIdJPT:
       
   392             if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   393                 {
       
   394                 MakeJnpPredTxtItemL();
       
   395                 }
       
   396             break;
       
   397         case EGSLangIdKT:
       
   398             if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   399                 {
       
   400                 MakeKeypressTimeoutItemL();
       
   401                 }
       
   402             break;
       
   403         case EGSLangIdJQC:
       
   404         case EGSLangIdJQP:
       
   405         case EGSLangIdJQWSP:
       
   406             if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) &&
       
   407                  FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) )
       
   408                 {
       
   409                 MakeJapQwertyItemL( aFeatureId );
       
   410                 }
       
   411             break;
       
   412         case EGSLangIdDIM:
       
   413             if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
       
   414                 {
       
   415                 MakeDIMItemL();
       
   416                 }
       
   417             break;
       
   418         case EGSLangIdCangJie:
       
   419             //Check for support is not done here assuming it is checked
       
   420             //before calling this method with this ID.
       
   421             if ( iModel->DefaultInputMethodL() == ECangJie )
       
   422                 {
       
   423                 MakeCangJieItemL();
       
   424                 }
       
   425             break;
       
   426         case EGSLangIdPredictiveMode:
       
   427         	if ( !FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
       
   428                 {
       
   429 #ifndef RD_INTELLIGENT_TEXT_INPUT
       
   430         		MakePredictiveModeItemL();
       
   431 #else
       
   432         		MakePredictiveOptionsItemL();
       
   433 #endif
       
   434         		}
       
   435         default:
       
   436             break;
       
   437         }
       
   438 
       
   439     // Currently selected feature id
       
   440     const TInt currentlySelectedFeature = iListboxItemArray->CurrentFeature();
       
   441     
       
   442     //Make a list item visible based on feature ID
       
   443     MakeListItemVisibleL( aFeatureId, currentlySelectedFeature );
       
   444     
       
   445     // Update the listbox
       
   446     iListBox->HandleItemAdditionL();
       
   447     }
       
   448 
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 // CGSLangContainer::MakeDTLItemL
       
   452 //
       
   453 //
       
   454 // -----------------------------------------------------------------------------
       
   455 //
       
   456 void CGSLangContainer::MakeDTLItemL()
       
   457     {
       
   458     // Get the item from the listbox model and then dynamically set
       
   459     // its caption
       
   460     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   461     TPtr ptrBuffer ( dynamicText->Des() );
       
   462     const TInt uiLanguage = iModel->LanguageL( CGSLangModel::EGSUiLanguage );
       
   463     TInt count = iDtLanguagesCodes->Count();
       
   464 
       
   465     for ( TInt index=0; index<count; ++index )
       
   466         {
       
   467         if ( ( *iDtLanguagesCodes )[ index ] == uiLanguage )
       
   468             {
       
   469             ptrBuffer = ( *iDtLanguageItems )[ index ];
       
   470             break;
       
   471             }
       
   472         }
       
   473 
       
   474     if ( !ptrBuffer.Length() && iDtLanguageItems->Count() > 0 )
       
   475         {
       
   476         ptrBuffer = ( *iDtLanguageItems )[0];
       
   477         }
       
   478 
       
   479     // Finally, set the dynamic text
       
   480     iListboxItemArray->SetDynamicTextL( EGSLangIdDTL, ptrBuffer );
       
   481     CleanupStack::PopAndDestroy( dynamicText );
       
   482 
       
   483     // And add to listbox
       
   484     iListboxItemArray->SetItemVisibilityL( EGSLangIdDTL,
       
   485         CGSListBoxItemTextArray::EVisible );
       
   486     }
       
   487 
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // CGSLangContainer::MakeITLItemL
       
   491 //
       
   492 //
       
   493 // -----------------------------------------------------------------------------
       
   494 //
       
   495 void CGSLangContainer::MakeITLItemL()
       
   496     {
       
   497     // Dynamic text not wanted in case we have dual language suppport
       
   498 #ifndef FF_DUAL_LANGUAGE_SUPPORT
       
   499     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   500     TPtr ptrBuffer ( dynamicText->Des() );
       
   501 
       
   502     // Get Input Language code
       
   503     const TInt inputLanguage = iModel->LanguageL( CGSLangModel::EGSInputLanguage );
       
   504     const TInt uiLanguage = iModel->LanguageL( CGSLangModel::EGSUiLanguage );
       
   505     TInt count = iWtLanguagesCodes->Count();
       
   506     for ( TInt index=0; index<count; ++index )
       
   507         {
       
   508         if ( !iUpdateITL )
       
   509             {
       
   510             if ( ( *iWtLanguagesCodes )[index] == inputLanguage )
       
   511                 {
       
   512                 ptrBuffer = ( *iWtLanguageItems )[index];
       
   513                 break;
       
   514                 }
       
   515             }
       
   516         else
       
   517             {
       
   518             if ( ( *iWtLanguagesCodes )[index] == uiLanguage &&
       
   519                  uiLanguage != 0 ) // 'Automatic' = 0
       
   520                 {
       
   521                 iModel->SetLanguageL( CGSLangModel::EGSInputLanguage,
       
   522                                     ( *iWtLanguagesCodes )[index] );
       
   523                 ptrBuffer = ( *iWtLanguageItems )[index];
       
   524                 break;
       
   525                 }
       
   526             }
       
   527         }
       
   528     iUpdateITL = EFalse;
       
   529     if ( !ptrBuffer.Length() && iWtLanguageItems->Count() > 0 )
       
   530         {
       
   531         ptrBuffer = ( *iWtLanguageItems )[0];
       
   532         }
       
   533 
       
   534     // Finally, set the dynamic text
       
   535     iListboxItemArray->SetDynamicTextL( EGSLangIdITL, ptrBuffer );
       
   536     CleanupStack::PopAndDestroy( dynamicText );
       
   537 #endif
       
   538 
       
   539     // And add to listbox
       
   540     iListboxItemArray->SetItemVisibilityL( EGSLangIdITL,
       
   541         CGSListBoxItemTextArray::EVisible );
       
   542         
       
   543     //Set visibility to the input method item, according to input language
       
   544     MakeListItemVisibleL( EGSLangIdDIM, EGSLangIdITL );
       
   545     MakeListItemVisibleL( EGSLangIdCangJie, EGSLangIdDIM );
       
   546     }
       
   547 
       
   548 
       
   549 // -----------------------------------------------------------------------------
       
   550 // CGSLangContainer::MakeT9LItemL
       
   551 //
       
   552 //
       
   553 // -----------------------------------------------------------------------------
       
   554 //
       
   555 void CGSLangContainer::MakeT9LItemL()
       
   556     {
       
   557     const TInt mode = iModel->PredictiveOnOff( CGSLangModel::EGSLangOther );
       
   558     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   559     TPtr ptrBuffer ( dynamicText->Des() );
       
   560     //When input language is Chinese, it is check if English is 
       
   561     //supporting predictive                            
       
   562     TInt langCode = iModel->LanguageL( CGSLangModel::EGSInputLanguage);
       
   563     TBool checkEngine = EFalse;
       
   564     if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
       
   565         {
       
   566         langCode = ELangEnglish;
       
   567         checkEngine = ETrue;   
       
   568         }
       
   569   
       
   570     if ( !iModel->CheckDictionaryFromPtiL(
       
   571             langCode ,checkEngine ) )
       
   572         {
       
   573         ptrBuffer = iOnOffNotAvailable->Des();
       
   574         }
       
   575     else 
       
   576         {
       
   577 #ifdef RD_INTELLIGENT_TEXT_INPUT            
       
   578         if(!iModel->DeviceHasMultipleKeyboardsL())
       
   579 #endif 
       
   580             {
       
   581             ptrBuffer = ( *iOnOffItems )[1-mode];
       
   582             }
       
   583         }
       
   584        
       
   585     // Finally, set the dynamic text
       
   586     iListboxItemArray->SetDynamicTextL( EGSLangIdT9L, ptrBuffer );
       
   587     CleanupStack::PopAndDestroy( dynamicText );
       
   588     
       
   589     // And add to listbox
       
   590     iListboxItemArray->SetItemVisibilityL( EGSLangIdT9L,
       
   591         CGSListBoxItemTextArray::EVisible );
       
   592     if( !mode )
       
   593 		{
       
   594 		iListboxItemArray->SetItemVisibilityL( EGSLangIdPredictiveMode,
       
   595 		    CGSListBoxItemTextArray::EInvisible );
       
   596 		}
       
   597     }
       
   598 
       
   599 
       
   600 // -----------------------------------------------------------------------------
       
   601 // CGSLangContainer::SetT9ItemVisibilityL
       
   602 //
       
   603 // Sets predictive text item's visibility
       
   604 // -----------------------------------------------------------------------------
       
   605 //
       
   606 void CGSLangContainer::SetT9ItemVisibilityL( TBool aVisibility )
       
   607     {
       
   608     if( aVisibility )
       
   609         {
       
   610         iListboxItemArray->SetItemVisibilityL( EGSLangIdT9L,
       
   611         CGSListBoxItemTextArray::EVisible );
       
   612         }
       
   613     else
       
   614         {
       
   615         iListboxItemArray->SetItemVisibilityL( EGSLangIdT9L,
       
   616         CGSListBoxItemTextArray::EInvisible );
       
   617         }
       
   618     }
       
   619 
       
   620 
       
   621 // -----------------------------------------------------------------------------
       
   622 // CGSLangContainer::MakeEngPredTxtItemL
       
   623 //
       
   624 //
       
   625 // -----------------------------------------------------------------------------
       
   626 //
       
   627 void CGSLangContainer::MakeEngPredTxtItemL()
       
   628     {
       
   629     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   630     TPtr ptrBuffer ( dynamicText->Des() );
       
   631     const TInt mode = iModel->PredictiveOnOff( CGSLangModel::EGSLangOther );
       
   632     if ( iModel->CheckDictionaryFromPtiL(
       
   633                  iModel->LanguageL( CGSLangModel::EGSInputLanguage ) ) )
       
   634         {
       
   635         ptrBuffer = ( *iOnOffItems )[1-mode];
       
   636         }
       
   637     else
       
   638         {
       
   639         ptrBuffer = iOnOffNotAvailable->Des();
       
   640         }
       
   641 
       
   642     // Finally, set the dynamic text
       
   643     iListboxItemArray->SetDynamicTextL( EGSLangIdEPT, ptrBuffer );
       
   644     CleanupStack::PopAndDestroy( dynamicText );
       
   645 
       
   646     // And add to listbox
       
   647     iListboxItemArray->SetItemVisibilityL( EGSLangIdEPT,
       
   648         CGSListBoxItemTextArray::EVisible );
       
   649     }
       
   650 
       
   651 
       
   652 // -----------------------------------------------------------------------------
       
   653 // CGSLangContainer::MakeResetATOKDictionaryItemL
       
   654 //
       
   655 //
       
   656 // -----------------------------------------------------------------------------
       
   657 //
       
   658 void CGSLangContainer::MakeResetATOKDictionaryItemL()
       
   659     {
       
   660     iListboxItemArray->SetItemVisibilityL(
       
   661         EGSLangIdResetAtokDict,
       
   662         CGSListBoxItemTextArray::EVisible );
       
   663     }
       
   664 
       
   665 
       
   666 // -----------------------------------------------------------------------------
       
   667 // CGSLangContainer::MakeJnpPredTxtItemL
       
   668 //
       
   669 //
       
   670 // -----------------------------------------------------------------------------
       
   671 //
       
   672 void CGSLangContainer::MakeJnpPredTxtItemL()
       
   673     {
       
   674     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   675     TPtr ptrBuffer ( dynamicText->Des() );
       
   676 
       
   677     const TInt mode = iModel->PredictiveOnOff( CGSLangModel::EGSLangJapanese );
       
   678     if ( iModel->CheckDictionaryFromPtiL(
       
   679                  iModel->LanguageL( CGSLangModel::EGSInputLanguage ) ) )
       
   680         {
       
   681         ptrBuffer = ( *iJapPredTxtOnOffItems )[1-mode];
       
   682         }
       
   683     else
       
   684         {
       
   685         ptrBuffer = iOnOffNotAvailable->Des();
       
   686         }
       
   687 
       
   688     // Finally, set the dynamic text
       
   689     iListboxItemArray->SetDynamicTextL( EGSLangIdJPT, ptrBuffer );
       
   690     CleanupStack::PopAndDestroy( dynamicText );
       
   691 
       
   692     // And add to listbox
       
   693     iListboxItemArray->SetItemVisibilityL( EGSLangIdJPT,
       
   694         CGSListBoxItemTextArray::EVisible );
       
   695     }
       
   696 
       
   697 
       
   698 // -----------------------------------------------------------------------------
       
   699 // CGSLangContainer::MakeAHNumberModeItemL
       
   700 //
       
   701 //
       
   702 // -----------------------------------------------------------------------------
       
   703 //
       
   704 void CGSLangContainer::MakeAHNumberModeItemL()
       
   705     {
       
   706     const TInt defaultNumberModeIndex = 
       
   707                iModel->DefaultNumberMode( EGSNbrModeTypeArabic );
       
   708     
       
   709     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   710     TPtr ptrBuffer ( dynamicText->Des() );
       
   711     
       
   712     ptrBuffer = ( *iAHNumberModeItems )[defaultNumberModeIndex];
       
   713 
       
   714     // Set the dynamic text
       
   715     iListboxItemArray->SetDynamicTextL( EGSLangAHNumberMode, ptrBuffer );
       
   716     CleanupStack::PopAndDestroy( dynamicText );
       
   717 
       
   718     // And add to listbox
       
   719     iListboxItemArray->SetItemVisibilityL( EGSLangAHNumberMode,
       
   720                                            CGSListBoxItemTextArray::EVisible );
       
   721     }
       
   722 
       
   723 // -----------------------------------------------------------------------------
       
   724 // CGSLangContainer::MakeHindiNumberModeItemL
       
   725 //
       
   726 //
       
   727 // -----------------------------------------------------------------------------
       
   728 //
       
   729 void CGSLangContainer::MakeHindiNumberModeItemL()
       
   730     {
       
   731     const TInt defaultNumberModeIndex = 
       
   732                iModel->DefaultNumberMode( EGSNbrModeTypeIndic );
       
   733     
       
   734     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   735     TPtr ptrBuffer ( dynamicText->Des() );
       
   736     
       
   737     ptrBuffer = ( *iHindiNumberModeItems )[defaultNumberModeIndex];
       
   738 
       
   739     // Set the dynamic text
       
   740     iListboxItemArray->SetDynamicTextL( EGSLangHindiNumberMode, ptrBuffer );
       
   741     CleanupStack::PopAndDestroy( dynamicText );
       
   742 
       
   743     // And add to listbox
       
   744     iListboxItemArray->SetItemVisibilityL( EGSLangHindiNumberMode,
       
   745                                            CGSListBoxItemTextArray::EVisible );
       
   746     }
       
   747 
       
   748 
       
   749 // -----------------------------------------------------------------------------
       
   750 // CGSLangContainer::MakeDIMItemL
       
   751 //
       
   752 //
       
   753 // -----------------------------------------------------------------------------
       
   754 //
       
   755 void CGSLangContainer::MakeDIMItemL()
       
   756     {
       
   757     //fetch the current value from iModel:
       
   758     // current item is the Hexadecimal value of Input method code from CenRep
       
   759     TInt lang = iModel->LanguageL( CGSLangModel::EGSInputLanguage );
       
   760     TInt resId = 0;
       
   761      
       
   762     if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) 
       
   763        || (FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput) &&
       
   764            FeatureManager::FeatureSupported(KFeatureIdChinese)))
       
   765         {
       
   766         resId = R_DIM_QWERTY_SETTING_PAGE_LBX;
       
   767         }
       
   768     else
       
   769         {
       
   770         resId = R_DIM_SETTING_PAGE_LBX;
       
   771         }
       
   772 	
       
   773 	TInt keyboardLayout = 0;
       
   774     RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout);
       
   775     TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout;
       
   776 	
       
   777 	TBool isCangjieSupported = EFalse;   
       
   778     
       
   779     CGSRadioButtonSettingPageItemTextArray* items = 
       
   780         CGSRadioButtonSettingPageItemTextArray::NewL( resId, *iCoeEnv, NULL );
       
   781         
       
   782     
       
   783     CleanupStack::PushL(items);
       
   784     
       
   785     switch( lang )
       
   786         {
       
   787         case ELangPrcChinese:
       
   788             if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput )
       
   789                || FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput))
       
   790                 {
       
   791                 items->SetItemVisibilityL( EGSLangSPIdQwPinyin, 
       
   792                                    CGSListBoxItemTextArray::EVisible );
       
   793                 }
       
   794             else
       
   795                 {
       
   796                 items->SetItemVisibilityL( EGSLangSPIdPinyin, 
       
   797                                    CGSListBoxItemTextArray::EVisible );
       
   798                 }
       
   799             break;
       
   800         case ELangHongKongChinese:
       
   801             if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) 
       
   802                 || FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput))
       
   803                 {
       
   804 				if (!(layout == EPtiKeyboard12Key || layout == EPtiKeyboardHalfQwerty))
       
   805 					{
       
   806 					isCangjieSupported = ETrue;
       
   807 					}
       
   808 					
       
   809                 if ( iModel->CheckCangjieSupportL( ELangHongKongChinese ) && isCangjieSupported )
       
   810                     {
       
   811                     items->SetItemVisibilityL( EGSLangSPIdQwCangJie, 
       
   812                                    CGSListBoxItemTextArray::EVisible );
       
   813                     }
       
   814                 }
       
   815             break;
       
   816         case ELangTaiwanChinese:
       
   817             if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput )
       
   818                 || FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput))
       
   819                 {
       
   820                 items->SetItemVisibilityL( EGSLangSPIdQwZhuyin, 
       
   821                                    CGSListBoxItemTextArray::EVisible );
       
   822                 }
       
   823             else
       
   824                 {
       
   825                 items->SetItemVisibilityL( EGSLangSPIdZhuyin, 
       
   826                                    CGSListBoxItemTextArray::EVisible );
       
   827                 }
       
   828             break;
       
   829         default:
       
   830             break;
       
   831         }
       
   832                                    
       
   833     TInt oldInputMethodCode =iModel->DefaultInputMethodL();
       
   834      TInt currentItem = 0;
       
   835 
       
   836     // Construct a map for PRC,HK and TW for Input Method codes
       
   837     struct TMapArray { TInt iInputMethodCode; TInt index0, index1, index2; };
       
   838      //Note: The values 0, 1, 2, 3 have been used to align with the setting page indices
       
   839     
       
   840     TMapArray qwertyMethodMap_Cangjie[] = {
       
   841         //            PRC, HK, TW
       
   842         { EPinyin     , 0, -1, -1 },
       
   843         { EZhuyin     ,-1, -1,  0 },
       
   844         { EStroke     , 1,  0,  1 },
       
   845         { ECangJie    ,-1,  1, -1 },
       
   846         { ELatin      , 2,  2,  2 }
       
   847      };
       
   848 	 
       
   849 	 TMapArray qwertyMethodMap_NoCangjie[] = {
       
   850         //            PRC, HK, TW
       
   851         { EPinyin     , 0, -1, -1 },
       
   852         { EZhuyin     ,-1, -1,  0 },
       
   853         { EStroke     , 1,  0,  1 },
       
   854         { ECangJie    ,-1, -1, -1 },
       
   855         { ELatin      , 2,  1,  2 }
       
   856      };
       
   857         
       
   858     TMapArray itutMethodMap[] = {
       
   859         //            PRC, HK, TW
       
   860         { EPinyin     , 0, -1, -1 },
       
   861         { EZhuyin     ,-1, -1,  0 },
       
   862         { EStroke     , 1,  0,  1 },
       
   863         { ELatinText  , 2,  1,  2 },
       
   864         { ELatinUpper , 3,  2,  3 },
       
   865         { ELatinLower , 4,  3,  4 }
       
   866      }; 
       
   867     
       
   868     TInt itemsNum = KGSMapSize;
       
   869     TMapArray* methodMap = NULL;
       
   870     if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput )
       
   871        || (FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput) &&
       
   872            FeatureManager::FeatureSupported(KFeatureIdChinese)))
       
   873         {
       
   874 		    if ( isCangjieSupported )
       
   875 		        {
       
   876             methodMap = qwertyMethodMap_Cangjie;
       
   877             itemsNum = sizeof( qwertyMethodMap_Cangjie ) / sizeof( TMapArray );
       
   878             }
       
   879 		    else
       
   880 		        {
       
   881 		        methodMap = qwertyMethodMap_NoCangjie;
       
   882 		        itemsNum = sizeof( qwertyMethodMap_NoCangjie ) / sizeof( TMapArray );
       
   883 		        }
       
   884         }  
       
   885     else
       
   886         {
       
   887         methodMap = itutMethodMap;
       
   888         itemsNum = sizeof( itutMethodMap ) / sizeof( TMapArray );
       
   889         }
       
   890     for(TInt i = 0; i < itemsNum && i < KGSMapSize; i++)
       
   891         {
       
   892         if (oldInputMethodCode == methodMap[i].iInputMethodCode)
       
   893             {
       
   894             TInt val = 0;
       
   895             if ( lang == ELangPrcChinese )      { val = methodMap[i].index0; }
       
   896             if ( lang == ELangHongKongChinese ) { val = methodMap[i].index1; }
       
   897             if ( lang == ELangTaiwanChinese )   { val = methodMap[i].index2; }
       
   898             currentItem = val;
       
   899             break;
       
   900             }
       
   901         }
       
   902     if ( currentItem == -1 ) 
       
   903         { 
       
   904         currentItem = 0;
       
   905         }
       
   906   
       
   907     TInt featureId = items->FeatureIdByIndex( currentItem );
       
   908     HBufC* dynamicText = NULL;
       
   909     dynamicText = CGSItemTextArray::GetItemCaptionFromFeatureIdLC( 
       
   910                                                  resId, 
       
   911                                                  featureId, 
       
   912                                                  *iCoeEnv );
       
   913                                                  
       
   914     iListboxItemArray->SetDynamicTextL( EGSLangIdDIM, *dynamicText );
       
   915     // And add to listbox
       
   916     iListboxItemArray->SetItemVisibilityL( EGSLangIdDIM,
       
   917         CGSListBoxItemTextArray::EVisible );
       
   918     
       
   919     CleanupStack::PopAndDestroy( dynamicText );
       
   920     CleanupStack::PopAndDestroy( items );
       
   921     }
       
   922 
       
   923 
       
   924 // ---------------------------------------------------------------------------
       
   925 // CGSLangContainer::MakeKeypressTimeoutItemL()
       
   926 // 
       
   927 // Creates the Keypress Timeout item  
       
   928 // ---------------------------------------------------------------------------
       
   929 //
       
   930 void CGSLangContainer::MakeKeypressTimeoutItemL()
       
   931     {
       
   932     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   933     TPtr ptrBuffer ( dynamicText->Des() );
       
   934 
       
   935     // Get current data
       
   936     const TInt currentTime = iModel->KeypressTimeout();
       
   937     TInt currentIndex;
       
   938     if ( currentTime == 0 )
       
   939         {
       
   940         currentIndex = EGSKeypressTimeoutItemNone;
       
   941         }
       
   942     else if ( currentTime > KGSMultiTapTimerDefault )
       
   943         {
       
   944         currentIndex = EGSKeypressTimeoutItemLong;
       
   945         }
       
   946     else if ( currentTime < KGSMultiTapTimerDefault )
       
   947         {
       
   948         currentIndex = EGSKeypressTimeoutItemShort;
       
   949         }
       
   950     else
       
   951         {
       
   952         currentIndex = EGSKeypressTimeoutItemMedium;
       
   953         }
       
   954     ptrBuffer = ( *iKeypressTimeoutItems )[ currentIndex ];
       
   955 
       
   956     // Finally, set the dynamic text
       
   957     iListboxItemArray->SetDynamicTextL( EGSLangIdKT, ptrBuffer );
       
   958     CleanupStack::PopAndDestroy( dynamicText );
       
   959 
       
   960     // And add to listbox
       
   961     iListboxItemArray->SetItemVisibilityL( EGSLangIdKT, 
       
   962         CGSListBoxItemTextArray::EVisible );
       
   963     }
       
   964 
       
   965 // ---------------------------------------------------------------------------
       
   966 // CGSLangContainer::MakeJapQwertyItemL()
       
   967 // 
       
   968 // Creates the Japanese Qwerty setting item  
       
   969 // ---------------------------------------------------------------------------
       
   970 //
       
   971 void CGSLangContainer::MakeJapQwertyItemL( TInt aFeatureId )
       
   972     {
       
   973     TGSJapQwertyFlags flag = EGSJapQwertyFlagNone;
       
   974     CDesCArrayFlat* arrary = NULL;
       
   975 
       
   976     switch ( aFeatureId )
       
   977         {
       
   978         case EGSLangIdJQC:
       
   979             flag = EGSJapQwertyFlagComma;
       
   980             arrary = iJapQwertyCommaItems;
       
   981             break;
       
   982         case EGSLangIdJQP:
       
   983             flag = EGSJapQwertyFlagPeriod;
       
   984             arrary = iJapQwertyPeriodItems;
       
   985             break;
       
   986         case EGSLangIdJQWSP:
       
   987             flag = EGSJapQwertyFlagSpaceFullWidth;
       
   988             arrary = iJapQwertyWidthOfSpaceItems;
       
   989             break;
       
   990         default:
       
   991             break;
       
   992         }
       
   993 
       
   994     if ( flag != EGSJapQwertyFlagNone )
       
   995         {
       
   996         HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   997         TPtr ptrBuffer ( dynamicText->Des() );
       
   998         const TBool currentValue = iModel->JapanQwertyFlags( flag );
       
   999         // If current value is ETrue, display index is 0.
       
  1000         TInt dispIndex = ( currentValue )? 0 : 1;
       
  1001         // get current index string
       
  1002         ptrBuffer = ( *arrary )[ dispIndex ];  
       
  1003 
       
  1004         // Finally, set the dynamic text
       
  1005         iListboxItemArray->SetDynamicTextL( aFeatureId, ptrBuffer );
       
  1006         CleanupStack::PopAndDestroy( dynamicText );
       
  1007 
       
  1008         // And add to listbox
       
  1009         iListboxItemArray->SetItemVisibilityL( aFeatureId, 
       
  1010             CGSListBoxItemTextArray::EVisible );
       
  1011         }
       
  1012     }
       
  1013 
       
  1014 
       
  1015 // -----------------------------------------------------------------------------
       
  1016 // CGSLangContainer::CurrentFeatureId
       
  1017 //
       
  1018 //
       
  1019 // -----------------------------------------------------------------------------
       
  1020 //
       
  1021 TInt CGSLangContainer::CurrentFeatureId() const
       
  1022     {
       
  1023     return iListboxItemArray->CurrentFeature( );
       
  1024     }
       
  1025 
       
  1026 
       
  1027 // -----------------------------------------------------------------------------
       
  1028 // CGSLangContainer::GetHelpContext
       
  1029 //
       
  1030 //
       
  1031 // -----------------------------------------------------------------------------
       
  1032 //
       
  1033 void CGSLangContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
  1034     {
       
  1035     aContext.iMajor = KUidGS;
       
  1036     aContext.iContext = HLP_GS_LANGUAGE_PLUGIN;
       
  1037     }   
       
  1038 
       
  1039 
       
  1040 // -----------------------------------------------------------------------------
       
  1041 // CGSLangContainer::Model
       
  1042 //
       
  1043 //
       
  1044 // -----------------------------------------------------------------------------
       
  1045 //
       
  1046 CGSLangModel* CGSLangContainer::Model()
       
  1047     {
       
  1048     return iModel;
       
  1049     }
       
  1050 
       
  1051 
       
  1052 // -----------------------------------------------------------------------------
       
  1053 // CGSLangContainer::NumberModeItems
       
  1054 //
       
  1055 //
       
  1056 // -----------------------------------------------------------------------------
       
  1057 //
       
  1058 const MDesCArray* CGSLangContainer::NumberModeItems( TInt aNbrModeType )
       
  1059     {
       
  1060     if ( aNbrModeType == EGSNbrModeTypeArabic )
       
  1061         {
       
  1062         return iAHNumberModeItems;
       
  1063         }
       
  1064     else
       
  1065         {
       
  1066         return iHindiNumberModeItems;
       
  1067         }
       
  1068     }
       
  1069     
       
  1070 
       
  1071 // -----------------------------------------------------------------------------
       
  1072 // CGSLangContainer::MakeListItemVisibleL
       
  1073 //
       
  1074 // Make a list item visible, when needed
       
  1075 // -----------------------------------------------------------------------------
       
  1076 //
       
  1077 void CGSLangContainer::MakeListItemVisibleL( TInt aFeatureId, 
       
  1078                                              TInt aCurrentlySelectedFeature )
       
  1079     {
       
  1080     switch ( aFeatureId )
       
  1081         {
       
  1082         case EGSLangAHNumberMode:
       
  1083             // UI language was changed
       
  1084             if ( iElaf && aCurrentlySelectedFeature == EGSLangIdDTL )
       
  1085                 {
       
  1086                 CGSListBoxItemTextArray::TVisibility digitTypeVisibility =
       
  1087                     CGSListBoxItemTextArray::EInvisible;
       
  1088                 TInt uiLang = iModel->LanguageL( CGSLangModel::EGSUiLanguage );
       
  1089                 if ( ( uiLang == ELangArabic && User::Language() == ELangArabic )
       
  1090                    || ( uiLang == ELangUrdu && User::Language() == ELangUrdu ) ||
       
  1091                    ( uiLang == ELangFarsi && User::Language() == ELangFarsi ) )
       
  1092                     {
       
  1093                     digitTypeVisibility = CGSListBoxItemTextArray::EVisible;
       
  1094                     }
       
  1095 
       
  1096                 // Set the visibility
       
  1097                 iListboxItemArray->SetItemVisibilityL( aFeatureId,
       
  1098                     digitTypeVisibility );
       
  1099                 }
       
  1100             break;
       
  1101         case EGSLangHindiNumberMode:
       
  1102             // UI language was changed
       
  1103             if ( aCurrentlySelectedFeature == EGSLangIdDTL )
       
  1104                 {
       
  1105                 CGSListBoxItemTextArray::TVisibility digitTypeVisibility =
       
  1106                     CGSListBoxItemTextArray::EInvisible;
       
  1107                 if ( ( iModel->LanguageL( CGSLangModel::EGSUiLanguage ) == 
       
  1108                      ELangHindi && User::Language() == ELangHindi ) ||
       
  1109                      ( iModel->LanguageL( CGSLangModel::EGSUiLanguage ) == 
       
  1110                      ELangMarathi && User::Language() == ELangMarathi ) )
       
  1111                     {
       
  1112                     digitTypeVisibility = CGSListBoxItemTextArray::EVisible;
       
  1113                     }
       
  1114     
       
  1115                 // Set the visibility
       
  1116                 iListboxItemArray->SetItemVisibilityL( aFeatureId,
       
  1117                     digitTypeVisibility );
       
  1118                 }
       
  1119             break;
       
  1120         case EGSLangIdDIM:
       
  1121             // Input language was changed
       
  1122             if( FeatureManager::FeatureSupported( KFeatureIdChinese ) && !iElaf )
       
  1123                 {
       
  1124                 if ( aCurrentlySelectedFeature == EGSLangIdITL )
       
  1125                     {
       
  1126                     CGSListBoxItemTextArray::TVisibility 
       
  1127                     defInputMethodVisibility = CGSListBoxItemTextArray::EVisible;
       
  1128                     TInt inputLanguage = 
       
  1129                          iModel->LanguageL( CGSLangModel::EGSInputLanguage );
       
  1130                     if ( inputLanguage != ELangPrcChinese &&
       
  1131                          inputLanguage != ELangHongKongChinese &&
       
  1132                          inputLanguage != ELangTaiwanChinese )
       
  1133                         {
       
  1134                         defInputMethodVisibility = 
       
  1135                             CGSListBoxItemTextArray::EInvisible;
       
  1136                         }
       
  1137     
       
  1138                 // Set the visibility
       
  1139                 iListboxItemArray->SetItemVisibilityL( aFeatureId,
       
  1140                     defInputMethodVisibility );
       
  1141                 }
       
  1142             }
       
  1143             break;
       
  1144         case EGSLangIdCangJie:
       
  1145             // Default Input Language/Method was changed
       
  1146             if ( aCurrentlySelectedFeature == EGSLangIdDIM )
       
  1147                 {
       
  1148                 CGSListBoxItemTextArray::TVisibility 
       
  1149                         cangJieItemVisibility = CGSListBoxItemTextArray::EInvisible;            
       
  1150                 TInt defaultInputMethod = 
       
  1151                              iModel->DefaultInputMethodL();
       
  1152                 TInt inputLanguage = iModel->LanguageL( CGSLangModel::EGSInputLanguage );
       
  1153                             
       
  1154                 if ( defaultInputMethod == ECangJie && 
       
  1155                         iModel->CheckCangjieSupportL( inputLanguage ) )
       
  1156                     {
       
  1157                     cangJieItemVisibility = CGSListBoxItemTextArray::EVisible;
       
  1158                     }
       
  1159         
       
  1160                 // Set the visibility
       
  1161                 iListboxItemArray->SetItemVisibilityL( aFeatureId,
       
  1162                     cangJieItemVisibility );
       
  1163                 }
       
  1164             break;
       
  1165         default:
       
  1166             break;
       
  1167         }    
       
  1168     
       
  1169     }
       
  1170     
       
  1171 // -----------------------------------------------------------------------------
       
  1172 // CGSLangContainer::MakeCangJieItemL
       
  1173 //
       
  1174 // Should be visible only if Input language is Chinese HK and this supports
       
  1175 // CangJie input mode. Checked from PtiEngine.
       
  1176 // -----------------------------------------------------------------------------
       
  1177 //
       
  1178 void CGSLangContainer::MakeCangJieItemL()
       
  1179     {
       
  1180     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
  1181     TPtr ptrBuffer ( dynamicText->Des() );
       
  1182     
       
  1183     const TInt selectedItem = iModel->ChiCangJieInputL();
       
  1184     const TInt inputLang = iModel->LanguageL( CGSLangModel::EGSInputLanguage );
       
  1185     if ( iModel->CheckDictionaryFromPtiL( inputLang ) )
       
  1186         {
       
  1187         ptrBuffer = ( *iChiCangJieItems )[ selectedItem ];
       
  1188         }
       
  1189 
       
  1190     // Finally, set the dynamic text
       
  1191     iListboxItemArray->SetDynamicTextL( EGSLangIdCangJie, ptrBuffer );
       
  1192     CleanupStack::PopAndDestroy( dynamicText );
       
  1193 
       
  1194     // And add to listbox
       
  1195     iListboxItemArray->SetItemVisibilityL( EGSLangIdCangJie,
       
  1196         CGSListBoxItemTextArray::EVisible );
       
  1197     }
       
  1198 
       
  1199 
       
  1200 // -----------------------------------------------------------------------------
       
  1201 // CGSLangContainer::MakePredictiveModeItemL
       
  1202 // Towards Word Autocompletion Req from 4.0
       
  1203 // Create Predictvie mode setting values
       
  1204 // 0   --->  Normal
       
  1205 // 1   --->  Autocompletion
       
  1206 // -----------------------------------------------------------------------------
       
  1207 //
       
  1208 void CGSLangContainer::MakePredictiveModeItemL()
       
  1209     {
       
  1210     if ( iModel->PredictiveOnOff( CGSLangModel::EGSLangOther ) )
       
  1211     	{
       
  1212     	HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
  1213     	TPtr ptrBuffer ( dynamicText->Des() );
       
  1214     
       
  1215     	const TInt selectedItem = iModel->PredictiveModeL();
       
  1216     	if ( iModel->CheckDictionaryFromPtiL(
       
  1217 		             iModel->LanguageL( CGSLangModel::EGSInputLanguage ) ) )
       
  1218 		    {
       
  1219 		    ptrBuffer = ( *iPredictiveModeItems )[ selectedItem ];
       
  1220 		    }
       
  1221 		else
       
  1222 		    {
       
  1223 		    ptrBuffer = iOnOffNotAvailable->Des();
       
  1224 		    }
       
  1225     	
       
  1226     	#ifndef RD_SCALABLE_UI_V2
       
  1227     	if( iModel->CheckAutoWordCompletionSupportL() )
       
  1228     		{    			 
       
  1229     		// Finally, set the dynamic text
       
  1230     		iListboxItemArray->SetDynamicTextL( EGSLangIdPredictiveMode, ptrBuffer );
       
  1231     	
       
  1232     		// And add to listbox
       
  1233     		iListboxItemArray->SetItemVisibilityL( EGSLangIdPredictiveMode,
       
  1234         						   CGSListBoxItemTextArray::EVisible );        	
       
  1235         	}
       
  1236       	#endif // RD_SCALABLE_UI_V2  		
       
  1237       				   
       
  1238       	CleanupStack::PopAndDestroy( dynamicText );    	
       
  1239     	   	       
       
  1240         }
       
  1241     }
       
  1242 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1243 // -----------------------------------------------------------------------------
       
  1244 // CGSLangContainer::MakePredictiveSettingListL
       
  1245 // -----------------------------------------------------------------------------
       
  1246 //
       
  1247 void CGSLangContainer::MakePredictiveOptionsItemL()
       
  1248     {    
       
  1249     // Check whether the language supports prediction or not 
       
  1250     // if not disable input options from language menu
       
  1251     TInt keyboardLayout = 0;
       
  1252     RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout);
       
  1253     TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout;
       
  1254     TBool isPredictionSupport = EFalse;
       
  1255     switch(layout)
       
  1256         {
       
  1257         case EPtiKeyboardHalfQwerty:
       
  1258             isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineHalfQwertyPredictive);
       
  1259             break;
       
  1260         case EPtiKeyboardQwerty4x12:
       
  1261         case EPtiKeyboardQwerty4x10:  
       
  1262         case EPtiKeyboardQwerty3x11:
       
  1263         case EPtiKeyboardCustomQwerty:
       
  1264             isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineQwertyPredictive);
       
  1265             break;
       
  1266         case EPtiKeyboardNone:
       
  1267         case EPtiKeyboard12Key:
       
  1268 #ifndef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__
       
  1269             isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive);
       
  1270 #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__            
       
  1271             break;
       
  1272         default:
       
  1273             isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive);
       
  1274             break;     
       
  1275         }
       
  1276     if (isPredictionSupport == EFalse)
       
  1277         {
       
  1278         iListboxItemArray->SetItemVisibilityL( EGSLangIdPredictiveOptions,
       
  1279                 CGSListBoxItemTextArray::EInvisible );
       
  1280         }
       
  1281     else
       
  1282         {
       
  1283         iListboxItemArray->SetItemVisibilityL( EGSLangIdPredictiveOptions,
       
  1284                 CGSListBoxItemTextArray::EVisible );
       
  1285         }
       
  1286     }
       
  1287 
       
  1288 void CGSLangContainer::HandleResourceChange( TInt aType )
       
  1289     {
       
  1290     CGSBaseContainer::HandleResourceChange(aType);
       
  1291     TInt keyboardLayout = 0;
       
  1292         RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout);
       
  1293         TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout;
       
  1294         TBool isPredictionSupport = EFalse;
       
  1295         switch(layout)
       
  1296             {
       
  1297             case EPtiKeyboardHalfQwerty:
       
  1298                 isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineHalfQwertyPredictive);
       
  1299                 break;
       
  1300             case EPtiKeyboardQwerty4x12:
       
  1301             case EPtiKeyboardQwerty4x10:  
       
  1302             case EPtiKeyboardQwerty3x11:
       
  1303             case EPtiKeyboardCustomQwerty:
       
  1304                 isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineQwertyPredictive);
       
  1305                 break;
       
  1306             case EPtiKeyboardNone:
       
  1307             case EPtiKeyboard12Key:
       
  1308                 // Commenting out the below function call as ITI is not supported for Touch Input.
       
  1309     #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__
       
  1310                 //isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive);
       
  1311     #else
       
  1312                 isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive);
       
  1313     #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__
       
  1314                 break;
       
  1315             default:
       
  1316                 isPredictionSupport = iModel->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive);
       
  1317                 break;     
       
  1318             }
       
  1319         if (isPredictionSupport == EFalse)
       
  1320             {
       
  1321             iListboxItemArray->SetItemVisibilityL( EGSLangIdPredictiveOptions,
       
  1322                     CGSListBoxItemTextArray::EInvisible );
       
  1323             }
       
  1324         else
       
  1325             {
       
  1326             iListboxItemArray->SetItemVisibilityL( EGSLangIdPredictiveOptions,
       
  1327                     CGSListBoxItemTextArray::EVisible );
       
  1328             }
       
  1329         iListBox->HandleItemAdditionL();
       
  1330         MakeT9LItemL();
       
  1331     }
       
  1332 #endif
       
  1333 // End of File