CAknSettingItem* CBuddycloudEditPlaceList::CreateSettingItemL (TInt aIdentifier) {
	CAknSettingItem* aSettingItem = NULL;

    switch(aIdentifier) {
		case EEditPlaceItemName:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iName);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemStreet:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iStreet);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EZeroLengthAllowed | CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemArea:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iArea);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EZeroLengthAllowed | CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemCity:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iCity);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EZeroLengthAllowed | CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemPostcode:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iPostcode);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EZeroLengthAllowed | CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemRegion:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iRegion);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EZeroLengthAllowed | CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemCountry:
			aSettingItem = new (ELeave) CAknTextSettingItem(aIdentifier, iCountry);
			aSettingItem->SetSettingPageFlags(CAknTextSettingPage::EPredictiveTextEntryPermitted);
			break;
		case EEditPlaceItemVisibility:
			aSettingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier, iShared);
			break;
		default:
			break;
    }

    return aSettingItem;
}
	CAknSettingItem* CreateSettingItemL( TInt identifier )
	{
		CALLSTACKITEM_N(_CL("CAutoSettingsImpl"), _CL("CreateSettingItemL"));
		CAknSettingItem * settingItem = NULL;
		
		const TSettingItem i = TClSettings::GetKClSettings(identifier);
		
		switch (i.iDatatype) {
		case ::EAP:
			{
				TInt *p=new (ELeave) TInt;
				*p=1;
				if (i.iDefaultExists) *p=i.iIntDefault;
				iData[identifier]=p;
				CAknSettingItem * item = (new (ELeave) CAknEnumeratedTextPopupSettingItem(identifier, *p ));
				settingItem =  item;
				iItems[identifier] = item;
				break;
			}
		case ::EString:
			{
				TBuf<256>* p=new (ELeave) TBuf<256>;
				iData[identifier]=p;
				if (i.iDefaultExists && i.iStringDefault) *p=TPtrC((TText*)i.iStringDefault);
				CAknSettingItem * item = NULL;
				
				// Hack to make password secret.
				// Should enable 
				if ( i.iSettingNo == SETTING_JABBER_PASS )
					{
						item =  new (ELeave) CAknPasswordSettingItem(identifier, 
																	 CAknPasswordSettingItem::EAlpha,
																	 *p);
						
					}
				else
					{
						item = new (ELeave) CAknTextSettingItem(identifier, *p);
						/* !Allowing empty setting! */
						TInt flags=item->SettingPageFlags();
						item->SetSettingPageFlags( flags | CAknTextSettingPage::EZeroLengthAllowed );
					}
				settingItem = item;
				iItems[identifier] = item;
				break;
			}
		case ::EBool:
			{
				TInt *p=new (ELeave) TInt;
				*p=1;
				if (i.iDefaultExists) *p=i.iIntDefault;
				iData[identifier]=p;
				CAknSettingItem * item =new (ELeave) CAknBinaryPopupSettingItem(identifier, *p );
				settingItem =  item;
				iItems[identifier] =  item; 
				break;
			}
		case ::EEnum:
		{
			TInt *p=new (ELeave) TInt;
			*p=1;
			if (i.iDefaultExists) *p=i.iIntDefault;
			iData[identifier]=p;
			CAknSettingItem * item =new (ELeave) CAknEnumeratedTextPopupSettingItem(identifier, *p );
			settingItem =  item;
			iItems[identifier] =  item; 
			break;
		}
		case ::EInt:
			{
				TInt *p=new (ELeave) TInt;
				*p=0;
				if (i.iDefaultExists) *p=i.iIntDefault;
				iData[identifier]=p;
				CAknSettingItem * item = new (ELeave) CAknIntegerEdwinSettingItem(identifier, *p );
				settingItem =  item;
				iItems[identifier] =  item;
				break;
			}
		default:
			break;
		}
		if (!settingItem) {
			User::Leave(-1027);
		}
		return settingItem;
	}