customization/EmbeddedLinkAdapter/src/EmbeddedLinkAdapter.cpp
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2004 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:  DM Email Settings Adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "EmbeddedLinkAdapter.h"
       
    21 
       
    22 #include <implementationproxy.h> // For TImplementationProxy definition
       
    23 
       
    24 //#ifdef __SAP_POLICY_MANAGEMENT
       
    25 #include <PolicyEngineXACML.h>
       
    26 //#endif
       
    27 
       
    28 #include "EmbeddedLinkHandler.h"
       
    29 #include "nsmldmuri.h"
       
    30 #include "debug.h"
       
    31 #include <featmgr.h>
       
    32 #include <utf.h> 
       
    33 
       
    34 
       
    35 #define TO_BE_IMPLEMENTED()	{ ret = EError; }
       
    36 
       
    37 typedef TBuf<10> TEmbeddedLinkAppName;
       
    38 
       
    39 // ------------------------------------------------------------------------------------------------
       
    40 // CNSmlEmbeddedLinkAdapter* CNSmlEmbeddedLinkAdapter::NewL( )
       
    41 // ------------------------------------------------------------------------------------------------
       
    42 CNSmlEmbeddedLinkAdapter* CNSmlEmbeddedLinkAdapter::NewL( MSmlDmCallback* aDmCallback )
       
    43 	{
       
    44 	RDEBUG("CNSmlEmbeddedLinkAdapter::NewL(): begin");
       
    45 	CNSmlEmbeddedLinkAdapter* self = NewLC( aDmCallback );
       
    46 	CleanupStack::Pop();
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 // ------------------------------------------------------------------------------------------------
       
    51 // CNSmlEmbeddedLinkAdapter* CNSmlEmbeddedLinkAdapter::NewLC( )
       
    52 // ------------------------------------------------------------------------------------------------
       
    53 CNSmlEmbeddedLinkAdapter* CNSmlEmbeddedLinkAdapter::NewLC( MSmlDmCallback* aDmCallback )
       
    54 	{
       
    55 	RDEBUG("CNSmlEmbeddedLinkAdapter::NewLC(): begin");
       
    56 	CNSmlEmbeddedLinkAdapter* self = new ( ELeave ) CNSmlEmbeddedLinkAdapter( aDmCallback );
       
    57 	CleanupStack::PushL( self );
       
    58 	self->ConstructL( );
       
    59 	return self;
       
    60 	}
       
    61 
       
    62 
       
    63 // ------------------------------------------------------------------------------------------------
       
    64 // CNSmlEmbeddedLinkAdapter::CNSmlEmbeddedLinkAdapter()
       
    65 // ------------------------------------------------------------------------------------------------
       
    66 
       
    67 CNSmlEmbeddedLinkAdapter::CNSmlEmbeddedLinkAdapter( MSmlDmCallback* aDmCallback ) 
       
    68 	: CTARMDmAdapter( aDmCallback )
       
    69 	, iCallBack( aDmCallback )
       
    70 	{
       
    71 	RDEBUG("CNSmlEmbeddedLinkAdapter::CNSmlEmbeddedLinkAdapter(): begin");
       
    72 	}
       
    73 
       
    74 
       
    75 // ------------------------------------------------------------------------------------------------
       
    76 // CNSmlEmbeddedLinkAdapter::~CNSmlEmbeddedLinkAdapter()
       
    77 // ------------------------------------------------------------------------------------------------
       
    78 
       
    79 
       
    80 CNSmlEmbeddedLinkAdapter::~CNSmlEmbeddedLinkAdapter()
       
    81 	{
       
    82 	RDEBUG("CNSmlEmbeddedLinkAdapter::~CNSmlEmbeddedLinkAdapter(): begin");
       
    83 	FeatureManager::UnInitializeLib();
       
    84 	delete iLinkHandler;
       
    85 	}
       
    86 
       
    87 // ------------------------------------------------------------------------------------------------
       
    88 //  CNSmlEmbeddedLinkAdapter::DDFVersionL()
       
    89 // ------------------------------------------------------------------------------------------------
       
    90 void CNSmlEmbeddedLinkAdapter::DDFVersionL( CBufBase& aDDFVersion )
       
    91 	{
       
    92 	RDEBUG("CNSmlEmbeddedLinkAdapter::DDFVersionL(TDes& aDDFVersion): begin");
       
    93 	aDDFVersion.InsertL( 0,KNSmlEmbeddedLinkAdapterDDFVersion );
       
    94 	RDEBUG("CNSmlEmbeddedLinkAdapter::DDFVersionL(TDes& aDDFVersion): end");
       
    95 	}
       
    96 
       
    97 
       
    98 // ------------------------------------------------------------------------------------------------
       
    99 //  CNSmlEmbeddedLinkAdapter::DDFStructureL()
       
   100 //
       
   101 // ------------------------------------------------------------------------------------------------
       
   102 void CNSmlEmbeddedLinkAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
       
   103 	{
       
   104 	RDEBUG("CNSmlEmbeddedLinkAdapter::DDFStructureL(): begin");	
       
   105 
       
   106 	TSmlDmAccessTypes accessTypesGet;
       
   107 	accessTypesGet.SetGet();
       
   108 
       
   109 	TSmlDmAccessTypes accessTypesAddGet;
       
   110 	accessTypesAddGet.SetAdd();
       
   111 	accessTypesAddGet.SetGet();
       
   112 
       
   113 	TSmlDmAccessTypes accessTypesGetReplace;
       
   114 	accessTypesGetReplace.SetGet();
       
   115 	accessTypesGetReplace.SetReplace();
       
   116 
       
   117 	TSmlDmAccessTypes accessTypesNone;
       
   118 
       
   119 	/*
       
   120 	Node: ./Customization
       
   121 	*/
       
   122 	MSmlDmDDFObject& Customization = aDDF.AddChildObjectL( KNSmlEmbeddedLinkCustomization );
       
   123 	FillNodeInfoL( Customization, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent,
       
   124 				MSmlDmDDFObject::ENode, KNullDesC8 );	
       
   125 	
       
   126 	/*
       
   127 	Node: ./EmbeddedLinks
       
   128 	*/
       
   129 	MSmlDmDDFObject& EmbeddedLinks = Customization.AddChildObjectL( KNSmlEmbeddedLinkEmbeddedLinks );
       
   130 	FillNodeInfoL( EmbeddedLinks, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent,
       
   131 				MSmlDmDDFObject::ENode, KNullDesC8 );
       
   132 
       
   133 
       
   134 	/*
       
   135 	Node: ./EmbeddedLinks/<X>
       
   136 	*/
       
   137 	MSmlDmDDFObject& groupNode = EmbeddedLinks.AddChildObjectGroupL( );
       
   138 	FillNodeInfoL( groupNode, accessTypesGet, MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic,
       
   139 					MSmlDmDDFObject::ENode, KNSmlEmbeddedLinkDynamicNode );
       
   140 
       
   141 	/*
       
   142 	Node: ./EmbeddedLinks/<X>/Links
       
   143 	*/
       
   144 	MSmlDmDDFObject& Links = groupNode.AddChildObjectL( KNSmlEmbeddedLinkLink );
       
   145 	FillNodeInfoL( Links,accessTypesAddGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent,
       
   146 					MSmlDmDDFObject::ENode, KNSmlEmbeddedLinkLink );
       
   147 
       
   148 	/*
       
   149 	Node: ./EmbeddedLinks/<X>/ID
       
   150 	*/
       
   151 	/*
       
   152 	MSmlDmDDFObject& idNode = groupNode.AddChildObjectL( KNSmlEmbeddedLinkID );
       
   153 	FillNodeInfoL( idNode, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent,
       
   154 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkLink );
       
   155 	*/
       
   156 	/*
       
   157 	Node: ./EmbeddedLinks/<X>/AppName
       
   158 	*/
       
   159 	/*
       
   160 	MSmlDmDDFObject& appNameNode = groupNode.AddChildObjectL( KNSmlEmbeddedLinkAppName );
       
   161 	FillNodeInfoL( appNameNode, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent,
       
   162 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkLink );
       
   163 	*/
       
   164 	
       
   165 	/*
       
   166 	Node: ./EmbeddedLinks/<X>/Links/<X>
       
   167 	*/
       
   168 	TSmlDmAccessTypes accessTypesAddDeleteGetReplace;
       
   169 	accessTypesAddDeleteGetReplace.SetAdd();
       
   170 	accessTypesAddDeleteGetReplace.SetDelete();
       
   171 	accessTypesAddDeleteGetReplace.SetGet();
       
   172 	accessTypesAddDeleteGetReplace.SetReplace();
       
   173 
       
   174 	MSmlDmDDFObject& group2Node = Links.AddChildObjectGroupL( );
       
   175 	FillNodeInfoL( group2Node, accessTypesAddDeleteGetReplace, MSmlDmDDFObject::EZeroOrMore,
       
   176 					MSmlDmDDFObject::EDynamic,			//EDynamic
       
   177 					MSmlDmDDFObject::ENode, KNSmlEmbeddedLinkLink );
       
   178 
       
   179 
       
   180 	/*
       
   181 	Node: ./EmbeddedLinks/<X>/Links/<X>/URL
       
   182 	*/
       
   183 	MSmlDmDDFObject& urlNode = group2Node.AddChildObjectL( KNSmlEmbeddedLinkURL );
       
   184 	FillNodeInfoL( urlNode, accessTypesGetReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent,
       
   185 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkURL );
       
   186 
       
   187 	/*
       
   188 	Node: ./EmbeddedLinks/<X>/Links/<X>/Name
       
   189 	*/
       
   190 	MSmlDmDDFObject& nameNode = group2Node.AddChildObjectL( KNSmlEmbeddedLinkName );
       
   191 	FillNodeInfoL( nameNode, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
       
   192 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkName );
       
   193 
       
   194 	/*
       
   195 	Node: ./EmbeddedLinks/<X>/Links/<X>/UserName
       
   196 	*/
       
   197 	MSmlDmDDFObject& usernameNode = group2Node.AddChildObjectL( KNSmlEmbeddedLinkUserName );
       
   198 	FillNodeInfoL( usernameNode, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
       
   199 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkUserName );
       
   200 
       
   201 	/*
       
   202 	Node: ./EmbeddedLinks/<X>/Links/<X>/Password
       
   203 	*/
       
   204 	MSmlDmDDFObject& passwordNode = group2Node.AddChildObjectL( KNSmlEmbeddedLinkPassword );
       
   205 	FillNodeInfoL( passwordNode, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
       
   206 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkPassword );
       
   207 
       
   208 	/*
       
   209 	Node: ./EmbeddedLinks/<X>/Links/<X>/ConRef
       
   210 	*/
       
   211 	MSmlDmDDFObject& confrefNode = group2Node.AddChildObjectL( KNSmlEmbeddedLinkConfRef );
       
   212 	FillNodeInfoL( confrefNode, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
       
   213 					MSmlDmDDFObject::EChr, KNSmlEmbeddedLinkConfRef );
       
   214 
       
   215 
       
   216 	}
       
   217 
       
   218 // ------------------------------------------------------------------------------------------------
       
   219 //  CNSmlEmbeddedLinkAdapter::UpdateLeafObjectL()
       
   220 // ------------------------------------------------------------------------------------------------
       
   221 void CNSmlEmbeddedLinkAdapter::_UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TDesC8& aObject, const TDesC8& /*aType*/, const TInt aStatusRef )	//OK
       
   222 	{
       
   223 	RDEBUG( "CNSmlEmbeddedLinkAdapter::UpdateLeafObjectL(): begin" );
       
   224 
       
   225 	TError ret( EOk ) ;
       
   226 
       
   227 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   228 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   229 	TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) );
       
   230 	TPtrC8 field( NSmlDmURI::LastURISeg( uriPtrc ) ) ;
       
   231 #else
       
   232 	TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) );
       
   233 	TPtrC8 field( NSmlDmURI::LastURISeg( aURI ) ) ;
       
   234 #endif	
       
   235 	
       
   236 	TBuf<1000>obj;
       
   237 	TInt err = CnvUtfConverter::ConvertToUnicodeFromUtf8(obj,aObject);
       
   238 	
       
   239 	if( cnt == 6 )
       
   240 		{	
       
   241 		TInt linkUid;
       
   242 		
       
   243 		HBufC8* luid = iCallBack->GetLuidAllocL( NSmlDmURI::RemoveLastSeg( aURI ) );	
       
   244 
       
   245 		TLex8 lexa( luid->Des() );
       
   246 		TInt err = lexa.Val( linkUid );
       
   247 
       
   248 		delete luid;
       
   249 
       
   250 		if (err == KErrNone)
       
   251 			{
       
   252 			if ( field == KNSmlEmbeddedLinkURL )
       
   253 				{
       
   254 				iLinkHandler->UpdateLinkUrlL( linkUid, obj );
       
   255 				}
       
   256 			else if ( field == KNSmlEmbeddedLinkName )
       
   257 				{
       
   258 				iLinkHandler->UpdateLinkNameL( linkUid, obj );
       
   259 				}
       
   260 			else if ( field == KNSmlEmbeddedLinkUserName )
       
   261 				{
       
   262 				iLinkHandler->UpdateUserNameL( linkUid, obj );
       
   263 				}
       
   264 			else if ( field == KNSmlEmbeddedLinkPassword )
       
   265 				{
       
   266 				iLinkHandler->UpdatePasswordL( linkUid, obj );
       
   267 				}
       
   268 			else if ( field == KNSmlEmbeddedLinkConfRef )
       
   269 				{
       
   270 				iLinkHandler->UpdateWapApL( linkUid, obj );
       
   271 				}
       
   272 			else 
       
   273 				{
       
   274 				ret = EInvalidObject;
       
   275 				}
       
   276 			}
       
   277 		else 
       
   278 			{
       
   279 			ret = EInvalidObject;
       
   280 			}
       
   281 		} 
       
   282 	else 
       
   283 		{
       
   284 		ret = EInvalidObject;
       
   285 		}
       
   286 
       
   287 	iCallBack->SetStatusL( aStatusRef, ret );
       
   288 	}
       
   289 
       
   290 // ------------------------------------------------------------------------------------------------
       
   291 //
       
   292 // ------------------------------------------------------------------------------------------------
       
   293 void CNSmlEmbeddedLinkAdapter::_UpdateLeafObjectL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, TInt aStatusRef )
       
   294 	{
       
   295 	RDEBUG( "CNSmlEmbeddedLinkAdapter::UpdateLeafObjectL(...RWriteStream...): begin" );
       
   296 	//Not supported
       
   297 	TError ret = EError;
       
   298 	iCallBack->SetStatusL( aStatusRef, ret );
       
   299 	}
       
   300 
       
   301 // ------------------------------------------------------------------------------------------------
       
   302 // CNSmlEmbeddedLinkAdapter::DeleteObjectL( const TDesC& aURI, const TDesC& aLUID )
       
   303 // ------------------------------------------------------------------------------------------------
       
   304 void CNSmlEmbeddedLinkAdapter::_DeleteObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TInt aStatusRef )		// OK
       
   305 	{
       
   306 	RDEBUG("CNSmlEmbeddedLinkAdapter::DeleteLeafObjectL( ): begin");
       
   307 
       
   308 	TError ret = EOk ;
       
   309 	TInt linkUid;
       
   310 	HBufC8* field = HBufC8::NewLC( 16 );
       
   311 	
       
   312 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   313 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   314 	TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) );
       
   315 	field->Des().Copy( NSmlDmURI::LastURISeg( uriPtrc ) );
       
   316 #else
       
   317 	TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) );
       
   318 	field->Des().Copy( NSmlDmURI::LastURISeg( aURI ) );
       
   319 #endif	
       
   320 
       
   321 	if ( cnt == 5 )
       
   322 		{					// remove item from bookmarks
       
   323 			
       
   324 		HBufC8* luid = iCallBack->GetLuidAllocL( aURI );
       
   325 	
       
   326 		TLex8 lexa( luid->Des() );
       
   327 		TInt err( lexa.Val( linkUid ) );
       
   328 		delete luid;
       
   329 		luid = NULL;
       
   330 		if ( err == KErrNone )
       
   331 			{
       
   332 			iLinkHandler->RemoveLinkL( linkUid );
       
   333 			} 
       
   334 		else 
       
   335 			{
       
   336 			ret = EInvalidObject;
       
   337 			}
       
   338 
       
   339 		} 
       
   340 	else if ( cnt == 6 ) 
       
   341 		{
       
   342 		
       
   343 		HBufC8* luid=iCallBack->GetLuidAllocL( NSmlDmURI::RemoveLastSeg( aURI ) );		
       
   344 		TLex8 lexa( luid->Des() );
       
   345 		
       
   346 		TInt err( lexa.Val( linkUid ) );
       
   347 		delete luid;
       
   348 		luid = NULL;
       
   349 		TBuf<8> emptyStr;
       
   350 		emptyStr.Copy( _L("") );
       
   351 		
       
   352 		if ( err == KErrNone )
       
   353 			{
       
   354 			if( field->Des() == KNSmlEmbeddedLinkURL )
       
   355 				{
       
   356 				//iLinkHandler->UpdateLinkUrlL(linkUid, _L(""));
       
   357 				iLinkHandler->UpdateLinkUrlL( linkUid, emptyStr );
       
   358 				}
       
   359 			else if ( field->Des() == KNSmlEmbeddedLinkName )
       
   360 				{
       
   361 				iLinkHandler->UpdateLinkNameL( linkUid, emptyStr );
       
   362 				}
       
   363 			else if ( field->Des() == KNSmlEmbeddedLinkUserName )
       
   364 				{
       
   365 				iLinkHandler->UpdateUserNameL(linkUid, emptyStr);
       
   366 				}
       
   367 			else if ( field->Des() == KNSmlEmbeddedLinkPassword )
       
   368 				{
       
   369 				iLinkHandler->UpdatePasswordL( linkUid, emptyStr );
       
   370 				}
       
   371 			else if ( field->Des() == KNSmlEmbeddedLinkConfRef ) 
       
   372 				{
       
   373 				
       
   374 				}
       
   375 			else 
       
   376 				{
       
   377 				ret = EInvalidObject;
       
   378 				}
       
   379 			}
       
   380 		else 
       
   381 			{
       
   382 			ret = EInvalidObject;
       
   383 			}
       
   384 		
       
   385 		}	
       
   386 	else
       
   387 		{
       
   388 		}
       
   389 	CleanupStack::PopAndDestroy(); //  field
       
   390 	iCallBack->SetStatusL(aStatusRef, ret);
       
   391 	}
       
   392 
       
   393 // ------------------------------------------------------------------------------------------------
       
   394 //  CNSmlEmbeddedLinkAdapter::FetchLeafObjectL( const TDesC& aURI, const TDesC& aLUID, const TDesC& aType, CBufBase& aObject )
       
   395 // ------------------------------------------------------------------------------------------------
       
   396 void CNSmlEmbeddedLinkAdapter::_FetchLeafObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef )
       
   397 	{
       
   398 	RDEBUG( "CNSmlEmbeddedLinkAdapter::FetchLeafObjectL(): begin" );
       
   399 
       
   400 	TError ret( EOk );
       
   401 
       
   402 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   403 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   404 	TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) );
       
   405 	TPtrC8 mapping( NSmlDmURI::LastURISeg( uriPtrc ) );
       
   406 #else
       
   407 	TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) );
       
   408 	TPtrC8 mapping( NSmlDmURI::LastURISeg( aURI ) );
       
   409 #endif
       
   410 	
       
   411 	HBufC *data = HBufC::NewLC( 1000 );			
       
   412 	CBufBase* object = CBufFlat::NewL( 1000 );
       
   413 	CleanupStack::PushL( object );
       
   414 
       
   415 	TBuf<64> appName;
       
   416 	
       
   417 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   418 	RecognizeAppTypeL( uriPtrc, appName );
       
   419 #else
       
   420 	RecognizeAppTypeL( aURI, appName );
       
   421 #endif	
       
   422 	
       
   423 	if ( cnt == 6 )
       
   424 		{
       
   425 		
       
   426 		TPtrC8 linkName( NSmlDmURI::RemoveLastSeg( aURI ) );	
       
   427 		HBufC8* uidBuf = iCallBack->GetLuidAllocL( linkName );
       
   428 		
       
   429 		CleanupStack::PushL( uidBuf );
       
   430 		TInt uidInt;
       
   431 		TInt app;
       
   432 
       
   433 		TLex8 leksa( uidBuf->Des() );
       
   434 		leksa.Val( uidInt );
       
   435 
       
   436 		TLex leksa2( appName );
       
   437 		leksa2.Val( app );
       
   438 
       
   439 		CEmbeddedLinkApp* linkApp = NULL;
       
   440 		
       
   441 		User::LeaveIfError( iLinkHandler->GetLinkAppL( app, linkApp ) );
       
   442 
       
   443 		CFavouritesItem* favItem = CFavouritesItem::NewL();
       
   444 		CleanupStack::PushL( favItem );
       
   445 		linkApp->GetLinkL( uidInt, *favItem );
       
   446 
       
   447 
       
   448 		// HBufC *uidi = iCallback->GetLuidALloc(linkname);
       
   449 		// tee uidista TUid ja  hae browserista uidia vastaava linkki
       
   450 		// kaiva applikaatiofoldertieto urin seasta jos tartteee
       
   451 		// ota linkistä tarvittava tieto kuten allakin on jo tehhty
       
   452 
       
   453 		if( mapping == KNSmlEmbeddedLinkURL )
       
   454 			{
       
   455 			data->Des().Copy( favItem->Url() );
       
   456 			} 
       
   457 		else if ( mapping == KNSmlEmbeddedLinkName )
       
   458 			{
       
   459 			data->Des().Copy( favItem->Name() );
       
   460 			}
       
   461 		else if ( mapping == KNSmlEmbeddedLinkUserName )
       
   462 			{
       
   463 			ret = EError;
       
   464 			}
       
   465 		else if( mapping == KNSmlEmbeddedLinkPassword )
       
   466 			{
       
   467 			ret = EError;
       
   468 			}
       
   469 		else if( mapping == KNSmlEmbeddedLinkConfRef )
       
   470 			{
       
   471 			TFavouritesWapAp wapAp = favItem->WapAp();
       
   472 			if (wapAp.IsDefault())
       
   473 				{
       
   474 				data->Des().Copy( KWapApDefault() );
       
   475 				}
       
   476 			else if (wapAp.IsNull())
       
   477 				{
       
   478 				data->Des().Copy( KWapApNull() );
       
   479 				}
       
   480 			else
       
   481 				{
       
   482 				TUint32 val = wapAp.ApId();
       
   483 				data->Des().Num( (TInt64)val );
       
   484 				}
       
   485 			}
       
   486 		else
       
   487 			{
       
   488 			ret = EInvalidObject;
       
   489 			}
       
   490 
       
   491 		CleanupStack::PopAndDestroy( 2 );	// favItem, //sf-NO:(linkApp), uidBuf
       
   492 		}
       
   493 	else if ( cnt == 4 )
       
   494 		{
       
   495 		TInt app;
       
   496 		TLex leksaApp( appName );
       
   497 		leksaApp.Val( app );
       
   498 
       
   499 		CEmbeddedLinkApp* linkApp = NULL;
       
   500 		User::LeaveIfError( iLinkHandler->GetLinkAppL( app, linkApp ) );
       
   501 
       
   502 		if( mapping == KNSmlEmbeddedLinkID )
       
   503 			{
       
   504 			TInt id = linkApp->AppId();
       
   505 			data->Des().Num( (TInt64)id );
       
   506 			}
       
   507 		else if ( mapping == KNSmlEmbeddedLinkAppName )
       
   508 			{
       
   509 			TPtrC name = linkApp->AppName();
       
   510 			data->Des().Copy( name );
       
   511 			}
       
   512 		else
       
   513 			{
       
   514 			ret = EInvalidObject;
       
   515 			}
       
   516 		}
       
   517 	else 
       
   518 		{
       
   519 		ret = EInvalidObject;
       
   520 		}
       
   521 	TBuf8<1000> resultBuf;
       
   522 	 TInt retVal = CnvUtfConverter::ConvertFromUnicodeToUtf8(resultBuf,data->Des());
       
   523 	object->InsertL( 0, resultBuf );
       
   524 	iCallBack->SetResultsL( aResultsRef, *object, aType );
       
   525 	iCallBack->SetStatusL( aStatusRef, ret );
       
   526 	CleanupStack::PopAndDestroy( 2 ); // object, data
       
   527 	}
       
   528 
       
   529 
       
   530 // ------------------------------------------------------------------------------------------------
       
   531 //
       
   532 // ------------------------------------------------------------------------------------------------
       
   533 void CNSmlEmbeddedLinkAdapter::_FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TDesC8& /*aType*/, TInt /*aResultsRef*/, TInt aStatusRef )
       
   534 	{
       
   535 	RDEBUG("CNSmlEmbeddedLinkAdapter::FetchLeafObjectSizeL(): begin");
       
   536 
       
   537 	TError ret = EOk;
       
   538 
       
   539 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   540 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   541 	TNodeId nodeId = NodeId( uriPtrc );
       
   542 #else
       
   543 	TNodeId nodeId = NodeId( aURI );
       
   544 #endif	
       
   545 
       
   546 	switch( nodeId )
       
   547 		{
       
   548 	case ENodeCustomization:
       
   549 		ret = EError;
       
   550 		break;
       
   551 
       
   552 	default:
       
   553 		ret = EError;
       
   554 		break;
       
   555 		}
       
   556 
       
   557 	iCallBack->SetStatusL( aStatusRef, ret );
       
   558 	}
       
   559 
       
   560 // ------------------------------------------------------------------------------------------------
       
   561 //  CNSmlEmbeddedLinkAdapter::ChildURIListL( const TDesC& aURI, const TDesC& aParentLUID, const CArrayFix<TNSmlDmMappingInfo>& aPreviousURISegmentList, CArrayFix<TPtrC>& aCurrentURISegmentList )
       
   562 // ------------------------------------------------------------------------------------------------
       
   563 void CNSmlEmbeddedLinkAdapter::_ChildURIListL( const TDesC8& aURI, 
       
   564 		const TDesC8& /*aParentLUID*/, 
       
   565 		const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/, 
       
   566 		const TInt aResultsRef, const TInt aStatusRef  )		//OK
       
   567 	{
       
   568 	RDEBUG("CNSmlEmbeddedLinkAdapter::ChildURIListL(): begin");
       
   569 	TError ret( EOk );
       
   570 	HBufC *data = HBufC::NewLC( 1000 );	
       
   571 	CBufBase* object = CBufFlat::NewL( 1000 );
       
   572 	
       
   573 	CleanupStack::PushL( object );
       
   574 
       
   575 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   576 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   577 	TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) );
       
   578 #else
       
   579 	TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) );
       
   580 #endif
       
   581 
       
   582 	if ( cnt == 1 )
       
   583 		{
       
   584 		object->InsertL( 0, KRootLeafs8 );
       
   585 		}
       
   586 	else if ( cnt == 2 )
       
   587 		{							// application list							
       
   588 		RArray<TEmbeddedLinkAppName> array;
       
   589 		
       
   590 		iLinkHandler->SupportingApplicationsL( array );
       
   591 		
       
   592 		data->Des().Zero();
       
   593 		TBuf<8> app;
       
   594 		for( TInt i=0; i<array.Count(); i++)
       
   595 			{
       
   596 			if ( i > 0 ) 
       
   597 				{
       
   598 				data->Des().Append( '/' );
       
   599 				}
       
   600 			app=array[i];
       
   601 			data->Des().Append( array[i] );
       
   602 			}
       
   603 		array.Close();
       
   604 		}	
       
   605 	else if ( cnt == 3 )
       
   606 		{
       
   607 		object->InsertL( 0, KAppLeafs8 );
       
   608 		} 
       
   609 	else if ( cnt == 4 )
       
   610 		{				// tietyn applikaation linkkilistaus		/Customization/EmbeddedLinks/4/Links
       
   611 		TBuf<32> appName;
       
   612 		TInt appType;
       
   613 #ifdef __TARM_SYMBIAN_CONVERGENCY		
       
   614 		User::LeaveIfError( RecognizeAppTypeL( uriPtrc, appName ) );
       
   615 #else
       
   616 		User::LeaveIfError( RecognizeAppTypeL( aURI, appName ) );
       
   617 #endif		
       
   618 		TLex lexa( appName );
       
   619 		User::LeaveIfError( lexa.Val( appType ) );
       
   620 	
       
   621 		CEmbeddedLinkApp* linkApp = NULL;
       
   622 		
       
   623 		User::LeaveIfError( iLinkHandler->GetLinkAppL( appType, linkApp ) );
       
   624 		
       
   625 		CFavouritesItemList* itemList = new ( ELeave ) CFavouritesItemList;
       
   626 		CleanupStack::PushL( itemList );
       
   627 
       
   628 		linkApp->GetLinksL( *itemList );
       
   629 		
       
   630 		HBufC8 *URIname = HBufC8::NewLC( 64 );
       
   631 		
       
   632 		TBuf8<32> uidBuf;
       
   633 
       
   634 		for( TInt i = 0; i < itemList->Count(); i++ )
       
   635 			{				// Generates the list of bookmarks AND also maps the luids to the bookmarks
       
   636 			if( i > 0 && object->Size() > 0 ) 
       
   637 				{
       
   638 				data->Des().Append( '/' );
       
   639 				}
       
   640 			data->Des().Append( itemList->At( i )->Name() );
       
   641 			{
       
   642 			TBuf8<1000> resultBuf;
       
   643 			TInt retVal = CnvUtfConverter::ConvertFromUnicodeToUtf8(resultBuf,data->Des());
       
   644 			object->InsertL( object->Size(), resultBuf);
       
   645 			data->Des().Zero();
       
   646 			}
       
   647 			// TODO, SymbianConvergencym is this aURI ok in this method? should be I guess...
       
   648 			URIname->Des().Append( aURI );
       
   649 			URIname->Des().Append( _L8( "/" ) );
       
   650 			URIname->Des().Append( itemList->At( i )->Name() );
       
   651 			
       
   652 			TInt contekstiId( itemList->At( i )->ContextId() );
       
   653 			TInt pfolderid( itemList->At( i )->ParentFolder() );	
       
   654 			TInt linkUid( itemList->At( i )->Uid() );
       
   655 			uidBuf.AppendNum( (TInt64)linkUid );
       
   656 			
       
   657 			HBufC8* ptr = iCallBack->GetLuidAllocL( URIname->Des() );
       
   658 			
       
   659 			if ( ptr->Length() == 0 )
       
   660 				{
       
   661 				iCallBack->SetMappingL( URIname->Des(), uidBuf );		// Check if the bookmark has already a luid mapping	
       
   662 				}
       
   663 			
       
   664 			delete ptr;
       
   665 			ptr = NULL;
       
   666 			
       
   667 			uidBuf.Zero();
       
   668 			URIname->Des().Zero();
       
   669 		
       
   670 			}
       
   671 		CleanupStack::PopAndDestroy( 2 );	// URIname, itemList, //sf-NO:linkApp
       
   672 		}
       
   673 	else if ( cnt == 5 )
       
   674 		{
       
   675 		object->InsertL( 0, KLinkLeafs8 );
       
   676 		} 
       
   677 	else 
       
   678 		{
       
   679 		ret = EInvalidObject;
       
   680 		}
       
   681 	    TBuf8<1000> resultBuf;
       
   682 	     TInt retVal = CnvUtfConverter::ConvertFromUnicodeToUtf8(resultBuf,data->Des());
       
   683 	    object->InsertL( 0, resultBuf );
       
   684 	
       
   685 	iCallBack->SetResultsL( aResultsRef, *object, KNullDesC8 );
       
   686 	iCallBack->SetStatusL( aStatusRef, ret );
       
   687 	CleanupStack::PopAndDestroy( 2 );	//data, object
       
   688 	}
       
   689 
       
   690 
       
   691 // ------------------------------------------------------------------------------------------------
       
   692 // CNSmlEmbeddedLinkAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID )
       
   693 // ------------------------------------------------------------------------------------------------
       
   694 void CNSmlEmbeddedLinkAdapter::_AddNodeObjectL( const TDesC8& aURI, const TDesC8& /*aParentLUID*/, const TInt aStatusRef )
       
   695 {
       
   696 	TError ret( EOk );
       
   697 	RDEBUG( "CNSmlEmbeddedLinkAdapter::AddNodeObjectL(): begin" );
       
   698 
       
   699 	// tee uus bookmark
       
   700 	// sitte iCallback->SetMapping (aURI, bookmarkUIDi favouriteItemistä);
       
   701 
       
   702 	TInt appType;
       
   703 	TBuf<32> appName;
       
   704 
       
   705 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   706 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   707 	User::LeaveIfError( RecognizeAppTypeL( uriPtrc, appName ) );
       
   708 #else
       
   709 	User::LeaveIfError( RecognizeAppTypeL( aURI, appName ) );
       
   710 #endif	
       
   711 	
       
   712 	TLex lexa( appName );
       
   713 
       
   714 	User::LeaveIfError( lexa.Val( appType ) );
       
   715 	
       
   716 	CEmbeddedLinkApp* linkApp = NULL;
       
   717 	User::LeaveIfError( iLinkHandler->GetLinkAppL( appType, linkApp ) );
       
   718 
       
   719 	TBuf<8> emptyStr;
       
   720 	emptyStr.Copy( _L( "Unknown" ) );
       
   721 
       
   722 	TInt luid( linkApp->AddLinkL( emptyStr, emptyStr ) );
       
   723 	if( luid < KErrNone )
       
   724 		{
       
   725 		ret = EError;
       
   726 		}
       
   727 	else
       
   728 		{
       
   729 		TBuf8<16> luidBuf;
       
   730 		luidBuf.AppendNum( (TInt64)luid );
       
   731 		iCallBack->SetMappingL( aURI, luidBuf );	
       
   732 		}
       
   733 
       
   734 	iCallBack->SetStatusL( aStatusRef, ret );
       
   735 }
       
   736 
       
   737 // ------------------------------------------------------------------------------------------------
       
   738 //
       
   739 // ------------------------------------------------------------------------------------------------
       
   740 void CNSmlEmbeddedLinkAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, TInt aStatusRef )
       
   741 	{
       
   742 	RDEBUG("CNSmlEmbeddedLinkAdapter::ExecuteCommandL(): begin");
       
   743 	//Not supported
       
   744 	TError ret = EError;
       
   745 	iCallBack->SetStatusL( aStatusRef, ret );
       
   746 	}
       
   747 
       
   748 // ------------------------------------------------------------------------------------------------
       
   749 //
       
   750 // ------------------------------------------------------------------------------------------------
       
   751 void CNSmlEmbeddedLinkAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, TInt aStatusRef )
       
   752 	{
       
   753 	RDEBUG("CNSmlEmbeddedLinkAdapter::ExecuteCommandL(...RWriteStream...): begin");
       
   754 	//Not supported
       
   755 	TError ret = EError;
       
   756 	iCallBack->SetStatusL( aStatusRef, ret );
       
   757 	}
       
   758 	
       
   759 // ------------------------------------------------------------------------------------------------
       
   760 //
       
   761 // ------------------------------------------------------------------------------------------------
       
   762 void CNSmlEmbeddedLinkAdapter::_CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, TInt aStatusRef )
       
   763 	{
       
   764 	RDEBUG("CNSmlEmbeddedLinkAdapter::CopyCommandL(): begin");
       
   765 	//Not supported
       
   766 	TError ret = EError;
       
   767 	iCallBack->SetStatusL( aStatusRef, ret );
       
   768 	}
       
   769 
       
   770 // ------------------------------------------------------------------------------------------------
       
   771 //
       
   772 // ------------------------------------------------------------------------------------------------
       
   773 void CNSmlEmbeddedLinkAdapter::StartAtomicL()
       
   774 	{
       
   775 	RDEBUG("CNSmlEmbeddedLinkAdapter::StartAtomicL(): begin");
       
   776 	//Not supported
       
   777 	}
       
   778 
       
   779 // ------------------------------------------------------------------------------------------------
       
   780 //
       
   781 // ------------------------------------------------------------------------------------------------
       
   782 void CNSmlEmbeddedLinkAdapter::CommitAtomicL()
       
   783 	{
       
   784 	RDEBUG("CNSmlEmbeddedLinkAdapter::CommitAtomicL(): begin");
       
   785 	//Not supported
       
   786 	}
       
   787 
       
   788 // ------------------------------------------------------------------------------------------------
       
   789 //
       
   790 // ------------------------------------------------------------------------------------------------
       
   791 void CNSmlEmbeddedLinkAdapter::RollbackAtomicL()
       
   792 	{
       
   793 	RDEBUG("CNSmlEmbeddedLinkAdapter::RollbackAtomicL(): begin");
       
   794 	//Not supported
       
   795 	}
       
   796 
       
   797 // ------------------------------------------------------------------------------------------------
       
   798 //
       
   799 // ------------------------------------------------------------------------------------------------
       
   800 TBool CNSmlEmbeddedLinkAdapter::StreamingSupport( TInt& /*aItemSize*/ )
       
   801 	{
       
   802 	RDEBUG("CNSmlEmbeddedLinkAdapter::StreamingSupport(): begin");
       
   803 	return EFalse;
       
   804 	}
       
   805 
       
   806 // ------------------------------------------------------------------------------------------------
       
   807 //
       
   808 // ------------------------------------------------------------------------------------------------
       
   809 #ifdef __TARM_SYMBIAN_CONVERGENCY	
       
   810 void CNSmlEmbeddedLinkAdapter::StreamCommittedL( RWriteStream& /*aStream*/ )
       
   811 #else
       
   812 void CNSmlEmbeddedLinkAdapter::StreamCommittedL()
       
   813 #endif	
       
   814 	{	
       
   815 	RDEBUG("CNSmlEmbeddedLinkAdapter::StreamCommittedL(): begin");
       
   816 	RDEBUG("CNSmlEmbeddedLinkAdapter::StreamCommittedL(): end");
       
   817 	}
       
   818 
       
   819 // ------------------------------------------------------------------------------------------------
       
   820 //
       
   821 // ------------------------------------------------------------------------------------------------
       
   822 void CNSmlEmbeddedLinkAdapter::CompleteOutstandingCmdsL()
       
   823 	{
       
   824 	RDEBUG("CNSmlEmbeddedLinkAdapter::CompleteOutstandingCmdsL(): begin");
       
   825 	}
       
   826 
       
   827 // -----------------------------------------------------------------------------
       
   828 // 
       
   829 // -----------------------------------------------------------------------------
       
   830 //
       
   831 //#ifdef __SAP_POLICY_MANAGEMENT
       
   832 
       
   833 TPtrC8 CNSmlEmbeddedLinkAdapter::PolicyRequestResourceL( const TDesC8& /*aURI*/ )
       
   834 {
       
   835 	
       
   836 	if(!FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement ))
       
   837 	{
       
   838 		User::Leave(KErrNotSupported);
       
   839 		
       
   840 	}
       
   841 		return PolicyEngineXACML::KCustomizationManagement();
       
   842 	
       
   843 }
       
   844 	
       
   845 //#endif
       
   846 
       
   847 // ------------------------------------------------------------------------------------------------
       
   848 //
       
   849 // ------------------------------------------------------------------------------------------------
       
   850 CNSmlEmbeddedLinkAdapter::TNodeId CNSmlEmbeddedLinkAdapter::NodeId( const TDesC8& aURI )
       
   851 	{
       
   852 	TNodeId id = ENodeUnknown;
       
   853 
       
   854 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   855 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   856 	TInt cnt = NSmlDmURI::NumOfURISegs( uriPtrc ) ;
       
   857 	TPtrC8 app = NSmlDmURI::LastURISeg( uriPtrc ) ;
       
   858 #else
       
   859 	TInt cnt = NSmlDmURI::NumOfURISegs( aURI ) ;
       
   860 	TPtrC8 app = NSmlDmURI::LastURISeg( aURI ) ;
       
   861 #endif
       
   862 
       
   863 	if ( cnt == 1 )
       
   864 		{
       
   865 		if (app == KNSmlEmbeddedLinkCustomization)
       
   866 			{
       
   867 			id = ENodeCustomization;
       
   868 			}
       
   869 		}
       
   870 	else if ( cnt == 2 ) 
       
   871 		{
       
   872 		if (app == KNSmlEmbeddedLinkEmbeddedLinks)
       
   873 			{
       
   874 			id = ENodeEmbeddedLinks;
       
   875 			}
       
   876 		}
       
   877 	else if ( cnt == 3 ) 
       
   878 		{
       
   879 		id = ENodeEmbeddedLinksX1;
       
   880 		}
       
   881 	else if ( cnt == 4 ) 
       
   882 		{
       
   883 		if (app == KNSmlEmbeddedLinkLink)
       
   884 			{
       
   885 			id = ENodeLinks;
       
   886 			}
       
   887 		else if (app == KNSmlEmbeddedLinkID)
       
   888 			{
       
   889 			id = ENodeID;
       
   890 			}
       
   891 		else if (app == KNSmlEmbeddedLinkAppName)
       
   892 			{
       
   893 			id = ENodeAppName;
       
   894 			}
       
   895 		}
       
   896 	else if ( cnt == 5 ) 
       
   897 		{
       
   898 		id = ENodeLinksX2;
       
   899 		}
       
   900 	else if ( cnt == 6 )
       
   901 		{
       
   902 		if (app == KNSmlEmbeddedLinkEmbeddedLinks)
       
   903 			{
       
   904 			id = ENodeURL;
       
   905 			}
       
   906 		else if (app == KNSmlEmbeddedLinkEmbeddedLinks)
       
   907 			{
       
   908 			id = ENodeName;
       
   909 			}
       
   910 		else if (app == KNSmlEmbeddedLinkEmbeddedLinks)
       
   911 			{
       
   912 			id = ENodeUserName;
       
   913 			}
       
   914 		else if (app == KNSmlEmbeddedLinkEmbeddedLinks)
       
   915 			{
       
   916 			id = ENodePassword;
       
   917 			}
       
   918 		else if (app == KNSmlEmbeddedLinkEmbeddedLinks)
       
   919 			{
       
   920 			id = ENodeConRef;
       
   921 			}
       
   922 		}
       
   923 
       
   924 	return id;
       
   925 	}
       
   926 
       
   927 // ------------------------------------------------------------------------------------------------
       
   928 // CNSmlEmbeddedLinkAdapter::RecognizeAppTypeL(const TDesC8& aURI, TDes& aAppName)
       
   929 // ------------------------------------------------------------------------------------------------
       
   930 TInt CNSmlEmbeddedLinkAdapter::RecognizeAppTypeL( const TDesC8& aURI, TDes& aAppName )
       
   931 	{
       
   932 	HBufC8 *appName = HBufC8::NewLC( 64 );
       
   933 	
       
   934 #ifdef __TARM_SYMBIAN_CONVERGENCY
       
   935 	TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
       
   936 	appName->Des().Copy( uriPtrc );
       
   937 #else
       
   938 	appName->Des().Copy( aURI );
       
   939 #endif	
       
   940 
       
   941 	if ( NSmlDmURI::NumOfURISegs( aURI ) > 2 )
       
   942 		{
       
   943 		while( NSmlDmURI::NumOfURISegs( appName->Des() ) > 3 )
       
   944 			{
       
   945 			
       
   946 			appName->Des().Copy( NSmlDmURI::RemoveLastSeg( appName->Des() ) );
       
   947 			}
       
   948 		appName->Des().Copy( NSmlDmURI::LastURISeg( appName->Des() ) );
       
   949 		aAppName.Copy( appName->Des() );
       
   950 		} 
       
   951 	else 
       
   952 		{
       
   953 		CleanupStack::PopAndDestroy();	//appName
       
   954 		return KErrNotFound;	
       
   955 		}
       
   956 	CleanupStack::PopAndDestroy();	//appName
       
   957 	return KErrNone;
       
   958 	}
       
   959 
       
   960 // ------------------------------------------------------------------------------------------------
       
   961 //
       
   962 // ------------------------------------------------------------------------------------------------
       
   963 const TImplementationProxy ImplementationTable[] = 
       
   964 {
       
   965 	{ {KNSmlEmbeddedLinkAdapterImplUid}, (TProxyNewLPtr)CNSmlEmbeddedLinkAdapter::NewL }
       
   966 };
       
   967 
       
   968 // ------------------------------------------------------------------------------------------------
       
   969 //
       
   970 // ------------------------------------------------------------------------------------------------
       
   971 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   972 {
       
   973 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   974 	return ImplementationTable;
       
   975 }
       
   976 
       
   977 // ------------------------------------------------------------------------------------------------
       
   978 //
       
   979 // ------------------------------------------------------------------------------------------------
       
   980 void CNSmlEmbeddedLinkAdapter::ConstructL( )
       
   981 {
       
   982 	TRAPD( errf, FeatureManager::InitializeLibL() );
       
   983 	if( errf != KErrNone )
       
   984 	{
       
   985 		User::Leave(errf);
       
   986 	}
       
   987 	if(FeatureManager::FeatureSupported(KFeatureIdSapEmbeddedLinkAdapter))
       
   988 	{
       
   989 			iLinkHandler = CEmbeddedLinkHandler::NewL();
       
   990 	}
       
   991 	else
       
   992 	{
       
   993 		FeatureManager::UnInitializeLib();
       
   994    		User::Leave( KErrNotSupported );
       
   995 	}
       
   996 }
       
   997 
       
   998 
       
   999 // -------------------------------------------------------------------------------------
       
  1000 // CNSmlEmbeddedLinkAdapter::FillNodeInfoL()
       
  1001 // Fills the node info in ddf structure
       
  1002 // -------------------------------------------------------------------------------------
       
  1003 void CNSmlEmbeddedLinkAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes,
       
  1004 										MSmlDmDDFObject::TOccurence aOccurrence, MSmlDmDDFObject::TScope aScope, 
       
  1005 										MSmlDmDDFObject::TDFFormat aFormat,const TDesC8& aDescription )
       
  1006 {
       
  1007 	aNode.SetAccessTypesL(aAccTypes);
       
  1008 	aNode.SetOccurenceL(aOccurrence);
       
  1009 	aNode.SetScopeL(aScope);
       
  1010 	aNode.SetDFFormatL(aFormat);
       
  1011 	if(aFormat!=MSmlDmDDFObject::ENode)
       
  1012 	{
       
  1013 		aNode.AddDFTypeMimeTypeL(KNSmlEmbeddedLinkAdapterTextPlain);
       
  1014 	}
       
  1015 	aNode.SetDescriptionL(aDescription);
       
  1016 }
       
  1017 
       
  1018