syncmlfw/dm/settings/src/DMProfileContentHandler.cpp
changeset 0 b497e44ab2fc
child 24 13d7c31c74e0
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  XML file handler for DM-settings
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <f32file.h>
       
    22 #include <commdb.h>
       
    23 #include <nsmldebug.h>
       
    24 #include <featmgr.h>
       
    25 #include "DMprofileContentHandler.h"
       
    26 #include "nsmldmsettings.h"
       
    27 
       
    28 
       
    29 #define DES_AS_8_BIT(str) (TPtrC8((TText8*)((str).Ptr()), (str).Size()))
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 
       
    34 CDMProfileContentHandler::CDMProfileContentHandler()
       
    35 	{
       
    36 	}
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CDMProfileContentHandler::ConstructL
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CDMProfileContentHandler::ConstructL(CNSmlDMSettings* aSettings)
       
    44     {
       
    45 	iSettings = aSettings;
       
    46 	iProfileArray = new (ELeave) CArrayPtrFlat<CNSmlDMResourceProfile> (3);	
       
    47 	// init feature manager
       
    48 	FeatureManager::InitializeLibL();
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CDMProfileContentHandler::NewL
       
    53 // Two-phased constructor.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CDMProfileContentHandler* CDMProfileContentHandler::NewL(CNSmlDMSettings* aSettings )
       
    57     {
       
    58 		CDMProfileContentHandler* self = new( ELeave ) CDMProfileContentHandler;
       
    59     
       
    60 		CleanupStack::PushL( self );
       
    61 		self->ConstructL(aSettings);
       
    62 		CleanupStack::Pop();
       
    63 
       
    64 		return self;
       
    65     }
       
    66 
       
    67     
       
    68 // Destructor
       
    69 CDMProfileContentHandler::~CDMProfileContentHandler()
       
    70     {	
       
    71 	if(iProfileArray)
       
    72 		{
       
    73 		iProfileArray->ResetAndDestroy();
       
    74 		delete iProfileArray;			
       
    75 		}
       
    76 	// uninitialize feature manager
       
    77 	FeatureManager::UnInitializeLib();
       
    78     }
       
    79 
       
    80 // ----------------------------------------------------------
       
    81 // void CDMProfileContentHandler::RemoveDuplicateEntry()
       
    82 // Remove all the duplicate entries and the entries do not have
       
    83 // the values for the mandatory fields.
       
    84 // ----------------------------------------------------------
       
    85 void CDMProfileContentHandler::RemoveDuplicateEntry()
       
    86 {
       
    87 	_DBG_FILE("CDMProfileContentHandler::RemoveDuplicateEntry(): begin");
       
    88 	TInt count = iProfileArray->Count();
       
    89 	for(TInt i = 0; i < count; i++)
       
    90 	{
       
    91 		if(!(iProfileArray->At(i)->iServerId &&
       
    92 		    iProfileArray->At(i)->iUserName &&
       
    93 		    iProfileArray->At(i)->iServerURL ))
       
    94 		{
       
    95 				iProfileArray->Delete(i);
       
    96 				iProfileArray->Compress();				
       
    97 				i--;
       
    98 				count--;
       
    99 		}
       
   100 	}
       
   101 	
       
   102 	for ( TInt i = 0; i < count; i++ )
       
   103 	{
       
   104 		for(TInt j = i+1; j <count; j++)
       
   105 		{
       
   106 			if((iProfileArray->At(i)->iServerId->Des().Compare(iProfileArray->At(j)->iServerId->Des()) == 0) &&
       
   107 			(iProfileArray->At(i)->iServerId->Length() == iProfileArray->At(j)->iServerId->Length()))
       
   108 			{		
       
   109 				iProfileArray->Delete(j);
       
   110 				iProfileArray->Compress();
       
   111 				j--;
       
   112 				count--;
       
   113 			}
       
   114 		}
       
   115 	}
       
   116 	_DBG_FILE("CDMProfileContentHandler::RemoveDuplicateEntry(): end");
       
   117 }
       
   118 
       
   119 // ----------------------------------------------------------
       
   120 // void CDMProfileContentHandler::RemoveRSCEntryL()
       
   121 // ----------------------------------------------------------
       
   122 void CDMProfileContentHandler::RemoveRSCEntryL()
       
   123 {
       
   124 	_DBG_FILE("CDMProfileContentHandler::RemoveRSCEntryL(): begin");
       
   125 	TInt count = iProfileArray->Count();
       
   126 	for ( TInt i = 0; i < count; i++ )
       
   127 	{
       
   128 		if((iSettings->ServerIdFoundL(iProfileArray->At(i)->iServerId->Des())) ||
       
   129 		((! FeatureManager::FeatureSupported ( KFeatureIdSyncMlDmObex )) &&( iProfileArray->At(i)->iTransportId == KNSmlDmBluetoothType)))
       
   130 		{
       
   131 			iProfileArray->Delete(i);
       
   132 			iProfileArray->Compress();
       
   133 			i--;
       
   134 			count--;			
       
   135 		}				
       
   136 	}
       
   137 	_DBG_FILE("CDMProfileContentHandler::RemoveRSCEntryL(): end");
       
   138 }
       
   139 
       
   140 // ----------------------------------------------------------
       
   141 // void CDMProfileContentHandler::GetAccessPointIdL()
       
   142 // ----------------------------------------------------------
       
   143 TBool CDMProfileContentHandler::GetAccessPointIdL(TInt count,TInt &iapId)
       
   144 {
       
   145 	_DBG_FILE("CDMProfileContentHandler::GetAccessPointIdL(): begin");
       
   146 
       
   147 	CCommsDatabase *database = CCommsDatabase::NewL();
       
   148     TUint32 id;
       
   149     TBool ret = EFalse; 
       
   150     CleanupStack::PushL(database);
       
   151     CCommsDbTableView*  checkView;
       
   152     checkView = database->OpenViewMatchingTextLC(TPtrC(IAP),TPtrC(COMMDB_NAME), iProfileArray->At(count)->iAccessPoint->Des());
       
   153     TInt error = checkView->GotoFirstRecord();
       
   154     if (error == KErrNone)
       
   155     {     
       
   156      //Get the IAP ID 
       
   157      checkView->ReadUintL(TPtrC(COMMDB_ID), id);
       
   158      iapId = id; 
       
   159      ret = ETrue;     
       
   160     }
       
   161          
       
   162     CleanupStack::PopAndDestroy(2);
       
   163     _DBG_FILE("CDMProfileContentHandler::GetAccessPointIdL(): end");
       
   164 
       
   165     return ret;
       
   166             
       
   167 }
       
   168 // ----------------------------------------------------------
       
   169 // void CDMProfileContentHandler::SaveProfilesL()
       
   170 // save the profiles into db.
       
   171 // First it will remove the duplicate entry from iProfileArray itself and also remove
       
   172 // the entries present in the RSC if any.
       
   173 // ----------------------------------------------------------
       
   174 void CDMProfileContentHandler::SaveProfilesL()
       
   175 {
       
   176 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): begin");
       
   177 	RemoveDuplicateEntry();
       
   178 	RemoveRSCEntryL();
       
   179 	TInt iapId = 0;
       
   180 	
       
   181 	for ( TInt i = 0; i < iProfileArray->Count(); i++ )
       
   182 	{
       
   183 		if(iProfileArray->At(i)->iAccessPoint)
       
   184 		{
       
   185 			if(GetAccessPointIdL(i, iapId))
       
   186 			{
       
   187 				iProfileArray->At(i)->iIapId = iapId;
       
   188 			}
       
   189 			else
       
   190 			{
       
   191 			iapId = KErrGeneral;
       
   192 			TLex id(iProfileArray->At(i)->iAccessPoint->Des());
       
   193 			id.Val(iapId);
       
   194 			if( iapId == KErrGeneral || iapId == KErrNotFound )
       
   195 			    {
       
   196 			    iProfileArray->At(i)->iIapId = iapId;
       
   197 			    }
       
   198 			}
       
   199 		}
       
   200 		if(! iProfileArray->At(i)->iProfileDisplayName)
       
   201 		{
       
   202 			TBuf<KNSmlDmProfileNameMaxLength> defaultProfile;
       
   203 			defaultProfile.Format( KNSmlDMDefaultProfile );
       
   204 			iProfileArray->At(i)->iProfileDisplayName = defaultProfile.AllocL();
       
   205 		}	
       
   206 		CNSmlDMProfile* profile = iSettings->CreateProfileL();
       
   207 		CleanupStack::PushL( profile );
       
   208 		iProfileArray->At(i)->SaveProfileL( profile );
       
   209 		profile->SaveL();
       
   210 		CleanupStack::PopAndDestroy(); // profile
       
   211 							
       
   212 	}
       
   213 	_DBG_FILE("CDMProfileContentHandler::SaveProfilesL(): end");
       
   214 }
       
   215 // -----------------------------------------------------------------------------
       
   216 //  CDMProfileContentHandler::IsChar
       
   217 //	Returns true value for other than numerical character.
       
   218 // -----------------------------------------------------------------------------
       
   219 TBool CDMProfileContentHandler::IsChar( const TUint8 aChar )
       
   220 {
       
   221 	TBool ret(ETrue);
       
   222 	switch(aChar)
       
   223 	{
       
   224 		case '0':
       
   225 		case '1':
       
   226 		case '2':
       
   227 		case '3':
       
   228 		case '4':
       
   229 		case '5':
       
   230 		case '6':
       
   231 		case '7':
       
   232 		case '8':
       
   233 		case '9':
       
   234 		{
       
   235 			ret = EFalse;
       
   236 			break;
       
   237 		}
       
   238 		default: ret = ETrue;		
       
   239 	}
       
   240 	return ret;    
       
   241 }
       
   242 
       
   243 TInt CDMProfileContentHandler::StartDocument()
       
   244    {	
       
   245 		TInt error = KNSmlDmSettingsSuccess;
       
   246 		iFile.Close();
       
   247 		iSession.Close();
       
   248 		error = iSession.Connect();
       
   249 		error =iFile.Replace(iSession, iFilename, EFileWrite);
       
   250 		
       
   251 		return error;
       
   252    }
       
   253 
       
   254 TInt CDMProfileContentHandler::EndDocument()
       
   255 {
       
   256 		iFile.Close();
       
   257 		iSession.Close();
       
   258 		return KNSmlDmSettingsSuccess;
       
   259 }
       
   260 
       
   261 // ----------------------------------------------------------
       
   262 // void CDMProfileContentHandler::AddProfileL()
       
   263 // Appends a new profile to the array.
       
   264 // ----------------------------------------------------------
       
   265 void CDMProfileContentHandler::AddProfileL( )
       
   266 {
       
   267 	_DBG_FILE("CDMProfileContentHandler::AddProfileL(): begin");
       
   268 	CNSmlDMResourceProfile* profile = CNSmlDMResourceProfile::NewLC();
       
   269 	iProfileArray->AppendL( profile );
       
   270 	CleanupStack::Pop();
       
   271 	_DBG_FILE("CDMProfileContentHandler::AddProfileL(): end");		
       
   272 }
       
   273 
       
   274 TInt CDMProfileContentHandler::StartElement(TDesC& /* aURI */, TDesC& /* aLocalName */, TDesC& aName, MXMLAttributes * /* aAttributeList*/)
       
   275 {	
       
   276 
       
   277 		if (! aName.Compare(KNSmlDMXmlFactorySettings()))
       
   278 		{
       
   279 			TRAPD(leavecode, AddProfileL());
       
   280 			if(leavecode != KErrNone )
       
   281 			{
       
   282 				return KNSmlDmSettingsFail;
       
   283 			}						
       
   284 			iDMAccountInProgress = ETrue;
       
   285 			iCounter++;
       
   286 		}
       
   287 		
       
   288 		if (!iDMAccountInProgress)
       
   289 			return KNSmlDmSettingsSuccess;
       
   290 		
       
   291 		if (! aName.Compare(KNSmlDMXmlProfileName()))
       
   292 		{
       
   293 			iState = EProfileName;			
       
   294 		}	
       
   295 		
       
   296 		else if (! aName.Compare(KNSmlDMXmlServerId()))
       
   297 		{
       
   298 			iState = EServerID;			
       
   299 		}
       
   300 		
       
   301 		else if (! aName.Compare(KNSmlDMXmlProfileServerPassword()))
       
   302 		{
       
   303 			iState = EServerPassword;
       
   304 		}
       
   305 
       
   306 		else if (! aName.Compare(KNSmlDMXmlProfileUsername()))
       
   307 		{
       
   308 			iState = EUserName;
       
   309 		}
       
   310 		
       
   311 		else if (! aName.Compare(KNSmlDMXmlProfileClientPassword()))
       
   312 		{
       
   313 			iState = EClientPwd;
       
   314 		}
       
   315 
       
   316 		else if (! aName.Compare(KNSmlDMXmlProfileServerUrl()))
       
   317 		{
       
   318 			iState = EServerURL;
       
   319 		}
       
   320 		
       
   321 		else if (! aName.Compare(KNSmlDMXmlProfileTransportId()))
       
   322 		{
       
   323 			iState = ETransportID;
       
   324 		}
       
   325 		
       
   326 		else if (! aName.Compare(KNSmlDMXmlProfileAP()))
       
   327 		{
       
   328 			iState = EAccessPoint;
       
   329 		}
       
   330 		
       
   331 		else if (! aName.Compare(KNSmlDMXmlProfileServerAlertedAction()))
       
   332 		{
       
   333 			iState = EServerAlertedAction;
       
   334 		}
       
   335 		
       
   336 		else if (! aName.Compare(KNSmlDMXmlProfileAuthentication()))
       
   337 		{
       
   338 			iState = EAuthentication;
       
   339 		}
       
   340 		
       
   341 		else if (! aName.Compare(KNSmlDMXmlProfileDeleteAllowed()))
       
   342 		{
       
   343 			iState = EDeleteAllowed;
       
   344 		}
       
   345 		
       
   346 		else if (! aName.Compare(KNSmlDMXmlProfileView()))
       
   347 		{
       
   348 			iState = EProfileView;
       
   349 		}
       
   350 		
       
   351 		else if (! aName.Compare(KNSmlDMXmlProfileNetworkAuthentication()))
       
   352 		{
       
   353 			iState = ENetworkAuthentication;
       
   354 		}
       
   355 		
       
   356 		else if (! aName.Compare(KNSmlDMXmlProfileHttpAuthUsername()))
       
   357 		{
       
   358 			iState = EHTTPUserName;
       
   359 		}
       
   360 		
       
   361 		else if (! aName.Compare(KNSmlDMXmlProfileHttpAuthPassword()))
       
   362 		{
       
   363 			iState = EHTTPPwd;
       
   364 		}				
       
   365 		
       
   366 		else if (! aName.Compare(KNSmlDMXmlProfileLock()))
       
   367 		{
       
   368 			iState = EProfileLock;
       
   369 		}
       
   370 
       
   371 		return KNSmlDmSettingsSuccess;
       
   372 }
       
   373 
       
   374 TInt CDMProfileContentHandler::EndElement(TDesC& /* aURI */, TDesC& /* aLocalName */, TDesC& aName)
       
   375 {
       
   376 		if (!iDMAccountInProgress)
       
   377 			return KNSmlDmSettingsSuccess;
       
   378 		
       
   379 		if (! aName.Compare(KNSmlDMXmlFactorySettings()))
       
   380 		{
       
   381 	    	iDMAccountInProgress = EFalse;
       
   382 		}
       
   383 		
       
   384 		if (iState != EStateHandled)
       
   385 		{				
       
   386 			iState = EStateHandled;   //Assume that empty feild. No need to set.
       
   387 		}		
       
   388 
       
   389 		return KNSmlDmSettingsSuccess;
       
   390 }
       
   391 TInt CDMProfileContentHandler::StartCDATA()
       
   392 {
       
   393 	// do nothing
       
   394 	return KNSmlDmSettingsSuccess;
       
   395 }
       
   396 TInt CDMProfileContentHandler::EndCDATA()
       
   397 {
       
   398 	// do nothing
       
   399 	return KNSmlDmSettingsSuccess;
       
   400 }
       
   401 
       
   402 // ----------------------------------------------------------
       
   403 // void CDMProfileContentHandler::AddProfileElementL()
       
   404 // Assigns profile element value.
       
   405 // ----------------------------------------------------------
       
   406 void CDMProfileContentHandler::AddProfileElementL(TDesC& aBuf)
       
   407 {
       
   408 	_DBG_FILE("CDMProfileContentHandler::AddProfileElementL(): begin");
       
   409 	if(iState == EProfileName)
       
   410 	{
       
   411 		if(aBuf.Length() > KNSmlDmProfileNameMaxLength)
       
   412 		{
       
   413 			TPtrC buf = aBuf.Left(KNSmlDmProfileNameMaxLength);
       
   414 			iProfileArray->At(iCounter-1)->iProfileDisplayName = buf.AllocL();
       
   415 		}
       
   416 		else		
       
   417 			iProfileArray->At(iCounter-1)->iProfileDisplayName = aBuf.AllocL();		
       
   418 		iState = EStateHandled;		
       
   419 	}
       
   420 	
       
   421 	else if(iState == EServerID)
       
   422 	{
       
   423 		iProfileArray->At(iCounter-1)->iServerId = aBuf.AllocL();		
       
   424 		iState = EStateHandled;		
       
   425 	}
       
   426 	
       
   427 	else if(iState == EServerPassword)
       
   428 	{		
       
   429 		iProfileArray->At(iCounter-1)->iPassWord = aBuf.AllocL();
       
   430 		iState = EStateHandled;		
       
   431 	}
       
   432 	
       
   433 	else if(iState == EUserName)
       
   434 	{		
       
   435 		iProfileArray->At(iCounter-1)->iUserName = aBuf.AllocL();
       
   436 		iState = EStateHandled;		
       
   437 	}
       
   438 	
       
   439 	else if(iState == EClientPwd)
       
   440 	{		
       
   441 		iProfileArray->At(iCounter-1)->iClientPassword = aBuf.AllocL();
       
   442 		iState = EStateHandled;		
       
   443 	}
       
   444 	
       
   445 	else if(iState == EServerURL)
       
   446 	{		
       
   447 		TInt len = aBuf.Length();
       
   448 		TInt locate(0);
       
   449 		if( aBuf.Find( KNSmlDMSettingsHTTP )==0 )//http:
       
   450 		{
       
   451 			locate = KNSmlDMSettingsHTTP().Length();
       
   452 		}
       
   453 		else if( aBuf.Find( KNSmlDMSettingsHTTPS )==0 )//https:
       
   454 		{
       
   455 			locate = KNSmlDMSettingsHTTPS().Length();
       
   456 		}
       
   457 		
       
   458 		TPtrC buf =aBuf.Right(len-locate);
       
   459 		TInt locateColon = buf.Locate(KNSmlDMColon); // ':'
       
   460 		if(locateColon > 0)
       
   461 		{
       
   462 			TInt bufLen = buf.Length();	
       
   463 			TPtrC buf1 = buf.Right(bufLen - locateColon);
       
   464 			TInt digit(0);
       
   465 			for( TInt i = locate + locateColon + 1; i < len; i++ )
       
   466 			{			
       
   467 				if (IsChar(aBuf[i]))
       
   468 				{
       
   469 					if(aBuf[i]!= KNSmlDMUriSeparator )
       
   470 					{
       
   471 						TPtrC strBuf = aBuf.Right(len - locate - locateColon);
       
   472 						TInt locateSlash = strBuf.Locate(KNSmlDMUriSeparator);
       
   473 						if(locateSlash > 0)
       
   474 						{
       
   475 							TPtrC ptrBuf1 = aBuf.Left(len-locateColon-1);
       
   476 							TBuf<KNSmlDmFileNameLength> buffer;
       
   477 							buffer.Append(ptrBuf1);
       
   478 							TPtrC ptrBuf2 = aBuf.Right(len-locate-locateColon-locateSlash);
       
   479 							buffer.Append(ptrBuf2);
       
   480 							iProfileArray->At(iCounter-1)->iServerURL = buffer.AllocL();
       
   481 							break;
       
   482 						}
       
   483 						else
       
   484 						{
       
   485 							TPtrC ptrBuf = aBuf.Left(locate + locateColon);
       
   486 							iProfileArray->At(iCounter-1)->iServerURL = ptrBuf.AllocL();
       
   487 							break;
       
   488 						}
       
   489 					}
       
   490 					else
       
   491 					{
       
   492 						iProfileArray->At(iCounter-1)->iServerURL = aBuf.AllocL();
       
   493 						break;
       
   494 					}
       
   495 				}
       
   496 				if(digit>= KNSmlDmMaxPortLength) // the max length of the port number
       
   497 				{
       
   498 					TPtrC ptrBuf1 = aBuf.Left(locate + locateColon);
       
   499 					TBuf<KNSmlDmFileNameLength> buffer;
       
   500 					buffer.Append(ptrBuf1);
       
   501 					TPtrC ptrBuf2 = aBuf.Right(len-i);
       
   502 					TInt locateSlash = ptrBuf2.Locate(KNSmlDMUriSeparator);
       
   503 					if(locateSlash > 0)
       
   504 					{
       
   505 						TPtrC ptrBuf3 = aBuf.Right(len-i-locateSlash);
       
   506 						buffer.Append(ptrBuf3);							
       
   507 					}						
       
   508 					iProfileArray->At(iCounter-1)->iServerURL = buffer.AllocL();	
       
   509 					break;
       
   510 				}
       
   511 				else if(i == (len-1))					
       
   512 					iProfileArray->At(iCounter-1)->iServerURL = aBuf.AllocL();					
       
   513 		
       
   514 				digit++;			
       
   515 			}		
       
   516 		}
       
   517 		else
       
   518 		{
       
   519 			iProfileArray->At(iCounter-1)->iServerURL = aBuf.AllocL();
       
   520 		}
       
   521 		iState = EStateHandled;		
       
   522 	}
       
   523 	else
       
   524 	{
       
   525 	AddRemainingElementsL(aBuf);	//To decrease cyclomatic complexity
       
   526 	}	
       
   527 	_DBG_FILE("CDMProfileContentHandler::AddProfileElementL(): end");
       
   528 }
       
   529 
       
   530 TInt CDMProfileContentHandler::Charecters(TDesC& aBuf, TInt /* aStart */, TInt /* aLength */)
       
   531 {	
       
   532 
       
   533 	if (!iDMAccountInProgress)
       
   534 		return KNSmlDmSettingsSuccess;
       
   535 	
       
   536 	TRAPD(leavecode, AddProfileElementL(aBuf));
       
   537 	if(leavecode != KErrNone )
       
   538 	{
       
   539 		return KNSmlDmSettingsFail;
       
   540 	}		
       
   541 	return KNSmlDmSettingsSuccess;
       
   542 }
       
   543 
       
   544 TInt CDMProfileContentHandler::Comment(TDesC& /* aComment */)
       
   545 {
       
   546 	// do nothing
       
   547 	return KNSmlDmSettingsSuccess;
       
   548 }
       
   549 
       
   550 TInt CDMProfileContentHandler::ProcessingInstructions(TDesC& /* aTarget */, TDesC& /* aData */)
       
   551 {
       
   552 	// do nothing
       
   553 	return KNSmlDmSettingsSuccess;
       
   554 }
       
   555 TInt CDMProfileContentHandler::IgnoreWhiteSpace(TDesC& /* aString */)
       
   556 {
       
   557 	// do nothing
       
   558 	return KNSmlDmSettingsSuccess;
       
   559 }
       
   560 TInt CDMProfileContentHandler::StartEntity(TDesC& /* aName */)
       
   561 {
       
   562 	// do nothing
       
   563 	return KNSmlDmSettingsSuccess;
       
   564 }
       
   565 TInt CDMProfileContentHandler::EndEntity(TDesC& /* aName */)
       
   566 {
       
   567 	// do nothing
       
   568 	return KNSmlDmSettingsSuccess;
       
   569 }
       
   570 TInt CDMProfileContentHandler::SkippedEntity(TDesC& /* aName */)
       
   571 {
       
   572 	// do nothing
       
   573 	return KNSmlDmSettingsSuccess;
       
   574 }
       
   575 TInt CDMProfileContentHandler::Error(TInt /* aErrorCode */, TInt /* aSeverity */)
       
   576 {
       
   577 	return KNSmlDmSettingsSuccess;
       
   578 }
       
   579 
       
   580 // ----------------------------------------------------------
       
   581 // void CDMProfileContentHandler::AddRemainingElementsL()
       
   582 // Assigns remaining profile element value other than in 
       
   583 // AddProfileElementL method
       
   584 // ----------------------------------------------------------
       
   585 void CDMProfileContentHandler::AddRemainingElementsL(TDesC& aBuf)
       
   586 	{
       
   587 	_DBG_FILE("CDMProfileContentHandler::AddRemainingElementsL(): end");
       
   588 	if(iState == ETransportID)
       
   589 		{	
       
   590 		TInt val(0);
       
   591 		if(! aBuf.Compare(KNSmlDMInternetTypeString()))
       
   592 			val = KNSmlDmInternetType;
       
   593 		else if (! aBuf.Compare(KNSmlDMBluetoothTypeString()))
       
   594 			val = KNSmlDmBluetoothType;		
       
   595 		iProfileArray->At(iCounter-1)->iTransportId = val;
       
   596 		iState = EStateHandled;		
       
   597 		}
       
   598 
       
   599 	else if(iState == EAccessPoint)
       
   600 		{		
       
   601 		iProfileArray->At(iCounter-1)->iAccessPoint = aBuf.AllocL();
       
   602 		iState = EStateHandled;		
       
   603 		}
       
   604 
       
   605 	else if(iState == EServerAlertedAction)
       
   606 		{		
       
   607 		TLex var(aBuf);
       
   608 		TInt val;
       
   609 		var.Val(val);
       
   610 		iProfileArray->At(iCounter-1)->iServerAlertAction = val;
       
   611 		iState = EStateHandled;		
       
   612 		}
       
   613 
       
   614 	else if(iState == EAuthentication)
       
   615 		{		
       
   616 		TLex var(aBuf);
       
   617 		TInt val;
       
   618 		var.Val(val);
       
   619 		iProfileArray->At(iCounter-1)->iAuthenticationRequired = val;
       
   620 		iState = EStateHandled;		
       
   621 		}
       
   622 
       
   623 	else if(iState == EDeleteAllowed)
       
   624 		{		
       
   625 		TLex var(aBuf);
       
   626 		TInt val;
       
   627 		var.Val(val);
       
   628 		iProfileArray->At(iCounter-1)->iDeleteAllowed = val;
       
   629 		iState = EStateHandled;		
       
   630 		}
       
   631     else if(iState == EProfileLock)
       
   632      	{		
       
   633 		TLex var(aBuf);
       
   634 		TInt val;
       
   635 		var.Val(val);
       
   636 		iProfileArray->At(iCounter-1)->iProfileLock = val;
       
   637 		iState = EStateHandled;		
       
   638 	    }
       
   639 	else if(iState == EProfileView)
       
   640 		{		
       
   641 		TLex var(aBuf);
       
   642 		TInt val;
       
   643 		var.Val(val);
       
   644 		iProfileArray->At(iCounter-1)->iProfileHidden = val;
       
   645 		iState = EStateHandled;		
       
   646 		}
       
   647 
       
   648 	else if(iState == ENetworkAuthentication)
       
   649 		{		
       
   650 		TLex var(aBuf);
       
   651 		TInt val;
       
   652 		var.Val(val);
       
   653 		iProfileArray->At(iCounter-1)->iHttpAuthUsed = val;
       
   654 		iState = EStateHandled;		
       
   655 		}
       
   656 
       
   657 	else if(iState == EHTTPUserName)
       
   658 		{		
       
   659 		iProfileArray->At(iCounter-1)->iHttpAuthUsername = aBuf.AllocL();
       
   660 		iState = EStateHandled;		
       
   661 		}
       
   662 
       
   663 	else if(iState == EHTTPPwd)
       
   664 		{		
       
   665 		iProfileArray->At(iCounter-1)->iHttpAuthPassword = aBuf.AllocL();
       
   666 		iState = EStateHandled;		
       
   667 		}
       
   668 	_DBG_FILE("CDMProfileContentHandler::AddRemainingElementsL(): end");
       
   669 	}
       
   670 //  End of File