omads/omadsappui/AspSyncUtil/src/AspProfileWizardDialog.cpp
changeset 0 dab8a81a92de
child 1 95fdac6ccb5c
equal deleted inserted replaced
-1:000000000000 0:dab8a81a92de
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <txtfrmat.h>
       
    21 #include <txtfmlyr.h>
       
    22 #include <gdi.h>
       
    23 // BackGround Context
       
    24 #include <AknsBasicBackgroundControlContext.h>
       
    25 
       
    26 #include "AspProfileWizardDialog.h"
       
    27 #include "AspUtil.h"
       
    28 #include "AspDialogUtil.h"
       
    29 #include "AspDebug.h"
       
    30 #include "AspSyncUtil.rh"
       
    31 
       
    32 #include <textresolver.h>
       
    33 #include <eikrted.h>  // CEikRichTextEditor
       
    34 
       
    35 
       
    36 // ============================ MEMBER FUNCTIONS ===============================
       
    37 
       
    38 
       
    39 /*******************************************************************************
       
    40  * class CAspTextSettingPage
       
    41  *******************************************************************************/
       
    42 
       
    43 
       
    44 //------------------------------------------------------------------------------
       
    45 // CAspTextSettingPage::CAspTextSettingPage
       
    46 // 
       
    47 //------------------------------------------------------------------------------
       
    48 //
       
    49 CAspTextSettingPage::CAspTextSettingPage(TInt aResourceID, TDes& aText,
       
    50                      TInt aTextSettingPageFlags, TAspSettingPageParam& aParam)
       
    51  : CAknTextSettingPage(aResourceID, aText, aTextSettingPageFlags), iParam(aParam)
       
    52 	{
       
    53 	}
       
    54 
       
    55 
       
    56 //------------------------------------------------------------------------------
       
    57 // Destructor
       
    58 // 
       
    59 //------------------------------------------------------------------------------
       
    60 //
       
    61 CAspTextSettingPage::~CAspTextSettingPage()
       
    62 	{
       
    63 	delete iIndicatorHandler;
       
    64 	}
       
    65 
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CAspTextSettingPage::OKToExitL
       
    69 // 
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 TBool CAspTextSettingPage::OkToExitL(TInt aButtonId)
       
    73 	{
       
    74 	 // command id set in ProcessCommandL
       
    75 	if (iParam.iCommandId == EAknSoftkeyOk || iParam.iCommandId == EEikBidSelect)
       
    76 		{
       
    77 		if (iParam.iObserver)
       
    78 			{
       
    79 			CEikEdwin* edwin = TextControl();
       
    80 			HBufC* hBuf = NULL;
       
    81 			TInt len = edwin->TextLength();
       
    82 			if (len == 0)
       
    83 				{
       
    84 				hBuf = HBufC::NewL(0);
       
    85 				}
       
    86 			else
       
    87 				{
       
    88 				hBuf = edwin->GetTextInHBufL();
       
    89 				}
       
    90 				
       
    91 			TBool ret = iParam.iObserver->CheckValidity(hBuf->Des(),
       
    92 			                                            iParam.iSettingType);
       
    93 			
       
    94 			delete hBuf;
       
    95 			return ret;
       
    96 			}
       
    97 		}
       
    98 
       
    99 	return  CAknTextSettingPage::OkToExitL(aButtonId);
       
   100 	}
       
   101 
       
   102 
       
   103 //------------------------------------------------------------------------------
       
   104 // CAspTextSettingPage::ProcessCommandL
       
   105 // 
       
   106 //------------------------------------------------------------------------------
       
   107 //
       
   108 void CAspTextSettingPage::ProcessCommandL(TInt aCommandId)
       
   109 	{
       
   110     iParam.iCommandId = aCommandId; // return command id to caller
       
   111     
       
   112     CAknTextSettingPage::ProcessCommandL(aCommandId);
       
   113 	}
       
   114 
       
   115 
       
   116 // ----------------------------------------------------------------------------
       
   117 // CIMSSettingsWizardEditTextPage::PostDisplayCheckL
       
   118 //
       
   119 // ----------------------------------------------------------------------------
       
   120 //
       
   121 TBool CAspTextSettingPage::PostDisplayCheckL()
       
   122     {
       
   123     // Set the text to navipane
       
   124     UpdateNaviPaneL();
       
   125 
       
   126     return ETrue;
       
   127     }
       
   128     
       
   129 // ----------------------------------------------------------------------------
       
   130 // CIMSSettingsWizardEditTextPage::UpdateIndicatorL
       
   131 //
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 void CAspTextSettingPage::UpdateNaviPaneL()
       
   135     {
       
   136     if (!iIndicatorHandler)
       
   137     	{
       
   138     	iIndicatorHandler = new (ELeave) CAspIndicatorHandler(
       
   139     	                                 iAvkonEnv->EditingStateIndicator());
       
   140     	}
       
   141     	
       
   142     iIndicatorHandler->SetIndicatorStateL(
       
   143               EAknNaviPaneEditorIndicatorMessageLength, iParam.iPageText);
       
   144     }
       
   145     
       
   146 
       
   147 // ----------------------------------------------------------------------------
       
   148 // CAspTextSettingPage::OfferKeyEventL
       
   149 //
       
   150 // ----------------------------------------------------------------------------
       
   151 //
       
   152 TKeyResponse CAspTextSettingPage::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
   153                                                  TEventCode aType)
       
   154     {
       
   155     if(EKeyEnter == aKeyEvent.iCode)
       
   156     {
       
   157     	ProcessCommandL(EAknSoftkeyOk);
       
   158     	return EKeyWasConsumed;
       
   159     }
       
   160     if (aType == EEventKeyDown && iParam.iObserver)
       
   161         {
       
   162        	iParam.iObserver->HandleEditorEvent(
       
   163        	                  MAspEditorPageObserver::EKeyEvent, 0);
       
   164         }
       
   165         
       
   166     return CAknTextSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
   167     }
       
   168 
       
   169 
       
   170 
       
   171 /*******************************************************************************
       
   172  * class CAspRadioButtonSettingPage
       
   173  *******************************************************************************/
       
   174 
       
   175 
       
   176 //------------------------------------------------------------------------------
       
   177 // CAspRadioButtonSettingPage::CAspRadioButtonSettingPage
       
   178 // 
       
   179 //------------------------------------------------------------------------------
       
   180 //
       
   181 CAspRadioButtonSettingPage::CAspRadioButtonSettingPage(TInt aResourceID,
       
   182                             TInt& aCurrentSelectionIndex,
       
   183                             const MDesCArray* aItemArray,
       
   184                             TAspSettingPageParam& aParam)
       
   185                             
       
   186  : CAknRadioButtonSettingPage(aResourceID, aCurrentSelectionIndex, aItemArray),
       
   187    iParam(aParam)
       
   188 	{
       
   189 	iItemArray = aItemArray;
       
   190 	}
       
   191 
       
   192 
       
   193 //------------------------------------------------------------------------------
       
   194 // Destructor
       
   195 // 
       
   196 //------------------------------------------------------------------------------
       
   197 //
       
   198 CAspRadioButtonSettingPage::~CAspRadioButtonSettingPage()
       
   199 	{
       
   200 	delete iNaviPaneHandler;
       
   201 	}
       
   202 
       
   203 
       
   204 //------------------------------------------------------------------------------
       
   205 // CAspRadioButtonSettingPage::ProcessCommandL
       
   206 //------------------------------------------------------------------------------
       
   207 //
       
   208 void CAspRadioButtonSettingPage::ProcessCommandL(TInt aCommandId)
       
   209 	{
       
   210     if (aCommandId == EAknSoftkeyOk || aCommandId == EEikBidSelect)
       
   211     	{
       
   212     	TInt index = ListBoxControl()->CurrentItemIndex();
       
   213     	TBuf<KBufSize> buf;
       
   214     	buf.Num(index);
       
   215     	TBool ret = iParam.iObserver->CheckValidity(buf, iParam.iSettingType);
       
   216     	}
       
   217     
       
   218     iParam.iCommandId = aCommandId; // return command id to caller
       
   219     
       
   220     CAknRadioButtonSettingPage::ProcessCommandL(aCommandId);
       
   221 	}
       
   222 
       
   223 
       
   224 // ----------------------------------------------------------------------------
       
   225 // CAspRadioButtonSettingPage::PostDisplayCheckL
       
   226 // ----------------------------------------------------------------------------
       
   227 //
       
   228 TBool CAspRadioButtonSettingPage::PostDisplayCheckL()
       
   229     {
       
   230     UpdateNaviPaneL();
       
   231 
       
   232     return ETrue;
       
   233     }
       
   234 
       
   235 
       
   236 // ----------------------------------------------------------------------------
       
   237 // CAspRadioButtonSettingPage::UpdateNaviPaneL
       
   238 // ----------------------------------------------------------------------------
       
   239 //
       
   240 void CAspRadioButtonSettingPage::UpdateNaviPaneL()
       
   241     {
       
   242     if (!iNaviPaneHandler)
       
   243     	{
       
   244     	iNaviPaneHandler = new (ELeave) CAspNaviPaneHandler(
       
   245     	                       iEikonEnv->AppUiFactory()->StatusPane());
       
   246     	}
       
   247     	
       
   248     iNaviPaneHandler->SetNaviPaneTitleL(iParam.iPageText);
       
   249     }
       
   250 
       
   251 //----------------------------------------------------------------------------
       
   252 //CAspRadioButtonSettingPage::HandleListBoxEventL
       
   253 //----------------------------------------------------------------------------
       
   254 //
       
   255 
       
   256 
       
   257 void CAspRadioButtonSettingPage::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
       
   258 {
       
   259 	if( AknLayoutUtils::PenEnabled() )
       
   260 	{
       
   261 	  	switch(aEventType)
       
   262 		{  
       
   263 			case EEventItemClicked:
       
   264        			 this->ProcessCommandL(EAknSoftkeySelect);	
       
   265         		 break;
       
   266 		  	default:
       
   267 				break;
       
   268     		
       
   269 		}	
       
   270 	}
       
   271 }
       
   272 
       
   273 // ----------------------------------------------------------------------------
       
   274 // CAspRadioButtonSettingPage::OfferKeyEventL
       
   275 //
       
   276 // ----------------------------------------------------------------------------
       
   277 //
       
   278 TKeyResponse CAspRadioButtonSettingPage::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
   279                                                  TEventCode aType)
       
   280     {
       
   281         if(EKeyEnter == aKeyEvent.iCode)
       
   282     {
       
   283     	ProcessCommandL(EAknSoftkeyOk);
       
   284     	return EKeyWasConsumed;
       
   285     }
       
   286     if (aType == EEventKeyDown && iParam.iObserver)
       
   287         {
       
   288        	iParam.iObserver->HandleEditorEvent(
       
   289                               MAspEditorPageObserver::EKeyEvent, 0);    
       
   290         }
       
   291         
       
   292     return CAknRadioButtonSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
   293     }
       
   294 
       
   295 
       
   296 
       
   297 /*******************************************************************************
       
   298  * class CAspAlphaPasswordSettingPage
       
   299  *******************************************************************************/
       
   300 
       
   301 
       
   302 //------------------------------------------------------------------------------
       
   303 // CAspAlphaPasswordSettingPage::CAspAlphaPasswordSettingPage
       
   304 // 
       
   305 //------------------------------------------------------------------------------
       
   306 //
       
   307 CAspAlphaPasswordSettingPage::CAspAlphaPasswordSettingPage(TInt aResourceID,
       
   308                               TDes& aNewPassword, const TDesC& aOldPassword,
       
   309                               TAspSettingPageParam& aParam)
       
   310                               
       
   311  : CAknAlphaPasswordSettingPage(aResourceID, aNewPassword, aOldPassword),
       
   312    iParam(aParam)
       
   313 	{
       
   314 	}
       
   315 
       
   316 
       
   317 //------------------------------------------------------------------------------
       
   318 // Destructor
       
   319 // 
       
   320 //------------------------------------------------------------------------------
       
   321 //
       
   322 CAspAlphaPasswordSettingPage::~CAspAlphaPasswordSettingPage()
       
   323 	{
       
   324 	delete iIndicatorHandler;
       
   325 	}
       
   326 
       
   327 
       
   328 //------------------------------------------------------------------------------
       
   329 // CAspAlphaPasswordSettingPage::ProcessCommandL
       
   330 // 
       
   331 //------------------------------------------------------------------------------
       
   332 //
       
   333 void CAspAlphaPasswordSettingPage::ProcessCommandL(TInt aCommandId)
       
   334 	{
       
   335     iParam.iCommandId = aCommandId; // return command id to caller
       
   336     
       
   337     CAknAlphaPasswordSettingPage::ProcessCommandL(aCommandId);
       
   338 	}
       
   339 
       
   340 
       
   341 // ----------------------------------------------------------------------------
       
   342 // CAspAlphaPasswordSettingPage::PostDisplayCheckL
       
   343 
       
   344 // ----------------------------------------------------------------------------
       
   345 //
       
   346 TBool CAspAlphaPasswordSettingPage::PostDisplayCheckL()
       
   347     {
       
   348     UpdateNaviPaneL();
       
   349 
       
   350     return ETrue;
       
   351     }
       
   352 
       
   353 // ----------------------------------------------------------------------------
       
   354 // CAspAlphaPasswordSettingPage::UpdateNaviPaneL
       
   355 //
       
   356 // ----------------------------------------------------------------------------
       
   357 //
       
   358 void CAspAlphaPasswordSettingPage::UpdateNaviPaneL()
       
   359     {
       
   360     if (!iIndicatorHandler)
       
   361     	{
       
   362     	iIndicatorHandler = new (ELeave) CAspIndicatorHandler(
       
   363     	                                 iAvkonEnv->EditingStateIndicator());
       
   364     	}
       
   365     	
       
   366     iIndicatorHandler->SetIndicatorStateL(
       
   367               EAknNaviPaneEditorIndicatorMessageLength, iParam.iPageText);
       
   368     }
       
   369 
       
   370 
       
   371 // ----------------------------------------------------------------------------
       
   372 // CAspAlphaPasswordSettingPage::OfferKeyEventL
       
   373 //
       
   374 // ----------------------------------------------------------------------------
       
   375 //
       
   376 TKeyResponse CAspAlphaPasswordSettingPage::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
   377                                                  TEventCode aType)
       
   378     {
       
   379     if (aType == EEventKeyDown && iParam.iObserver)
       
   380         {
       
   381        	iParam.iObserver->HandleEditorEvent(
       
   382                                 MAspEditorPageObserver::EKeyEvent, 0);    
       
   383         }
       
   384         
       
   385     return CAknAlphaPasswordSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
   386     }
       
   387 
       
   388 
       
   389 /*******************************************************************************
       
   390  * class CAspCheckBoxSettingPage
       
   391  *******************************************************************************/
       
   392 
       
   393 
       
   394 //------------------------------------------------------------------------------
       
   395 // CAspCheckBoxSettingPage::CAspCheckBoxSettingPage
       
   396 // 
       
   397 //------------------------------------------------------------------------------
       
   398 //
       
   399 CAspCheckBoxSettingPage::CAspCheckBoxSettingPage(TInt aResourceID,
       
   400                    CSelectionItemList* aItemArray, TAspSettingPageParam& aParam)
       
   401                    
       
   402  : CAknCheckBoxSettingPage(aResourceID, aItemArray), iParam(aParam)
       
   403 	{
       
   404     iSelectionItemList = aItemArray;
       
   405 	}
       
   406 
       
   407 
       
   408 //------------------------------------------------------------------------------
       
   409 // Destructor
       
   410 // 
       
   411 //------------------------------------------------------------------------------
       
   412 //
       
   413 CAspCheckBoxSettingPage::~CAspCheckBoxSettingPage()
       
   414 	{
       
   415 	delete iNaviPaneHandler;
       
   416 	}
       
   417 
       
   418 
       
   419 //------------------------------------------------------------------------------
       
   420 // CAspCheckBoxSettingPage::ProcessCommandL
       
   421 // 
       
   422 //------------------------------------------------------------------------------
       
   423 //
       
   424 void CAspCheckBoxSettingPage::ProcessCommandL(TInt aCommandId)
       
   425 	{
       
   426     if (aCommandId == EAknSoftkeyMark)
       
   427     	{
       
   428         CAknSetStyleListBox* listbox = ListBoxControl();
       
   429         TInt index = listbox->CurrentItemIndex();
       
   430        	CSelectableItem* selectableItem = (*iSelectionItemList)[index];
       
   431        	TBuf<KBufSize> buf;
       
   432        	buf = selectableItem->ItemText();
       
   433        	
       
   434        	TBool ret = iParam.iObserver->CheckValidity(buf, iParam.iSettingType);
       
   435 			
       
   436        	if (ret)
       
   437        	
       
   438        		{
       
   439             CAknCheckBoxSettingPage::ProcessCommandL(aCommandId);
       
   440             return;
       
   441        		}
       
   442        	else
       
   443        		{
       
   444        		return;	
       
   445        		}
       
   446     	}
       
   447     
       
   448     	
       
   449     iParam.iCommandId = aCommandId; // return command id to caller
       
   450 
       
   451     CAknCheckBoxSettingPage::ProcessCommandL(aCommandId);
       
   452 	}
       
   453 
       
   454 
       
   455 // ----------------------------------------------------------------------------
       
   456 // CAspCheckBoxSettingPage::PostDisplayCheckL
       
   457 //
       
   458 // ----------------------------------------------------------------------------
       
   459 //
       
   460 TBool CAspCheckBoxSettingPage::PostDisplayCheckL()
       
   461     {
       
   462     UpdateNaviPaneL();
       
   463     
       
   464     iSelectionCount = ListBoxControl()->SelectionIndexes()->Count();
       
   465 
       
   466     return ETrue;
       
   467     }
       
   468 
       
   469 
       
   470 // ----------------------------------------------------------------------------
       
   471 // CAspCheckBoxSettingPage::UpdateNaviPaneL
       
   472 // ----------------------------------------------------------------------------
       
   473 //
       
   474 void CAspCheckBoxSettingPage::UpdateNaviPaneL()
       
   475     {
       
   476     if (!iNaviPaneHandler)
       
   477     	{
       
   478     	iNaviPaneHandler = new (ELeave) CAspNaviPaneHandler(
       
   479     	                       iEikonEnv->AppUiFactory()->StatusPane());
       
   480     	}
       
   481     	
       
   482     iNaviPaneHandler->SetNaviPaneTitleL(iParam.iPageText);
       
   483     }
       
   484 
       
   485 // ----------------------------------------------------------------------------
       
   486 // CAspCheckBoxSettingPage::OfferKeyEventL
       
   487 //
       
   488 // ----------------------------------------------------------------------------
       
   489 //
       
   490 TKeyResponse CAspCheckBoxSettingPage::OfferKeyEventL(const TKeyEvent& aKeyEvent, 
       
   491                                                  TEventCode aType)
       
   492     {
       
   493     if(EKeyEnter == aKeyEvent.iCode)
       
   494     {
       
   495     	ProcessCommandL(EAknSoftkeyMark);
       
   496     	return EKeyWasConsumed;
       
   497     }
       
   498    
       
   499     if (aType == EEventKeyDown && iParam.iObserver)
       
   500         {
       
   501        	iParam.iObserver->HandleEditorEvent(
       
   502                               MAspEditorPageObserver::EKeyEvent, 0);    
       
   503         }
       
   504 
       
   505     if (aType == EEventKeyUp && iParam.iObserver)
       
   506         {
       
   507 	    TInt count = ListBoxControl()->SelectionIndexes()->Count();
       
   508        	if (count != iSelectionCount)
       
   509        		{
       
   510        		iParam.iObserver->GetNavipaneText(iParam.iPageText, count);
       
   511        	    UpdateNaviPaneL();
       
   512        	    iSelectionCount = count;
       
   513        		}
       
   514         }
       
   515         
       
   516     return CAknCheckBoxSettingPage::OfferKeyEventL(aKeyEvent, aType);
       
   517     }
       
   518 // ----------------------------------------------------------------------------
       
   519 // CAspCheckBoxSettingPage::HandleListBoxEventL
       
   520 //
       
   521 // ----------------------------------------------------------------------------
       
   522 //
       
   523 
       
   524 				 
       
   525 void CAspCheckBoxSettingPage::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
       
   526 {
       
   527 	TInt index;
       
   528 	CSelectableItem* selectableItem;
       
   529 	if( AknLayoutUtils::PenEnabled() )  
       
   530 	{
       
   531 	  	switch(aEventType)
       
   532 	
       
   533 		{   
       
   534 			case EEventItemClicked:
       
   535        		 	 index=aListBox->CurrentItemIndex();
       
   536        		 	 selectableItem = (*iSelectionItemList)[index];
       
   537        		 	 if(selectableItem->SelectionStatus())
       
   538        		 	 {
       
   539        		   		this->ProcessCommandL(EAknSoftkeyUnmark);	
       
   540        		 	 }
       
   541        		     else
       
   542        		     {
       
   543        			    this->ProcessCommandL(EAknSoftkeyMark);
       
   544        		     }
       
   545 		        break;
       
   546 	 	default:
       
   547 			    break;
       
   548 		}	
       
   549 	}
       
   550 
       
   551 }
       
   552 
       
   553 /*******************************************************************************
       
   554  * class CAspProfileWizardDialog
       
   555  *******************************************************************************/
       
   556 
       
   557 
       
   558 
       
   559 // -----------------------------------------------------------------------------
       
   560 // CAspProfileWizardDialog::ShowDialogL
       
   561 // 
       
   562 // -----------------------------------------------------------------------------
       
   563 //
       
   564 TBool CAspProfileWizardDialog::ShowDialogL(TAspParam& aParam)
       
   565 	{
       
   566     CAspProfileWizardDialog* dialog = CAspProfileWizardDialog::NewL(aParam);
       
   567 
       
   568 	TBool ret = dialog->ExecuteLD(R_ASP_PROFILE_WIZARD_DIALOG);
       
   569 
       
   570 	return ret;
       
   571 	}
       
   572 
       
   573 
       
   574 // -----------------------------------------------------------------------------
       
   575 // CAspProfileWizardDialog::NewL
       
   576 //
       
   577 // -----------------------------------------------------------------------------
       
   578 //
       
   579 CAspProfileWizardDialog* CAspProfileWizardDialog::NewL(TAspParam& aParam)
       
   580     {
       
   581     FLOG( _L("CAspProfileWizardDialog::NewL START") );
       
   582 
       
   583     CAspProfileWizardDialog* self = new (ELeave) CAspProfileWizardDialog(aParam);
       
   584     CleanupStack::PushL(self);
       
   585     self->ConstructL();
       
   586     CleanupStack::Pop(self);
       
   587 
       
   588     FLOG( _L("CAspProfileWizardDialog::NewL END") );
       
   589     return self;
       
   590     }
       
   591 
       
   592 
       
   593 // -----------------------------------------------------------------------------
       
   594 // CAspProfileWizardDialog::CAspProfileWizardDialog
       
   595 // 
       
   596 // -----------------------------------------------------------------------------
       
   597 //
       
   598 CAspProfileWizardDialog::CAspProfileWizardDialog(TAspParam& aParam) 
       
   599     {
       
   600     iSyncSession = aParam.iSyncSession;
       
   601 	iApplicationId = aParam.iApplicationId;
       
   602 	iDialogParam = &aParam;
       
   603 	
       
   604 	iBgContext = NULL;
       
   605 	iMoveBack = EFalse ;
       
   606 	__ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrGeneral));
       
   607     }
       
   608 
       
   609 
       
   610 // -----------------------------------------------------------------------------
       
   611 // CAspProfileWizardDialog::ConstructL
       
   612 //
       
   613 // -----------------------------------------------------------------------------
       
   614 //
       
   615 void CAspProfileWizardDialog::ConstructL()
       
   616     {
       
   617     FLOG( _L("CAspProfileWizardDialog::ConstructL START") );
       
   618 
       
   619     if (iApplicationId == KErrNotFound)
       
   620     	{
       
   621     	User::Leave(KErrNotFound); // unknown caller app
       
   622     	}
       
   623 	
       
   624     TAspParam param2(KErrNotFound, iSyncSession);
       
   625 	iBearerHandler = CAspBearerHandler::NewL(param2);
       
   626 
       
   627 	iStatusPaneHandler = CStatusPaneHandler::NewL(iAvkonAppUi);
       
   628 	iStatusPaneHandler->StoreOriginalTitleL();
       
   629 	
       
   630 	CAspResHandler::ReadL(iNaviPaneTextFormat, R_ASP_WIZARD_PAGE_COUNTER);
       
   631 	
       
   632 	iActiveCaller = CAspActiveCaller::NewL(this);
       
   633 
       
   634 	TAspParam param(iApplicationId, iSyncSession);
       
   635 	iWizard = CAspProfileWizard::NewL(param);
       
   636 	SetDefaultValuesL();
       
   637 	
       
   638 	param.iApplicationId = EApplicationIdSync;
       
   639 	iProfileList = CAspProfileList::NewL	(param);
       
   640 	iProfileList->ReadAllProfilesL(CAspProfileList::ENoMandatoryCheck);
       
   641 	
       
   642 	iPopupNote = CAknInfoPopupNoteController::NewL();
       
   643 	
       
   644     if (iApplicationId == EApplicationIdEmail)
       
   645     	{
       
   646    	    CDesCArray* arr = iWizard->LocalDatabaseList(KUidNSmlAdapterEMail.iUid);
       
   647 	    if (!arr)
       
   648 		    {
       
   649 		    TDialogUtil::ShowErrorNoteL(R_ASP_NO_MAILBOXES);
       
   650 		    User::Leave(KErrNotFound); // no syncml mailbox
       
   651 		    }
       
   652 		
       
   653 	    if (arr->Count() == 0) 
       
   654 		    {
       
   655 		    TDialogUtil::ShowErrorNoteL(R_ASP_NO_MAILBOXES);
       
   656 		    User::Leave(KErrNotFound); // no syncml mailbox
       
   657 		    }
       
   658     	}
       
   659 
       
   660 	FLOG( _L("CAspProfileWizardDialog::ConstructL END") );
       
   661     } 
       
   662 
       
   663 
       
   664 // -----------------------------------------------------------------------------
       
   665 // Destructor
       
   666 //
       
   667 // -----------------------------------------------------------------------------
       
   668 //
       
   669 CAspProfileWizardDialog::~CAspProfileWizardDialog()
       
   670     {
       
   671     FLOG( _L("CAspProfileWizardDialog::~CAspProfileWizardDialog START") );
       
   672 
       
   673     if (iAvkonAppUi)
       
   674     	{
       
   675     	iAvkonAppUi->RemoveFromStack(this);
       
   676     	}
       
   677 
       
   678 	delete iWizard;
       
   679 	if(iTextEditorText)
       
   680 		{
       
   681 		delete iTextEditorText;
       
   682 		}
       
   683     delete iBearerHandler;
       
   684 	delete iStatusPaneHandler;
       
   685 	delete iActiveCaller;
       
   686 	delete iProfileList;
       
   687 	
       
   688 	if (iPopupNote)
       
   689 		{
       
   690     	iPopupNote->HideInfoPopupNote();
       
   691 	    delete iPopupNote;
       
   692 		}
       
   693 	
       
   694 	if (iBgContext)
       
   695 		{
       
   696 		delete iBgContext ;
       
   697 		iBgContext = NULL ;
       
   698 		}
       
   699 
       
   700 	
       
   701 	FLOG( _L("CAspProfileWizardDialog::~CAspProfileWizardDialog END") );
       
   702     }
       
   703 
       
   704 
       
   705 //------------------------------------------------------------------------------
       
   706 // CAspProfileWizardDialog::ActivateL (from CCoeControl)
       
   707 //
       
   708 // Called by system when dialog is activated.
       
   709 //------------------------------------------------------------------------------
       
   710 //
       
   711 void CAspProfileWizardDialog::ActivateL()
       
   712 	{
       
   713     FLOG( _L("CAspProfileWizardDialog::ActivateL START") );
       
   714     
       
   715     CAknDialog::ActivateL();
       
   716 
       
   717 	// this cannot be in ConstructL which is executed before dialog is launched
       
   718 	iAvkonAppUi->AddToStackL(this);
       
   719 	
       
   720     FLOG( _L("CAspProfileWizardDialog::ActivateL END") );
       
   721     }
       
   722 
       
   723 
       
   724 // -----------------------------------------------------------------------------
       
   725 // CAspProfileWizardDialog::OKToExitL
       
   726 // 
       
   727 // -----------------------------------------------------------------------------
       
   728 //
       
   729 TBool CAspProfileWizardDialog::OkToExitL(TInt aButtonId)
       
   730 	{
       
   731     FLOG( _L("CAspProfileWizardDialog::OkToExitL START") );
       
   732 	
       
   733 	iDialogParam->iReturnValue = KErrNotFound;
       
   734 	iDialogParam->iProfileId = KErrNotFound;
       
   735 
       
   736 	if (aButtonId == EEikBidOk)
       
   737 		{
       
   738 		if (iWizard->CurrentItemType() == CAspWizardItem::ETypeStart)
       
   739 			{
       
   740 			if (iTextEditorText)
       
   741    				{
       
   742    			 	delete iTextEditorText;
       
   743 				iTextEditorText = NULL;
       
   744 				}
       
   745     		TRect mainPane;
       
   746 			AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, mainPane );
       
   747    	 		iTextEditor->SetRect(mainPane);
       
   748     		iTextEditor->SetTextL(iTextEditorText);
       
   749     		UpdateCbaL(R_ASP_CBA_NEXT_BACK_NEXT);
       
   750 		
       
   751 			iWizard->MoveToNext();
       
   752 			
       
   753 			// start wizard when this completes (in HandleActiveCallL)
       
   754 			iActiveCaller->Request();
       
   755 			 
       
   756 			FLOG( _L("CAspProfileWizardDialog::OkToExitL END") );
       
   757 			return EFalse;
       
   758 			}
       
   759 		else if (iWizard->CurrentItemType() == CAspWizardItem::ETypeEnd)
       
   760 			{
       
   761 			iDialogParam->iReturnValue = KErrNone;
       
   762 			iDialogParam->iProfileId = iWizard->CreatedProfileId();
       
   763 	        
       
   764 	        FLOG( _L("CAspProfileWizardDialog::OkToExitL END") );
       
   765 			return ETrue;
       
   766 			}
       
   767 		//Case of quick succession clicks on touch screen profile creation wizard
       
   768 		else
       
   769 			{
       
   770 			   return EFalse;	
       
   771 			}
       
   772 		}
       
   773 	//Case of quick succession backs on touch screen profile creation wizard
       
   774 	else if(aButtonId == EAknSoftkeyDone)
       
   775 	{
       
   776 		return EFalse;
       
   777 	}
       
   778 		
       
   779 		
       
   780 	
       
   781 	FLOG( _L("CAspProfileWizardDialog::OkToExitL END") );
       
   782 	return CAknDialog::OkToExitL(aButtonId);
       
   783 	}
       
   784 
       
   785 
       
   786 //------------------------------------------------------------------------------
       
   787 // CAspProfileWizardDialog::ProcessCommandL
       
   788 //
       
   789 //------------------------------------------------------------------------------
       
   790 //
       
   791 void CAspProfileWizardDialog::ProcessCommandL(TInt /*aCommandId*/)
       
   792 	{
       
   793 	}
       
   794 
       
   795 
       
   796 // ----------------------------------------------------------------------------
       
   797 // CAspProfileWizardDialog::OfferKeyEventL
       
   798 // 
       
   799 // ----------------------------------------------------------------------------
       
   800 //
       
   801 TKeyResponse CAspProfileWizardDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   802 	{
       
   803 	if (aType == EEventKey)
       
   804 		{
       
   805 		switch (aKeyEvent.iCode)
       
   806 			{
       
   807 			case EKeyEnter:
       
   808 			{
       
   809 			     TryExitL(EEikBidOk);
       
   810 			     return EKeyWasConsumed;
       
   811 			}
       
   812 			case EKeyOK:
       
   813 				{
       
   814 				break;
       
   815 				}
       
   816 
       
   817 			case EKeyEscape:  // framework calls this when dialog must shut down
       
   818 				{
       
   819 				return CAknDialog::OfferKeyEventL(aKeyEvent, aType);
       
   820         		}
       
   821 
       
   822             default:
       
   823 				{
       
   824 				//return iTextEditor->OfferKeyEventL(aKeyEvent, aType);
       
   825 			    break;
       
   826 				}
       
   827 			}
       
   828 		}
       
   829 
       
   830 	return CAknDialog::OfferKeyEventL( aKeyEvent, aType);
       
   831 	}
       
   832 
       
   833 
       
   834 // -----------------------------------------------------------------------------
       
   835 // CAspProfileWizardDialog::PreLayoutDynInitL
       
   836 //
       
   837 // Called by framework before dialog is shown.
       
   838 // -----------------------------------------------------------------------------
       
   839 //
       
   840 void CAspProfileWizardDialog::PreLayoutDynInitL()
       
   841     {
       
   842     FLOG( _L("CAspProfileWizardDialog::PreLayoutDynInitL START") );
       
   843    
       
   844     iTextEditor = (CEikRichTextEditor*) ControlOrNull (EAspProfileWizardDialogList);
       
   845     
       
   846     User::LeaveIfNull(iTextEditor);
       
   847    
       
   848     SetTextEditorTextL(R_ASP_SET_WIZARD_START);
       
   849     
       
   850 	TRect mainPane;
       
   851     AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPane);        
       
   852     iTextEditor->SetRect(mainPane);
       
   853 	
       
   854 	SetBackgroundContextL ();
       
   855 	
       
   856     iStatusPaneHandler->SetNaviPaneTitleL(KNullDesC);
       
   857     iStatusPaneHandler->SetTitleL(R_ASP_SETTING_DIALOG_TITLE);
       
   858     
       
   859     FLOG( _L("CAspProfileWizardDialog::PreLayoutDynInitL END") );
       
   860 	}
       
   861 
       
   862 
       
   863 // ----------------------------------------------------------------------------
       
   864 // CAspProfileWizardDialog::HandleResourceChange
       
   865 // 
       
   866 // ----------------------------------------------------------------------------
       
   867 //
       
   868 void CAspProfileWizardDialog::HandleResourceChange(TInt aType)
       
   869     {   
       
   870     if (aType == KEikDynamicLayoutVariantSwitch) //Handle change in layout orientation
       
   871         {
       
   872         TRect mainPaneRect;
       
   873         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
       
   874         SetRect(mainPaneRect);
       
   875         iTextEditor->SetSize(mainPaneRect.Size());
       
   876         SetBackgroundContextL();
       
   877         CCoeControl::HandleResourceChange(aType);
       
   878 		DrawDeferred();
       
   879 	    return;
       
   880 		}
       
   881 	if (aType == KAknsMessageSkinChange)
       
   882 		{
       
   883 		// When skin changes, we need to update text color
       
   884 		TRAP_IGNORE(UpdateTextColorL());
       
   885 		}
       
   886 		
       
   887     CCoeControl::HandleResourceChange(aType);
       
   888     }
       
   889 
       
   890 
       
   891 // -----------------------------------------------------------------------------
       
   892 // CAspProfileWizardDialog::HandleActiveCallL (from MAspActiveCallerObserver)
       
   893 //
       
   894 // -----------------------------------------------------------------------------
       
   895 //
       
   896 void CAspProfileWizardDialog::HandleActiveCallL(TInt /*aCallId*/)
       
   897 	{
       
   898     FLOG( _L("CAspProfileWizardDialog::HandleActiveCallL START") );
       
   899 	
       
   900 	TInt err = RunWizard();
       
   901 	
       
   902 	if (err != KErrNone)
       
   903 		{
       
   904 		iWizard->DeleteProfile();
       
   905 		
       
   906 		ShowErrorNoteL(err);
       
   907 
       
   908         TryExitL(EEikBidCancel); // close profile wizard dialog
       
   909 		}
       
   910 
       
   911     FLOG( _L("CAspProfileWizardDialog::HandleActiveCallL END") );
       
   912 	}
       
   913 
       
   914 
       
   915 // -----------------------------------------------------------------------------
       
   916 // CAspProfileWizardDialog::RunWizard
       
   917 //
       
   918 // -----------------------------------------------------------------------------
       
   919 //
       
   920 TInt CAspProfileWizardDialog::RunWizard()
       
   921 	{
       
   922     FLOG( _L("CAspProfileWizardDialog::RunWizard START") );
       
   923     
       
   924     TRAPD(err, RunWizardL());
       
   925 	
       
   926 	HidePopupNote();
       
   927 	
       
   928 	if (err != KErrNone)
       
   929 		{
       
   930 		iWizard->MoveToStart();
       
   931 		FLOG( _L("### RunWizardL failed (%d) ###"), err );
       
   932 		}
       
   933 		
       
   934     FLOG( _L("CAspProfileWizardDialog::RunWizard END") );
       
   935 	return err;
       
   936 	}
       
   937 
       
   938 
       
   939 // -----------------------------------------------------------------------------
       
   940 // CAspProfileWizardDialog::RunWizardL
       
   941 //
       
   942 // -----------------------------------------------------------------------------
       
   943 //
       
   944 void CAspProfileWizardDialog::RunWizardL()
       
   945 	{
       
   946 	for (;;)
       
   947 		{
       
   948 		CAspWizardItem* item = iWizard->CurrentItem();
       
   949 	
       
   950 	    if (item->iSettingType == CAspWizardItem::ETypeEnd)
       
   951 		    {
       
   952 		    iMoveBack = ETrue ;
       
   953 		    iWizard->CreateProfileL();
       
   954 		    
       
   955 		    if (iApplicationId == EApplicationIdSync)
       
   956 		    	{
       
   957 		    	SetTextEditorTextL(R_ASP_SET_WIZARD_END);
       
   958 		        UpdateCbaL(R_ASP_CBA_ACTIVATE_LATER_ACTIVATE);
       
   959 		    	}
       
   960 		    else if (iApplicationId == EApplicationIdEmail)
       
   961 		    	{
       
   962 		    	SetTextEditorTextL(R_ASP_SET_WIZARD_END_EMAIL);
       
   963 		    	UpdateCbaL(R_AVKON_SOFTKEYS_OK_EMPTY);
       
   964 		    	}
       
   965 		    else
       
   966 		    	{
       
   967 		    	SetTextEditorTextL(R_ASP_SET_WIZARD_END_APP);
       
   968 		    	UpdateCbaL(R_AVKON_SOFTKEYS_OK_EMPTY);
       
   969 		    	}
       
   970 
       
   971 		    TBuf<KBufSize> buf;
       
   972 		    GetNaviPaneText(buf, item);
       
   973 		    iStatusPaneHandler->SetNaviPaneTitleL(buf);
       
   974 		    
       
   975 		    return; // return to wizard dialog view
       
   976 		    }
       
   977 		
       
   978 	    if (item->iSettingType == CAspWizardItem::ETypeStart)
       
   979 		    {
       
   980 		    iMoveBack = ETrue ;
       
   981 		    SetTextEditorTextL(R_ASP_SET_WIZARD_START);
       
   982 		    UpdateCbaL(R_ASP_CBA_START_CANCEL_START);
       
   983 		    return; // return to wizard dialog view
       
   984 		    }
       
   985 
       
   986 	    TInt ret = EditSettingItemL(item); // show setting editor
       
   987 	
       
   988 	    if (ret == EAknSoftkeyOk || ret == EEikBidSelect)
       
   989 		    {
       
   990 		    iMoveBack = EFalse ;
       
   991 		    iWizard->MoveToNext();
       
   992         	}
       
   993 	    else if (ret == EAknSoftkeyDone)
       
   994 		    {
       
   995 		    iMoveBack = ETrue ;
       
   996 		    iWizard->MoveToPrevious();
       
   997 			}
       
   998 	    else
       
   999 	        {
       
  1000 	        iMoveBack = EFalse ;
       
  1001 	        iWizard->MoveToStart();
       
  1002 		    return; // probably system cancel - wizard must close
       
  1003 		    }
       
  1004 		}
       
  1005 	}
       
  1006 
       
  1007 
       
  1008 //------------------------------------------------------------------------------
       
  1009 // CAspProfileWizardDialog::EditSettingItemL
       
  1010 //
       
  1011 // Calls setting editing functions. 
       
  1012 //------------------------------------------------------------------------------
       
  1013 //
       
  1014 TInt CAspProfileWizardDialog::EditSettingItemL(CAspWizardItem* aItem)
       
  1015 	{
       
  1016 	TInt ret = EAknSoftkeyOk;
       
  1017 	
       
  1018 	ShowPopupNoteL(aItem->iPopupNoteResourceId, KMsToWaitBeforePopup);
       
  1019 	
       
  1020 	switch (aItem->iSettingType)
       
  1021 		{
       
  1022 		case CAspWizardItem::ETypeStart:
       
  1023 		    break;
       
  1024 			
       
  1025 		case CAspWizardItem::ETypeProfileName:
       
  1026 			ret = EditSettingItemProfileNameL(aItem);
       
  1027 		    break;
       
  1028 
       
  1029 		case CAspWizardItem::ETypeProtocolVersion:
       
  1030 			ret = EditSettingItemProtocolVersionL(aItem);
       
  1031 		    break;
       
  1032 
       
  1033 		case CAspWizardItem::ETypeHostAddress:
       
  1034 			ret = EditSettingItemHostAddressL(aItem);
       
  1035 		    break;
       
  1036 
       
  1037 		case CAspWizardItem::ETypeServerId:
       
  1038 			ret = EditSettingItemTextL(aItem);
       
  1039 		    break;
       
  1040 
       
  1041 		case CAspWizardItem::ETypeBearerType:
       
  1042 			ret = EditSettingItemBearerTypeL(aItem);
       
  1043 		    break;
       
  1044 
       
  1045 		case CAspWizardItem::ETypeUserName:
       
  1046 			ret = EditSettingItemTextL(aItem);
       
  1047 		    break;
       
  1048 		
       
  1049 		case CAspWizardItem::ETypePassword:
       
  1050 			ret = EditSettingItemSecretL(aItem);
       
  1051 		    break;
       
  1052 		    
       
  1053 		case CAspWizardItem::ETypeContentSelection:
       
  1054 			ret = EditSettingItemContentSelectionL(aItem);
       
  1055 		    break;
       
  1056 
       
  1057 		case CAspWizardItem::ETypeSyncContent:
       
  1058 	    	ret = EditSettingItemTextL(aItem);
       
  1059 		    break;
       
  1060 
       
  1061 		case CAspWizardItem::ETypeSyncContentLocalDatabase:
       
  1062 	    	ret = EditSettingItemLocalDatabaseL(aItem);
       
  1063 		    break;
       
  1064 
       
  1065 		case CAspWizardItem::ETypeEnd:
       
  1066 			break;
       
  1067 
       
  1068 		default:
       
  1069 		    break;
       
  1070 		}
       
  1071 
       
  1072 	HidePopupNote();
       
  1073 	
       
  1074 	return ret;
       
  1075 	}
       
  1076 
       
  1077 
       
  1078 //------------------------------------------------------------------------------
       
  1079 // CAspProfileWizardDialog::EditSettingItemTextL
       
  1080 //
       
  1081 // Edit text setting item.
       
  1082 //------------------------------------------------------------------------------
       
  1083 //
       
  1084 TInt CAspProfileWizardDialog::EditSettingItemTextL(CAspWizardItem* aItem)
       
  1085 	{
       
  1086 	TUtil::StrCopy(iBuf, aItem->Value());
       
  1087 	
       
  1088 	TInt flags(CAknTextSettingPage::EZeroLengthAllowed);
       
  1089 
       
  1090     TAspSettingPageParam param;
       
  1091     param.iCommandId = EAknSoftkeyOk;
       
  1092     GetNaviPaneText(param.iPageText, aItem);
       
  1093     param.iObserver = this;
       
  1094     param.iSettingType = aItem->iSettingType;
       
  1095     
       
  1096 	CAspTextSettingPage* dlg = new (ELeave) CAspTextSettingPage(
       
  1097 	                     R_ASP_SETTING_TEXT_NEXT_BACK, iBuf, flags, param);
       
  1098 	CleanupStack::PushL(dlg);
       
  1099 
       
  1100 	dlg->SetSettingTextL(aItem->Header()); 
       
  1101 	dlg->ConstructL();
       
  1102 	dlg->TextControl()->SetTextLimit(aItem->iMaxLength);
       
  1103 
       
  1104 	if (aItem->iLatinInput)
       
  1105 		{		
       
  1106 		dlg->TextControl()->SetAvkonWrap(ETrue);
       
  1107 		dlg->TextControl()->SetAknEditorCase(EAknEditorLowerCase);
       
  1108 		dlg->TextControl()->SetAknEditorFlags(EAknEditorFlagNoT9 |
       
  1109 		                                EAknEditorFlagLatinInputModesOnly);
       
  1110 		}
       
  1111 	
       
  1112 	CleanupStack::Pop(dlg);
       
  1113 
       
  1114     //
       
  1115 	// CAknTextSettingPage::ExecuteLD returns boolean. 
       
  1116 	// See CAknSettingPage::ProcessCommandL what softkey values map to
       
  1117 	// ETrue and EFalse.
       
  1118 	// Profile wizard editors return EAknSoftkeyDone for "Back" and 
       
  1119 	// EAknSoftkeyOk for "Next". Editors need "positive" ids for saving
       
  1120 	// setting values.
       
  1121 	//
       
  1122 	TInt ret = dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
       
  1123    
       
  1124 
       
  1125     aItem->SetValueL(iBuf);
       
  1126     
       
  1127     return param.iCommandId;
       
  1128 	}
       
  1129 
       
  1130 
       
  1131 //------------------------------------------------------------------------------
       
  1132 // CAspProfileWizardDialog::EditSettingItemProtocolVersionL
       
  1133 //
       
  1134 //------------------------------------------------------------------------------
       
  1135 //
       
  1136 TBool CAspProfileWizardDialog::EditSettingItemProtocolVersionL(CAspWizardItem* aItem)
       
  1137 	{
       
  1138 	TInt curSelection = aItem->iNumber;
       
  1139 	CDesCArray* arr2 = CAspResHandler::ReadDesArrayStaticLC(R_ASP_PROTOCOL_VERSION);
       
  1140 	CDesCArray* arr = TUtil::NumberConversionLC(arr2);
       
  1141 	
       
  1142     TAspSettingPageParam param;
       
  1143     param.iCommandId = EAknSoftkeyOk;
       
  1144     GetNaviPaneText(param.iPageText, aItem);
       
  1145     param.iObserver = this;
       
  1146     param.iSettingType = aItem->iSettingType;
       
  1147 	
       
  1148 	CAspRadioButtonSettingPage* dlg = new (ELeave) CAspRadioButtonSettingPage(
       
  1149 	                                  R_ASP_SETTING_RADIO_NEXT_BACK, 
       
  1150 	                                  curSelection, arr, param);
       
  1151 	CleanupStack::PushL(dlg);
       
  1152 	dlg->SetSettingTextL(aItem->Header()); 
       
  1153 	CleanupStack::Pop(dlg);
       
  1154 
       
  1155 	dlg->ExecuteLD();
       
  1156 	
       
  1157 	aItem->iNumber = curSelection;
       
  1158    	aItem->SetValueL((*arr)[curSelection]);
       
  1159    	
       
  1160    	if (curSelection == EAspProtocol_1_1)
       
  1161    		{
       
  1162    		iWizard->SetContentEnabled(KUidNSmlAdapterEMail.iUid, EFalse);
       
  1163         iWizard->SetEnabled(CAspWizardItem::ETypeServerId, EFalse);
       
  1164    		}
       
  1165    	else
       
  1166    		{
       
  1167    		iWizard->SetEnabled(CAspWizardItem::ETypeServerId, ETrue);
       
  1168    		}
       
  1169 
       
  1170 	CleanupStack::PopAndDestroy(arr);
       
  1171 	CleanupStack::PopAndDestroy(arr2);
       
  1172    	return param.iCommandId;
       
  1173 	}
       
  1174 
       
  1175 
       
  1176 //------------------------------------------------------------------------------
       
  1177 // CAspProfileWizardDialog::EditSettingItemBearerTypeL
       
  1178 //
       
  1179 //------------------------------------------------------------------------------
       
  1180 //
       
  1181 TInt CAspProfileWizardDialog::EditSettingItemBearerTypeL(CAspWizardItem* aItem)
       
  1182 	{
       
  1183 	CDesCArray* arr = iBearerHandler->BuildBearerListLC();
       
  1184 	if (arr->Count() == 0) 
       
  1185 		{
       
  1186 		User::Leave(KErrNotFound);
       
  1187 		}
       
  1188 
       
  1189 	TInt curSelection = iBearerHandler->ListIndexForBearer(aItem->iNumber);
       
  1190 	if (curSelection == KErrNotFound)
       
  1191 		{
       
  1192 		User::Leave(KErrNotFound);
       
  1193 		}
       
  1194 
       
  1195 
       
  1196     TAspSettingPageParam param;
       
  1197     param.iCommandId = EAknSoftkeyOk;
       
  1198     GetNaviPaneText(param.iPageText, aItem);
       
  1199     param.iObserver = this;
       
  1200     param.iSettingType = aItem->iSettingType;
       
  1201 	
       
  1202 	CAspRadioButtonSettingPage* dlg = new (ELeave) CAspRadioButtonSettingPage(
       
  1203 	                                  R_ASP_SETTING_RADIO_NEXT_BACK, 
       
  1204 	                                  curSelection, arr, param);
       
  1205 	CleanupStack::PushL(dlg);
       
  1206 	dlg->SetSettingTextL(aItem->Header()); 
       
  1207 	CleanupStack::Pop(dlg);
       
  1208 
       
  1209 	dlg->ExecuteLD();
       
  1210 		
       
  1211 	aItem->iNumber = iBearerHandler->BearerForListIndex(curSelection);
       
  1212    	aItem->SetValueL((*arr)[curSelection]);
       
  1213 	
       
  1214 	CleanupStack::PopAndDestroy(arr);
       
  1215 		
       
  1216    	return param.iCommandId;
       
  1217 	}
       
  1218 
       
  1219 
       
  1220 //------------------------------------------------------------------------------
       
  1221 // CAspProfileWizardDialog::EditSettingItemLocalDatabaseL
       
  1222 //
       
  1223 //------------------------------------------------------------------------------
       
  1224 //
       
  1225 TInt CAspProfileWizardDialog::EditSettingItemLocalDatabaseL(CAspWizardItem* aItem)
       
  1226 	{
       
  1227 	CDesCArray* arr = iWizard->LocalDatabaseList(aItem->iSettingId);
       
  1228 	if (!arr)
       
  1229 		{
       
  1230 		User::Leave(KErrNotFound);
       
  1231 		}
       
  1232 		
       
  1233 	if (arr->Count() == 0) 
       
  1234 		{
       
  1235 		User::Leave(KErrNotFound);
       
  1236 		}
       
  1237 
       
  1238 	TInt curSelection = aItem->iNumber;
       
  1239 	if (curSelection < 0)
       
  1240 		{
       
  1241 		curSelection = 0;
       
  1242 		}
       
  1243 
       
  1244 
       
  1245     TAspSettingPageParam param;
       
  1246     param.iCommandId = EAknSoftkeyOk;
       
  1247     GetNaviPaneText(param.iPageText, aItem);
       
  1248     param.iObserver = this;
       
  1249     param.iSettingType = aItem->iSettingType;
       
  1250 	
       
  1251 	CAspRadioButtonSettingPage* dlg = new (ELeave) CAspRadioButtonSettingPage(
       
  1252 	                                  R_ASP_SETTING_RADIO_NEXT_BACK, 
       
  1253 	                                  curSelection, arr, param);
       
  1254 	CleanupStack::PushL(dlg);
       
  1255 	dlg->SetSettingTextL(aItem->Header()); 
       
  1256 	CleanupStack::Pop(dlg);
       
  1257 
       
  1258 	dlg->ExecuteLD();
       
  1259 		
       
  1260 	aItem->iNumber = curSelection;
       
  1261    	aItem->SetValueL((*arr)[curSelection]);
       
  1262 	
       
  1263    	return param.iCommandId;
       
  1264 	}
       
  1265 
       
  1266 
       
  1267 //------------------------------------------------------------------------------
       
  1268 // CAspProfileWizardDialog::EditSettingItemSecretL
       
  1269 //
       
  1270 //------------------------------------------------------------------------------
       
  1271 //
       
  1272 TInt CAspProfileWizardDialog::EditSettingItemSecretL(CAspWizardItem* aItem)
       
  1273 	{
       
  1274 	TBuf<KBufSize64> newPassword;
       
  1275 	TUtil::StrCopy(newPassword, aItem->Value());
       
  1276 	
       
  1277 	
       
  1278     TAspSettingPageParam param;
       
  1279     param.iCommandId = EAknSoftkeyOk;
       
  1280     GetNaviPaneText(param.iPageText, aItem);
       
  1281     param.iObserver = this;
       
  1282     param.iSettingType = aItem->iSettingType;
       
  1283 
       
  1284 	CAspAlphaPasswordSettingPage* pwd = new (ELeave) CAspAlphaPasswordSettingPage(
       
  1285 		     R_ASP_SETTING_PASSWORD_NEXT_BACK, newPassword, aItem->Value(), param);
       
  1286 
       
  1287 	CleanupStack::PushL(pwd);
       
  1288 	pwd->SetSettingTextL(aItem->Header()); 
       
  1289 	pwd->ConstructL();
       
  1290 	pwd->AlphaPasswordEditor()->SetMaxLength(aItem->iMaxLength);
       
  1291 	//pwd->AlphaPasswordEditor()->RevealSecretText(ETrue);
       
  1292 	CleanupStack::Pop(pwd);
       
  1293 
       
  1294 	TInt ret = pwd->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
       
  1295 		
       
  1296 	aItem->SetValueL(newPassword);
       
  1297    	
       
  1298    	return param.iCommandId;
       
  1299 	}
       
  1300 
       
  1301 
       
  1302 //------------------------------------------------------------------------------
       
  1303 // CAspProfileWizardDialog::EditSettingItemProfileNameL
       
  1304 //
       
  1305 //------------------------------------------------------------------------------
       
  1306 //
       
  1307 TInt CAspProfileWizardDialog::EditSettingItemProfileNameL(CAspWizardItem* aItem)
       
  1308 	{
       
  1309 	TInt commandId = EditSettingItemTextL(aItem);
       
  1310       	
       
  1311     return commandId;
       
  1312 	}
       
  1313 
       
  1314 
       
  1315 //------------------------------------------------------------------------------
       
  1316 // CAspProfileWizardDialog::EditSettingItemHostAddressL
       
  1317 //
       
  1318 //------------------------------------------------------------------------------
       
  1319 //
       
  1320 TInt CAspProfileWizardDialog::EditSettingItemHostAddressL(CAspWizardItem* aItem)
       
  1321 	{
       
  1322 	_LIT(KIPAddressRegX,"http://*");
       
  1323 	TInt bearer = iWizard->NumberValue(CAspWizardItem::ETypeBearerType);
       
  1324 	TPtrC ptr = aItem->Value();
       
  1325 	TPtrC httpHeader(KIPAddressRegX); 
       
  1326 	
       
  1327 	if (bearer == EAspBearerInternet)
       
  1328 		{
       
  1329 		   //If existing ptr is NOT an IP address
       
  1330 		   if(ptr.MatchC(httpHeader) == KErrNotFound)
       
  1331 		   {
       
  1332 				aItem->SetValueL(KHttpHeader);   	
       
  1333 		   }
       
  1334 		}
       
  1335 	else
       
  1336 		{
       
  1337 		    //If existing ptr is IP address
       
  1338 		    if(ptr.MatchC(httpHeader) != KErrNotFound)
       
  1339 		    {
       
  1340 		    	aItem->SetValueL(KNullDesC); 		
       
  1341 		    }
       
  1342 		}
       
  1343 	
       
  1344 	TInt commandId;
       
  1345 	while (ETrue)
       
  1346 		{
       
  1347 		commandId = EditSettingItemTextL(aItem);
       
  1348 		if (commandId == EAknSoftkeyOk && bearer == EAspBearerInternet)
       
  1349 			{
       
  1350 			if (!TURIParser::IsValidUri(aItem->Value()))
       
  1351 				{			
       
  1352 				TDialogUtil::ShowInformationNoteL(R_ASP_LOG_ERR_URIINVALID);
       
  1353 				}
       
  1354 			else
       
  1355 				{
       
  1356 				break;	
       
  1357 				}
       
  1358 			}
       
  1359 		else
       
  1360 			{
       
  1361 			break;	
       
  1362 			}
       
  1363 		}
       
  1364     return commandId;
       
  1365 	}
       
  1366 
       
  1367 
       
  1368 //------------------------------------------------------------------------------
       
  1369 // CAspProfileWizardDialog::EditSettingItemContentSelectionL
       
  1370 //
       
  1371 //------------------------------------------------------------------------------
       
  1372 //
       
  1373 TInt CAspProfileWizardDialog::EditSettingItemContentSelectionL(CAspWizardItem* aItem)
       
  1374 	{
       
  1375 	CAspSelectionItemList* list = new (ELeave) CAspSelectionItemList(1);
       
  1376 	CleanupStack::PushL(TCleanupItem(CAspSelectionItemList::Cleanup, list));
       
  1377 	
       
  1378 	iWizard->GetContentSelectionL(list);
       
  1379 	
       
  1380     TAspSettingPageParam param;
       
  1381     param.iCommandId = EAknSoftkeyOk;
       
  1382     GetNaviPaneText(param.iPageText, aItem);
       
  1383     param.iObserver = this;
       
  1384     param.iSettingType = aItem->iSettingType;
       
  1385 
       
  1386 	CAspCheckBoxSettingPage* dlg = new (ELeave) CAspCheckBoxSettingPage(
       
  1387 	                                   R_ASP_SETTING_CHECK_NEXT_BACK, list, param);
       
  1388 	
       
  1389    	CleanupStack::PushL(dlg);
       
  1390     dlg->SetSettingTextL(aItem->Header());
       
  1391 	CleanupStack::Pop(dlg);
       
  1392 
       
  1393     TBool ret = dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
       
  1394     
       
  1395     iWizard->SetContentSelectionL(list);
       
  1396     
       
  1397 	CleanupStack::PopAndDestroy(list);
       
  1398 
       
  1399    	return param.iCommandId;
       
  1400 	}
       
  1401 
       
  1402 
       
  1403 //------------------------------------------------------------------------------
       
  1404 // CAspProfileWizardDialog::CheckValidity (from MAspEditorPageObserver)
       
  1405 //
       
  1406 //------------------------------------------------------------------------------
       
  1407 //
       
  1408 TBool CAspProfileWizardDialog::CheckValidity(const TDesC& aText, TInt aSettingType)
       
  1409 	{
       
  1410 	TInt ret = ETrue;
       
  1411 	
       
  1412 	TRAPD(err, ret = CheckValidityL(aText, aSettingType));
       
  1413 	
       
  1414 	if (err != KErrNone)
       
  1415 		{
       
  1416 		return ETrue;
       
  1417 		}
       
  1418 	
       
  1419 	return ret;
       
  1420 	}
       
  1421 	
       
  1422 
       
  1423 //------------------------------------------------------------------------------
       
  1424 // CAspProfileWizardDialog::CheckValidityL (from MAspEditorPageObserver)
       
  1425 //
       
  1426 //------------------------------------------------------------------------------
       
  1427 //
       
  1428 TBool CAspProfileWizardDialog::CheckValidityL(const TDesC& aText, TInt aSettingType)
       
  1429 	{
       
  1430 	if (aSettingType == CAspWizardItem::ETypeProfileName)
       
  1431 		{
       
  1432 	    if (TUtil::IsEmpty(aText))
       
  1433 		    {
       
  1434 		    TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_PROFILE_NAME_MISSING);
       
  1435 		    return EFalse;
       
  1436 		    }
       
  1437 		}
       
  1438 		
       
  1439 	if (aSettingType == CAspWizardItem::ETypeSyncContent)
       
  1440 		{
       
  1441 	    if (TUtil::IsEmpty(aText))
       
  1442 		    {
       
  1443 		    CAspWizardItem* item = iWizard->CurrentItem();
       
  1444 		    if (item->iErrorNoteResourceId == R_ASP_NOTE_CONTACTS_DB_MISSING)
       
  1445 		    	{
       
  1446 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_CONTACTS_DB_MISSING);
       
  1447 		    	return EFalse;
       
  1448 		    	}
       
  1449 		    else if (item->iErrorNoteResourceId == R_ASP_NOTE_CALENDAR_DB_MISSING)
       
  1450 		    	{	
       
  1451 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_CALENDAR_DB_MISSING);
       
  1452 		    	return EFalse;
       
  1453 		    	}
       
  1454 		    else if (item->iErrorNoteResourceId == R_ASP_NOTE_NOTES_DB_MISSING)
       
  1455 		    	{
       
  1456 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_NOTES_DB_MISSING);
       
  1457 		    	return EFalse;
       
  1458 		    	}
       
  1459 		    else if (item->iErrorNoteResourceId == R_ASP_NOTE_EMAIL_DB_MISSING)
       
  1460 		    	{
       
  1461 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_EMAIL_DB_MISSING);
       
  1462 		    	return EFalse;
       
  1463 		    	} 
       
  1464 		    else if (item->iErrorNoteResourceId == R_ASP_NOTE_MMS_DATABASE_MISSING)
       
  1465 		    	{
       
  1466 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_MMS_DATABASE_MISSING);
       
  1467 		    	return EFalse;
       
  1468 		    	} 
       
  1469 		    else if (item->iErrorNoteResourceId == R_ASP_NOTE_SMS_DATABASE_MISSING)
       
  1470 		        {
       
  1471 		        TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_SMS_DATABASE_MISSING);
       
  1472 		        return EFalse;
       
  1473 		        } 
       
  1474 		    else if (item->iErrorNoteResourceId == R_ASP_NOTE_BKM_DATABASE_MISSING)
       
  1475 		    	{
       
  1476 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_BKM_DATABASE_MISSING);
       
  1477 		    	return EFalse;
       
  1478 		    	} 
       
  1479 		    else
       
  1480 		    	{
       
  1481 		    	TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_REMOTE_DATABASE_MISSING);
       
  1482 		    	return EFalse;
       
  1483     	    	}
       
  1484     	        	    
       
  1485     	    }
       
  1486 		}
       
  1487 
       
  1488 	if (aSettingType == CAspWizardItem::ETypeHostAddress)
       
  1489 		{
       
  1490 	    if (TUtil::IsEmpty(aText))
       
  1491 		    {
       
  1492 		    TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_HOST_ADDRESS_MISSING);
       
  1493 		    return EFalse;
       
  1494 		    }
       
  1495 		TInt bearer = iWizard->NumberValue(CAspWizardItem::ETypeBearerType);
       
  1496 		if	(bearer == EAspBearerInternet)		    
       
  1497 			{
       
  1498 				if (!TURIParser::IsValidUri(aText))
       
  1499 			    {
       
  1500 			    TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_INCORRECT_HOST_ADDRESS);
       
  1501 			    return EFalse;
       
  1502 			    }
       
  1503 			}
       
  1504 			else if (bearer == EAspBearerBlueTooth)
       
  1505 			{
       
  1506 				if (!TURIParser::IsValidBluetoothHostAddress(aText))
       
  1507 			    {
       
  1508 			    TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_INCORRECT_HOST_ADDRESS);
       
  1509 			    return EFalse;
       
  1510 			    }
       
  1511 			}
       
  1512 		}
       
  1513     
       
  1514 	if (aSettingType == CAspWizardItem::ETypeServerId)
       
  1515 		{
       
  1516 	    if (!iProfileList->IsUniqueServerId(aText, KErrNotFound))
       
  1517 		    {
       
  1518 		    TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_INCORRECT_SERVER_ID);
       
  1519 		    return EFalse;
       
  1520 		    }
       
  1521 		}
       
  1522 
       
  1523 	if (aSettingType == CAspWizardItem::ETypeContentSelection)
       
  1524 		{
       
  1525 		TInt adapterId = iWizard->ContentId(aText);
       
  1526 		if (adapterId == KUidNSmlAdapterEMail.iUid)
       
  1527 			{
       
  1528 		    TInt protocol = iWizard->NumberValue(CAspWizardItem::ETypeProtocolVersion);
       
  1529 		   	
       
  1530 		   	
       
  1531 		   	CDesCArray* arr = iWizard->LocalDatabaseList(KUidNSmlAdapterEMail.iUid);
       
  1532 	        if (!arr)
       
  1533 		        {
       
  1534 		        TDialogUtil::ShowErrorNoteL(R_ASP_NO_MAILBOXES);
       
  1535 		        return EFalse;  // no syncml mailbox
       
  1536 		        }
       
  1537 		
       
  1538 	        if (arr->Count() == 0) 
       
  1539 		        {
       
  1540 		        TDialogUtil::ShowErrorNoteL(R_ASP_NO_MAILBOXES);
       
  1541 		        return EFalse;   // no syncml mailbox
       
  1542 		        }
       
  1543 			}
       
  1544 		}
       
  1545 
       
  1546 	
       
  1547 
       
  1548 	return ETrue;
       
  1549 	}
       
  1550 
       
  1551 
       
  1552 //------------------------------------------------------------------------------
       
  1553 // CAspProfileWizardDialog::GetNavipaneText (from MAspEditorPageObserver)
       
  1554 //
       
  1555 //------------------------------------------------------------------------------
       
  1556 //
       
  1557 void CAspProfileWizardDialog::GetNavipaneText(TDes& aText, TInt aContentCount)
       
  1558 	{
       
  1559     CAspWizardItem* item = iWizard->CurrentItem();
       
  1560     
       
  1561     TInt total = iWizard->NumOfEnabledItems();
       
  1562     total--; // start page not included in page count
       
  1563     
       
  1564     TInt current = iWizard->NumOfCurrentItem(item);
       
  1565     current--; // start page not included in page count
       
  1566     
       
  1567     TInt enabledContentCount = iWizard->NumOfEnabledContentItems();
       
  1568     
       
  1569     total = total - enabledContentCount;
       
  1570     total = total + aContentCount;
       
  1571 
       
  1572     GetNaviPaneText(aText, current, total);
       
  1573 	}
       
  1574 
       
  1575 
       
  1576 //------------------------------------------------------------------------------
       
  1577 // CAspProfileWizardDialog::HandleEditorEvent (from MAspEditorPageObserver)
       
  1578 //
       
  1579 //------------------------------------------------------------------------------
       
  1580 //
       
  1581 void CAspProfileWizardDialog::HandleEditorEvent(TInt aEvent, TInt /*aValue*/)
       
  1582 	{
       
  1583 	if (aEvent == MAspEditorPageObserver::EKeyEvent)
       
  1584 		{
       
  1585 		HidePopupNote();
       
  1586 		TRAP_IGNORE( ShowPopupNoteL(KErrNotFound, KMsToWaitBeforeRePopup) );
       
  1587 		}
       
  1588 	}
       
  1589 	
       
  1590 
       
  1591 // -----------------------------------------------------------------------------
       
  1592 // CAspProfileWizardDialog::SetDefaultValuesL
       
  1593 // 
       
  1594 // -----------------------------------------------------------------------------
       
  1595 //
       
  1596 void CAspProfileWizardDialog::SetDefaultValuesL()
       
  1597 	{
       
  1598 	// use existing profile list for name creation
       
  1599 	if (iDialogParam->iProfileList)
       
  1600 		{
       
  1601 	    HBufC* hBuf = CAspProfile::GetNewProfileNameLC(
       
  1602 	                  iDialogParam->iProfileList, iApplicationId);
       
  1603 	    iWizard->SetStringValueL(hBuf->Des(), CAspWizardItem::ETypeProfileName);  
       
  1604 	    CleanupStack::PopAndDestroy(hBuf);
       
  1605 		}
       
  1606 	else
       
  1607 		{
       
  1608 		// create profile list for name creation
       
  1609 	    TAspParam param(EApplicationIdSync, iSyncSession);
       
  1610         CAspProfileList* list =  CAspProfileList::NewLC(param);
       
  1611 	    list->ReadAllProfilesL(CAspProfileList::EBasePropertiesOnly);
       
  1612 	
       
  1613 	    HBufC* hBuf = CAspProfile::GetNewProfileNameLC(list, iApplicationId);
       
  1614 	    iWizard->SetStringValueL(hBuf->Des(), CAspWizardItem::ETypeProfileName);
       
  1615 	    CleanupStack::PopAndDestroy(hBuf);
       
  1616 	
       
  1617 	    CleanupStack::PopAndDestroy(list);
       
  1618 		}
       
  1619 		
       
  1620 	if (iBearerHandler)
       
  1621 		{
       
  1622 		TInt bearerType = iBearerHandler->DefaultBearer();
       
  1623 		iWizard->SetNumberValue(bearerType, CAspWizardItem::ETypeBearerType);
       
  1624 		}
       
  1625 		
       
  1626 	TInt num = EAspProtocol_1_2;
       
  1627 	iWizard->SetNumberValue(num, CAspWizardItem::ETypeProtocolVersion);
       
  1628 	}
       
  1629 
       
  1630 
       
  1631 // -----------------------------------------------------------------------------
       
  1632 // CAspProfileWizardDialog::GetNaviPaneText
       
  1633 //
       
  1634 // Function constructs navi pane text. Text format is:
       
  1635 // "Page %0N/%1N"  (eg "Page 5/6")
       
  1636 // -----------------------------------------------------------------------------
       
  1637 //
       
  1638 void CAspProfileWizardDialog::GetNaviPaneText(TDes& aText, TInt aCurrent, TInt aFinal)
       
  1639 	{
       
  1640     TBuf <KBufSize> buf;
       
  1641     
       
  1642     // replace  %0N with aCurrent
       
  1643     StringLoader::Format(buf, iNaviPaneTextFormat, 0, aCurrent);
       
  1644     
       
  1645     // replace %1N with aFinal
       
  1646     StringLoader::Format(aText, buf, 1, aFinal);
       
  1647     
       
  1648     AknTextUtils::DisplayTextLanguageSpecificNumberConversion(aText);
       
  1649 	}
       
  1650 
       
  1651 
       
  1652 // -----------------------------------------------------------------------------
       
  1653 // CAspProfileWizardDialog::GetNaviPaneText
       
  1654 //
       
  1655 // -----------------------------------------------------------------------------
       
  1656 //
       
  1657 void CAspProfileWizardDialog::GetNaviPaneText(TDes& aText, CAspWizardItem* aItem)
       
  1658 	{
       
  1659     TInt total = iWizard->NumOfEnabledItems();
       
  1660     total--; // start page not included in page count
       
  1661     
       
  1662     TInt current = iWizard->NumOfCurrentItem(aItem);
       
  1663     current--; // start page not included in page count
       
  1664 
       
  1665     GetNaviPaneText(aText, current, total);
       
  1666 	}
       
  1667 
       
  1668 
       
  1669 // -----------------------------------------------------------------------------
       
  1670 // CAspProfileWizardDialog::UpdateCbaL
       
  1671 // 
       
  1672 // -----------------------------------------------------------------------------
       
  1673 //
       
  1674 void CAspProfileWizardDialog::UpdateCbaL(TInt aResourceId)
       
  1675     {
       
  1676     CEikButtonGroupContainer& cba = ButtonGroupContainer();
       
  1677     cba.SetCommandSetL(aResourceId);
       
  1678     cba.DrawDeferred();
       
  1679     }
       
  1680 
       
  1681 
       
  1682 // -----------------------------------------------------------------------------
       
  1683 // CAspProfileWizardDialog::SetTextEditorTextL
       
  1684 //
       
  1685 // -----------------------------------------------------------------------------
       
  1686 //
       
  1687 void CAspProfileWizardDialog::SetTextEditorTextL(TInt aResource)
       
  1688 	{
       
  1689 	if(iTextEditorText)
       
  1690 		{
       
  1691 		delete iTextEditorText;
       
  1692 		iTextEditorText = NULL;		
       
  1693 		}
       
  1694 	if (iMoveBack)
       
  1695 		{
       
  1696 		TRect mainPane;
       
  1697     	AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPane);        
       
  1698     	iTextEditor->SetRect(mainPane);
       
  1699 		}
       
  1700 	iTextEditorText = CAspResHandler::ReadL(aResource);
       
  1701 	UpdateTextColorL() ;
       
  1702 	iTextEditor->SetTextL(iTextEditorText);
       
  1703 	}
       
  1704 
       
  1705 
       
  1706 // -----------------------------------------------------------------------------
       
  1707 // CAspProfileWizardDialog::ShowPopupNote
       
  1708 //
       
  1709 // -----------------------------------------------------------------------------
       
  1710 //
       
  1711 void CAspProfileWizardDialog::ShowPopupNoteL(TInt aResource, TInt aDelay) 
       
  1712     {
       
  1713     if (aResource != KErrNotFound)
       
  1714     	{
       
  1715     	HBufC* hBuf = CAspResHandler::ReadLC(aResource);    
       
  1716         iPopupNote->SetTextL(hBuf->Des());
       
  1717         CleanupStack::PopAndDestroy(hBuf);
       
  1718     	}
       
  1719     	
       
  1720     iPopupNote->SetTimePopupInView(KMsTimePopupInView);    
       
  1721     iPopupNote->SetTimeDelayBeforeShow(aDelay);
       
  1722     iPopupNote->ShowInfoPopupNote();    
       
  1723     }
       
  1724 
       
  1725 
       
  1726 // -----------------------------------------------------------------------------
       
  1727 // CAspProfileWizardDialog::HidePopupNote
       
  1728 //
       
  1729 // -----------------------------------------------------------------------------
       
  1730 //
       
  1731 void CAspProfileWizardDialog::HidePopupNote() 
       
  1732     {
       
  1733     iPopupNote->HideInfoPopupNote();
       
  1734     }
       
  1735 
       
  1736 
       
  1737 // -----------------------------------------------------------------------------
       
  1738 // CAspProfileWizardDialog::ShowErrorNoteL
       
  1739 //
       
  1740 // -----------------------------------------------------------------------------
       
  1741 //
       
  1742 void CAspProfileWizardDialog::ShowErrorNoteL(TInt aError)
       
  1743 	{
       
  1744 	if (aError == KErrNoMemory || aError == KErrDiskFull)
       
  1745 		{
       
  1746 		CTextResolver* tr = CTextResolver::NewLC();
       
  1747 		iBuf = tr->ResolveErrorString(aError, CTextResolver::ECtxNoCtxNoSeparator);
       
  1748      	CleanupStack::PopAndDestroy(tr);
       
  1749 		}
       
  1750 	else
       
  1751 		{
       
  1752 		CAspResHandler::ReadL(iBuf, R_ASP_LOG_ERR_PROFILE_WIZARD);
       
  1753 		}
       
  1754 		
       
  1755     TDialogUtil::ShowErrorNoteL(iBuf);
       
  1756 	}
       
  1757 
       
  1758 // -----------------------------------------------------------------------------
       
  1759 // CAspProfileWizardDialog::SetBackgroundContextL
       
  1760 //
       
  1761 // -----------------------------------------------------------------------------
       
  1762 //
       
  1763 void CAspProfileWizardDialog::SetBackgroundContextL( )
       
  1764 {
       
  1765 	TRect mainPane( 0,0,0,0 );
       
  1766 		
       
  1767 	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, mainPane );
       
  1768 	
       
  1769 	if (iBgContext)
       
  1770 		{
       
  1771 		delete iBgContext ;
       
  1772 		iBgContext = NULL ;
       
  1773 		}
       
  1774 	
       
  1775 	iBgContext = CAknsBasicBackgroundControlContext::NewL( 
       
  1776                         KAknsIIDQsnBgAreaMain, mainPane, EFalse );
       
  1777 		
       
  1778 	iTextEditor->SetSkinBackgroundControlContextL( iBgContext );                            
       
  1779 }
       
  1780 
       
  1781 
       
  1782 // -----------------------------------------------------------------------------
       
  1783 // CAspProfileWizardDialog::UpdateTextColorL
       
  1784 //
       
  1785 // -----------------------------------------------------------------------------
       
  1786 //
       
  1787 void CAspProfileWizardDialog::UpdateTextColorL() 
       
  1788 	{
       
  1789 	TRgb textColor( KRgbBlack );
       
  1790 	AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), 
       
  1791 	                           textColor,
       
  1792 	                           KAknsIIDQsnTextColors,
       
  1793 	                           EAknsCIQsnTextColorsCG6 );
       
  1794 
       
  1795 
       
  1796 	const CFont* sysfont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); 
       
  1797 	TFontSpec sysfontspec = sysfont->FontSpecInTwips();
       
  1798 
       
  1799 	TCharFormat charFormat;
       
  1800 	TCharFormatMask charFormatMask;
       
  1801 	charFormat.iFontSpec = sysfontspec;
       
  1802 
       
  1803 	charFormat.iFontPresentation.iTextColor = textColor; 
       
  1804 	charFormatMask.SetAll();
       
  1805 	charFormatMask.SetAttrib( EAttFontHeight );
       
  1806 	charFormatMask.SetAttrib( EAttColor );
       
  1807 	CCharFormatLayer* formatLayer = CCharFormatLayer::NewL(charFormat, charFormatMask);
       
  1808 	iTextEditor->SetCharFormatLayer(formatLayer);
       
  1809 	}
       
  1810 
       
  1811 //  End of File