fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonImpl.cpp
branchRCL_3
changeset 44 ecbabf52600f
child 56 8152b1f1763a
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2007 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 *       Provides the FEP's Avkon UI access methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include "AknFepUiAvkonImpl.h"
       
    31 #include "AknFepUiAvkonStylusPopUpMenu.h"
       
    32 #include <aknnotedialog.h>          //CAknNoteDialog
       
    33 #include <aknmessagequerydialog.h>  //CAknMessageQueryDialog
       
    34 #include <aknradiobuttonsettingpage.h>
       
    35 #include <aknsettingpage.h>
       
    36 #include <aknlistquerydialog.h>
       
    37 #include <aknedsts.h>               //CAknEdwinState
       
    38 #include <barsread.h>
       
    39 #include <aknfep.rsg>
       
    40 #include "AknFepGlobalEnums.h"
       
    41 #include <aknstyluspopupmenu.h>
       
    42 #include <aknSctDialog.h>           //CAknCharMapDialog
       
    43 #include <akntouchpane.h>
       
    44 #include "AknFepQuery.h"
       
    45 #include <aknedformaccessor.h>
       
    46 #include "AknFepIndicatorAvkon.h"
       
    47 #include <AknFepManagerInterface.h> // MAknFepManagerInterface
       
    48 #include <AknIndicatorContainer.h>  //CAknIndicatorContainer
       
    49 #include "AknFepUIAvkonCtrlContainerChinese.h"
       
    50 #include "AknFepUIAvkonCtrlContainerJapanese.h"
       
    51 #include <AknFepUiInterfacePanic.h>
       
    52 #include "AknFepUIAvkonCtrlJapaneseKutenQueryDialog.h"
       
    53 #include <featmgr.h>
       
    54 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
    55 // Predictive QWERTY (XT9) changes ---->
       
    56 #include <aknappui.h>
       
    57 #include <akntitle.h> //CAknTitlePane
       
    58 #include <StringLoader.h>
       
    59 #include "AknFepAvkonCandidatePopup.h"
       
    60 #include "AknFepUiAvkonCtrlExactWordPopupContent.h"
       
    61 #include "AknFepPredictiveSettingDialog.h"
       
    62 #include "AknFepUserDictionaryEditDialog.h"
       
    63 
       
    64 #ifdef FF_DUAL_LANGUAGE_SUPPORT
       
    65 #include "AknFepUIAvkonCtrlDualLanguageSettingDialog.h"
       
    66 #endif //FF_DUAL_LANGUAGE_SUPPORT
       
    67 // Predictive QWERTY (XT9) changes <----
       
    68 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__    
       
    69 #include <AvkonInternalCRKeys.h> 
       
    70 #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__
       
    71 #endif //RD_INTELLIGENT_TEXT_INPUT
       
    72 
       
    73 GLDEF_C void AknFepUiInterfacePanic(TAknFepUiInterfacePanic aPanic)
       
    74     {
       
    75     User::Panic(_L("AKNFEPUI"),aPanic);
       
    76     }
       
    77 
       
    78 
       
    79 // This command is is used for setting empty CBA.
       
    80 const TInt ENullCommandId = 0;
       
    81 
       
    82 
       
    83 CAknFepUIAvkonImpl* CAknFepUIAvkonImpl::NewL()
       
    84 	{
       
    85 	CAknFepUIAvkonImpl* self = new(ELeave) CAknFepUIAvkonImpl();
       
    86     CleanupStack::PushL(self);
       
    87     self->ConstructL();
       
    88     CleanupStack::Pop(self);
       
    89     return self;	
       
    90 	}
       
    91 
       
    92 void CAknFepUIAvkonImpl::ConstructL()
       
    93     {
       
    94 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
    95 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__   
       
    96     //Attach the P&S property to the keyboardlayout and subscribe to the P&S framework
       
    97     // for any keyboard layout change.
       
    98     User::LeaveIfError(iKeyboardLayoutStatusProperty.Attach(KCRUidAvkon, KAknKeyBoardLayout));    
       
    99     iKeyboardLayoutStatusSubscriber = new (ELeave) CSubscriber(
       
   100                                          TCallBack(HandleKeyboardLayoutChangeNotification, this), 
       
   101                                          iKeyboardLayoutStatusProperty);    
       
   102     iKeyboardLayoutStatusSubscriber->SubscribeL();
       
   103 #endif
       
   104 #endif     
       
   105     }
       
   106 
       
   107 CAknFepUIAvkonImpl::CAknFepUIAvkonImpl()
       
   108 	{
       
   109     iDialog = NULL;
       
   110     iPredictiveSettingDialog = NULL;
       
   111     iListQueryDialog = NULL;
       
   112     iTextQueryDialog = NULL;
       
   113 	}
       
   114 CAknFepUIAvkonImpl::~CAknFepUIAvkonImpl()
       
   115 	{
       
   116     delete iCba;
       
   117     iCba = NULL;
       
   118     DeleteDialogs();
       
   119 
       
   120 #ifdef RD_INTELLIGENT_TEXT_INPUT    
       
   121 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__       
       
   122     if (iKeyboardLayoutStatusSubscriber)
       
   123         {
       
   124         iKeyboardLayoutStatusSubscriber->StopSubscribe();
       
   125         }
       
   126     iKeyboardLayoutStatusProperty.Close();
       
   127     delete iKeyboardLayoutStatusSubscriber;     
       
   128 #endif    
       
   129 #endif   
       
   130 	}
       
   131 
       
   132 void CAknFepUIAvkonImpl::DeleteDialogs()
       
   133     {
       
   134     if(iDialog)
       
   135         {
       
   136         delete iDialog;
       
   137         iDialog = NULL;
       
   138         }
       
   139     if(iCharMapDialog)
       
   140         {
       
   141         delete iCharMapDialog;
       
   142         iCharMapDialog = NULL;
       
   143         }
       
   144     if(iListQueryDialog)
       
   145         {
       
   146         delete iListQueryDialog;
       
   147         iListQueryDialog = NULL;
       
   148         }
       
   149     if(iTextQueryDialog)
       
   150         {
       
   151         delete iTextQueryDialog;
       
   152         iTextQueryDialog = NULL;
       
   153         }
       
   154     if(iPredictiveSettingDialog)
       
   155         {
       
   156         TRAP_IGNORE( iPredictiveSettingDialog->ProcessCommandL(EAknCmdExit));
       
   157         }
       
   158     }
       
   159 
       
   160 void CAknFepUIAvkonImpl::LaunchConfirmationNoteL(TInt aResourceId)
       
   161 	{
       
   162     CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog();
       
   163     dlg->SetTimeout(CAknNoteDialog::EShortTimeout);
       
   164     dlg->SetTone(CAknNoteDialog::ENoTone);
       
   165     dlg->ExecuteLD(aResourceId);
       
   166 	}
       
   167 
       
   168 void CAknFepUIAvkonImpl::LaunchHelpTextQueryL(TInt aResourceId)
       
   169 	{
       
   170     CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog();
       
   171     iDialog = dlg;
       
   172     dlg->ExecuteLD(aResourceId);
       
   173     iDialog = NULL;
       
   174 	}
       
   175 
       
   176 TInt CAknFepUIAvkonImpl::LaunchCangJieOptionDlgL(TInt aResourceId, TInt& aLevel, MDesC16Array* aItems)
       
   177 	{
       
   178     CAknRadioButtonSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage (
       
   179         aResourceId,
       
   180         aLevel,
       
   181         aItems
       
   182         );
       
   183     TBool ret = dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
       
   184 	return ret;
       
   185 	}
       
   186 
       
   187 /* TCleanupSlotBase can be placed on the cleanup stack to cleanup
       
   188  * a CBase derived object, but with the benefit that the CBase
       
   189  * object can be reassigned.
       
   190  * Essesntially it is a reusable cleanup stack slot.
       
   191  * This is useful for situations where you would like to be able
       
   192  * to remove or change an item on the cleanup stack, but do not
       
   193  * know enough about the contents of the cleanup stack above it
       
   194  * to unstack then restack the items that should remain.
       
   195  */
       
   196 class TCleanupSlotCBase
       
   197 	{
       
   198 public:
       
   199 	TCleanupSlotCBase() 
       
   200 		: iObj(NULL) 
       
   201 		{}
       
   202 	TCleanupSlotCBase(CBase* aObj) 
       
   203 		: iObj(aObj) 
       
   204 		{}
       
   205 	void PushL()
       
   206 		{ CleanupStack::PushL(TCleanupItem(Cleanup, this)); }
       
   207 	void Pop()
       
   208 		{ CleanupStack::Pop(); }
       
   209 	void PopAndDestroy()
       
   210 		{ CleanupStack::PopAndDestroy(); }
       
   211 	void SetObj(CBase* aObj)
       
   212 		{ iObj = aObj; }
       
   213 private:
       
   214 	static void Cleanup(TAny* aThis)
       
   215 		{ delete static_cast<CBase*>(static_cast<TCleanupSlotCBase*>(aThis)->iObj); }
       
   216 private:
       
   217 	CBase* iObj;
       
   218 	};
       
   219 	
       
   220 TInt CAknFepUIAvkonImpl::LaunchListPopupL(TInt aResourceId, TInt& aIndex, TInt aInitialIndex, MDesC16Array* aItems, CArrayPtr<CGulIcon>* aIcons)
       
   221 	{
       
   222 	TCleanupSlotCBase iconsCleanup(aIcons);
       
   223 	iconsCleanup.PushL();
       
   224 	
       
   225     iListQueryDialog = new (ELeave) CAknListQueryDialog(&aIndex);
       
   226     iListQueryDialog->PrepareLC( aResourceId );
       
   227     
       
   228     CAknListQueryControl* listQueryControl = 
       
   229         STATIC_CAST( CAknListQueryControl*, iListQueryDialog->Control(EListQueryControl));
       
   230     if (aIcons)
       
   231     	{
       
   232 	    listQueryControl->Listbox()->ItemDrawer()->FormattedCellData()
       
   233 	        ->SetIconArrayL( aIcons );
       
   234 	   	iconsCleanup.SetObj(NULL);	// ownership transferred to dialog
       
   235 	    listQueryControl->Listbox()->ItemDrawer()->FormattedCellData()
       
   236 	        ->SetNotAlwaysDrawnSubCellL( 0, ETrue );// Needed because not using icon in cell.
       
   237     	}
       
   238 
       
   239     // Activate selected language:
       
   240     CTextListBoxModel* model = listQueryControl->Listbox()->Model();
       
   241     model->SetItemTextArray( aItems );
       
   242     model->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   243     iListQueryDialog->ListBox()->SetCurrentItemIndex( aInitialIndex );
       
   244 
       
   245     // Fire up the dialog
       
   246     TInt ret = iListQueryDialog->RunLD();
       
   247     iconsCleanup.Pop();
       
   248     iListQueryDialog = NULL;
       
   249     return ret;
       
   250 	}
       
   251 
       
   252 void CAknFepUIAvkonImpl::UpdateSoftkeysL(TInt aResourceId, CAknEdwinState* aEditorState, MEikCommandObserver* aObserver, TInt aInputMode)
       
   253 	{
       
   254     CEikButtonGroupContainer* currentEditorCba=aEditorState->CbaState().iCurrentCba;
       
   255     if (currentEditorCba /*&& currentEditorCba->IsVisible()*/)
       
   256         {
       
   257 //        currentEditorCba->MakeVisible(ETrue);
       
   258         TBool cbaModified = EFalse;
       
   259 
       
   260         // remove the old command button(s)
       
   261         if (aEditorState->CbaState().iLeftSoftkeyCommandId)
       
   262             {
       
   263             currentEditorCba->RemoveCommandFromStack(ELeftSoftkeyIndex, currentEditorCba->ButtonGroup()->CommandId(ELeftSoftkeyIndex));
       
   264             currentEditorCba->RemoveCommandObserver(ELeftSoftkeyIndex);
       
   265             aEditorState->CbaState().iLeftSoftkeyCommandId=0;
       
   266             cbaModified = ETrue;
       
   267             }
       
   268         if (aEditorState->CbaState().iRightSoftkeyCommandId)
       
   269             {
       
   270             currentEditorCba->RemoveCommandFromStack(ERightSoftkeyIndex, currentEditorCba->ButtonGroup()->CommandId(ERightSoftkeyIndex));
       
   271             currentEditorCba->RemoveCommandObserver(ERightSoftkeyIndex);
       
   272             aEditorState->CbaState().iRightSoftkeyCommandId=0;
       
   273             cbaModified = ETrue;
       
   274             }
       
   275         if (aEditorState->MiddleSoftkeyCommandId())
       
   276             {
       
   277             currentEditorCba->RemoveCommandFromStack(EMiddleSoftkeyIndex, currentEditorCba->ButtonGroup()->CommandId(EMiddleSoftkeyIndex));
       
   278             currentEditorCba->RemoveCommandObserver(EMiddleSoftkeyIndex);
       
   279             aEditorState->SetMiddleSoftkeyCommandId(0);
       
   280             cbaModified = ETrue;
       
   281             }
       
   282 
       
   283         if( aResourceId  == R_AKNFEP_SOFTKEYS_FINGER ||
       
   284             aResourceId  == R_AKNFEP_SOFTKEYS_FINGER_OPTION_PREVIOUS  ||
       
   285             aResourceId  == R_AKNFEP_SOFTKEYS_FINGER_SPELL_PREVIOUS )
       
   286             {
       
   287             ShowOwnsSoftkeysL(aResourceId, aObserver);
       
   288             return;     // return this function
       
   289             }
       
   290         // for Japanese
       
   291         switch (aResourceId)
       
   292             {
       
   293             case R_AKNFEP_SOFTKEYS_PREDICT_OTHER_COMMIT:
       
   294             case R_AKNFEP_SOFTKEYS_EMPTY_EMPTY_COMMIT:
       
   295             case R_AKNFEP_SOFTKEYS_EMPTY_OTHER_COMMIT:
       
   296             case R_AKNFEP_SOFTKEYS_PHRASE_CREATION_SELECT_CANCEL_SELECT:
       
   297             case R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE:
       
   298                 ShowOwnsSoftkeysL(aResourceId, aObserver);
       
   299                 return;     // return this function
       
   300             case R_AKNFEP_SOFTKEYS_CONVERT_OTHER_SELECT:
       
   301             case R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_SELECT:
       
   302             case R_AVKON_SOFTKEYS_EMPTY:
       
   303                 ShowEmptySoftkeysL(ETrue, aObserver, aInputMode);
       
   304                 return;     // return this function
       
   305             default:
       
   306                 // delete iCba object in this function
       
   307                 ShowEmptySoftkeysL(EFalse, aObserver, aInputMode);
       
   308                 break;
       
   309             }
       
   310 
       
   311         // add the new button/command ids
       
   312         if (aResourceId)
       
   313             {
       
   314             TResourceReader reader;
       
   315             CCoeEnv::Static()->CreateResourceReaderLC(reader, aResourceId);
       
   316             reader.ReadInt32();     // flags
       
   317             reader.ReadInt16();     // width
       
   318             reader.ReadInt32();     // related buttons
       
   319             reader.ReadInt16();     // size of buttons array
       
   320 
       
   321             TInt leftSoftkeyShortCommandId=(currentEditorCba->ButtonGroup()->CommandId(ELeftSoftkeyIndex)) & 0x0000ffff;
       
   322 
       
   323             for (TInt index=0; index < currentEditorCba->ButtonCount(); index++)
       
   324                 {
       
   325                 TInt cbaIndex = index;
       
   326                 if ( index >=1 )
       
   327                     {
       
   328                     cbaIndex++;    // skip the scrollbar
       
   329                     }
       
   330 
       
   331                 TUint8 version = (TUint8)reader.ReadUint8();
       
   332                 TInt commandId;
       
   333                 if (version == KAknCbaVersion)
       
   334                     {
       
   335                     TUint32 shortCommandId = reader.ReadUint16();
       
   336                     TUint32 longCommandId = reader.ReadUint16();
       
   337                     commandId = (longCommandId << 16) | shortCommandId;
       
   338                     }
       
   339                 else
       
   340                     {
       
   341                     commandId = TInt(TUint(reader.ReadUint16()));
       
   342                     }
       
   343                 TPtrC text=reader.ReadTPtrC();
       
   344                 reader.ReadTPtrC(); // bmp filename
       
   345                 reader.ReadInt16(); // bmp id
       
   346                 reader.ReadInt16(); // bmp mask id
       
   347 
       
   348                 // check we have a command and also check that if we're changing the
       
   349                 // left softkey that it is 'Options'
       
   350                 if ( commandId )
       
   351                     {
       
   352                     if(!currentEditorCba->UpdatedCommandObserverExists(CEikButtonGroupContainer::TCommandPosition(cbaIndex)))
       
   353                         {
       
   354                         currentEditorCba->UpdateCommandObserverL(cbaIndex, *aObserver);
       
   355                         currentEditorCba->AddCommandToStackL(cbaIndex, commandId, text);
       
   356                         
       
   357                     if (cbaIndex==ELeftSoftkeyIndex)
       
   358                         {
       
   359                         aEditorState->CbaState().iLeftSoftkeyCommandId=commandId;
       
   360                         }
       
   361                     else if (cbaIndex==ERightSoftkeyIndex)
       
   362                         {
       
   363                         aEditorState->CbaState().iRightSoftkeyCommandId=commandId;
       
   364                         }
       
   365                     else if (cbaIndex==EMiddleSoftkeyIndex)
       
   366                         {
       
   367                         aEditorState->SetMiddleSoftkeyCommandId(commandId);
       
   368                         }
       
   369                         }
       
   370 
       
   371                     cbaModified = ETrue;
       
   372                     }
       
   373                 }
       
   374             CleanupStack::PopAndDestroy(); // reader
       
   375             }
       
   376 
       
   377         if (cbaModified)
       
   378             {
       
   379             currentEditorCba->DrawNow(); // to update the cba
       
   380             }
       
   381         }
       
   382 	}
       
   383 
       
   384 /**
       
   385  *  Show cba of aResourceId using owns cba object(iCba)
       
   386  *
       
   387  *  @since 3.2
       
   388  *  @param aResourceId Cba resource id.
       
   389  *  @return None
       
   390  */
       
   391 void CAknFepUIAvkonImpl::ShowOwnsSoftkeysL(const TInt aResourceId, MEikCommandObserver* aObserver)
       
   392     {
       
   393     if (iCba)
       
   394         {
       
   395         DeleteCBAL();
       
   396         }
       
   397     // Create Inside CBA if needed
       
   398     CreateInsideCBAL( CEikButtonGroupContainer::ECba,
       
   399     		          CEikButtonGroupContainer::EHorizontal,
       
   400     		          aObserver,
       
   401     		          aResourceId );
       
   402     
       
   403     if ( iCba == NULL )
       
   404         {
       
   405         iCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba,
       
   406                                                CEikButtonGroupContainer::EHorizontal,
       
   407                                                aObserver,
       
   408                                                aResourceId );
       
   409         iCba->SetBoundingRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
       
   410         iCba->DrawNow();
       
   411         }
       
   412     }
       
   413 
       
   414 /**
       
   415  * This method is that empty CBA is shown in case aShown is ETrue.
       
   416  * If aShown is EFalse, empty CBA is erased.
       
   417  */
       
   418 void CAknFepUIAvkonImpl::ShowEmptySoftkeysL(TBool aShown, MEikCommandObserver* aObserver, TInt aInputMode)
       
   419     {
       
   420     if (aShown)
       
   421         {
       
   422         if (!iCba)
       
   423             {
       
   424             CreateInsideCBAL( CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, aObserver, R_AVKON_SOFTKEYS_EMPTY );
       
   425             if ( iCba == NULL )
       
   426             	{
       
   427                 iCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba, 
       
   428                 		                               CEikButtonGroupContainer::EHorizontal, 
       
   429                 		                               aObserver, R_AVKON_SOFTKEYS_EMPTY );
       
   430                 iCba->SetBoundingRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
       
   431             	}
       
   432             }
       
   433         // set each CBA
       
   434         TBool update = UpdateSoftkeyLabelL(ELeftSoftkeyIndex, ENullCommandId, R_TEXT_SOFTKEY_EMPTY);
       
   435         if (aInputMode == EPinyin || aInputMode == EZhuyin ||
       
   436             aInputMode == EStroke || aInputMode == ECangJie)
       
   437             {
       
   438             update |= UpdateSoftkeyLabelL(ERightSoftkeyIndex, EAknFepSoftkeyCloseWindow, R_AKNFEP_SOFTKEY_CCPU_CANCEL);
       
   439             update |= UpdateSoftkeyLabelL( EMiddleSoftkeyIndex, ENullCommandId, R_AVKON_SOFTKEY_SELECT_TEXT ); 
       
   440             }
       
   441         else
       
   442             {
       
   443             update |= UpdateSoftkeyLabelL(ERightSoftkeyIndex, ENullCommandId, R_TEXT_SOFTKEY_EMPTY);
       
   444             update |= UpdateSoftkeyLabelL(EMiddleSoftkeyIndex, ENullCommandId, R_TEXT_SOFTKEY_EMPTY);
       
   445             }
       
   446 
       
   447         if (update)
       
   448             {
       
   449             iCba->DrawNow();
       
   450             }
       
   451         }
       
   452     else
       
   453         {
       
   454         DeleteCBAL();
       
   455         }
       
   456     }
       
   457 
       
   458 TBool CAknFepUIAvkonImpl::SoftkeysExist()
       
   459 	{
       
   460 	return iCba != NULL;
       
   461 	}
       
   462 
       
   463 TInt CAknFepUIAvkonImpl::SoftkeyCommandId(TInt aPosition)
       
   464 	{
       
   465 	return iCba->ButtonGroup()->CommandId(aPosition);
       
   466 	}
       
   467 
       
   468 void CAknFepUIAvkonImpl::DeleteSoftkeys()
       
   469 	{
       
   470 	TRAP_IGNORE( DeleteCBAL() );
       
   471 	}
       
   472 
       
   473 void CAknFepUIAvkonImpl::DrawSoftkeysNow()
       
   474 	{
       
   475 	iCba->DrawNow();
       
   476 	}
       
   477 
       
   478 void CAknFepUIAvkonImpl::CreateSoftkeys(TInt aResourceId, MEikCommandObserver* aObserver)
       
   479 	{
       
   480 	DeleteSoftkeys();
       
   481 	TRAP_IGNORE(CreateInsideCBAL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, aObserver, aResourceId));
       
   482 	if ( iCba == NULL)
       
   483 		{
       
   484         TRAP_IGNORE(iCba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, aObserver, aResourceId));
       
   485         iCba->SetBoundingRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
       
   486 		}
       
   487     iCba->MakeVisible(ETrue);
       
   488     iCba->ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront + 10);
       
   489 	}
       
   490 
       
   491 TBool CAknFepUIAvkonImpl::UpdateSoftkeyLabelL(TInt aPosition, TInt aCommandId, TInt aTextResId)
       
   492 	{
       
   493     if (iCba->ButtonGroup()->CommandId(aPosition) != aCommandId)
       
   494         {
       
   495         HBufC* buf = CEikonEnv::Static()->AllocReadResourceLC(aTextResId);
       
   496         if( buf->Des().Length() > 1 && EMiddleSoftkeyIndex != aPosition )
       
   497             {
       
   498             iCba->SetCommandL(aPosition, aCommandId, buf->Des().Mid(1));  
       
   499             CEikCba *eikcba = static_cast<CEikCba*>( iCba->ButtonGroup() );
       
   500             eikcba->EnableItemSpecificSoftkey( EFalse );                             
       
   501             }
       
   502         else
       
   503             {           
       
   504             iCba->SetCommandL(aPosition, aCommandId, *buf);
       
   505             }
       
   506         CleanupStack::PopAndDestroy(buf);
       
   507         return ETrue;
       
   508         }
       
   509     return EFalse;
       
   510 	}
       
   511 
       
   512 void CAknFepUIAvkonImpl::SetFepMenuObserver(MAknFepUiInterfaceMenuObserver* aObserver)
       
   513 	{
       
   514 	iFepMenuObserver = aObserver;
       
   515 	if (aObserver)
       
   516 		{	
       
   517 		CAknEnv::Static()->SetFepMenuObserver(this);
       
   518 		}
       
   519 	else
       
   520 		{	
       
   521 		CAknEnv::Static()->SetFepMenuObserver(NULL);
       
   522 		}
       
   523 	}
       
   524 
       
   525 CAknFepUiInterfaceMenuBar* CAknFepUIAvkonImpl::EditorStateMenuBar(CAknEdwinState* aEditorState)
       
   526 	{
       
   527 	iEditorMenuBar.iMenuBar = aEditorState->MenuBar();
       
   528 	return &iEditorMenuBar;
       
   529 	}
       
   530 
       
   531 void CAknFepUIAvkonImpl::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
       
   532 	{
       
   533 	iTempMenuPane.iMenuPane = aMenuPane;
       
   534 	if (iFepMenuObserver)
       
   535 		iFepMenuObserver->DynInitMenuPaneL(aResourceId, &iTempMenuPane);
       
   536 	}
       
   537 
       
   538 void CAknFepUIAvkonImpl::DynInitMenuBarL(TInt aResourceId,CEikMenuBar* aMenuBar)
       
   539 	{
       
   540 	CAknFepUIAvkonMenuBarImpl* impl = &iTempMenuBar;
       
   541 	if (iEditorMenuBar.iMenuBar == aMenuBar)
       
   542 		impl = &iEditorMenuBar;
       
   543 	impl->iMenuBar = aMenuBar;
       
   544 	if (iFepMenuObserver)
       
   545 		iFepMenuObserver->DynInitMenuBarL(aResourceId, impl);
       
   546 	}
       
   547 
       
   548 void CAknFepUIAvkonImpl::SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis)
       
   549 	{
       
   550 	CBase* impl = NULL;
       
   551 	if (aMenuControl == iEditorMenuBar.iMenuBar)
       
   552 		impl = &iEditorMenuBar;
       
   553 	else if (aMenuControl == iTempMenuBar.iMenuBar)
       
   554 		impl = &iTempMenuBar;
       
   555 	else if (aMenuControl == iTempMenuPane.iMenuPane)
       
   556 		impl = &iTempMenuPane;
       
   557 	if (iFepMenuObserver)
       
   558 		iFepMenuObserver->SetEmphasis(impl, aEmphasis);
       
   559 	}
       
   560 
       
   561 void CAknFepUIAvkonImpl::ProcessCommandL(TInt aCommandId)
       
   562 	{
       
   563 	if (iFepMenuObserver)
       
   564 		iFepMenuObserver->ProcessCommandL(aCommandId);
       
   565 	}
       
   566 
       
   567 CAknFepUiInterfaceMenuBar* CAknFepUIAvkonImpl::NewMenuBarL(MAknFepUiInterfaceMenuObserver* aObserver, TInt aHotKeyResourceId, TInt aMenuTitleResourceId)
       
   568 	{
       
   569 	CAknFepUIAvkonMenuBarOwningImpl* menuBar = new(ELeave) CAknFepUIAvkonMenuBarOwningImpl;
       
   570 	CleanupStack::PushL(menuBar);
       
   571 	menuBar->ConstructL(aObserver, aHotKeyResourceId, aMenuTitleResourceId);
       
   572 	CleanupStack::Pop(menuBar);
       
   573 	return menuBar;
       
   574 	}
       
   575 
       
   576 CAknFepUiInterfaceStylusPopUpMenu* CAknFepUIAvkonImpl::NewStylusPopUpMenuL(MAknFepUiInterfaceMenuObserver* aObserver, const TPoint& aPoint)
       
   577 	{
       
   578 	CAknFepUIAvkonStylusPopUpMenu* popupMenu = new(ELeave) CAknFepUIAvkonStylusPopUpMenu;
       
   579 	CleanupStack::PushL(popupMenu);
       
   580 	popupMenu->ConstructL(aObserver, aPoint);
       
   581 	CleanupStack::Pop(popupMenu);
       
   582 	return popupMenu;
       
   583 	}
       
   584 
       
   585 TInt CAknFepUIAvkonImpl::CharMapDialogL(TInt aCharCase, TDes& aSpecialChars, TInt aCharSetResourceId, TBool aLockNumericKeys, TBool aShowPictographsFirst, TBool aShowNoPictographs, TBool aShowAnotherTable, TInt aAfterSctChars, TInt aResId, TBool aDisableRecentItemRow )
       
   586 	{
       
   587 	TInt result;
       
   588 	
       
   589 	iCharMapDialog = new(ELeave) CAknCharMapDialog(aCharCase, aSpecialChars, aCharSetResourceId);
       
   590 
       
   591     if (aLockNumericKeys)
       
   592         {
       
   593         iCharMapDialog->LockNumericKeys(ETrue);
       
   594         }
       
   595 
       
   596     if ( aShowPictographsFirst )
       
   597         {
       
   598         // It is supposed that the pictograph table launch is allowed in this case.
       
   599         iCharMapDialog->ShowPictographsFirst();
       
   600         }
       
   601     else if (aShowNoPictographs)
       
   602         {
       
   603         // Pictograph table is not shown.
       
   604         iCharMapDialog->ShowNoPictographs();
       
   605         }
       
   606 
       
   607     if (aShowAnotherTable)
       
   608         {
       
   609         iCharMapDialog->ShowAnotherTable(aAfterSctChars);
       
   610         }
       
   611     if(aDisableRecentItemRow)
       
   612         {
       
   613         iCharMapDialog->DisableRecentCharsRow();
       
   614         }
       
   615     
       
   616 
       
   617     result = iCharMapDialog->ExecuteLD(aResId);
       
   618     iCharMapDialog = NULL;
       
   619     return result;
       
   620 	}
       
   621 
       
   622 void CAknFepUIAvkonImpl::TouchPaneSetFepPenSupportInterface(MAknFepPenSupportInterface* aFepPenSupportInterface)
       
   623 	{
       
   624 	if(iAvkonAppUi->TouchPane())
       
   625 		iAvkonAppUi->TouchPane()->SetFepPenSupportInterface(aFepPenSupportInterface);
       
   626 	}
       
   627 
       
   628 void CAknFepUIAvkonImpl::TouchPaneAllowInputMethodActivation(TBool aValue)
       
   629 	{
       
   630 	if(iAvkonAppUi->TouchPane())
       
   631 		iAvkonAppUi->TouchPane()->AllowInputMethodActivation(aValue);
       
   632 	}
       
   633 
       
   634 void CAknFepUIAvkonImpl::TouchPaneRefreshL()
       
   635 	{
       
   636 	if(iAvkonAppUi->TouchPane())
       
   637 		iAvkonAppUi->TouchPane()->RefreshL();
       
   638 	}
       
   639 
       
   640 void CAknFepUIAvkonImpl::TouchPaneSetInputMethodIconActivated(TBool aActivated)
       
   641 	{
       
   642 	if(iAvkonAppUi->TouchPane())
       
   643 		iAvkonAppUi->TouchPane()->SetInputMethodIconActivated(aActivated);
       
   644 	}
       
   645 
       
   646 TInt CAknFepUIAvkonImpl::TextQueryDialogL(TDes& aDataText, CAknEdwinState& aEditorState, TInt aEditorFlag, TInt aResId)
       
   647 	{
       
   648 	TInt result;
       
   649     iTextQueryDialog = new (ELeave) CAknFepTextQueryDialog(aDataText, aEditorState, CAknFepTextQueryDialog::ENoTone, aEditorFlag);
       
   650     iTextQueryDialog->PrepareLC(aResId);
       
   651 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   652     //last char space has to be reserved for null terminator
       
   653     iTextQueryDialog->SetMaxLength( KMaxUDBLength - 1 );
       
   654 #endif //RD_INTELLIGENT_TEXT_INPUT
       
   655     result = iTextQueryDialog->RunLD();
       
   656     iTextQueryDialog = NULL;
       
   657     return result;
       
   658 	}
       
   659 
       
   660 CPlainText* CAknFepUIAvkonImpl::PlainText(CAknEdwinState* aEditorState)
       
   661 	{
       
   662     CEikEdwin* editor = NULL;
       
   663     if (aEditorState)
       
   664         {
       
   665         CAknEdwinFormAccessor* formAccessor = aEditorState->FormAccessor();
       
   666         if (formAccessor)
       
   667             {
       
   668             editor = (CEikEdwin*)formAccessor->FormClientControl();
       
   669             if (editor)
       
   670                 {
       
   671                 return editor->Text();                
       
   672                 }
       
   673             }
       
   674         }
       
   675     return NULL;
       
   676 	}
       
   677 
       
   678 void CAknFepUIAvkonImpl::UpdateEditorContext(MAknEditingStateIndicator& aIndicator, MAknFepManagerInterface& aManager)
       
   679 	{
       
   680     CAknIndicatorContainer* indicatorContainer = aIndicator.IndicatorContainer();
       
   681 
       
   682     if(indicatorContainer)
       
   683         {
       
   684         TInt indicatorContext = indicatorContainer->IndicatorContext();
       
   685         aManager.SetEditorContext(indicatorContext);
       
   686         }
       
   687 	}
       
   688 
       
   689 CAknFepIndicator* CAknFepUIAvkonImpl::NewIndicatorL()
       
   690 	{
       
   691     return CAknFepIndicatorAvkon::NewL();
       
   692 	}
       
   693 
       
   694 TBool CAknFepUIAvkonImpl::IsDisplayDataQuery(TBool aIsFepAwareTextEditor)
       
   695 	{
       
   696     CEikAppUi* eikAppUi = (CEikAppUi *)CCoeEnv::Static()->AppUi();
       
   697     
       
   698     if( eikAppUi->IsDisplayingDialog() && eikAppUi->TopFocusedControl() )
       
   699         {
       
   700         CEikDialog* dlg = eikAppUi->TopFocusedControl()->MopGetObject( dlg );
       
   701         
       
   702         if ( dlg )
       
   703             {
       
   704             TInt flag = dlg->DialogFlags();
       
   705 
       
   706             if(!(flag & EEikDialogFlagFillScreen) &&
       
   707                !(flag & EEikDialogFlagFillAppClientRect) )
       
   708                 {
       
   709                 MObjectProvider* objectProvider = NULL;
       
   710 				MCoeFepAwareTextEditor* editor;
       
   711 			    MCoeFepAwareTextEditor_Extension1* ext1;
       
   712     			CAknEdwinState* state;
       
   713                 CCoeEnv* coeEnv = CCoeEnv::Static();
       
   714                 TCoeInputCapabilities inputCapabilities = 
       
   715                     static_cast<const CCoeAppUi*>(coeEnv->AppUi())->InputCapabilities();
       
   716 
       
   717     			if ( aIsFepAwareTextEditor &&
       
   718          			( editor = inputCapabilities.FepAwareTextEditor() ) != NULL &&       
       
   719          		    ( ext1 = editor->Extension1() ) != NULL &&
       
   720 				    ( state = (CAknEdwinState*)ext1->State( KNullUid ) ) != NULL )
       
   721         			{
       
   722         			objectProvider = state->ObjectProvider();
       
   723         			}
       
   724 
       
   725     			// If not found, try to get object provider from input capabilities.
       
   726     			// It is set there with CEikMfne-derived editors.
       
   727 
       
   728     			if ( !objectProvider )
       
   729         			{
       
   730         			objectProvider = inputCapabilities.ObjectProvider();
       
   731         			}
       
   732 
       
   733 			    if ( objectProvider )
       
   734         			{
       
   735         			CAknQueryControl* ctrl = objectProvider->MopGetObject( ctrl );
       
   736         		
       
   737         			if ( ctrl )
       
   738         				{
       
   739         				return ETrue;
       
   740         				}
       
   741         			}
       
   742         		}
       
   743             }
       
   744         }
       
   745          
       
   746     return EFalse;
       
   747 	}
       
   748 
       
   749 CAknFepUiInterfaceMenuBar* CAknFepUIAvkonImpl::ObjectProviderMenuBar(MObjectProvider* aObjectProvider)
       
   750 	{
       
   751 	if (!aObjectProvider)
       
   752 		return NULL;
       
   753 	CEikMenuBar* menu;
       
   754 	aObjectProvider->MopGetObject(menu);
       
   755 	if (menu)
       
   756 		{
       
   757 		iObjectProviderMenuBar.iMenuBar = menu;
       
   758 		return &iObjectProviderMenuBar;
       
   759 		}
       
   760 	else
       
   761 		return NULL;
       
   762 	}
       
   763 
       
   764 MAknFepUICtrlContainerChinese* CAknFepUIAvkonImpl::NewAknFepUICtrlContainerChineseL()
       
   765 	{
       
   766     if (FeatureManager::FeatureSupported(KFeatureIdChinese))
       
   767         {
       
   768         return CAknFepUICtrlContainerChinese::NewL();
       
   769         }
       
   770 
       
   771     User::Leave(KErrNotSupported);
       
   772 	return NULL;
       
   773 	}
       
   774 
       
   775 MAknFepUICtrlContainerJapanese* CAknFepUIAvkonImpl::NewAknFepUICtrlContainerJapaneseL(CAknFepUIManagerJapanese* aUiMng)
       
   776 	{
       
   777     if (FeatureManager::FeatureSupported(KFeatureIdJapanese))
       
   778         {
       
   779         return CAknFepUICtrlContainerJapanese::NewL(aUiMng);
       
   780         }
       
   781     return NULL;
       
   782 	}
       
   783 
       
   784 void CAknFepUIAvkonImpl::JapaneseKutenQueryDialogL(TInt aResId, TInt& aCharCode, TInt aTone)
       
   785 	{
       
   786     if (FeatureManager::FeatureSupported(KFeatureIdJapanese))
       
   787         {
       
   788         CAknFepUICtrlJapaneseKutenQueryDialog* query = CAknFepUICtrlJapaneseKutenQueryDialog::NewL(aCharCode, (CAknQueryDialog::TTone)aTone);
       
   789         iDialog = query;
       
   790         query->ExecuteLD(aResId);
       
   791         iDialog = NULL;
       
   792         }
       
   793 	}
       
   794 
       
   795 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   796 // Predictive QWERTY (XT9) changes ---->
       
   797 MAknFepCandidatePopup* CAknFepUIAvkonImpl::NewCandidatePopupL(MAknFepCandidatePopupCallback& aOwner)
       
   798 	{
       
   799 	MAknFepCandidatePopup* candidatePopup = CAknFepAvkonCandidatePopup::NewL(aOwner);
       
   800 	return candidatePopup;
       
   801 	}
       
   802 
       
   803 MAknFepUiWordPopupContent* CAknFepUIAvkonImpl::CreateWordPopupContentL()
       
   804 	{
       
   805 	return CAknFepExactWordPopupContent::NewL();	
       
   806 	}
       
   807 	
       
   808 void CAknFepUIAvkonImpl::LaunchPredictiveSettingDialogL(TInt aDialogResId, 
       
   809 														TInt aMenuResId, 
       
   810 														TInt aConfirmationQueryResId,
       
   811 														TInt aTitlePaneResId)
       
   812 	{
       
   813 	iPredictiveSettingDialog = CAknFepPredictiveSettingDialog::NewL(aMenuResId, aConfirmationQueryResId, aTitlePaneResId);
       
   814 	iPredictiveSettingDialog->ExecuteLD(aDialogResId);
       
   815 	iPredictiveSettingDialog = NULL;
       
   816 	}
       
   817 
       
   818 #ifdef __USER_DICTIONARY_EDITING__
       
   819 void CAknFepUIAvkonImpl::LaunchUserDictEditDialogL()
       
   820     {
       
   821     CAknFepUserDictionaryEditDialog::RunDlgLD();
       
   822     }
       
   823 #endif //__USER_DICTIONARY_EDITING__
       
   824 
       
   825 #ifdef FF_DUAL_LANGUAGE_SUPPORT
       
   826 void CAknFepUIAvkonImpl::LaunchWritingLanguageSettingDialogL(TInt aDialogResId, TInt aMenuResId, TInt aTitlePaneResId)
       
   827     {    
       
   828     CCoeEnv* coeEnv = CCoeEnv::Static();
       
   829 	CAknAppUi* appUi = static_cast<CAknAppUi*>(coeEnv->AppUi());
       
   830     CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( appUi->StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
   831     
       
   832     const TDesC* appTitle = titlePane->Text();
       
   833 	HBufC* oldTitle = appTitle->AllocL();
       
   834 	CleanupStack::PushL(oldTitle);
       
   835 	HBufC* title = StringLoader::LoadLC( aTitlePaneResId,coeEnv);
       
   836     titlePane->SetTextL( *title );
       
   837     CleanupStack::PopAndDestroy(title);
       
   838     
       
   839     CAknFepDualLanguageSettingDialog* dlg = CAknFepDualLanguageSettingDialog::NewL(aMenuResId);            
       
   840     iDialog = dlg;
       
   841     dlg->ExecuteLD(aDialogResId);
       
   842     iDialog = NULL;
       
   843     
       
   844     titlePane->SetTextL( *oldTitle );
       
   845     CleanupStack::PopAndDestroy(oldTitle);
       
   846     }
       
   847 #endif //FF_DUAL_LANGUAGE_SUPPORT
       
   848 // Predictive QWERTY (XT9) changes <----	
       
   849 
       
   850 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__
       
   851 TInt CAknFepUIAvkonImpl::HandleKeyboardLayoutChangeNotification(TAny* aObj)
       
   852     {
       
   853     if (aObj)
       
   854         {
       
   855         static_cast<CAknFepUIAvkonImpl*>(aObj)->HandleKeyboardLayoutChange();
       
   856         return KErrNone;
       
   857         }
       
   858     else
       
   859         {
       
   860         return KErrArgument;
       
   861         }
       
   862     }
       
   863 
       
   864 void CAknFepUIAvkonImpl::HandleKeyboardLayoutChange()
       
   865     {
       
   866     if(iPredictiveSettingDialog)
       
   867         {
       
   868         iPredictiveSettingDialog->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
   869         }
       
   870     }
       
   871 
       
   872 CAknFepUIAvkonImpl::CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty)
       
   873     :
       
   874     CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty)
       
   875     {
       
   876     CActiveScheduler::Add(this);
       
   877     }
       
   878 
       
   879 CAknFepUIAvkonImpl::CSubscriber::~CSubscriber()
       
   880     {
       
   881     Cancel();
       
   882     }
       
   883 
       
   884 void CAknFepUIAvkonImpl::CSubscriber::SubscribeL()
       
   885     {
       
   886     if (!IsActive())
       
   887         {
       
   888         iProperty.Subscribe(iStatus);
       
   889         SetActive();
       
   890         }
       
   891     }
       
   892 
       
   893 void CAknFepUIAvkonImpl::CSubscriber::StopSubscribe()
       
   894     {
       
   895     Cancel();
       
   896     }
       
   897 
       
   898 void CAknFepUIAvkonImpl::CSubscriber::RunL()
       
   899     {
       
   900     if (iStatus.Int() == KErrNone)
       
   901         {
       
   902         iCallBack.CallBack();
       
   903         SubscribeL();
       
   904         }
       
   905     }
       
   906 
       
   907 void CAknFepUIAvkonImpl::CSubscriber::DoCancel()
       
   908     {
       
   909     iProperty.Cancel();
       
   910     }
       
   911     
       
   912 #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__
       
   913 #endif //RD_INTELLIGENT_TEXT_INPUT
       
   914 
       
   915 void CAknFepUIAvkonImpl::DeleteCBAL()
       
   916 	{
       
   917 	if ( iCba )
       
   918 	    {
       
   919 	    delete iCba;
       
   920 	    iCba = NULL;
       
   921 	    }
       
   922 	
       
   923 	if ( isCbaEmded )
       
   924 		{
       
   925 		CEikAppUi* eikAppUi = (CEikAppUi *)CCoeEnv::Static()->AppUi();
       
   926 		if( eikAppUi!= NULL && eikAppUi->IsDisplayingDialog() && eikAppUi->TopFocusedControl() )
       
   927 		    {
       
   928 		    CEikDialog* dlg = eikAppUi->TopFocusedControl()->MopGetObject( dlg );
       
   929 		    if ( dlg )
       
   930 		        {
       
   931 		        CEikButtonGroupContainer* currentCba = dlg->MopGetObject( currentCba );
       
   932 	        	//CEikCba* dlgcba = static_cast<CEikCba*>( currentCba->ButtonGroup());
       
   933 	        	if ( currentCba && iDialogCba == currentCba )
       
   934 		            {
       
   935 		            currentCba->RemoveCommandFromStack( ELeftSoftkeyIndex, -1 );
       
   936 		            currentCba->RemoveCommandFromStack( ERightSoftkeyIndex, -1 );
       
   937 
       
   938 		            currentCba->DrawNow();
       
   939 		            currentCba->ActivateL();
       
   940 		            iDialogCba = NULL;
       
   941                     isCbaEmded = EFalse;
       
   942 		            }
       
   943 		        }
       
   944 		    }
       
   945 	    }
       
   946 	}
       
   947 
       
   948 void CAknFepUIAvkonImpl::CreateInsideCBAL( CEikButtonGroupContainer::TUse aUse,
       
   949 		                                   CEikButtonGroupContainer::TOrientation aOrientation,
       
   950                                            MEikCommandObserver* aCommandObserver,
       
   951                                            TInt aResourceId )
       
   952 	{
       
   953 	CEikAppUi* eikAppUi = (CEikAppUi *)CCoeEnv::Static()->AppUi();
       
   954 	// If current is dialog create inside CBA
       
   955 	if ( eikAppUi!= NULL && eikAppUi->IsDisplayingDialog() && eikAppUi->TopFocusedControl())
       
   956 		{
       
   957 		CEikDialog* dlg = eikAppUi->TopFocusedControl()->MopGetObject( dlg );
       
   958 		if ( dlg && CbaEmbeddedInDialog( dlg->DialogFlags()))
       
   959 		    {
       
   960 			CEikButtonGroupContainer* currentCba = dlg->MopGetObject( currentCba );
       
   961 			//CEikCba* dlgcba = static_cast<CEikCba*>( currentCba->ButtonGroup());
       
   962 			if ( currentCba )
       
   963 				{
       
   964 				TUint flags( 0 );
       
   965 				flags |= CEikButtonGroupContainer::EIsEmbedded | CEikButtonGroupContainer::EAddToStack;
       
   966 				if ( iCba != NULL )
       
   967 					{
       
   968 					delete iCba;
       
   969 					iCba = NULL;
       
   970 					}
       
   971 				iCba = CEikButtonGroupContainer::NewL( aUse, aOrientation, 
       
   972 						                               aCommandObserver, 
       
   973 						                               aResourceId, flags );
       
   974 				
       
   975 				CEikCba* cba = static_cast<CEikCba*>( iCba->ButtonGroup());
       
   976 				
       
   977 				//CEikCba* dlgcba = static_cast<CEikCba*>( currentCba->ButtonGroup());
       
   978 				if( !isCbaEmded )
       
   979 					{
       
   980 					currentCba->AddCommandToStackL( ELeftSoftkeyIndex, -1, _L(""), NULL, NULL );
       
   981 					currentCba->AddCommandToStackL( ERightSoftkeyIndex, -1, _L(""), NULL, NULL );
       
   982 					currentCba->ActivateL();
       
   983 					currentCba->DrawNow();
       
   984 					iDialogCba = currentCba;
       
   985 					isCbaEmded = ETrue;
       
   986 					}
       
   987 			
       
   988 				cba->SetButtonGroupFlags( ~( EEikCbaFlagTransparent | EEikCbaFlagOutlineFont ));
       
   989 				TRect dlgRect( dlg->Rect());
       
   990 				TRect cbaRect( currentCba->Rect());
       
   991 				iCba->SetRect( currentCba->Rect());
       
   992 				iCba->SetPosition( 
       
   993 						TPoint( dlg->DrawableWindow()->Position().iX,dlg->DrawableWindow()->Position().iY + dlgRect.Height() - cbaRect.Height()));
       
   994 				iCba->SetBoundingRect( dlg->Rect());
       
   995 			    }
       
   996 		    }
       
   997 		}
       
   998 	}
       
   999 
       
  1000 TBool CAknFepUIAvkonImpl::CbaEmbeddedInDialog( const TInt& aFlags )
       
  1001     {
       
  1002     return AknLayoutUtils::PenEnabled() && 
       
  1003         !( aFlags & EEikDialogFlagFillAppClientRect ) &&
       
  1004         !( aFlags & EEikDialogFlagFillScreen ) &&
       
  1005         !( aFlags & EEikDialogFlagVirtualInput );
       
  1006     }
       
  1007 //End of File