uifw/AvKon/src/AknSctDialog.cpp
changeset 0 2f259fa3e83a
child 9 aabf2c525e0f
child 14 3320e4e6e8bb
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <barsread.h>
       
    21 #include <uikon.hrh>
       
    22 #include <e32std.h>
       
    23 #include <eikcapc.h>
       
    24 
       
    25 #include <aknlayoutscalable_avkon.cdl.h>
       
    26 #include <layoutmetadata.cdl.h>
       
    27 
       
    28 #include "aknborders.h"
       
    29 #include "aknconsts.h"
       
    30 #include "AknUtils.h"
       
    31 #include "aknPopupHeadingPane.h"
       
    32 #include "aknCharMap.h"
       
    33 #include "aknSctDialog.h"
       
    34 #include "AknSettingCache.h"
       
    35 #include "aknenv.h"
       
    36 #include "AknDef.h"
       
    37 #include <bautils.h>
       
    38 
       
    39 #include <AknLayout.lag>
       
    40 #include <StringLoader.h>
       
    41 #include <e32property.h>
       
    42 #include <AvkonInternalCRKeys.h>    // KAknQwertyInputModeActive
       
    43 
       
    44 #include <featmgr.h> // temporary
       
    45 #include <PtiIndicDefs.h>
       
    46 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    47 #include <uikon/eikenvinterface.h>
       
    48 #endif
       
    49 
       
    50 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
    51 #include <gfxtranseffect/gfxtranseffect.h>
       
    52 #include <akntransitionutils.h>
       
    53 #endif
       
    54 
       
    55 #include <AknTasHook.h>
       
    56 #include "aknsctfocushandler.h"
       
    57 
       
    58 //
       
    59 // class CAknCharMapDialog
       
    60 //
       
    61 
       
    62 // const TInt KHorizontalDialogMargin = 3;
       
    63 // const TInt KVerticalDialogMargin = 3;
       
    64 
       
    65 _LIT(KResFileName, "z:\\resource\\avkon.r");
       
    66 
       
    67 const TInt KWsBufferSize = 16000;
       
    68 const TInt KAknSctCBaButtonDirections = 3; // bottom, right and left
       
    69 
       
    70 enum TCharMapDialogFlags
       
    71     {
       
    72     ECharMapDialogItemSelected = 0x01,
       
    73     ECharMapDialogItemLockNumericKeys = 0x02,
       
    74     ECharMapDialogRecentCharsRowDisabled = 0x04,
       
    75     ECharMapDialogTableExitSelected = 0x08
       
    76     };
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // Extension class
       
    80 //
       
    81 // ----------------------------------------------------------------------------
       
    82 //
       
    83 NONSHARABLE_CLASS(CAknCharMapDialogExtension): public CBase
       
    84     {
       
    85 public:
       
    86     static CAknCharMapDialogExtension* NewL(CAknCharMapDialog* aCaller);
       
    87     ~CAknCharMapDialogExtension();
       
    88 
       
    89 private:
       
    90     CAknCharMapDialogExtension(CAknCharMapDialog* aCaller);
       
    91     void ConstructL();
       
    92     static TInt QwertyModeChangeNotification(TAny* aObj);
       
    93     void HandleQwertyModeChangeNotification();
       
    94 
       
    95 public: // New method
       
    96     void SetCharacterCaseIfRequiredL();
       
    97     
       
    98 public:
       
    99     TInt iFlags;
       
   100     TBool iQwertyMode;
       
   101     CAknCharMapDialog* iCaller;
       
   102     TBool iHaveReceivedKeyEvent;
       
   103 
       
   104     TInt iShowAnotherTableCharCase;
       
   105     TAknCharMapPictoMode    iPictoMode;
       
   106     TAknCharMapEmotionMode  iEmotionMode;
       
   107 
       
   108 private:
       
   109     NONSHARABLE_CLASS(CSubscriber) : public CActive
       
   110         {
       
   111     public:
       
   112         CSubscriber(TCallBack aCallBack, RProperty& aProperty);
       
   113         ~CSubscriber();
       
   114 
       
   115     public: // New functions
       
   116         void SubscribeL();
       
   117         void StopSubscribe();
       
   118 
       
   119     private: // from CActive
       
   120         void RunL();
       
   121         void DoCancel();
       
   122 
       
   123     private:
       
   124         TCallBack   iCallBack;
       
   125         RProperty&  iProperty;
       
   126         };
       
   127 
       
   128 private:
       
   129     CSubscriber* iQwertyModeStatusSubscriber;
       
   130     RProperty iQwertyModeStatusProperty;
       
   131     TInt iOldCharCase;
       
   132     };
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // CAknCharMapDialogExtension::CAknCharMapDialogExtension
       
   136 //
       
   137 // Constructor of extension
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 CAknCharMapDialogExtension::CAknCharMapDialogExtension(CAknCharMapDialog* aCaller) : 
       
   141 iFlags(0), iQwertyMode(EFalse), iCaller(aCaller), 
       
   142 iShowAnotherTableCharCase(-1), iPictoMode(EAknCharMapPictoNoUse), iEmotionMode(EAknCharMapEmotionNoUse)
       
   143     {
       
   144     }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // CAknCharMapDialogExtension::~CAknCharMapDialogExtension
       
   148 //
       
   149 // Destructor of extension
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 CAknCharMapDialogExtension::~CAknCharMapDialogExtension()
       
   153     {
       
   154     // Stop subscribe in PubSub
       
   155     if (iQwertyModeStatusSubscriber)
       
   156         {
       
   157         iQwertyModeStatusSubscriber->StopSubscribe();
       
   158         }
       
   159     iQwertyModeStatusProperty.Close();
       
   160     delete iQwertyModeStatusSubscriber;
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CAknCharMapDialogExtension::NewL
       
   165 //
       
   166 // Symbian 2 phase constructor
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 CAknCharMapDialogExtension* CAknCharMapDialogExtension::NewL(CAknCharMapDialog* aCaller)
       
   170     { // static
       
   171     CAknCharMapDialogExtension* self = new (ELeave) CAknCharMapDialogExtension(aCaller);
       
   172     CleanupStack::PushL(self);
       
   173     self->ConstructL();
       
   174     CleanupStack::Pop();
       
   175     return self;
       
   176     }
       
   177 
       
   178 // -----------------------------------------------------------------------------
       
   179 // CAknCharMapDialogExtension::ConstructL
       
   180 //
       
   181 // Symbian construction
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 void CAknCharMapDialogExtension::ConstructL()
       
   185     {
       
   186     // Start also listening qwerty mode status.
       
   187     User::LeaveIfError(iQwertyModeStatusProperty.Attach(KCRUidAvkon,
       
   188         KAknQwertyInputModeActive));
       
   189 
       
   190     iQwertyModeStatusSubscriber = new (ELeave) CSubscriber(
       
   191         TCallBack(QwertyModeChangeNotification, this), iQwertyModeStatusProperty);
       
   192 
       
   193     iQwertyModeStatusSubscriber->SubscribeL();
       
   194 
       
   195     iOldCharCase=-1; // no default character case at beginning
       
   196     }
       
   197 
       
   198 TInt CAknCharMapDialogExtension::QwertyModeChangeNotification(TAny* aObj)
       
   199     {
       
   200     if (aObj != NULL)
       
   201         {
       
   202         static_cast<CAknCharMapDialogExtension*>(aObj)->HandleQwertyModeChangeNotification();
       
   203         return KErrNone;
       
   204         }
       
   205     else
       
   206         {
       
   207         return KErrArgument;
       
   208         }
       
   209     }
       
   210 
       
   211 void CAknCharMapDialogExtension::SetCharacterCaseIfRequiredL()
       
   212     {
       
   213     TInt value = 0;
       
   214     iQwertyModeStatusProperty.Get(value);
       
   215     iQwertyMode = value;
       
   216 
       
   217     CAknCharMap* charmapControl =
       
   218             STATIC_CAST(CAknCharMap*, iCaller->Control(EAknSCTQueryContentId));
       
   219 
       
   220     if ( (iQwertyMode) == (charmapControl->CharacterCase() == EAknSCTQwerty) )
       
   221         {
       
   222         // No change for Qwerty mode
       
   223         return;
       
   224         }
       
   225 
       
   226     if (iQwertyMode)
       
   227         {
       
   228         iFlags |= ECharMapDialogItemLockNumericKeys;
       
   229 
       
   230         iOldCharCase=charmapControl->CharacterCase();
       
   231         charmapControl->SetCharacterCaseL(EAknSCTQwerty);
       
   232         }
       
   233     else
       
   234         {
       
   235         iFlags &= (~ECharMapDialogItemLockNumericKeys);
       
   236         if (iOldCharCase!=-1)
       
   237             {
       
   238             charmapControl->SetCharacterCaseL(iOldCharCase);
       
   239             }
       
   240         else
       
   241             {
       
   242             charmapControl->SetCharacterCaseL(EAknSCTLowerCase);
       
   243             iOldCharCase = EAknSCTLowerCase;
       
   244             }
       
   245         }
       
   246     //charmapControl->DrawNow();
       
   247     }
       
   248 
       
   249 void CAknCharMapDialogExtension::HandleQwertyModeChangeNotification()
       
   250     {
       
   251     TInt value = 0;
       
   252     iQwertyModeStatusProperty.Get(value);
       
   253     iQwertyMode = value;
       
   254 
       
   255     CAknCharMap* charmapControl =
       
   256             STATIC_CAST(CAknCharMap*, iCaller->Control(EAknSCTQueryContentId));
       
   257 
       
   258     if ( (iQwertyMode) == (charmapControl->CharacterCase() == EAknSCTQwerty) )
       
   259         {
       
   260         // No change for Qwerty mode
       
   261         return;
       
   262         }
       
   263 
       
   264     if (iQwertyMode)
       
   265         {
       
   266         iFlags |= ECharMapDialogItemLockNumericKeys;
       
   267 
       
   268         iOldCharCase=charmapControl->CharacterCase();
       
   269         TRAP_IGNORE( charmapControl->SetCharacterCaseL(EAknSCTQwerty) );
       
   270         }
       
   271     else
       
   272         {
       
   273         iFlags &= ~ECharMapDialogItemLockNumericKeys;
       
   274         if (iOldCharCase!=-1)
       
   275             {
       
   276             TRAP_IGNORE( charmapControl->SetCharacterCaseL(iOldCharCase) );
       
   277             }
       
   278         else
       
   279             {
       
   280             TRAP_IGNORE( charmapControl->SetCharacterCaseL(EAknSCTLowerCase) );
       
   281             iOldCharCase = EAknSCTLowerCase;
       
   282             }
       
   283         }
       
   284 
       
   285         // Reset focus.
       
   286     charmapControl->TakeFocus();
       
   287 
       
   288     // Draw new characters.
       
   289     charmapControl->DrawNow();
       
   290     }
       
   291 
       
   292 // CAknCharMapDialogExtension::CSubscriber
       
   293 CAknCharMapDialogExtension::CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty)
       
   294     : CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty)
       
   295     {
       
   296     CActiveScheduler::Add(this);
       
   297     }
       
   298 
       
   299 CAknCharMapDialogExtension::CSubscriber::~CSubscriber()
       
   300     {
       
   301     Cancel();
       
   302     }
       
   303 
       
   304 void CAknCharMapDialogExtension::CSubscriber::SubscribeL()
       
   305     {
       
   306     if (!IsActive())
       
   307         {
       
   308         iProperty.Subscribe(iStatus);
       
   309         SetActive();
       
   310         }
       
   311     }
       
   312 
       
   313 void CAknCharMapDialogExtension::CSubscriber::StopSubscribe()
       
   314     {
       
   315     Cancel();
       
   316     }
       
   317 
       
   318 void CAknCharMapDialogExtension::CSubscriber::RunL()
       
   319     {
       
   320     if (iStatus.Int() == KErrNone)
       
   321         {
       
   322         iCallBack.CallBack();
       
   323         SubscribeL();
       
   324         }
       
   325     }
       
   326 
       
   327 void CAknCharMapDialogExtension::CSubscriber::DoCancel()
       
   328     {
       
   329     iProperty.Cancel();
       
   330     }
       
   331 
       
   332 // CAknCharMapDialog
       
   333 EXPORT_C CAknCharMapDialog::CAknCharMapDialog(TInt aCharCase, TDes& aSpecialChars, TInt aCharSetResourceId) : 
       
   334     iSpecialChars(&aSpecialChars), iCharCase(aCharCase), iCharSetResourceId(aCharSetResourceId)
       
   335     {
       
   336     CEikDialog::SetBorder( AknBorderId::EAknBorderNotePopup );
       
   337     
       
   338     TRAP_IGNORE(iExtension=CAknCharMapDialogExtension::NewL(this));
       
   339 
       
   340 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
       
   341     GfxTransEffect::Register( this, KGfxContextMenuControlUid );
       
   342 #endif
       
   343     
       
   344     AKNTASHOOK_ADD( this, "CAknCharMapDialog" );
       
   345     }
       
   346 
       
   347 CAknCharMapDialog::~CAknCharMapDialog()
       
   348     {
       
   349     AKNTASHOOK_REMOVE();
       
   350     
       
   351     iAvkonEnv->CancelWsBufferRequest( iWsBufferRequestId );
       
   352     
       
   353     delete iExtension;
       
   354     }
       
   355 
       
   356 EXPORT_C void CAknCharMapDialog::HandleResourceChange(TInt aType)
       
   357     {
       
   358     CAknCharMap* charmapControl = static_cast<CAknCharMap*>( Control( EAknSCTQueryContentId ) );
       
   359 
       
   360     if (aType==KEikDynamicLayoutVariantSwitch)
       
   361         {
       
   362         TRAP_IGNORE(iExtension->SetCharacterCaseIfRequiredL());
       
   363         //DoLayout();
       
   364         }
       
   365 
       
   366     CAknDialog::HandleResourceChange(aType);
       
   367 
       
   368     if (aType==KEikDynamicLayoutVariantSwitch)
       
   369         {
       
   370         // Softkeys
       
   371         ButtonGroupContainer().MakeVisible(AknLayoutUtils::PenEnabled() ? EFalse : ETrue);
       
   372 
       
   373         // Heading
       
   374         CAknPopupHeadingPane* headingPane = static_cast< CAknPopupHeadingPane* >( Control( EAknSCTQueryHeadingId ) );
       
   375         CEikCaptionedControl *ctrl = GetLineByLineAndPageIndex(0, EAknSCTQueryHeadingId);
       
   376         if (AknLayoutUtils::PenEnabled())
       
   377             {
       
   378             ctrl->SetLatent(ETrue);
       
   379             ctrl->SetLatentGroupLineFollows(ETrue);
       
   380             TRAP_IGNORE(charmapControl->UpdateInputFieldL());
       
   381             }
       
   382         else
       
   383             {
       
   384             ctrl->SetLatent(EFalse);
       
   385             ctrl->SetLatentGroupLineFollows(EFalse);
       
   386             if ( headingPane && charmapControl )
       
   387                 {
       
   388                 TRAP_IGNORE(
       
   389                     {
       
   390                     headingPane->SetPageL(
       
   391                         charmapControl->CurrentPage(),
       
   392                         charmapControl->PageCount() );
       
   393                         const TDesC* title = (charmapControl->IsJapaneseSctUi()) ?
       
   394                         charmapControl->TitleWithSelectingSpecialChar() : charmapControl->Title();
       
   395                     if ( title )
       
   396                         {
       
   397                         headingPane->SetTextL( *title );
       
   398                         }
       
   399                     });
       
   400                 }
       
   401             //Set softkeys
       
   402             TRAP_IGNORE(SetSoftKeyL());
       
   403             }
       
   404         ctrl->SetFocusing(EFalse);
       
   405         DoLayout();
       
   406         DrawNow();
       
   407         Window().SetVisible( ETrue );
       
   408         }
       
   409     }
       
   410 
       
   411 EXPORT_C TBool CAknCharMapDialog::OkToExitL(TInt aButtonId)
       
   412     {
       
   413     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   414     
       
   415     if (aButtonId == EAknSoftkeyNext)
       
   416         {
       
   417         TInt page = charmapControl->NextPageL();
       
   418         CAknPopupHeadingPane* headingPane = STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
   419         headingPane->SetPageL(charmapControl->CurrentPage(), page);
       
   420         if (page && !AknLayoutUtils::PenEnabled())
       
   421             {
       
   422             const TDesC* title = charmapControl->IsJapaneseSctUi() ? 
       
   423                                  charmapControl->TitleWithSelectingSpecialChar() : 
       
   424                                  charmapControl->Title();
       
   425             headingPane->SetTextL(*title);
       
   426             }
       
   427 
       
   428         return(EFalse);
       
   429         }
       
   430 
       
   431     // Selection key / select softkey adds a character only if 5-key was not used
       
   432     // to select multiple characters before.
       
   433     if (aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect || aButtonId == EAknSoftkeyExit)
       
   434         {
       
   435         // In Japanese UI, SCT isn't closed by pressing "Select" softkey,
       
   436         // but SCT is closed by pressing "Back"(button id is EAknSoftkeyClose).
       
   437         MAknSctFocusHandler* handler = charmapControl->FocusHandler();
       
   438         if (charmapControl->IsJapaneseSctUi() &&
       
   439             aButtonId != EAknSoftkeyExit &&
       
   440             handler->FocusedControl() == charmapControl)
       
   441             {
       
   442             TKeyEvent key;
       
   443             key.iCode=EKeySpace;
       
   444             key.iModifiers=0;
       
   445             handler->FocusedControl()->OfferKeyEventL(key, EEventKey);
       
   446             return(EFalse);
       
   447             }
       
   448         // else
       
   449         TKeyEvent key;
       
   450         key.iCode=EKeyOK;
       
   451         key.iModifiers=0;
       
   452         if(handler->FocusedControl()->OfferKeyEventL(key, EEventKey) == EKeyWasNotConsumed)
       
   453             {
       
   454             return EFalse;
       
   455             }
       
   456         else
       
   457             {
       
   458             return handler->ExitWithKey(key.iCode);
       
   459             }
       
   460         }
       
   461 
       
   462     return(ETrue);
       
   463     }
       
   464 
       
   465 EXPORT_C void CAknCharMapDialog::PreLayoutDynInitL()
       
   466     {
       
   467     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   468 
       
   469     // Softkeys
       
   470     ButtonGroupContainer().MakeVisible(AknLayoutUtils::PenEnabled() ? EFalse : ETrue);
       
   471 
       
   472     // Heading
       
   473     CAknPopupHeadingPane* headingPane = STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
   474     headingPane->SetLayout(CAknPopupHeadingPane::EColourSelectionGridHeadingPane);
       
   475     charmapControl->SetTitleL(headingPane->PromptText());
       
   476     SetLineNonFocusing(EAknSCTQueryHeadingId);
       
   477     CEikCaptionedControl *ctrl = GetLineByLineAndPageIndex(0, EAknSCTQueryHeadingId);
       
   478     ctrl->SetLatent(AknLayoutUtils::PenEnabled() ? ETrue : EFalse);
       
   479     ctrl->SetLatentGroupLineFollows(AknLayoutUtils::PenEnabled() ? ETrue : EFalse);
       
   480 
       
   481     // Pictographs
       
   482     charmapControl->SetPictoMode(iExtension->iPictoMode);
       
   483 
       
   484     // Emotion
       
   485     charmapControl->SetEmotionModeL(iExtension->iEmotionMode);
       
   486 
       
   487     // ShowAnotherTable
       
   488     RArray<TInt> caseTable(3);
       
   489     if (iExtension->iShowAnotherTableCharCase > 0)
       
   490         {
       
   491         caseTable.AppendL(iExtension->iShowAnotherTableCharCase);
       
   492         }
       
   493     charmapControl->SetCaseTableL(caseTable);
       
   494     caseTable.Close();
       
   495 
       
   496     // 
       
   497     charmapControl->SetBuffer(*iSpecialChars);
       
   498     charmapControl->SetCharacterCaseL(iCharCase);
       
   499 
       
   500     if (!AknLayoutUtils::PenEnabled())
       
   501         {
       
   502         if (charmapControl->PageCount() > 1)
       
   503             {
       
   504             const TDesC* title = charmapControl->IsJapaneseSctUi()?
       
   505                                  charmapControl->TitleWithSelectingSpecialChar() : 
       
   506                                  charmapControl->Title();
       
   507             headingPane->SetPageL(1, charmapControl->PageCount());
       
   508             headingPane->SetTextL(*title);
       
   509             // Set softkeys
       
   510             SetSoftKeyL();
       
   511             }
       
   512         }
       
   513     else
       
   514         {
       
   515         charmapControl->UpdateInputFieldL();
       
   516         }
       
   517     
       
   518     // Key events should be received even when cba is invisible
       
   519     MEikButtonGroup* cba = ButtonGroupContainer().ButtonGroup();
       
   520     STATIC_CAST( CEikCba*, cba)->SetButtonGroupFlags( cba->ButtonGroupFlags() | EAknCBAFlagRespondWhenInvisible );
       
   521     
       
   522     RWsSession& wsSession = iEikonEnv->WsSession();
       
   523     TInt myWgId = iEikonEnv->RootWin().Identifier();
       
   524     TInt wgPrio = wsSession.GetWindowGroupOrdinalPriority(myWgId);
       
   525     // we are already on forgeround, need to update priority differently
       
   526     if (wgPrio == ECoeWinPriorityAlwaysAtFront)
       
   527         {
       
   528         iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1);
       
   529         }
       
   530 
       
   531 	/// -- Change Window Priority for dialog and CBA 
       
   532 	
       
   533 	DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); //
       
   534 	ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); 	
       
   535 
       
   536     }
       
   537 
       
   538 EXPORT_C void CAknCharMapDialog::SetSizeAndPosition( const TSize& aSize )
       
   539     {
       
   540     if ( AknLayoutUtils::PenEnabled() )
       
   541         {
       
   542         CAknDialog::SetSizeAndPosition( aSize );
       
   543         CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*,
       
   544                 Control(EAknSCTQueryContentId));
       
   545         charmapControl->DrawOffscreenBackgroundIfRequired();      
       
   546         }
       
   547     else
       
   548         {
       
   549         SetBorder( TGulBorder::ENone ); // No Dialog borders in SCT.
       
   550         DoLayout();
       
   551         }
       
   552 
       
   553     }
       
   554 
       
   555 EXPORT_C TKeyResponse CAknCharMapDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aModifiers)
       
   556     {
       
   557     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   558     CAknPopupHeadingPane* headingPane = STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
   559     TBool isLockNumericKeys = (iExtension->iFlags&ECharMapDialogItemLockNumericKeys != EFalse);
       
   560 
       
   561     if (aModifiers == EEventKey)
       
   562         {
       
   563         switch (aKeyEvent.iCode)
       
   564             {
       
   565             case '5':
       
   566                 if (isLockNumericKeys || aKeyEvent.iRepeats)
       
   567                     {
       
   568                     return EKeyWasConsumed;
       
   569                     }
       
   570 				break;
       
   571             case EKeySpace:     // for Qwerty
       
   572                 // If there is only one empty position left in the buffer.
       
   573                 if (iSpecialChars->Length() + 1 >= iSpecialChars->MaxLength())
       
   574                     {
       
   575                     // Add the selected character to list of special chars
       
   576                     charmapControl->OfferKeyEventL(aKeyEvent, aModifiers);
       
   577                     TKeyEvent event = {EKeyOK, EKeyOK, 0, 0};
       
   578                     return CEikDialog::OfferKeyEventL( event, EEventKey );
       
   579                     }
       
   580                 // No break. Fall through.
       
   581             case '2':
       
   582             case '4':
       
   583             case '6':
       
   584             case '8':
       
   585                 if (isLockNumericKeys && aKeyEvent.iCode!=EKeySpace)
       
   586                     {
       
   587                     return EKeyWasConsumed;
       
   588                     }
       
   589             case EKeyLeftArrow:
       
   590             case EKeyRightArrow:
       
   591             case EKeyUpArrow:
       
   592             case EKeyDownArrow:
       
   593                 {
       
   594                 TKeyResponse res = charmapControl->OfferKeyEventL(aKeyEvent, aModifiers);
       
   595                 RefreshTitleAndNavi();
       
   596                 return res;
       
   597                 }
       
   598 
       
   599             case EKeyEnter:
       
   600             case EKeyDevice3:
       
   601                 {
       
   602                 TryExitL(EAknSoftkeySelect);
       
   603                 return EKeyWasConsumed;
       
   604                 }
       
   605             case '*':
       
   606                 {
       
   607                 if (!aKeyEvent.iRepeats) // switch another table when repeat count is 0 only.
       
   608                     {
       
   609                     if(iExtension->iHaveReceivedKeyEvent)
       
   610                         {
       
   611                         SwitchTablesOrPagesL();
       
   612                         }
       
   613                     else
       
   614                         {
       
   615                         iExtension->iHaveReceivedKeyEvent = ETrue;
       
   616                         }
       
   617                     }
       
   618                 }
       
   619                 break;
       
   620 
       
   621             default:
       
   622                 break;
       
   623             }
       
   624         }
       
   625     else if (aModifiers == EEventKeyUp)
       
   626         {
       
   627         switch (aKeyEvent.iScanCode)
       
   628             {
       
   629             case EStdKeyLeftFunc:
       
   630             case EStdKeyRightFunc:
       
   631                 {
       
   632                 if (!aKeyEvent.iRepeats) // switch another table when repeat count is 0 only.
       
   633                     {
       
   634                     if (!isLockNumericKeys) // Check whether current input mode is Qwerty.
       
   635                         {
       
   636                         SwitchTablesOrPagesL();
       
   637                         }
       
   638                     }
       
   639                 }
       
   640                 break;
       
   641             default:
       
   642                 break;
       
   643             }
       
   644         }
       
   645     
       
   646     return CEikDialog::OfferKeyEventL( aKeyEvent, aModifiers );
       
   647     }
       
   648 
       
   649 EXPORT_C TInt CAknCharMapDialog::ExecuteLD(TInt aResourceId)
       
   650     {
       
   651     iWsBufferRequestId = iAvkonEnv->RequestWsBuffer( KWsBufferSize );
       
   652 
       
   653     // Prepare real char map
       
   654     CEikDialog::PrepareLC(aResourceId);
       
   655 
       
   656 
       
   657     // Build up input language spesific avkon resource file
       
   658     TBuf<32> fileName(KResFileName);
       
   659 
       
   660     TInt langcode= iAvkonEnv->SettingCache().InputLanguage();
       
   661     // get the phone language
       
   662     TLanguage phoneLanguage = AknLangUtils::UserLanguage();
       
   663 
       
   664     if ( (langcode & KAknLanguageMask) == ELangEnglish && phoneLanguage != ELangEnglish  )
       
   665         {
       
   666         switch ( phoneLanguage )
       
   667         	{
       
   668         	case ELangThai:
       
   669         		langcode = ELangEnglish_Thailand;
       
   670         		break;
       
   671         			
       
   672         	default:
       
   673         		break;
       
   674         	}
       
   675         }
       
   676     
       
   677     if (langcode < 10)
       
   678         {
       
   679         fileName.Append('0');
       
   680         }
       
   681     if(langcode == KLangHindiPhonetic)
       
   682         langcode = ELangHindi;
       
   683     fileName.AppendNum(langcode);
       
   684 
       
   685     TResourceReader reader;
       
   686 
       
   687     RFs& fs = iEikonEnv->FsSession();
       
   688 
       
   689     // if input language spesific avkon resourcefile exists
       
   690     if ( BaflUtils::FileExists(fs, fileName) )
       
   691         {
       
   692         RResourceFile resourceFile;
       
   693         resourceFile.OpenL( fs, fileName );
       
   694         CleanupClosePushL( resourceFile ); // push
       
   695         resourceFile.ConfirmSignatureL( 0 );
       
   696 
       
   697         // if resources with correct id exists
       
   698         // -> read characters from resource and copy them to real char map
       
   699         if ( resourceFile.OwnsResourceId(aResourceId) )
       
   700             {
       
   701             HBufC8* resource=resourceFile.AllocReadLC(aResourceId); // push
       
   702             reader.SetBuffer(resource);
       
   703 
       
   704             // Create input language specific CharMapDialog.
       
   705             // Used only for reading input language spesific characters
       
   706             // from avkon resource file (avkon.r**).
       
   707             TBuf<32> specialChars;
       
   708             CAknCharMapDialog* langDialog = new( ELeave ) CAknCharMapDialog(EAknSCTLowerCase, specialChars );
       
   709             CleanupStack::PushL( langDialog ); // push
       
   710 
       
   711             langDialog->CreateWindowL();
       
   712             langDialog->ConstructFromResourceL(reader);
       
   713 
       
   714             CAknCharMap* langMap = STATIC_CAST( CAknCharMap*, langDialog->Control( EAknSCTQueryContentId ) );
       
   715             CAknCharMap* charMap = STATIC_CAST( CAknCharMap*, Control( EAknSCTQueryContentId ) );
       
   716             charMap->CopyCharactersL( *langMap );
       
   717 
       
   718             CleanupStack::PopAndDestroy(2); // langDialog, resource
       
   719 
       
   720             }
       
   721 
       
   722         CleanupStack::PopAndDestroy(); // resourcefile
       
   723         }
       
   724     
       
   725     // get created charmap control
       
   726     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   727 
       
   728     if (iCharSetResourceId)
       
   729         {
       
   730         TResourceReader reader;
       
   731         iCoeEnv->CreateResourceReaderLC(reader, iCharSetResourceId);
       
   732         charmapControl->ReadAndAddCharSetFromResourceL(reader);
       
   733         CleanupStack::PopAndDestroy(); // reader
       
   734         }
       
   735 
       
   736     charmapControl->SetObserver(this);
       
   737 
       
   738     if ( iExtension && (iExtension->iFlags & ECharMapDialogRecentCharsRowDisabled) )
       
   739         {
       
   740         charmapControl->DisableRecentCharsRow();
       
   741         }
       
   742     
       
   743     return(RunLD());
       
   744     }
       
   745 
       
   746 EXPORT_C void CAknCharMapDialog::CEikDialog_Reserved_1()
       
   747     {
       
   748     }
       
   749 
       
   750 EXPORT_C void CAknCharMapDialog::CEikDialog_Reserved_2()
       
   751     {
       
   752     }
       
   753 
       
   754 EXPORT_C void CAknCharMapDialog::CAknCharMapDialog_Reserved()
       
   755     {
       
   756     }
       
   757 
       
   758 EXPORT_C void CAknCharMapDialog::ShowNoPictographs()
       
   759     {
       
   760     iExtension->iPictoMode = EAknCharMapPictoNoUse;
       
   761     }
       
   762 
       
   763 EXPORT_C void CAknCharMapDialog::ShowPictographsFirst()
       
   764     {
       
   765     iExtension->iPictoMode = EAknCharMapPictoFirst;
       
   766     }
       
   767 
       
   768 EXPORT_C void CAknCharMapDialog::SetEmotionMode(TAknCharMapEmotionMode aEmotionMode)
       
   769     {
       
   770     iExtension->iEmotionMode = aEmotionMode;
       
   771     }
       
   772 
       
   773 EXPORT_C void CAknCharMapDialog::ShowAnotherTable(TInt aCharCase)
       
   774     {
       
   775     iExtension->iShowAnotherTableCharCase = aCharCase;
       
   776     }
       
   777 
       
   778 void CAknCharMapDialog::DoLayout()
       
   779     {
       
   780     TAknLayoutRect dialogLayRect;
       
   781 
       
   782     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   783 
       
   784     // Number of character rows in the special char table.
       
   785     TInt rows = charmapControl->HeightInRows();
       
   786 
       
   787     if (!AknLayoutUtils::PenEnabled())
       
   788         {
       
   789         // Main pane without softkeys
       
   790         TRect mainPaneRect;
       
   791         if(!AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EPopupParent, mainPaneRect))
       
   792             {
       
   793             mainPaneRect = iAvkonAppUi->ClientRect();
       
   794             }
       
   795 
       
   796         // Dialog layout, check variety first
       
   797         TAknLayoutScalableParameterLimits charMapDialogVariety =
       
   798             AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
       
   799 
       
   800         TInt maxVariety = charMapDialogVariety.LastVariety();
       
   801 
       
   802         // Check the CBA, if the orientation is not landscape
       
   803         // there is not so much varieties
       
   804         AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
       
   805         TInt maxVarietyOffset = 0; // the offset for the certain cba location variety
       
   806         TInt varietyOffset = maxVariety + 1;
       
   807 
       
   808         // landscape variety number must be calculated offset == number of varieties
       
   809         // same applies to the variety number for the biggest sized layout for the variety
       
   810         if(Layout_Meta_Data::IsLandscapeOrientation())
       
   811             {
       
   812             varietyOffset = (maxVariety + 1)/KAknSctCBaButtonDirections; // the offset for one variety
       
   813             }
       
   814 
       
   815         // for right and left cba buttons the max variety is not zero
       
   816         // the varities are ordered by the location of the cba and the descending order
       
   817         // e.g the biggest sized layout first, the smallest last
       
   818         if(location == AknLayoutUtils::EAknCbaLocationRight)
       
   819             {
       
   820             maxVarietyOffset = varietyOffset;
       
   821             }
       
   822         else if(location == AknLayoutUtils::EAknCbaLocationLeft)
       
   823             {
       
   824             maxVarietyOffset = varietyOffset + varietyOffset; // 2*
       
   825             }
       
   826 
       
   827         TInt varietyNumber = varietyOffset - rows;
       
   828 
       
   829         // if more lines than possible to show, use the default
       
   830         // (the biggest grid) variety
       
   831         if(varietyNumber < 0)
       
   832             varietyNumber = 0;
       
   833         // if zero rows, use the minimum
       
   834         else if(rows<=0)
       
   835             varietyNumber -= 1;
       
   836 
       
   837         //add the varietyoffset
       
   838         varietyNumber += maxVarietyOffset;
       
   839 
       
   840         // Layout the dialog size
       
   841         dialogLayRect.LayoutRect( mainPaneRect,AknLayoutScalable_Avkon::popup_grid_graphic_window(varietyNumber));
       
   842         }
       
   843     else
       
   844         {
       
   845         dialogLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(), AknLayoutScalable_Avkon::popup_grid_graphic2_window(0));
       
   846         }
       
   847     // Set the retangle for dialog and eventually to CAknCharMap
       
   848     SetRect(dialogLayRect.Rect());
       
   849 
       
   850     // Need to update popup heading's skin IDs to zero to draw background
       
   851 
       
   852     // Offscreen background for picto table.
       
   853     charmapControl->DrawOffscreenBackgroundIfRequired();
       
   854     }
       
   855 
       
   856 // -----------------------------------------------------------------------------
       
   857 // CAknCharMapDialog::HandleControlEventL()
       
   858 //
       
   859 // Handles control events from char map table.
       
   860 // -----------------------------------------------------------------------------
       
   861 //
       
   862 
       
   863 EXPORT_C void CAknCharMapDialog::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType)
       
   864     {
       
   865     // get charmap control
       
   866     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   867 
       
   868     if ( charmapControl)
       
   869         {
       
   870         CAknPopupHeadingPane* headingPane = static_cast< CAknPopupHeadingPane* >( Control( EAknSCTQueryHeadingId ) );
       
   871         if (headingPane)
       
   872             {
       
   873             TRAP_IGNORE(
       
   874                 {
       
   875                 headingPane->SetPageL(charmapControl->CurrentPage(),charmapControl->PageCount() );
       
   876                 } );
       
   877             }
       
   878         if (AknLayoutUtils::PenEnabled())
       
   879             {
       
   880             TRAP_IGNORE(charmapControl->RefreshNaviPageL());
       
   881             }
       
   882         }
       
   883     if ( iExtension && (aControl == charmapControl) && (aEventType == EEventStateChanged) )
       
   884         {
       
   885         TInt status = charmapControl->StatusChanged();
       
   886         if (status == EAknCharSelectedSpecialCharacter)
       
   887             {
       
   888             // Something has been selected from CharMap
       
   889             iExtension->iFlags |= ECharMapDialogItemSelected;
       
   890             }
       
   891         else if (status == EAknCharChangedCategory)
       
   892             {
       
   893             TInt curCategory = charmapControl->CurrentCategory();
       
   894             ChangeCategoryL(curCategory);
       
   895             }
       
   896         else if (status == EAknCharSelectedNextTableButton)
       
   897             {
       
   898             SwitchTablesL();
       
   899             }
       
   900         else if (status == EAknCharSelectedTableExitButton)
       
   901             {
       
   902             TryExitL(EAknSoftkeyExit);
       
   903             }
       
   904         }
       
   905     }
       
   906 
       
   907 // -----------------------------------------------------------------------------
       
   908 // CAknCharMapDialog::HandleDialogPageEventL()
       
   909 //
       
   910 // Handles closing Charmap dialog after selection has been done with stylus.
       
   911 // -----------------------------------------------------------------------------
       
   912 //
       
   913 
       
   914 EXPORT_C void CAknCharMapDialog::HandleDialogPageEventL(TInt aEventID)
       
   915     {
       
   916     if ( iExtension && aEventID == MEikDialogPageObserver::EDialogPageTapped )
       
   917         {
       
   918         if (iExtension->iFlags & ECharMapDialogItemSelected )
       
   919             {
       
   920             iExtension->iFlags = 0;
       
   921             TryExitL(EAknSoftkeyOk);
       
   922             }
       
   923         else if (iExtension->iFlags == ECharMapDialogTableExitSelected)
       
   924             {
       
   925             iExtension->iFlags = 0;
       
   926             TryExitL(EAknSoftkeyExit);
       
   927             }
       
   928         }
       
   929     }
       
   930 
       
   931 EXPORT_C void CAknCharMapDialog::LockNumericKeys(TBool aLockStatus)
       
   932     {
       
   933     if (aLockStatus)
       
   934         {
       
   935         iExtension->iFlags |= ECharMapDialogItemLockNumericKeys;
       
   936         }
       
   937     else
       
   938         {
       
   939         iExtension->iFlags &= (~ECharMapDialogItemLockNumericKeys);
       
   940         }
       
   941     }
       
   942 
       
   943 EXPORT_C void CAknCharMapDialog::DisableRecentCharsRow()
       
   944     {
       
   945     iExtension->iFlags |= ECharMapDialogRecentCharsRowDisabled;
       
   946     }
       
   947 
       
   948 // -----------------------------------------------------------------------------
       
   949 // CAknCharMapDialog::HandlePointerEventL()
       
   950 //
       
   951 // Handles pointer events
       
   952 // -----------------------------------------------------------------------------
       
   953 //
       
   954 EXPORT_C void CAknCharMapDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   955     {
       
   956     if (!Rect().Contains( aPointerEvent.iPosition))
       
   957         {
       
   958         if(aPointerEvent.iType == TPointerEvent::EButton1Down)
       
   959             {
       
   960             TryExitL (EAknSoftkeyCancel);
       
   961             return;
       
   962             }
       
   963          else if(aPointerEvent.iType == TPointerEvent::EButton1Up)
       
   964             {
       
   965             CAknCharMap* charMap = STATIC_CAST( CAknCharMap*, Control( EAknSCTQueryContentId ) );
       
   966             charMap->HandlePointerEventL( aPointerEvent);
       
   967             }
       
   968         }
       
   969     else
       
   970         {
       
   971         CAknDialog::HandlePointerEventL(aPointerEvent);
       
   972         }
       
   973     }
       
   974 
       
   975 void CAknCharMapDialog::SwitchTablesOrPagesL()
       
   976     {
       
   977     if(!SwitchTablesL())
       
   978         {
       
   979         SwitchPagesL();
       
   980         }
       
   981     }
       
   982 
       
   983 TBool CAknCharMapDialog::SwitchTablesL()
       
   984     {
       
   985     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
   986     CAknPopupHeadingPane* headingPane = STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
   987 
       
   988     TBool layoutChanged;
       
   989     if (charmapControl->SwitchTablesL(layoutChanged))
       
   990         {
       
   991         ChangeLayoutL(layoutChanged);
       
   992         SetSoftKeyL(ETrue);
       
   993         return TRUE;
       
   994         }
       
   995     else
       
   996         {
       
   997         return FALSE;
       
   998         }
       
   999     }
       
  1000 
       
  1001 void CAknCharMapDialog::SwitchPagesL()
       
  1002     {
       
  1003     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
  1004     CAknPopupHeadingPane* headingPane = STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
  1005     
       
  1006     charmapControl->NextPageL();
       
  1007     RefreshTitleAndNavi();
       
  1008     }
       
  1009 
       
  1010 void CAknCharMapDialog::RefreshTitleAndNavi()
       
  1011     {
       
  1012     CAknCharMap* charmapControl = STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
  1013     CAknPopupHeadingPane* headingPane = STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
  1014     
       
  1015     if (!AknLayoutUtils::PenEnabled())
       
  1016         {
       
  1017         const TDesC* title = charmapControl->Title();
       
  1018         headingPane->SetPageL(charmapControl->CurrentPage());
       
  1019         if (title != charmapControl->Title())
       
  1020             {
       
  1021             const TDesC* title = charmapControl->IsJapaneseSctUi() ? 
       
  1022                                  charmapControl->TitleWithSelectingSpecialChar() : 
       
  1023                                  charmapControl->Title();
       
  1024             headingPane->SetTextL(*title);
       
  1025             }
       
  1026         }
       
  1027     else
       
  1028         {
       
  1029         charmapControl->RefreshNaviPageL();
       
  1030         }
       
  1031     }
       
  1032 
       
  1033 void CAknCharMapDialog::ChangeCategoryL(const TInt aCategory)
       
  1034     {
       
  1035     TBool layoutChanged;
       
  1036     CAknCharMap* charmapControl =
       
  1037         STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
  1038 
       
  1039     if (charmapControl->ChangeCategoryL( aCategory, layoutChanged ))
       
  1040         {
       
  1041         ChangeLayoutL(layoutChanged);
       
  1042         SetSoftKeyL(ETrue);
       
  1043         }
       
  1044     }
       
  1045 
       
  1046 void CAknCharMapDialog::ChangeLayoutL(const TBool aLayoutChanged)
       
  1047     {
       
  1048     CAknCharMap* charmapControl =
       
  1049         STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
  1050     CAknPopupHeadingPane* headingPane =
       
  1051         STATIC_CAST(CAknPopupHeadingPane*, Control(EAknSCTQueryHeadingId));
       
  1052     const TDesC* title = (charmapControl->IsJapaneseSctUi())?
       
  1053                             charmapControl->TitleWithSelectingSpecialChar()
       
  1054                             : charmapControl->Title();
       
  1055     if ( aLayoutChanged )
       
  1056         {
       
  1057         // This prevents the ugly graphics anomalies while the window
       
  1058         // is resized and repositioned.
       
  1059         Window().SetVisible( EFalse );
       
  1060         if (!AknLayoutUtils::PenEnabled())
       
  1061             {
       
  1062             headingPane->SetTextL(*title);
       
  1063             headingPane->SetPageL(1, charmapControl->PageCount());
       
  1064             }
       
  1065         DoLayout();
       
  1066         DrawNow();
       
  1067         Window().SetVisible( ETrue );
       
  1068         }
       
  1069 
       
  1070     // If the layout is the same, do not set layout again
       
  1071     // as this causes flicker.
       
  1072     else
       
  1073         {
       
  1074          if (!AknLayoutUtils::PenEnabled())
       
  1075             {
       
  1076             headingPane->SetTextL(*title);
       
  1077             headingPane->SetPageL(1, charmapControl->PageCount());
       
  1078             }
       
  1079         else
       
  1080             {
       
  1081             charmapControl->RefreshNaviPageL();
       
  1082             }
       
  1083         // Offscreen background for picto table.
       
  1084         charmapControl->DrawOffscreenBackgroundIfRequired();
       
  1085         DrawNow();
       
  1086         }
       
  1087     }
       
  1088 
       
  1089 void CAknCharMapDialog::SetSoftKeyL(const TBool aDrawNow /*= EFalse*/)
       
  1090     {
       
  1091     CAknCharMap* charmapControl =
       
  1092         STATIC_CAST(CAknCharMap*, Control(EAknSCTQueryContentId));
       
  1093     CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
  1094     TInt labelId(R_AVKON_SOFTKEY_SELECT_TEXT);
       
  1095     TInt id(EAknSoftkeySelect);
       
  1096     if (charmapControl->PageCount() > 1)
       
  1097         {
       
  1098         labelId = R_AVKON_SOFTKEY_NEXT_TEXT;
       
  1099         id = EAknSoftkeyNext;
       
  1100         }
       
  1101     HBufC* label = StringLoader::LoadL(labelId, iCoeEnv);
       
  1102     CleanupStack::PushL(label);
       
  1103     cba.SetCommandL(0, id, label->Des());
       
  1104     CleanupStack::PopAndDestroy(label); // label
       
  1105 
       
  1106     // In Japanese UI, right softkey is "Back".
       
  1107     if (charmapControl->IsJapaneseSctUi())
       
  1108         {
       
  1109         label = StringLoader::LoadL(R_AVKON_SOFTKEY_JAPAN_SCT_BACK, iCoeEnv);
       
  1110         CleanupStack::PushL(label);
       
  1111         cba.SetCommandL(2, EAknSoftkeyClose, label->Des());
       
  1112         CleanupStack::PopAndDestroy(label); // label
       
  1113         }
       
  1114 
       
  1115     // Since MSK is enable from the branch of 3.1, set MSK as Select Key
       
  1116     if (charmapControl->PageCount() > 1 && AknLayoutUtils::MSKEnabled())
       
  1117         {
       
  1118         label = StringLoader::LoadL(R_QTN_MSK_SELECT, iCoeEnv);
       
  1119         CleanupStack::PushL(label);
       
  1120         cba.SetCommandL(3, EAknSoftkeySelect,label->Des());
       
  1121         CleanupStack::PopAndDestroy(label); // label
       
  1122         }
       
  1123 
       
  1124     // Drawing
       
  1125     if (aDrawNow)
       
  1126         {
       
  1127         cba.DrawNow();
       
  1128         }
       
  1129     }
       
  1130 
       
  1131 
       
  1132 //  End of File