omads/omadsappui/AspSyncUtil/src/AspProfileWizard.cpp
branchRCL_3
changeset 52 4f0867e42d62
parent 0 dab8a81a92de
equal deleted inserted replaced
51:8e7494275d3a 52:4f0867e42d62
       
     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 
       
    21 #include "AspProfileWizard.h"
       
    22 #include "AspUtil.h"
       
    23 #include "AspDebug.h"
       
    24 #include "AspSyncUtil.rh"
       
    25 
       
    26 
       
    27 #include <textresolver.h>
       
    28 #include <applayout.cdl.h>      // Multiline_Message_writing_texts_Line_3
       
    29 #include <aknlayoutscalable_apps.cdl.h>
       
    30 
       
    31 				 
       
    32 
       
    33 
       
    34 
       
    35 /*******************************************************************************
       
    36  * class CAspWizardItem
       
    37  *******************************************************************************/
       
    38 
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CAspWizardItem::NewL
       
    42 //
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CAspWizardItem* CAspWizardItem::NewL()
       
    47     {
       
    48     CAspWizardItem* self = new (ELeave) CAspWizardItem();
       
    49 	CleanupStack::PushL(self);
       
    50 	self->ConstructL();
       
    51 	CleanupStack::Pop(self);
       
    52 	return self;
       
    53     }
       
    54 
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // Destructor
       
    58 //
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CAspWizardItem::~CAspWizardItem()
       
    62     {
       
    63     if (iValue)
       
    64 		{
       
    65 		delete iValue;
       
    66 		iValue = NULL ;
       
    67 		}
       
    68     delete iContentName;
       
    69     delete iHeader;
       
    70     }
       
    71 
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CAspWizardItem::CAspWizardItem
       
    75 //
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 CAspWizardItem::CAspWizardItem()
       
    79     {
       
    80     }
       
    81 
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CAspWizardItem::ConstructL
       
    85 //
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void CAspWizardItem::ConstructL()
       
    89     {
       
    90 	InitL();
       
    91     }
       
    92 
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CAspWizardItem::SetValueL
       
    96 //
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void CAspWizardItem::SetValueL(const TDesC& aText)
       
   100 	{
       
   101 	if (iValue)
       
   102 		{
       
   103 		delete iValue;
       
   104 		iValue = NULL;
       
   105 		}
       
   106 	iValue = aText.AllocL();
       
   107 	}
       
   108 
       
   109 
       
   110 // -----------------------------------------------------------------------------
       
   111 // CAspWizardItem::Value
       
   112 //
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 const TDesC& CAspWizardItem::Value()
       
   116 	{
       
   117 	__ASSERT_ALWAYS(iValue, TUtil::Panic(KErrGeneral));
       
   118 		
       
   119 	return *iValue;
       
   120 	}
       
   121 
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CAspWizardItem::SetContentNameL
       
   125 //
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 void CAspWizardItem::SetContentNameL(const TDesC& aText)
       
   129 	{
       
   130 	delete iContentName;
       
   131 	iContentName = NULL;
       
   132 	iContentName = aText.AllocL();
       
   133 	}
       
   134 
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CAspWizardItem::ContentName
       
   138 //
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 const TDesC& CAspWizardItem::ContentName()
       
   142 	{
       
   143 	__ASSERT_ALWAYS(iContentName, TUtil::Panic(KErrGeneral));
       
   144 		
       
   145 	return *iContentName;
       
   146 	}
       
   147 
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CAspWizardItem::SetHeaderL
       
   151 //
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 void CAspWizardItem::SetHeaderL(const TDesC& aText)
       
   155 	{
       
   156 	delete iHeader;
       
   157 	iHeader = NULL;
       
   158 	iHeader = aText.AllocL();
       
   159 	}
       
   160 
       
   161 
       
   162 // -----------------------------------------------------------------------------
       
   163 // CAspWizardItem::SetHeaderL
       
   164 //
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 void CAspWizardItem::SetHeaderL(TInt aResourceId)
       
   168 	{
       
   169 	delete iHeader;
       
   170 	iHeader = NULL;
       
   171 	iHeader = CAspResHandler::ReadL(aResourceId);
       
   172 	}
       
   173 
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CAspWizardItem::Header
       
   177 //
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 const TDesC& CAspWizardItem::Header()
       
   181 	{
       
   182 	__ASSERT_ALWAYS(iHeader, TUtil::Panic(KErrGeneral));
       
   183 		
       
   184 	return *iHeader;
       
   185 	}
       
   186 
       
   187 
       
   188 // -----------------------------------------------------------------------------
       
   189 // CAspWizardItem::InitL
       
   190 //
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 void CAspWizardItem::InitL()
       
   194 	{
       
   195 	iSettingType = KErrNotFound;
       
   196 	iSettingId = KErrNotFound;
       
   197 	iResourceId = KErrNotFound;
       
   198 	iPopupNoteResourceId = KErrNotFound;
       
   199 	iErrorNoteResourceId = KErrNotFound;
       
   200 	iEnabled = ETrue;
       
   201 	iMaxLength = 0;
       
   202 	iMandatory = ETrue;
       
   203 	iLatinInput = ETrue;  // accept only western chars
       
   204 	iNumber = 0;
       
   205 	SetValueL(KNullDesC);
       
   206 	SetContentNameL(KNullDesC);
       
   207 	SetHeaderL(KNullDesC);
       
   208     }
       
   209 
       
   210 
       
   211 	
       
   212 	
       
   213 
       
   214 /*******************************************************************************
       
   215  * class CAspProfileWizard
       
   216  *******************************************************************************/
       
   217 
       
   218 
       
   219 
       
   220 
       
   221 // -----------------------------------------------------------------------------
       
   222 // CAspProfileWizard::NewL
       
   223 //
       
   224 // -----------------------------------------------------------------------------
       
   225 CAspProfileWizard* CAspProfileWizard::NewL(TAspParam& aParam)
       
   226     {
       
   227     CAspProfileWizard* self = new (ELeave) CAspProfileWizard(aParam);
       
   228     CleanupStack::PushL(self);
       
   229     self->ConstructL();
       
   230     CleanupStack::Pop(self);
       
   231 
       
   232     return(self);
       
   233     }
       
   234 
       
   235 
       
   236 // -----------------------------------------------------------------------------
       
   237 // CAspProfileWizard::CAspProfileWizard
       
   238 // 
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 CAspProfileWizard::CAspProfileWizard(TAspParam& aParam)
       
   242 	{
       
   243 	iApplicationId = aParam.iApplicationId;
       
   244 	iSyncSession = aParam.iSyncSession;
       
   245 	
       
   246 	iDialogParam = &aParam;
       
   247 	iProfileId = KErrNotFound;
       
   248 	iCurrentItemIndex = 0;
       
   249 
       
   250 	__ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrArgument));
       
   251     }
       
   252 
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 // CAspProfileWizard::ConstructL
       
   256 //
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 void CAspProfileWizard::ConstructL()
       
   260     {
       
   261     TAspParam param(iApplicationId, iSyncSession);
       
   262 	param.iMode = CAspContentList::EInitDataProviders;
       
   263 	iContentList = CAspContentList::NewL(param);
       
   264 
       
   265    	// get email syncml mailboxes
       
   266    	iLocalDataStores = new (ELeave) CDesCArrayFlat(KDefaultArraySize);
       
   267 	iContentList->GetLocalDatabaseList(KUidNSmlAdapterEMail.iUid, iLocalDataStores);
       
   268 
       
   269     CreateSettingListL();
       
   270 
       
   271     SetContentEnabled(iApplicationId);
       
   272 
       
   273    	if (iLocalDataStores->Count() == 0)
       
   274    		{
       
   275    		SetContentEnabled(KUidNSmlAdapterEMail.iUid, EFalse);
       
   276    		}
       
   277    	TBool emailEnabled = ContentEnabled(KUidNSmlAdapterEMail.iUid);
       
   278 	SetContentLocalDatabaseEnabled(KUidNSmlAdapterEMail.iUid, emailEnabled);
       
   279 	
       
   280 	if (iApplicationId == EApplicationIdEmail)
       
   281 		{
       
   282 		SetEnabled(CAspWizardItem::ETypeProtocolVersion, EFalse);
       
   283 		}
       
   284     } 
       
   285 
       
   286 
       
   287 // ----------------------------------------------------------------------------
       
   288 // Destructor
       
   289 //
       
   290 // ----------------------------------------------------------------------------
       
   291 //
       
   292 CAspProfileWizard::~CAspProfileWizard()
       
   293     {
       
   294     delete iLocalDataStores;
       
   295     
       
   296     iSettingList.ResetAndDestroy();
       
   297     iSettingList.Close();
       
   298     
       
   299     delete iContentList;
       
   300     }
       
   301 
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CAspProfileWizard::CreateSettingListL
       
   305 //
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 void CAspProfileWizard::CreateSettingListL()
       
   309     {
       
   310     TInt localDbCount = iLocalDataStores->Count();
       
   311     
       
   312 	CAspWizardItem* item = CAspWizardItem::NewL();
       
   313 	item->iSettingType = CAspWizardItem::ETypeStart;
       
   314 	item->iResourceId = R_ASP_SET_WIZARD_START;
       
   315 	item->SetHeaderL(item->iResourceId);
       
   316 	item->iEnabled = ETrue; // start must always be enabled
       
   317 	iSettingList.Append(item);
       
   318 
       
   319 	item = CAspWizardItem::NewL();
       
   320 	item->iSettingType = CAspWizardItem::ETypeProfileName;
       
   321 	item->iResourceId = R_ASP_SET_DESTINATION_NAME;
       
   322 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_PROFILE_NAME;
       
   323 	item->iErrorNoteResourceId = R_ASP_NOTE_PROFILE_NAME_MISSING;
       
   324 	item->SetHeaderL(item->iResourceId);
       
   325 	item->iMaxLength = KAspMaxProfileNameLength;
       
   326 	item->iLatinInput = EFalse; // accept also non-western chars
       
   327 	iSettingList.Append(item);
       
   328 
       
   329 	item = CAspWizardItem::NewL();
       
   330 	item->iSettingType = CAspWizardItem::ETypeProtocolVersion;
       
   331 	item->iResourceId = R_ASP_SET_PROTOCOL_VERSION;
       
   332 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_PROTOCOL_VERSION;
       
   333 	item->SetHeaderL(item->iResourceId);
       
   334 	iSettingList.Append(item);
       
   335 
       
   336 	item = CAspWizardItem::NewL();
       
   337 	item->iSettingType = CAspWizardItem::ETypeContentSelection;
       
   338 	item->iResourceId = R_ASP_SET_CONTENT_SELECTION;
       
   339 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_CONTENT_SELECTION;
       
   340 	item->SetHeaderL(item->iResourceId);
       
   341     iSettingList.Append(item);
       
   342 
       
   343     TInt count = iContentList->ProviderCount();
       
   344 	for (TInt i=0; i<count; i++)
       
   345 		{
       
   346 		TAspProviderItem& p = iContentList->ProviderItem(i);
       
   347 	
       
   348 	    //if (p.iDataProviderId == KUidNSmlAdapterEMail.iUid && localDbCount == 0)
       
   349 	    //	{
       
   350 	    //	continue; // leave email out - no email SyncML mailboxes found
       
   351 	    //	}
       
   352 	    
       
   353 	    item = CAspWizardItem::NewL();
       
   354 	    item->iSettingType = CAspWizardItem::ETypeSyncContent;
       
   355 	    item->iSettingId = p.iDataProviderId;
       
   356 	    item->iResourceId = 
       
   357 	          CAspResHandler::RemoteDatabaseHeaderId(p.iDataProviderId);
       
   358 	    item->iPopupNoteResourceId = 
       
   359 	          ContentPopupNoteResourceId(p.iDataProviderId);
       
   360 	    
       
   361 	    if (p.iDataProviderId == KUidNSmlAdapterContact.iUid)
       
   362             {
       
   363             item->iErrorNoteResourceId = R_ASP_NOTE_CONTACTS_DB_MISSING;
       
   364             }
       
   365         else if (p.iDataProviderId == KUidNSmlAdapterCalendar.iUid)
       
   366             {
       
   367             item->iErrorNoteResourceId = R_ASP_NOTE_CALENDAR_DB_MISSING;
       
   368             }
       
   369         else if (p.iDataProviderId == KUidNSmlAdapterSms.iUid)
       
   370             {
       
   371             item->iErrorNoteResourceId = R_ASP_NOTE_SMS_DATABASE_MISSING;
       
   372             }
       
   373         else if (p.iDataProviderId == KUidNSmlAdapterMMS.iUid)
       
   374             {
       
   375             item->iErrorNoteResourceId = R_ASP_NOTE_MMS_DATABASE_MISSING;
       
   376             }
       
   377         else if (p.iDataProviderId == KUidNSmlAdapterNote.iUid)
       
   378             {
       
   379             item->iErrorNoteResourceId = R_ASP_NOTE_NOTES_DB_MISSING;
       
   380             }
       
   381         else if (p.iDataProviderId == KUidNSmlAdapterBookmarks.iUid)
       
   382             {
       
   383             item->iErrorNoteResourceId = R_ASP_NOTE_BKM_DATABASE_MISSING;
       
   384             }
       
   385         else
       
   386             {
       
   387             item->iErrorNoteResourceId = R_ASP_NOTE_REMOTE_DATABASE_MISSING;
       
   388             }
       
   389 	    item->SetHeaderL(item->iResourceId);
       
   390 	    item->iMaxLength = KAspMaxRemoteNameLength;
       
   391 	    
       
   392 	    HBufC* hBuf = CAspResHandler::GetContentNameLC(p.iDataProviderId, p.iDisplayName);
       
   393 	    item->SetContentNameL(hBuf->Des());
       
   394         CleanupStack::PopAndDestroy(hBuf);
       
   395 	    
       
   396         iSettingList.Append(item);
       
   397         
       
   398         if (p.iDataProviderId == KUidNSmlAdapterEMail.iUid && localDbCount > 1)
       
   399         	{
       
   400 	        item = CAspWizardItem::NewL();
       
   401 	        item->iSettingType = CAspWizardItem::ETypeSyncContentLocalDatabase;
       
   402 	        item->iSettingId = p.iDataProviderId;
       
   403 	        item->iResourceId = R_ASP_LOCAL_DATABASE_EML;
       
   404 	        item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_EMAIL_LOCAL_DB;
       
   405 	        item->SetHeaderL(item->iResourceId);
       
   406     
       
   407             iSettingList.Append(item);
       
   408         	}
       
   409 		}
       
   410 
       
   411 	item = CAspWizardItem::NewL();
       
   412 	item->iSettingType = CAspWizardItem::ETypeBearerType;
       
   413 	item->iResourceId = R_ASP_SET_BEARER_TYPE;
       
   414 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_CONNECTION_TYPE;
       
   415 	item->SetHeaderL(item->iResourceId);
       
   416     iSettingList.Append(item);
       
   417 
       
   418 	item = CAspWizardItem::NewL();
       
   419 	item->iSettingType = CAspWizardItem::ETypeHostAddress;
       
   420 	item->iResourceId = R_ASP_SET_HOST_ADDRESS;
       
   421 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_HOST_ADDRESS;
       
   422 	item->iErrorNoteResourceId = R_ASP_NOTE_HOST_ADDRESS_MISSING;
       
   423 	item->SetHeaderL(item->iResourceId);
       
   424 	item->iMaxLength = KAspMaxURILength;
       
   425     iSettingList.Append(item);
       
   426 
       
   427 	item = CAspWizardItem::NewL();
       
   428 	item->iSettingType = CAspWizardItem::ETypeServerId;
       
   429 	item->iResourceId = R_ASP_SET_SERVER_ID;
       
   430 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_SERVER_ID;
       
   431 	item->iErrorNoteResourceId = KErrNotFound;
       
   432 	item->SetHeaderL(item->iResourceId);
       
   433 	item->iMaxLength = KAspMaxServerIdLength;
       
   434     iSettingList.Append(item);
       
   435 
       
   436 	item = CAspWizardItem::NewL();
       
   437 	item->iSettingType = CAspWizardItem::ETypeUserName;
       
   438 	item->iResourceId = R_ASP_SET_USERNAME;
       
   439 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_USERNAME;
       
   440 	item->iErrorNoteResourceId = R_ASP_NOTE_USERNAME_MISSING;
       
   441 	item->SetHeaderL(item->iResourceId);
       
   442 	item->iMaxLength = KAspMaxUsernameLength;
       
   443     iSettingList.Append(item);
       
   444 
       
   445 	item = CAspWizardItem::NewL();
       
   446 	item->iSettingType = CAspWizardItem::ETypePassword;
       
   447 	item->iResourceId = R_ASP_SET_PASSWORD;
       
   448 	item->iPopupNoteResourceId = R_ASP_WIZARD_POPUP_PASSWORD;
       
   449 	item->iErrorNoteResourceId = R_ASP_NOTE_PASSWORD_MISSING;
       
   450 	item->SetHeaderL(item->iResourceId);
       
   451 	item->iMaxLength = KAspMaxPasswordLength;
       
   452     iSettingList.Append(item);
       
   453     
       
   454 	item = CAspWizardItem::NewL();
       
   455 	item->iSettingType = CAspWizardItem::ETypeEnd;
       
   456 	item->iResourceId = R_ASP_SET_WIZARD_END;
       
   457 	item->SetHeaderL(item->iResourceId);
       
   458 	item->iEnabled = ETrue; // end must always be enabled
       
   459 	iSettingList.Append(item);
       
   460     } 
       
   461 
       
   462 
       
   463 // -----------------------------------------------------------------------------
       
   464 // CAspProfileWizard::ContentPopupNoteResourceId
       
   465 // 
       
   466 // -----------------------------------------------------------------------------
       
   467 //
       
   468 TInt CAspProfileWizard::ContentPopupNoteResourceId(TInt aDataProviderId)
       
   469 	{
       
   470 	TInt ret = R_ASP_WIZARD_POPUP_REMOTE_DB;
       
   471 	
       
   472 	if (aDataProviderId == KUidNSmlAdapterContact.iUid)
       
   473 		{
       
   474 		ret = R_ASP_WIZARD_POPUP_CONTACTS_DB;
       
   475 		}
       
   476 	if (aDataProviderId == KUidNSmlAdapterCalendar.iUid)
       
   477 		{
       
   478 		ret = R_ASP_WIZARD_POPUP_CALENDAR_DB;
       
   479 		}
       
   480 	else if (aDataProviderId == KUidNSmlAdapterEMail.iUid)
       
   481 		{
       
   482 		ret = R_ASP_WIZARD_POPUP_EMAIL_DB;
       
   483 		}
       
   484 	else if (aDataProviderId == KUidNSmlAdapterNote.iUid)
       
   485 		{
       
   486     	ret = R_ASP_WIZARD_POPUP_NOTES_DB;
       
   487 		}
       
   488 	else if (aDataProviderId == KUidNSmlAdapterSms.iUid)
       
   489 		{
       
   490     	ret = R_ASP_WIZARD_POPUP_SMS_DB;
       
   491 		}
       
   492 	else if (aDataProviderId == KUidNSmlAdapterMMS.iUid)
       
   493 		{
       
   494     	ret = R_ASP_WIZARD_POPUP_MMS_DB;
       
   495 		}
       
   496 	else if (aDataProviderId == KUidNSmlAdapterBookmarks.iUid)
       
   497 		{
       
   498     	ret = R_ASP_WIZARD_POPUP_BKM_DB;
       
   499 		}
       
   500     
       
   501 
       
   502     return ret;
       
   503 	}
       
   504 
       
   505 
       
   506 //------------------------------------------------------------------------------
       
   507 // CAspProfileWizard::GetContentSelectionL
       
   508 // 
       
   509 // Construct CSelectionItemList from setting list.
       
   510 //------------------------------------------------------------------------------
       
   511 //
       
   512 void CAspProfileWizard::GetContentSelectionL(CSelectionItemList* aList)
       
   513 	{
       
   514 	TInt count = iSettingList.Count();
       
   515 	for (TInt i=0; i<count; i++)
       
   516 		{
       
   517 		CAspWizardItem* item = iSettingList[i];
       
   518 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   519 			{
       
   520 	        TBuf<KBufSize> buf(item->ContentName());
       
   521 	        CSelectableItem* selectableItem = new (ELeave) CSelectableItem(
       
   522 	                                          buf, item->iEnabled);
       
   523    	        CleanupStack::PushL(selectableItem);
       
   524 	        selectableItem->ConstructL();
       
   525 	        aList->AppendL(selectableItem);
       
   526 	        CleanupStack::Pop(selectableItem);
       
   527 			}
       
   528 		}
       
   529 	}
       
   530 
       
   531 
       
   532 //------------------------------------------------------------------------------
       
   533 // CAspProfileWizard::SetContentSelectionL
       
   534 // 
       
   535 // Update setting list from CSelectionItemList.
       
   536 //------------------------------------------------------------------------------
       
   537 //
       
   538 void CAspProfileWizard::SetContentSelectionL(CSelectionItemList* aList)
       
   539 	{
       
   540 	TInt count = aList->Count();
       
   541 	
       
   542 	for (TInt i=0; i<count; i++)
       
   543 		{
       
   544 		CSelectableItem* selectableItem = (*aList)[i];
       
   545 		TBool selected = selectableItem->SelectionStatus();
       
   546 		SetContentEnabled(selectableItem->ItemText(), selected);
       
   547 		}
       
   548 		
       
   549 	TBool emailEnabled = ContentEnabled(KUidNSmlAdapterEMail.iUid);
       
   550 	SetContentLocalDatabaseEnabled(KUidNSmlAdapterEMail.iUid, emailEnabled);
       
   551     }
       
   552 
       
   553 
       
   554 //------------------------------------------------------------------------------
       
   555 // CAspProfileWizard::SetContentEnabled
       
   556 // 
       
   557 //------------------------------------------------------------------------------
       
   558 //
       
   559 void CAspProfileWizard::SetContentEnabled(const TDesC& aText, TBool aEnabled)
       
   560 	{
       
   561 	TInt count = iSettingList.Count();
       
   562 	for (TInt i=0; i<count; i++)
       
   563 		{
       
   564 		CAspWizardItem* item = iSettingList[i];
       
   565 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   566 			{
       
   567 	        TPtrC ptr = item->ContentName();
       
   568 	        if (ptr.Compare(aText) == 0)
       
   569 	        	{
       
   570 	        	item->iEnabled = aEnabled;
       
   571 	        	break;
       
   572 	        	}
       
   573 			}
       
   574 		}
       
   575 	}
       
   576 
       
   577 
       
   578 //------------------------------------------------------------------------------
       
   579 // CAspProfileWizard::ContentId
       
   580 // 
       
   581 //------------------------------------------------------------------------------
       
   582 //
       
   583 TInt CAspProfileWizard::ContentId(const TDesC& aText)
       
   584 	{
       
   585 	TInt count = iSettingList.Count();
       
   586 	for (TInt i=0; i<count; i++)
       
   587 		{
       
   588 		CAspWizardItem* item = iSettingList[i];
       
   589 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   590 			{
       
   591 	        TPtrC ptr = item->ContentName();
       
   592 	        if (ptr.Compare(aText) == 0)
       
   593 	        	{
       
   594 	        	return item->iSettingId;
       
   595 	        	}
       
   596 			}
       
   597 		}
       
   598 		
       
   599 	return KErrNotFound;
       
   600 	}
       
   601 
       
   602 
       
   603 //------------------------------------------------------------------------------
       
   604 // CAspProfileWizard::SetContentEnabled
       
   605 // 
       
   606 //------------------------------------------------------------------------------
       
   607 //
       
   608 void CAspProfileWizard::SetContentEnabled(TInt aApplicationId)
       
   609 	{
       
   610 	TInt count = iSettingList.Count();
       
   611 	for (TInt i=0; i<count; i++)
       
   612 		{
       
   613 		CAspWizardItem* item = iSettingList[i];
       
   614 		if (item->iSettingType != CAspWizardItem::ETypeSyncContent)
       
   615 			{
       
   616 			continue;
       
   617 			}
       
   618 		
       
   619 		if (aApplicationId == EApplicationIdSync)
       
   620 			{
       
   621 			item->iEnabled = ETrue; // sync app enables all contents
       
   622 			}
       
   623 		else
       
   624 			{
       
   625 			TInt appId = TUtil::AppIdFromProviderId(item->iSettingId);
       
   626 		    if (appId == aApplicationId)
       
   627 			    {
       
   628 			    item->iEnabled = ETrue;
       
   629 			    }
       
   630 		    else
       
   631 			    {
       
   632 			    item->iEnabled = EFalse;
       
   633 			    }
       
   634 			}
       
   635 		}
       
   636 		
       
   637 	if (aApplicationId != EApplicationIdSync)
       
   638 		{
       
   639 		// only sync app shows content selection page
       
   640 		SetEnabled(CAspWizardItem::ETypeContentSelection, EFalse);
       
   641 		}
       
   642 	}
       
   643 
       
   644 
       
   645 //------------------------------------------------------------------------------
       
   646 // CAspProfileWizard::SetContentLocalDatabaseEnabled
       
   647 // 
       
   648 //------------------------------------------------------------------------------
       
   649 //
       
   650 void CAspProfileWizard::SetContentLocalDatabaseEnabled(TInt aDataproviderId, TBool aEnabled)
       
   651 	{
       
   652 	TInt count = iSettingList.Count();
       
   653 	for (TInt i=0; i<count; i++)
       
   654 		{
       
   655 		CAspWizardItem* item = iSettingList[i];
       
   656 		if (item->iSettingType == CAspWizardItem::ETypeSyncContentLocalDatabase)
       
   657 			{
       
   658 			if (item->iSettingId == aDataproviderId)
       
   659 			    {
       
   660 			    item->iEnabled = aEnabled;
       
   661 			    }
       
   662 			}
       
   663 		}
       
   664 	}
       
   665 
       
   666 
       
   667 //------------------------------------------------------------------------------
       
   668 // CAspProfileWizard::SetContentEnabled
       
   669 // 
       
   670 //------------------------------------------------------------------------------
       
   671 //
       
   672 void CAspProfileWizard::SetContentEnabled(TInt aDataproviderId, TBool aEnabled)
       
   673 	{
       
   674 	TInt count = iSettingList.Count();
       
   675 	for (TInt i=0; i<count; i++)
       
   676 		{
       
   677 		CAspWizardItem* item = iSettingList[i];
       
   678 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   679 			{
       
   680 			if (item->iSettingId == aDataproviderId)
       
   681 			    {
       
   682 			    item->iEnabled = aEnabled;
       
   683 			    }
       
   684 			}
       
   685 		}
       
   686 	}
       
   687 
       
   688 
       
   689 //------------------------------------------------------------------------------
       
   690 // CAspProfileWizard::ContentEnabled
       
   691 // 
       
   692 //------------------------------------------------------------------------------
       
   693 //
       
   694 TBool CAspProfileWizard::ContentEnabled(TInt aDataproviderId)
       
   695 	{
       
   696 	TInt count = iSettingList.Count();
       
   697 	for (TInt i=0; i<count; i++)
       
   698 		{
       
   699 		CAspWizardItem* item = iSettingList[i];
       
   700 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   701 			{
       
   702 			if (item->iSettingId == aDataproviderId)
       
   703 			    {
       
   704 			    return item->iEnabled;
       
   705 			    }
       
   706 			}
       
   707 		}
       
   708 		
       
   709 	return EFalse;
       
   710 	}
       
   711 
       
   712 
       
   713 //------------------------------------------------------------------------------
       
   714 // CAspProfileWizard::SetContentEnabled
       
   715 // 
       
   716 //------------------------------------------------------------------------------
       
   717 //
       
   718 void CAspProfileWizard::SetContentEnabled(RArray<TInt>& aDataProviderArray)
       
   719 	{
       
   720 	TInt count = iSettingList.Count();
       
   721 	for (TInt i=0; i<count; i++)
       
   722 		{
       
   723 		CAspWizardItem* item = iSettingList[i];
       
   724 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   725 			{
       
   726 			item->iEnabled = EFalse;
       
   727 			if (aDataProviderArray.Find(item->iSettingId) != KErrNotFound)
       
   728 				{
       
   729 				item->iEnabled = ETrue;
       
   730 				}
       
   731 			}
       
   732 		}
       
   733 	}
       
   734 
       
   735 
       
   736 //------------------------------------------------------------------------------
       
   737 // CAspProfileWizard::GetContentEnabled
       
   738 // 
       
   739 //------------------------------------------------------------------------------
       
   740 //
       
   741 void CAspProfileWizard::GetContentEnabled(RArray<TInt>& aDataProviderArray)
       
   742 	{
       
   743 	aDataProviderArray.Reset();
       
   744 	
       
   745 	TInt count = iSettingList.Count();
       
   746 	for (TInt i=0; i<count; i++)
       
   747 		{
       
   748 		CAspWizardItem* item = iSettingList[i];
       
   749 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   750 			{
       
   751 			if (item->iEnabled)
       
   752 				{
       
   753 				aDataProviderArray.Append(item->iSettingId);
       
   754 				}
       
   755 			}
       
   756 		}
       
   757 	}
       
   758 
       
   759 
       
   760 //------------------------------------------------------------------------------
       
   761 // CAspProfileWizard::GetContentName
       
   762 // 
       
   763 //------------------------------------------------------------------------------
       
   764 //
       
   765 void CAspProfileWizard::GetContentName(TDes& aText)
       
   766 	{
       
   767 	aText = KNullDesC;
       
   768 	
       
   769 	TInt count = iSettingList.Count();
       
   770 	for (TInt i=0; i<count; i++)
       
   771 		{
       
   772 		CAspWizardItem* item = iSettingList[i];
       
   773 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   774 			{
       
   775 			if (item->iEnabled)
       
   776 				{
       
   777 				aText = item->ContentName();
       
   778 				}
       
   779 			}
       
   780 		}
       
   781 	}
       
   782 
       
   783 
       
   784 //------------------------------------------------------------------------------
       
   785 // CAspProfileWizard::SetEnabled
       
   786 // 
       
   787 //------------------------------------------------------------------------------
       
   788 //
       
   789 void CAspProfileWizard::SetEnabled(TInt aSettingType, TBool aEnabled)
       
   790 	{
       
   791 	TInt count = iSettingList.Count();
       
   792 	for (TInt i=0; i<count; i++)
       
   793 		{
       
   794 		CAspWizardItem* item = iSettingList[i];
       
   795 		if (item->iSettingType == aSettingType)
       
   796 			{
       
   797         	item->iEnabled = aEnabled;
       
   798         	break;
       
   799 			}
       
   800 		}
       
   801 	}
       
   802 
       
   803 
       
   804 //------------------------------------------------------------------------------
       
   805 // CAspProfileWizard::DeleteProfile
       
   806 //
       
   807 //------------------------------------------------------------------------------
       
   808 //
       
   809 void CAspProfileWizard::DeleteProfile()
       
   810 	{
       
   811 	FLOG( _L("CAspProfileWizard::DeleteProfile START") );
       
   812 	
       
   813 	if (iProfileId != KErrNotFound)
       
   814 		{
       
   815 		TRAPD(err, iSyncSession->DeleteProfileL(iProfileId));
       
   816 		iProfileId = KErrNotFound;
       
   817 		
       
   818 		if (err != KErrNone)
       
   819 			{
       
   820 			FLOG( _L("### RSyncMLSession::DeleteProfileL failed (%d) ###"), err );
       
   821 			}
       
   822 		}
       
   823 		
       
   824 	FLOG( _L("CAspProfileWizard::DeleteProfile END") );
       
   825     }
       
   826 
       
   827 
       
   828 //------------------------------------------------------------------------------
       
   829 // CAspProfileWizard::CreateProfileL
       
   830 //
       
   831 //------------------------------------------------------------------------------
       
   832 //
       
   833 void CAspProfileWizard::CreateProfileL()
       
   834 	{
       
   835 	FLOG( _L("CAspProfileWizard::CreateProfileL START") );
       
   836 	
       
   837 	TAspParam param(iApplicationId, iSyncSession);
       
   838 	CAspProfile* profile = CAspProfile::NewLC(param);
       
   839 	
       
   840 	iProfileId = KErrNotFound;
       
   841 	profile->CreateL(CAspProfile::EAllProperties);
       
   842 	iProfileId = profile->ProfileId();
       
   843 	
       
   844 	CAspProfile::SetDefaultValuesL(profile);
       
   845 	
       
   846 	GetStringValue(iBuf, CAspWizardItem::ETypeProfileName);
       
   847 	profile->SetNameL(iBuf);
       
   848     
       
   849 	TInt protocol = NumberValue(CAspWizardItem::ETypeProtocolVersion);
       
   850 	profile->SetProtocolVersionL(protocol);
       
   851 
       
   852 	TInt bearerType = NumberValue(CAspWizardItem::ETypeBearerType);
       
   853 	profile->SetBearerTypeL(bearerType);
       
   854 	
       
   855 	GetStringValue(iBuf, CAspWizardItem::ETypeHostAddress);
       
   856 	TURIParser parser(iBuf);
       
   857 	TInt portNumber = parser.Port();
       
   858 	if (!parser.IsValidPort(portNumber))
       
   859 		{
       
   860 		portNumber = parser.DefaultPort();
       
   861 		}
       
   862     profile->SetHostAddressL(iBuf, portNumber);
       
   863     
       
   864     GetStringValue(iBuf, CAspWizardItem::ETypeServerId);
       
   865     profile->SetServerIdL(iBuf);
       
   866 	
       
   867 	GetStringValue(iBuf, CAspWizardItem::ETypeUserName);
       
   868 	profile->SetUserNameL(iBuf);
       
   869 	
       
   870 	GetStringValue(iBuf, CAspWizardItem::ETypePassword);
       
   871 	profile->SetPasswordL(iBuf);
       
   872 	
       
   873 	profile->SaveL();
       
   874 	iContentList->SetProfile(profile);
       
   875 	
       
   876 	TInt count = iSettingList.Count();
       
   877 	for (TInt i=0; i<count; i++)
       
   878 		{
       
   879 		CAspWizardItem* item = iSettingList[i];
       
   880 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
   881 			{
       
   882 			if (item->iEnabled)
       
   883 				{
       
   884 				TBuf<KBufSize> localDb;
       
   885 				GetStringValue(iBuf, CAspWizardItem::ETypeSyncContent,
       
   886 				               item->iSettingId);
       
   887 				
       
   888 				GetStringValue(localDb, CAspWizardItem::ETypeSyncContentLocalDatabase,
       
   889 				               item->iSettingId);
       
   890 				               
       
   891 				iContentList->CreateTask(item->iSettingId,
       
   892 				              localDb, iBuf, ETrue, ESyncDirectionTwoWay);
       
   893 				}
       
   894 			}
       
   895 		}
       
   896 	
       
   897 	iContentList->SetProfile(NULL);
       
   898 	CleanupStack::PopAndDestroy(profile);
       
   899 	
       
   900 	FLOG( _L("CAspProfileWizard::CreateProfileL END") );
       
   901     }
       
   902 
       
   903 
       
   904 //------------------------------------------------------------------------------
       
   905 // CAspProfileWizard::SetStringValueL
       
   906 //
       
   907 //------------------------------------------------------------------------------
       
   908 //
       
   909 void CAspProfileWizard::SetStringValueL(const TDesC& aValue,
       
   910                                         TInt aSettingType, TInt aSettingId)
       
   911 	{
       
   912 	TInt count = iSettingList.Count();
       
   913 	for (TInt i=0; i<count; i++)
       
   914 		{
       
   915 		CAspWizardItem* item = iSettingList[i];
       
   916 		if (item->iSettingType == aSettingType && item->iSettingId == aSettingId)
       
   917 			{
       
   918 			item->SetValueL(aValue);
       
   919 			break;
       
   920 			}
       
   921 		}
       
   922 	}
       
   923 
       
   924 
       
   925 //------------------------------------------------------------------------------
       
   926 // CAspProfileWizard::SetStringValueL
       
   927 //
       
   928 //------------------------------------------------------------------------------
       
   929 //
       
   930 void CAspProfileWizard::SetStringValueL(const TDesC& aValue, TInt aSettingType)
       
   931 	{
       
   932 	TInt count = iSettingList.Count();
       
   933 	for (TInt i=0; i<count; i++)
       
   934 		{
       
   935 		CAspWizardItem* item = iSettingList[i];
       
   936 		if (item->iSettingType == aSettingType)
       
   937 			{
       
   938 			item->SetValueL(aValue);
       
   939 			break;
       
   940 			}
       
   941 		}
       
   942 	}
       
   943 
       
   944 
       
   945 //------------------------------------------------------------------------------
       
   946 // CAspProfileWizard::GetStringValue
       
   947 //
       
   948 //------------------------------------------------------------------------------
       
   949 //
       
   950 void CAspProfileWizard::GetStringValue(TDes& aValue, TInt aSettingType)
       
   951 	{
       
   952 	aValue = KNullDesC;
       
   953 	
       
   954 	TInt count = iSettingList.Count();
       
   955 	for (TInt i=0; i<count; i++)
       
   956 		{
       
   957 		CAspWizardItem* item = iSettingList[i];
       
   958 		if (item->iSettingType == aSettingType)
       
   959 			{
       
   960 			TUtil::StrCopy(aValue, item->Value());
       
   961 			break;
       
   962 			}
       
   963 		}
       
   964 	}
       
   965 
       
   966 
       
   967 //------------------------------------------------------------------------------
       
   968 // CAspProfileWizard::GetStringValue
       
   969 //
       
   970 //------------------------------------------------------------------------------
       
   971 //
       
   972 void CAspProfileWizard::GetStringValue(TDes& aValue, TInt aSettingType, TInt aSettingId)
       
   973 	{
       
   974 	aValue = KNullDesC;
       
   975 	
       
   976 	TInt count = iSettingList.Count();
       
   977 	for (TInt i=0; i<count; i++)
       
   978 		{
       
   979 		CAspWizardItem* item = iSettingList[i];
       
   980 		if (item->iSettingType == aSettingType && item->iSettingId == aSettingId)
       
   981 			{
       
   982 			TUtil::StrCopy(aValue, item->Value());
       
   983 			break;
       
   984 			}
       
   985 		}
       
   986 	}
       
   987 
       
   988 
       
   989 //------------------------------------------------------------------------------
       
   990 // CAspProfileWizard::GetNumberValue
       
   991 //
       
   992 //------------------------------------------------------------------------------
       
   993 //
       
   994 void CAspProfileWizard::GetNumberValue(TInt& aValue, TInt aSettingType)
       
   995 	{
       
   996 	aValue = KErrNotFound;
       
   997 	
       
   998 	TInt count = iSettingList.Count();
       
   999 	for (TInt i=0; i<count; i++)
       
  1000 		{
       
  1001 		CAspWizardItem* item = iSettingList[i];
       
  1002 		if (item->iSettingType == aSettingType)
       
  1003 			{
       
  1004 			aValue = item->iNumber;
       
  1005 			break;
       
  1006 			}
       
  1007 		}
       
  1008 	}
       
  1009 
       
  1010 
       
  1011 //------------------------------------------------------------------------------
       
  1012 // CAspProfileWizard::NumberValue
       
  1013 //
       
  1014 //------------------------------------------------------------------------------
       
  1015 //
       
  1016 TInt CAspProfileWizard::NumberValue(TInt aSettingType)
       
  1017 	{
       
  1018 	TInt num = KErrNotFound;
       
  1019 	GetNumberValue(num, aSettingType);
       
  1020 	return num;
       
  1021 	}
       
  1022 
       
  1023 
       
  1024 //------------------------------------------------------------------------------
       
  1025 // CAspProfileWizard::SetNumberValue
       
  1026 //
       
  1027 //------------------------------------------------------------------------------
       
  1028 //
       
  1029 void CAspProfileWizard::SetNumberValue(TInt& aValue, TInt aSettingType)
       
  1030 	{
       
  1031 	TInt count = iSettingList.Count();
       
  1032 	for (TInt i=0; i<count; i++)
       
  1033 		{
       
  1034 		CAspWizardItem* item = iSettingList[i];
       
  1035 		if (item->iSettingType == aSettingType)
       
  1036 			{
       
  1037 			item->iNumber = aValue;
       
  1038 			break;
       
  1039 			}
       
  1040 		}
       
  1041 	}
       
  1042 	
       
  1043 	
       
  1044 //------------------------------------------------------------------------------
       
  1045 // CAspProfileWizard::NumOfEnabledContentItems
       
  1046 //
       
  1047 //------------------------------------------------------------------------------
       
  1048 //
       
  1049 TInt CAspProfileWizard::NumOfEnabledContentItems()
       
  1050 	{
       
  1051 	TInt total = 0;
       
  1052 
       
  1053 	TInt count = iSettingList.Count();
       
  1054 	for (TInt i=0; i<count; i++)
       
  1055 		{
       
  1056 		CAspWizardItem* item = iSettingList[i];
       
  1057 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
  1058 			{
       
  1059 			if (item->iEnabled)
       
  1060 				{
       
  1061 				total++;
       
  1062 				}
       
  1063 			}
       
  1064 		}
       
  1065 		
       
  1066 	return total;
       
  1067 	}
       
  1068 
       
  1069 
       
  1070 //------------------------------------------------------------------------------
       
  1071 // CAspProfileWizard::NumOfContentItems
       
  1072 //
       
  1073 //------------------------------------------------------------------------------
       
  1074 //
       
  1075 TInt CAspProfileWizard::NumOfContentItems()
       
  1076 	{
       
  1077 	TInt total = 0;
       
  1078 
       
  1079 	TInt count = iSettingList.Count();
       
  1080 	for (TInt i=0; i<count; i++)
       
  1081 		{
       
  1082 		CAspWizardItem* item = iSettingList[i];
       
  1083 		if (item->iSettingType == CAspWizardItem::ETypeSyncContent)
       
  1084 			{
       
  1085 			total++;
       
  1086 			}
       
  1087 		}
       
  1088 		
       
  1089 	return total;
       
  1090 	}
       
  1091 
       
  1092 
       
  1093 //------------------------------------------------------------------------------
       
  1094 // CAspProfileWizard::NumOfEnabledItems
       
  1095 //
       
  1096 //------------------------------------------------------------------------------
       
  1097 //
       
  1098 TInt CAspProfileWizard::NumOfEnabledItems()
       
  1099 	{
       
  1100 	TInt total = 0;
       
  1101 
       
  1102 	TInt count = iSettingList.Count();
       
  1103 	for (TInt i=0; i<count; i++)
       
  1104 		{
       
  1105 		CAspWizardItem* item = iSettingList[i];
       
  1106 		if (item->iEnabled)
       
  1107 			{
       
  1108 			total++;
       
  1109 			}
       
  1110 		}
       
  1111 		
       
  1112 	return total;
       
  1113 	}
       
  1114 
       
  1115 
       
  1116 //------------------------------------------------------------------------------
       
  1117 // CAspProfileWizard::NumOfCurrentItem
       
  1118 //
       
  1119 //------------------------------------------------------------------------------
       
  1120 //
       
  1121 TInt CAspProfileWizard::NumOfCurrentItem(CAspWizardItem* aItem)
       
  1122 	{
       
  1123 	// find position of aItem in the list of all enabled items
       
  1124 	TInt current = 0;
       
  1125 
       
  1126 	TInt count = iSettingList.Count();
       
  1127 	for (TInt i=0; i<count; i++)
       
  1128 		{
       
  1129 		CAspWizardItem* item = iSettingList[i];
       
  1130 		
       
  1131 		if (!item->iEnabled)
       
  1132 			{
       
  1133 			continue;
       
  1134 			}
       
  1135 		
       
  1136 		current++;
       
  1137 				
       
  1138 		if (item->iSettingType == aItem->iSettingType)
       
  1139 			{
       
  1140 			if (item->iSettingType != CAspWizardItem::ETypeSyncContent)
       
  1141 				{
       
  1142 				break;
       
  1143 				}
       
  1144 				
       
  1145 		    if (item->iSettingId == aItem->iSettingId)
       
  1146 		    	{
       
  1147 		    	break;
       
  1148 		    	}
       
  1149 			}
       
  1150 		}
       
  1151 		
       
  1152 	return current;
       
  1153 	}
       
  1154 
       
  1155 
       
  1156 //------------------------------------------------------------------------------
       
  1157 // CAspProfileWizard::CurrentItem
       
  1158 //
       
  1159 //------------------------------------------------------------------------------
       
  1160 //
       
  1161 CAspWizardItem* CAspProfileWizard::CurrentItem()
       
  1162 	{
       
  1163 	TInt count = iSettingList.Count();
       
  1164 	
       
  1165 	__ASSERT_ALWAYS(iCurrentItemIndex >= 0, TUtil::Panic(KErrGeneral));
       
  1166 	__ASSERT_ALWAYS(iCurrentItemIndex < count, TUtil::Panic(KErrGeneral));
       
  1167 	
       
  1168 	return iSettingList[iCurrentItemIndex];
       
  1169 	}
       
  1170 	
       
  1171 
       
  1172 //------------------------------------------------------------------------------
       
  1173 // CAspProfileWizard::CurrentItemType
       
  1174 //
       
  1175 //------------------------------------------------------------------------------
       
  1176 //
       
  1177 TInt CAspProfileWizard::CurrentItemType()
       
  1178 	{
       
  1179 	CAspWizardItem* item = CurrentItem();
       
  1180 	
       
  1181 	return  item->iSettingType;
       
  1182 	}
       
  1183 
       
  1184 
       
  1185 //------------------------------------------------------------------------------
       
  1186 // CAspProfileWizard::CreatedProfileId
       
  1187 //
       
  1188 //------------------------------------------------------------------------------
       
  1189 //
       
  1190 TInt CAspProfileWizard::CreatedProfileId()
       
  1191 	{
       
  1192 	return iProfileId;
       
  1193 	}
       
  1194 
       
  1195 
       
  1196 //------------------------------------------------------------------------------
       
  1197 // CAspProfileWizard::MoveToNext
       
  1198 //
       
  1199 //------------------------------------------------------------------------------
       
  1200 //
       
  1201 void CAspProfileWizard::MoveToNext()
       
  1202 	{
       
  1203 	iCurrentItemIndex = IncreaseCurrentIndex(iCurrentItemIndex);
       
  1204 	}
       
  1205 
       
  1206 
       
  1207 //------------------------------------------------------------------------------
       
  1208 // CAspProfileWizard::MoveToPrevious
       
  1209 //
       
  1210 //------------------------------------------------------------------------------
       
  1211 //
       
  1212 void CAspProfileWizard::MoveToPrevious()
       
  1213 	{
       
  1214 	iCurrentItemIndex = DecreaseCurrentIndex(iCurrentItemIndex);
       
  1215 	}
       
  1216 
       
  1217 
       
  1218 //------------------------------------------------------------------------------
       
  1219 // CAspProfileWizard::MoveToStart
       
  1220 //
       
  1221 //------------------------------------------------------------------------------
       
  1222 //
       
  1223 void CAspProfileWizard::MoveToStart()
       
  1224 	{
       
  1225 	iCurrentItemIndex = 0;
       
  1226 	}
       
  1227 
       
  1228 
       
  1229 // -----------------------------------------------------------------------------
       
  1230 // CAspProfileWizard::IncreaseCurrentIndex
       
  1231 //
       
  1232 // -----------------------------------------------------------------------------
       
  1233 //
       
  1234 TInt CAspProfileWizard::IncreaseCurrentIndex(const TInt aIndex)
       
  1235 	{
       
  1236 	TInt maxIndex = iSettingList.Count() - 1;
       
  1237 	TInt index = aIndex;
       
  1238 	
       
  1239 	for (;;)
       
  1240 		{
       
  1241 		__ASSERT_DEBUG(index < maxIndex, TUtil::Panic(KErrGeneral));
       
  1242 
       
  1243 		if (!(index < maxIndex))
       
  1244 			{
       
  1245 			return maxIndex;
       
  1246 			}
       
  1247 				
       
  1248 		index++;
       
  1249 				
       
  1250 	    CAspWizardItem* item = iSettingList[index];
       
  1251 	    if (item->iEnabled)
       
  1252 	    	{
       
  1253 	    	break;
       
  1254 	    	}
       
  1255 		}
       
  1256 		
       
  1257 	return index;
       
  1258 	}
       
  1259 
       
  1260 
       
  1261 // -----------------------------------------------------------------------------
       
  1262 // CAspProfileWizard::DecreaseCurrentIndex
       
  1263 //
       
  1264 // -----------------------------------------------------------------------------
       
  1265 //
       
  1266 TInt CAspProfileWizard::DecreaseCurrentIndex(const TInt aIndex)
       
  1267 	{
       
  1268 	TInt index = aIndex;
       
  1269 	
       
  1270 	for (;;)
       
  1271 		{
       
  1272 		__ASSERT_DEBUG(index > 0, TUtil::Panic(KErrGeneral));
       
  1273 		
       
  1274 		if (!(index > 0))
       
  1275 			{
       
  1276 			return 0;
       
  1277 			}
       
  1278 			
       
  1279 		index--;
       
  1280 		
       
  1281 	    CAspWizardItem* item = iSettingList[index];
       
  1282 	    if (item->iEnabled)
       
  1283 	    	{
       
  1284 	    	break;
       
  1285 	    	}
       
  1286 		}
       
  1287 		
       
  1288 	return index;
       
  1289 	}
       
  1290 
       
  1291 
       
  1292 // -----------------------------------------------------------------------------
       
  1293 // CAspProfileWizard::LocalDatabaseList
       
  1294 //
       
  1295 // -----------------------------------------------------------------------------
       
  1296 //
       
  1297 CDesCArray* CAspProfileWizard::LocalDatabaseList(const TInt aDataproviderId)
       
  1298 	{
       
  1299 	__ASSERT_DEBUG(aDataproviderId == KUidNSmlAdapterEMail.iUid, 
       
  1300 	               TUtil::Panic(KErrGeneral));
       
  1301 	
       
  1302 	return iLocalDataStores;
       
  1303 	}
       
  1304 	
       
  1305 
       
  1306 
       
  1307 
       
  1308 
       
  1309 
       
  1310 //  End of File