contentpublishingsrv/contentpublishingserver/cpserver/src/cpserverdatamanager.cpp
changeset 0 79c6a41cd166
child 12 502e5d91ad42
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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 <liwcommon.h>
       
    20 #include <s32mem.h>
       
    21 #include <escapeutils.h>
       
    22 
       
    23 #include "cpserverdatamanager.h"
       
    24 #include "ccontentmap.h"
       
    25 #include "cpublisherregistrymap.h"
       
    26 #include "cpstorage.h"
       
    27 #include "cpdebug.h"
       
    28 #include "cpstoragefactory.h"
       
    29 #include "cpglobals.h"
       
    30 #include "cpserversession.h"
       
    31 #include "cpnotificationhandler.h"
       
    32 
       
    33 using namespace LIW;
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // C++ destructor
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CCPDataManager::~CCPDataManager()
       
    40     {
       
    41     iNotificationsArray.Close( );
       
    42     delete iStorage;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // 
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CCPDataManager* CCPDataManager::NewL( TBool aBool )
       
    50     {
       
    51     CCPDataManager* self = CCPDataManager::NewLC( aBool );
       
    52     CleanupStack::Pop( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // 
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CCPDataManager* CCPDataManager::NewLC( TBool aBool )
       
    61     {
       
    62     CCPDataManager* self = new( ELeave ) CCPDataManager;
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL( aBool );
       
    65     return self;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // C++ constructor.
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CCPDataManager::CCPDataManager()
       
    73     {
       
    74 
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Standard 2nd phase constructor.
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void CCPDataManager::ConstructL( TBool aBool )
       
    82     {
       
    83     CP_DEBUG( _L8("CCPDataManager::ConstructL()") );
       
    84     if ( !aBool )
       
    85         {
       
    86         iStorage = StorageFactory::NewDatabaseL( );
       
    87         }
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // 
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 TUint CCPDataManager::AddDataL( CCPLiwMap& aMap )
       
    95     {
       
    96     CP_DEBUG( _L8("CCPDataManager::AddDataL()") );
       
    97     __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
       
    98 
       
    99     CCPLiwMap* getlistmap = CreateMapForGetlistLC( aMap );
       
   100 
       
   101     TBool activateMap = aMap.GetActivateInfo();
       
   102     TBool activateDB ( EFalse );
       
   103     TBool activateSupport =aMap.ActivateActionSupport( );
       
   104    	
       
   105    	if( activateSupport )
       
   106 	    {
       
   107 	    activateDB = GetActivateInfoL( getlistmap );
       
   108 	    }   
       
   109   
       
   110     TInt id = iStorage->AddL( &aMap );
       
   111 
       
   112     if( activateSupport )
       
   113         {
       
   114         if ( activateMap && !activateDB )
       
   115             {
       
   116             // append action trigger for activate
       
   117             aMap.InsertL( KActionTrigger, TLiwVariant( KActivateTrigger ) ); 
       
   118             }
       
   119         if ( !activateMap && activateDB )
       
   120             {
       
   121             // append action trigger for deactivate
       
   122             aMap.InsertL( KActionTrigger, TLiwVariant( KDeactivateTrigger ) ); 
       
   123             }
       
   124         //remove flag from map ( needed because map will be used in getlist 
       
   125         //operation )                
       
   126         aMap.Remove( KFlag );  
       
   127         }
       
   128      
       
   129     CleanupStack::PopAndDestroy( getlistmap );
       
   130 
       
   131     return id;
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 void CCPDataManager::AddNonPersistentDataL( const CCPLiwMap* aMap )
       
   139     {
       
   140     CLiwDefaultList* notificationList = CLiwDefaultList::NewLC( );
       
   141     BuildChangeInfoForAddL( aMap, notificationList );
       
   142     HandleChangeL( notificationList );
       
   143     CleanupStack::PopAndDestroy( notificationList );
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 void CCPDataManager::GetListL( const CCPLiwMap& aMap,
       
   151     CLiwGenericParamList& aOutParamList )
       
   152     {
       
   153     CP_DEBUG( _L8("CCPDataManager::GetListL()") );
       
   154     __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
       
   155     iStorage->GetListL( &aMap, aOutParamList );
       
   156     }
       
   157 // ---------------------------------------------------------------------------
       
   158 // 
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 TInt CCPDataManager::GetActionL( const CCPLiwMap& aMap,
       
   162     CLiwGenericParamList& aOutParamList, CLiwDefaultList* aNotificationList )
       
   163     {
       
   164     CP_DEBUG( _L8("CCPDataManager::GetActionL()") );
       
   165     __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
       
   166 
       
   167     CLiwGenericParamList* paramList = CLiwGenericParamList::NewLC( );
       
   168     TInt result( KErrNone );
       
   169     TRAP( result, iStorage->GetListL( &aMap, *paramList ) );
       
   170     RBuf8 actionTrigger;
       
   171     actionTrigger.CleanupClosePushL();
       
   172     
       
   173     if ( aMap.GetPropertyL( KActionTrigger, actionTrigger ) )
       
   174         {
       
   175         const TLiwGenericParam* param;
       
   176     	TInt pos( 0);
       
   177     	
       
   178         param = paramList->FindFirst( pos, KListMap );
       
   179         //at least one param should be valid to preceed
       
   180         if ( !param || pos == KErrNotFound )
       
   181         	{
       
   182         	BuildDefaultChangeInfoL(&aMap, aNotificationList);
       
   183         	}
       
   184         
       
   185         //iteration through paramList items
       
   186     	while ( param && pos != KErrNotFound )
       
   187     		{
       
   188     		BuildChangeInfoL( &aMap, param, aNotificationList );
       
   189     		FillActionParamListL( aOutParamList, param, actionTrigger );
       
   190     		param = paramList->FindNext( pos, KListMap );
       
   191     		}
       
   192         }
       
   193     else
       
   194         {
       
   195         User::Leave( KErrNotFound );
       
   196         }
       
   197     CleanupStack::PopAndDestroy( &actionTrigger );
       
   198     CleanupStack::PopAndDestroy( paramList );
       
   199     return result;
       
   200     }
       
   201 
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // 
       
   205 // ---------------------------------------------------------------------------
       
   206 //
       
   207 void CCPDataManager::FillActionParamListL( 
       
   208 		CLiwGenericParamList& aOutParamList, 
       
   209 		const TLiwGenericParam* aParam,
       
   210 		RBuf8 & aActionTrigger)
       
   211 	{
       
   212     CP_DEBUG( _L8("CCPDataManager::FillActionParamListL()") );
       
   213     __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
       
   214 		
       
   215 	RBuf8 actionBinaries;
       
   216 	actionBinaries.CleanupClosePushL();
       
   217 	ExtractActionL(  aParam, actionBinaries );
       
   218 
       
   219 	RDesReadStream str(actionBinaries);
       
   220 	CleanupClosePushL( str );
       
   221 	CLiwDefaultMap* actionMap = CLiwDefaultMap::NewLC( str );
       
   222 	ExtractTriggerL( aOutParamList, actionMap, aActionTrigger );
       
   223 
       
   224 	CleanupStack::PopAndDestroy( actionMap );
       
   225 	CleanupStack::PopAndDestroy( &str );
       
   226 	CleanupStack::PopAndDestroy( &actionBinaries );
       
   227 	}
       
   228 
       
   229 // ---------------------------------------------------------------------------
       
   230 // 
       
   231 // ---------------------------------------------------------------------------
       
   232 //
       
   233 void CCPDataManager::GetActivePublishersL( CLiwGenericParamList* aResultList )
       
   234     {
       
   235     CCPLiwMap *map = CPublisherRegistryMap::NewLC();
       
   236     map->InsertL( KFlag, TLiwVariant( TUint( 0 | EActivate ) ) );
       
   237     iStorage->GetListL( map, *aResultList );
       
   238     CleanupStack::PopAndDestroy(map);
       
   239     }
       
   240 
       
   241 
       
   242 // ---------------------------------------------------------------------------
       
   243 // 
       
   244 // ---------------------------------------------------------------------------
       
   245 //
       
   246 void CCPDataManager::ExtractTriggerL( CLiwGenericParamList& aOutParamList,
       
   247     const CLiwDefaultMap* aMap, const TDesC8& aTrigger )
       
   248     {
       
   249     CP_DEBUG( _L8("CCPDataManager::GetActionL()") );
       
   250     CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC( );
       
   251     TLiwVariant variant;
       
   252     variant.PushL( );
       
   253     if ( aMap->FindL( aTrigger, variant ) )
       
   254         {
       
   255         targetMap->InsertL( KActionMap, variant );
       
   256         }
       
   257     else
       
   258         {
       
   259         User::Leave( KErrNotFound );
       
   260         }
       
   261 
       
   262     TLiwGenericParam result( KListMap, TLiwVariant( targetMap ));
       
   263     aOutParamList.AppendL( result );
       
   264     CleanupStack::PopAndDestroy( &variant );
       
   265     CleanupStack::PopAndDestroy( targetMap );
       
   266     }
       
   267 
       
   268 // ---------------------------------------------------------------------------
       
   269 // 
       
   270 // ---------------------------------------------------------------------------
       
   271 //
       
   272 void CCPDataManager::RemoveDataL( const CCPLiwMap& aMap )
       
   273     {
       
   274     CP_DEBUG( _L8("CCPDataManager::RemoveData()") );
       
   275     __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
       
   276     iStorage->RemoveL( &aMap );
       
   277     }
       
   278 
       
   279 // ---------------------------------------------------------------------------
       
   280 //
       
   281 // ---------------------------------------------------------------------------
       
   282 //
       
   283 void CCPDataManager::AddObserverL(
       
   284     CCPNotificationHandler* aNotificationHandler )
       
   285     {
       
   286     CP_DEBUG( _L8("CCPDataManager::AddObserverL()") );
       
   287     __ASSERT_DEBUG( iStorage , User::Panic( _L("cpserver"), 0 ) );
       
   288     iNotificationsArray.AppendL( aNotificationHandler );
       
   289     if ( iNotificationsArray.Count( ) == 1 )
       
   290         {
       
   291         iStorage->SetCallback( this );
       
   292         }
       
   293     }
       
   294 
       
   295 // ---------------------------------------------------------------------------
       
   296 //
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 void CCPDataManager::RemoveObserver(
       
   300     CCPNotificationHandler* aNotificationHandler )
       
   301     {
       
   302     CP_DEBUG( _L8("CCPDataManager::RemoveObserver()") );
       
   303     TInt index = iNotificationsArray.Find( aNotificationHandler );
       
   304     __ASSERT_DEBUG( index >= 0 , User::Panic( _L("cpserver"), 0 ) );
       
   305     iNotificationsArray.Remove( index );
       
   306     if ( iNotificationsArray.Count( ) == 0 )
       
   307         {
       
   308         iStorage->SetCallback( 0 );
       
   309         }
       
   310     }
       
   311 
       
   312 // ---------------------------------------------------------------------------
       
   313 //
       
   314 // ---------------------------------------------------------------------------
       
   315 //
       
   316 void CCPDataManager::HandleChangeL( CLiwDefaultList* aListOfMaps )
       
   317     {
       
   318     CP_DEBUG( _L8("CCPDataManager::HandleChangeL()") );
       
   319     //for every session
       
   320     for ( TInt i = 0; i<iNotificationsArray.Count( ); i++ )
       
   321         {
       
   322         TRAPD(error, SendNotificationL(aListOfMaps, i));
       
   323         if ( error )
       
   324             {
       
   325             iNotificationsArray[i]->ErrorComplete( error );
       
   326             }
       
   327         }
       
   328     }
       
   329 
       
   330 // ---------------------------------------------------------------------------
       
   331 //
       
   332 // ---------------------------------------------------------------------------
       
   333 //
       
   334 void CCPDataManager::CloseDatabase()
       
   335     {
       
   336     CP_DEBUG( _L8("CCPDataManager::CloseDatabase()") );
       
   337     delete iStorage;
       
   338     iStorage = NULL;
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 //
       
   343 // ---------------------------------------------------------------------------
       
   344 //
       
   345 void CCPDataManager::OpenDatabaseL()
       
   346     {
       
   347     CP_DEBUG( _L8("CCPDataManager::OpenDatabaseL()") );
       
   348     if ( !iStorage )
       
   349         {
       
   350         iStorage = StorageFactory::NewDatabaseL( );
       
   351         
       
   352         // Restore storage observers
       
   353         if ( iNotificationsArray.Count() > 0 )
       
   354             {
       
   355             iStorage->SetCallback( this );
       
   356             }
       
   357         }
       
   358     }
       
   359 // ---------------------------------------------------------------------------
       
   360 //
       
   361 // ---------------------------------------------------------------------------
       
   362 //
       
   363 void CCPDataManager::SendNotificationL( CLiwDefaultList* aListOfMaps,
       
   364     TInt aIndex )
       
   365     {
       
   366     CP_DEBUG( _L8("CCPDataManager::SendNotificationL()") );
       
   367     iNotificationsArray[aIndex]->SendNotificationL( aListOfMaps );
       
   368     }
       
   369 
       
   370 // ---------------------------------------------------------------------------
       
   371 //
       
   372 // ---------------------------------------------------------------------------
       
   373 //
       
   374 void CCPDataManager::ExtractActionL( const TLiwGenericParam* aParam, RBuf8& aAction )
       
   375     {
       
   376     CP_DEBUG( _L8("CCPDataManager::ExtractActionL()") );
       
   377 	CLiwDefaultMap* map = CLiwDefaultMap::NewLC( );
       
   378 	if ( !aParam->Value().Get( *map ) )
       
   379 		{
       
   380 		User::Leave( KErrArgument );
       
   381 		}
       
   382 	
       
   383 	TLiwVariant variant; variant.PushL( );
       
   384 	TPtrC8 tempBuf( KNullDesC8 );
       
   385 	if ( map->FindL( KActionMap, variant ) 
       
   386 			&& variant.Get( tempBuf ) )
       
   387 		{
       
   388 		aAction.CreateL( tempBuf );
       
   389 		}
       
   390 	else
       
   391 		{
       
   392 		User::Leave( KErrArgument );
       
   393 		}
       
   394 	
       
   395 	CleanupStack::PopAndDestroy( &variant );
       
   396 	CleanupStack::PopAndDestroy( map );
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // 
       
   401 // -----------------------------------------------------------------------------
       
   402 //    
       
   403 CCPLiwMap* CCPDataManager::CreateMapForGetlistLC( const CCPLiwMap& aMap )
       
   404     {
       
   405     CCPLiwMap *resultmap = CPublisherRegistryMap::NewLC();
       
   406     RBuf publisher;
       
   407     publisher.CleanupClosePushL();
       
   408     RBuf content_type;
       
   409     content_type.CleanupClosePushL();
       
   410     RBuf content_id;
       
   411     content_id.CleanupClosePushL();
       
   412     aMap.GetPropertyL( KContentType, content_type );
       
   413     aMap.GetPropertyL( KContentId, content_id ); 
       
   414     aMap.GetPropertyL( KPublisherId, publisher );
       
   415     resultmap->InsertL( KPublisherId, TLiwVariant( publisher ));
       
   416     resultmap->InsertL( KContentId, TLiwVariant( content_id ));
       
   417     resultmap->InsertL( KContentType, TLiwVariant( content_type ));
       
   418     CleanupStack::PopAndDestroy( &content_id );
       
   419     CleanupStack::PopAndDestroy( &content_type );
       
   420     CleanupStack::PopAndDestroy( &publisher );
       
   421     return resultmap;
       
   422     }
       
   423 
       
   424 // -----------------------------------------------------------------------------
       
   425 // 
       
   426 // -----------------------------------------------------------------------------
       
   427 //    
       
   428 TBool CCPDataManager::GetActivateInfoL( const CCPLiwMap* aMap )
       
   429     {
       
   430     TBool result( EFalse );
       
   431     CLiwGenericParamList* outList = CLiwGenericParamList::NewLC();
       
   432 	TRAPD(err,GetListL(*aMap,*outList));
       
   433 	if (err == KErrNone)
       
   434 	    {
       
   435 	    TInt pos( 0 );
       
   436         outList->FindFirst( pos, KListMap );
       
   437         if( pos != KErrNotFound )
       
   438        	    {
       
   439    	    	TLiwVariant variant = (*outList)[pos].Value();
       
   440 		    CLiwDefaultMap *map = CLiwDefaultMap::NewLC();
       
   441    			variant.Get( *map );
       
   442    			if (map->FindL( KFlag, variant ))
       
   443        		    {
       
   444    	    		TUint flag;
       
   445    		    	variant.Get( flag );
       
   446    			   	result = flag & EActivate;
       
   447        			}
       
   448    	    	CleanupStack::PopAndDestroy( map );
       
   449   		    variant.Reset();
       
   450    		    }
       
   451 	    }
       
   452    	CleanupStack::PopAndDestroy( outList );
       
   453    	return result; 
       
   454     }	
       
   455 
       
   456 // -----------------------------------------------------------------------------
       
   457 // 
       
   458 // -----------------------------------------------------------------------------
       
   459 //    
       
   460 void CCPDataManager::BuildChangeInfoL( const CCPLiwMap* aMap, 
       
   461 		const TLiwGenericParam* aParam,	
       
   462 		CLiwDefaultList* aChangeInfoList )
       
   463 	{
       
   464 	TLiwVariant resultVar = aParam->Value();
       
   465 	resultVar.PushL();
       
   466 	CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC(); 
       
   467 	CLiwDefaultMap* resultMap = CLiwDefaultMap::NewLC(); 
       
   468 	resultVar.Get( *resultMap );
       
   469 	
       
   470 	CopyVariantL(KId, resultMap, changeInfoMap );
       
   471 	CopyVariantL(KPublisherId, resultMap, changeInfoMap );
       
   472 	CopyVariantL(KContentType, resultMap, changeInfoMap );
       
   473 	CopyVariantL(KContentId, resultMap, changeInfoMap );
       
   474 	CopyVariantL(KFlag, resultMap, changeInfoMap );
       
   475 	CopyVariantL(KType, aMap, changeInfoMap );
       
   476 	CopyVariantL(KActionTrigger, aMap, changeInfoMap );
       
   477 	CopyActionTrigger16L( aMap, changeInfoMap );
       
   478 	
       
   479 	changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) );
       
   480 	
       
   481 	aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) );
       
   482 	CleanupStack::PopAndDestroy( resultMap );
       
   483 	CleanupStack::PopAndDestroy( changeInfoMap );
       
   484 	CleanupStack::PopAndDestroy( &resultVar );
       
   485 	}
       
   486 
       
   487 
       
   488 // -----------------------------------------------------------------------------
       
   489 // 
       
   490 // -----------------------------------------------------------------------------
       
   491 //    
       
   492 void CCPDataManager::BuildDefaultChangeInfoL( const CCPLiwMap* aMap, 
       
   493 		CLiwDefaultList* aChangeInfoList )
       
   494 	{
       
   495 	CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC(); 
       
   496 	
       
   497 	CopyVariantL(KId, aMap, changeInfoMap );
       
   498 	CopyVariantL(KPublisherId, aMap, changeInfoMap );
       
   499 	CopyVariantL(KContentType, aMap, changeInfoMap );
       
   500 	CopyVariantL(KContentId, aMap, changeInfoMap );
       
   501 	CopyVariantL(KFlag, aMap, changeInfoMap );
       
   502 	CopyVariantL(KType, aMap, changeInfoMap );
       
   503 	CopyVariantL(KActionTrigger, aMap, changeInfoMap );
       
   504 	CopyActionTrigger16L( aMap, changeInfoMap );
       
   505 	
       
   506 	changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationExecute ) );
       
   507 	
       
   508 	aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) );
       
   509 	CleanupStack::PopAndDestroy( changeInfoMap );
       
   510 	}
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 //
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 void CCPDataManager::BuildChangeInfoForAddL( const CCPLiwMap* aMap,
       
   517         CLiwDefaultList* aChangeInfoList )
       
   518     {
       
   519     CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC();
       
   520 
       
   521     CopyVariantL(KId, aMap, changeInfoMap );
       
   522     CopyVariantL(KPublisherId, aMap, changeInfoMap );
       
   523     CopyVariantL(KContentType, aMap, changeInfoMap );
       
   524     CopyVariantL(KContentId, aMap, changeInfoMap );
       
   525     CopyVariantL(KFlag, aMap, changeInfoMap );
       
   526     CopyVariantL(KType, aMap, changeInfoMap );
       
   527     CopyVariantL(KActionTrigger, aMap, changeInfoMap );
       
   528     CopyVariantL(KDataMap, aMap, changeInfoMap );
       
   529     CopyActionTrigger16L( aMap, changeInfoMap );
       
   530 
       
   531     changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationAdd ) );
       
   532 
       
   533     aChangeInfoList->AppendL( TLiwVariant( changeInfoMap ) );
       
   534     CleanupStack::PopAndDestroy( changeInfoMap );
       
   535     }
       
   536 
       
   537 // -----------------------------------------------------------------------------
       
   538 //
       
   539 // -----------------------------------------------------------------------------
       
   540 //
       
   541 void CCPDataManager::CopyVariantL(const TDesC8& aKey,
       
   542 		const CLiwMap* aInMap, CLiwDefaultMap* aOutMap )
       
   543 	{
       
   544 	TLiwVariant variant;
       
   545 	variant.PushL();
       
   546 	if ( aInMap->FindL( aKey, variant ) )
       
   547 		{
       
   548 		aOutMap->InsertL( aKey, variant );
       
   549 		}
       
   550 	CleanupStack::PopAndDestroy( &variant );
       
   551 	}
       
   552 
       
   553 // -----------------------------------------------------------------------------
       
   554 // 
       
   555 // -----------------------------------------------------------------------------
       
   556 //   
       
   557 void CCPDataManager::CopyActionTrigger16L( 
       
   558 		const CLiwMap* aInMap, CLiwDefaultMap* aOutMap )
       
   559 	{
       
   560 	TLiwVariant variant;
       
   561 	variant.PushL();
       
   562 	if ( aInMap->FindL( KActionTrigger(), variant ) )
       
   563 		{
       
   564 
       
   565 		TPtrC8 result8( KNullDesC8 );
       
   566 		if( variant.Get( result8 ) )
       
   567 			{
       
   568 			RBuf actionTrigger;
       
   569 			actionTrigger.CleanupClosePushL();
       
   570 			actionTrigger.Assign( 
       
   571 					EscapeUtils::ConvertToUnicodeFromUtf8L( result8 ) );
       
   572 
       
   573 			variant.Reset();
       
   574 			variant.Set( actionTrigger );
       
   575 			CleanupStack::PopAndDestroy( &actionTrigger );
       
   576 			}
       
   577 		
       
   578 		aOutMap->InsertL( KActionTrigger16(), variant );
       
   579 		}
       
   580 	CleanupStack::PopAndDestroy( &variant );
       
   581 	}
       
   582