customization/isadapter/src/IdleSoftkeysWebTargetManager.cpp
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2002 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 Idle SoftKey  Adapter
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "IdleSoftkeysWebTargetManager.h"
       
    20 #include "UiSettingsUtil.h"
       
    21 // symbian
       
    22 // s60
       
    23 #include <centralrepository.h>
       
    24 // tarm
       
    25 #include "IsAdapterLiterals.h"
       
    26 #include "IsAdapterDefines.h"
       
    27 #include "nsmldmuri.h"
       
    28 #include "TARMCharConv.h"
       
    29 #include "TPtrC8I.h"
       
    30 #include "debug.h"
       
    31 
       
    32 // #define ISADAPTER_USE_CAPTION_IN_WEBTARGET_NAME
       
    33 
       
    34 
       
    35 CIdleSoftkeysWebTargetManager::CIdleSoftkeysWebTargetManager( MSmlDmCallback *& aCallBack,
       
    36         RFavouritesDb   & aFavDb ) : iCallBack( aCallBack ), iFavDb( aFavDb )        
       
    37         {
       
    38         	iUiSettingsNotInitialized = ETrue;	
       
    39         }
       
    40         
       
    41 CIdleSoftkeysWebTargetManager::~CIdleSoftkeysWebTargetManager()
       
    42 	{
       
    43 	if(iUiSettingsNotInitialized == EFalse)
       
    44 		{
       
    45 		delete iUiSettings;
       
    46 		}
       
    47 	}
       
    48 
       
    49         
       
    50 // -------------------------------------------------------------------------------------
       
    51 // CIdleSoftkeysWebTargetManager::ListWebTargetsL
       
    52 // -------------------------------------------------------------------------------------
       
    53 TInt CIdleSoftkeysWebTargetManager::ListWebTargetsL( CBufFlat &aList )
       
    54     {
       
    55     RDEBUG( "CIdleSoftkeysWebTargetManager::ListWebTargetsL() >" );
       
    56 
       
    57     TInt i, num = 6, offset;
       
    58    	if(iUiSettingsNotInitialized)
       
    59    	{
       
    60    		iUiSettings = CUiSettingsUtil::NewL( );
       
    61    		iUiSettings->ReadBookmarksL();
       
    62    		iUiSettingsNotInitialized = EFalse;
       
    63    	}
       
    64 	iUiSettings->GetWebTargetsCount( num ) ;
       
    65     HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
    66     RDEBUG_2( "CIdleSoftkeysWebTargetManager::ListWebTargetsL() HBufC8 dataH ALLOC %x", dataH);
       
    67     TPtr8 data( dataH->Des() );
       
    68 
       
    69     for(i=0, offset=0; i<num; i++)
       
    70         {
       
    71         TBuf8<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> numBuf;
       
    72         TInt mappingIndex;
       
    73         TInt bmUid;
       
    74 
       
    75         //
       
    76         // List BM's with valid UID (>= 0)
       
    77         //
       
    78         // General names for the new bookmarks on the fly
       
    79         //
       
    80         User::LeaveIfError(iUiSettings->GetWebTargetAppUid( i, bmUid ));
       
    81         
       
    82         
       
    83         if( bmUid >= 0 )
       
    84             {
       
    85             mappingIndex = -1;
       
    86             numBuf.Num( bmUid );
       
    87             HBufC8* targetName = NULL;
       
    88 
       
    89             //
       
    90             // Case 1: There is already URI to LUID mapping, continue with that
       
    91             //
       
    92             if( (KErrNone == FindURIByLUIDL( data, numBuf, mappingIndex )) && (mappingIndex != -1) )
       
    93                 {
       
    94                 //
       
    95                 // LUid was found in the database
       
    96                 //
       
    97                 targetName = GenerateNodeNameL( NSmlDmURI::LastURISeg(data) );
       
    98                 CleanupStack::PushL(targetName);
       
    99                 }
       
   100 #ifdef ISADAPTER_USE_CAPTION_IN_WEBTARGET_NAME
       
   101             else
       
   102             //
       
   103             // Case 2: Bookmark caption is not used in mappings, use that webtarget name
       
   104             //
       
   105             if( NULL != (targetName = GenerateNodeNameL( i )) )
       
   106                 {
       
   107                 //
       
   108                 // 
       
   109                 //
       
   110                 CleanupStack::PushL(targetName);
       
   111                 UpdateLUIDDatabaseL( *targetName, numBuf, mappingIndex);
       
   112                 }
       
   113 #endif
       
   114             else
       
   115                 {
       
   116                 //
       
   117                 // Generate unique name
       
   118                 //
       
   119                 targetName = GenerateNodeNameL( offset, KPrefixWebTargetURI() );
       
   120                 CleanupStack::PushL(targetName);
       
   121 
       
   122                 mappingIndex = -1;
       
   123                 while( (KErrNone == FindLUIDByURIL( *targetName, data, mappingIndex )) &&
       
   124                        (mappingIndex != -1) )
       
   125                     {
       
   126                     offset ++;
       
   127                     mappingIndex = -1;
       
   128 
       
   129                     CleanupStack::PopAndDestroy( targetName );
       
   130                     targetName = GenerateNodeNameL( offset, KPrefixWebTargetURI() );
       
   131                     CleanupStack::PushL(targetName);
       
   132                     }
       
   133 
       
   134                 // We have now unique webtarget node name and unique LUid
       
   135                 //
       
   136                 numBuf.Num( bmUid );
       
   137                 mappingIndex = -1;
       
   138                 UpdateLUIDDatabaseL( *targetName, numBuf, mappingIndex);
       
   139                 }
       
   140 
       
   141             // Add webtarget node name to list
       
   142             //
       
   143             if( aList.Size() > 0 )
       
   144             {
       
   145                 aList.InsertL( aList.Size(), KNSmlISSeparator() );
       
   146             }
       
   147             aList.InsertL( aList.Size(), NSmlDmURI::LastURISeg(*targetName) );
       
   148             CleanupStack::PopAndDestroy( targetName );
       
   149             }
       
   150         }
       
   151 
       
   152     CleanupStack::PopAndDestroy( dataH );
       
   153 
       
   154     RDEBUG( "CIdleSoftkeysWebTargetManager::ListWebTargetsL() <" );
       
   155     return KErrNone;
       
   156     }
       
   157 
       
   158 // -------------------------------------------------------------------------------------
       
   159 // CIdleSoftkeysWebTargetManager::CheckWebTargetsL
       
   160 // -------------------------------------------------------------------------------------
       
   161 void CIdleSoftkeysWebTargetManager::CheckWebTargetsL()
       
   162     {
       
   163     RDEBUG( "CIdleSoftkeysWebTargetManager::CheckWebTargetsL() ><" );
       
   164     }
       
   165 
       
   166 #ifdef ISADAPTER_USE_CAPTION_IN_WEBTARGET_NAME
       
   167 // -------------------------------------------------------------------------------------
       
   168 // CIdleSoftkeysWebTargetManager::GenerateNodeNameL
       
   169 // -------------------------------------------------------------------------------------
       
   170 HBufC8* CIdleSoftkeysWebTargetManager::GenerateNodeNameL(TInt aIndex)
       
   171     {
       
   172     RDEBUG( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 1 >" );
       
   173 
       
   174     //
       
   175     // Get caption of the bookmark
       
   176     //
       
   177     TBuf<64> caption; 
       
   178     if(iUiSettingsNotInitialized)
       
   179    	{
       
   180    		iUiSettings = CUiSettingsUtil::NewL( );
       
   181    		iUiSettings->ReadBookmarksL();
       
   182    		iUiSettingsNotInitialized = EFalse;
       
   183    	}
       
   184    	
       
   185     User::LeaveIfError( iUiSettings->GetWebTargetCaption( aIndex, caption ) );
       
   186     
       
   187 
       
   188     
       
   189     if( HasInvalidCharacters( caption ) )
       
   190         {
       
   191         return NULL;
       
   192         }
       
   193 
       
   194     //
       
   195     // Generate URI with caption
       
   196     // Reserve space
       
   197     //
       
   198     TInt length = caption.Length() + KPrefixWebTargetURI().Length();
       
   199     HBufC8* targetName = HBufC8::NewLC( length );
       
   200     TPtr8 ptr( targetName->Des() );
       
   201 
       
   202     //
       
   203     // Generate URI with caption
       
   204     // Append strings
       
   205     //
       
   206     ptr.Append( KPrefixWebTargetURI() );
       
   207     ptr.Append( caption );
       
   208 
       
   209     HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   210     TPtr8 data( dataH->Des() );
       
   211     TInt index = -1;
       
   212     TBool okToAdd = (KErrNone != FindLUIDByURIL( ptr, data, index ));
       
   213     CleanupStack::PopAndDestroy( dataH );
       
   214 
       
   215     if( okToAdd )
       
   216         {
       
   217         RDEBUG8_2( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 1 < %S", &targetName );
       
   218         CleanupStack::Pop(targetName);
       
   219         return targetName;
       
   220         }
       
   221     else
       
   222         {
       
   223         RDEBUG( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 1 < NULL, WebTarget name was reserved!" );
       
   224         CleanupStack::PopAndDestroy(targetName);
       
   225         return NULL;
       
   226         }
       
   227     }
       
   228 #endif
       
   229 
       
   230 // -------------------------------------------------------------------------------------
       
   231 // CIdleSoftkeysWebTargetManager::GenerateNodeNameL
       
   232 // -------------------------------------------------------------------------------------
       
   233 HBufC8* CIdleSoftkeysWebTargetManager::GenerateNodeNameL(TInt aIndex, const TDesC8 &aPrefix)
       
   234     {
       
   235     RDEBUG( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 2 >" );
       
   236 
       
   237     TInt length = aPrefix.Length()
       
   238                     + KPrefixWebTargetNodeName().Length()
       
   239                     + MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64;
       
   240 
       
   241     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 2 About to ALLOC %d bytes.", length );
       
   242 
       
   243     HBufC8* targetName = HBufC8::NewL( length );
       
   244 
       
   245     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 2 ALLOC HBufC8 targetName %x", targetName );
       
   246 
       
   247     TPtr8 ptr( targetName->Des() );
       
   248 
       
   249     ptr.Format(KFormatWebTargetNodeName, aIndex+1);
       
   250     ptr.Insert(0, aPrefix);
       
   251 
       
   252     RDEBUG8_2( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 2 < %S", &targetName );
       
   253     return targetName;
       
   254     }
       
   255 
       
   256 // -------------------------------------------------------------------------------------
       
   257 // CIdleSoftkeysWebTargetManager::GenerateNodeNameL
       
   258 // -------------------------------------------------------------------------------------
       
   259 HBufC8* CIdleSoftkeysWebTargetManager::GenerateNodeNameL(const TDesC8 &aText)
       
   260     {
       
   261     RDEBUG( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 3 >" );
       
   262 
       
   263     TInt length = aText.Length();
       
   264 
       
   265     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 3 About to ALLOC %d bytes.", length );
       
   266 
       
   267     HBufC8* targetName = HBufC8::NewL( length );
       
   268 
       
   269     RDEBUG_2("CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 3 ALLOC HBufC8 targetName %x", targetName );
       
   270 
       
   271     TPtr8 ptr( targetName->Des() );
       
   272 
       
   273     ptr.Copy( aText );
       
   274 
       
   275     RDEBUG8_2( "CIdleSoftkeysWebTargetManager::GenerateNodeNameL() 3 < %S", &targetName );
       
   276     return targetName;
       
   277     }
       
   278 
       
   279 // -------------------------------------------------------------------------------------
       
   280 // CIdleSoftkeysWebTargetManager::RenameL
       
   281 // -------------------------------------------------------------------------------------
       
   282 TInt CIdleSoftkeysWebTargetManager::RenameL( const TDesC8& aURI, const TDesC8& /*aLUID*/,
       
   283                                    const TDesC8& aNewURI )
       
   284     {
       
   285     RDEBUG( "CIdleSoftkeysWebTargetManager::RenameL() >" );
       
   286 
       
   287     HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   288     RDEBUG_2( "CIdleSoftkeysWebTargetManager::RenameL() HBufC8 dataH ALLOC %x", dataH);
       
   289 
       
   290     TPtr8 data( dataH->Des() );
       
   291     TInt index = -1;
       
   292     TInt retVal = KErrNone;
       
   293 
       
   294 // OPTION 1: URI is already new one, find old according to LUID
       
   295 #ifdef NOT_DEFINED
       
   296 
       
   297     // If we find some URI with that LUID ...
       
   298     if( ((KErrNone != FindLUIDByURIL( aURI, data, index ))) &&
       
   299          (KErrNone == FindURIByLUIDL( data, aLUID, index )) && (index != -1)  )
       
   300     
       
   301         {
       
   302         // ... we replace that URI with new one
       
   303         UpdateLUIDDatabaseL( aURI, aLUID, index );
       
   304         }
       
   305     else
       
   306         {
       
   307         retVal = KErrNotFound;
       
   308         }
       
   309 
       
   310 // OPTION 2: New (complete) URI is found in the argument
       
   311 #else
       
   312 
       
   313     TInt index2 = -1;
       
   314     if ( (KErrNone != FindLUIDByURIL( aNewURI, data, index )) &&
       
   315          (KErrNone == FindLUIDByURIL( aURI, data,  index2 )) 
       
   316          )
       
   317         {
       
   318         UpdateLUIDDatabaseL( aNewURI, data, index2 );
       
   319         }
       
   320     else
       
   321         {
       
   322         retVal = KErrNotFound;
       
   323         }
       
   324 
       
   325 #endif
       
   326 
       
   327     CleanupStack::PopAndDestroy( dataH );
       
   328 
       
   329     RDEBUG_2( "CIdleSoftkeysWebTargetManager::RenameL() < %d", retVal );
       
   330     return retVal;
       
   331     }
       
   332 
       
   333 // -------------------------------------------------------------------------------------
       
   334 // CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL
       
   335 // -------------------------------------------------------------------------------------
       
   336 TInt CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL(const TDesC8& aURI, TInt &aIndex )
       
   337     {
       
   338     RDEBUG( "CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL() >" );
       
   339 	__UHEAP_MARK;
       
   340     CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
       
   341     TInt index = -1;
       
   342     TInt compareLen = KPrefixWebTargetNodeName().Length();
       
   343     TPtrC8 nodeName = NSmlDmURI::URISeg(aURI, 3);
       
   344 
       
   345     HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   346     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL() HBufC8 dataH ALLOC %x", dataH);
       
   347     TPtr8 data( dataH->Des() );
       
   348 
       
   349     if( NSmlDmURI::NumOfURISegs( aURI ) >= 4 )
       
   350         {
       
   351         TInt bmIndex = -1;
       
   352         HBufC8* targetName = NULL;
       
   353         if( KErrNone == FindLUIDByURIL( NSmlDmURI::URISeg(aURI, 0, 4), data, bmIndex ) )
       
   354             {
       
   355             targetName = GenerateNodeNameL( NSmlDmURI::LastURISeg(aURI) );
       
   356             }
       
   357         else
       
   358             {
       
   359             status = CSmlDmAdapter::EError;
       
   360             }
       
   361 
       
   362         if( CSmlDmAdapter::EOk == status )
       
   363             {
       
   364             CleanupStack::PushL( targetName );
       
   365             TPtrC8 ptr( NSmlDmURI::LastURISeg(*targetName) );
       
   366             if( ptr == nodeName )
       
   367                 {
       
   368                 aIndex = index;
       
   369                 }
       
   370             CleanupStack::PopAndDestroy( targetName );
       
   371             }
       
   372         }
       
   373     else
       
   374         {
       
   375         status = CSmlDmAdapter::EError;
       
   376         }
       
   377 
       
   378     CleanupStack::PopAndDestroy( dataH );
       
   379 	__UHEAP_MARKEND;
       
   380     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL() < %d", (TInt)status );
       
   381     return status;
       
   382     }
       
   383 
       
   384 // -------------------------------------------------------------------------------------
       
   385 // CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL
       
   386 // -------------------------------------------------------------------------------------
       
   387 TInt CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL(const TDesC8& aURI, CFavouritesItem &aItem, TInt &aIndex )
       
   388     {
       
   389     RDEBUG( "CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL() >" );
       
   390 
       
   391     CSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
       
   392     TInt bmIndex = -1;
       
   393     TInt bmUid = -1;
       
   394     TInt compareLen = KPrefixWebTargetNodeName().Length();
       
   395     TPtrC8 nodeName = NSmlDmURI::URISeg(aURI, 3);
       
   396 
       
   397     HBufC8* dataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   398     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL() HBufC8 dataH ALLOC %x", dataH);
       
   399     TPtr8 data( dataH->Des() );
       
   400 
       
   401     if( NSmlDmURI::NumOfURISegs( aURI ) >= 4 )
       
   402         {
       
   403         TInt repIndex = -1;
       
   404         HBufC8* targetName = NULL;
       
   405         if( KErrNone == FindLUIDByURIL( NSmlDmURI::URISeg(aURI, 0, 4), data, repIndex ) )
       
   406             {
       
   407             targetName = GenerateNodeNameL( nodeName );
       
   408             CleanupStack::PushL( targetName );
       
   409             TPtrC8 ptr( NSmlDmURI::LastURISeg(*targetName) );
       
   410             User::LeaveIfError( ptr == nodeName ? KErrNone : KErrGeneral );
       
   411             CleanupStack::PopAndDestroy( targetName );
       
   412 
       
   413             TLex8 lex;
       
   414             lex.Assign(data);
       
   415             User::LeaveIfError( lex.Val( bmUid ) );
       
   416             TInt ret = KErrNone;
       
   417            	if(iUiSettingsNotInitialized)
       
   418    			{	
       
   419    				iUiSettings = CUiSettingsUtil::NewL( );
       
   420    				iUiSettings->ReadBookmarksL();
       
   421    				iUiSettingsNotInitialized = EFalse;
       
   422    			}
       
   423            	User::LeaveIfError(iUiSettings->GetWebTargetIndex(bmUid,bmIndex));
       
   424             if( -1 == bmIndex )
       
   425                 {
       
   426                 ret = KErrNotFound;
       
   427                 }
       
   428             if( KErrNotFound == ret )
       
   429                 {
       
   430                 User::LeaveIfError(iUiSettings->GetWebTargetIndex(bmUid, bmIndex));                
       
   431                 }
       
   432             else
       
   433                 {
       
   434                 User::LeaveIfError( ret );
       
   435                 }
       
   436             }
       
   437         else
       
   438             {
       
   439             status = CSmlDmAdapter::EError;
       
   440             }
       
   441 
       
   442         if( CSmlDmAdapter::EOk == status )
       
   443             {
       
   444             if( KErrNone == iFavDb.Get( bmUid, aItem ) )
       
   445                 {
       
   446                 aIndex = bmIndex;
       
   447                 }
       
   448             else
       
   449                 {
       
   450                 status = CSmlDmAdapter::EError;
       
   451                 }
       
   452             }
       
   453         }
       
   454     else
       
   455         {
       
   456         status = CSmlDmAdapter::EError;
       
   457         }
       
   458 
       
   459     CleanupStack::PopAndDestroy( dataH );
       
   460 
       
   461     RDEBUG_2( "CIdleSoftkeysWebTargetManager::GetTargetFromNodeNameL() < %d", (TInt)status );
       
   462     return status;
       
   463     }
       
   464 
       
   465 // -------------------------------------------------------------------------------------
       
   466 // CIdleSoftkeysWebTargetManager::PrepareItemL
       
   467 // -------------------------------------------------------------------------------------
       
   468 void CIdleSoftkeysWebTargetManager::PrepareItemL( const TDesC8& aURI, CFavouritesItem &aItem, TInt &aIndex )
       
   469     {
       
   470     RDEBUG( "CIdleSoftkeysWebTargetManager::PrepareItemL() >" );
       
   471 	CheckWebTargetsL();
       
   472     TInt error = GetTargetFromNodeNameL( aURI, aItem, aIndex );
       
   473     if( KErrNone != error )
       
   474         {
       
   475         RDEBUG_2( "CIdleSoftkeysWebTargetManager::PrepareItemL TError %d", error );
       
   476         User::Leave( KErrNotFound );
       
   477         }
       
   478 
       
   479     RDEBUG( "CIdleSoftkeysWebTargetManager::PrepareItemL() <" );
       
   480     }
       
   481 
       
   482 // -------------------------------------------------------------------------------------
       
   483 // CIdleSoftkeysWebTargetManager::ReleaseItemL
       
   484 // -------------------------------------------------------------------------------------
       
   485 void CIdleSoftkeysWebTargetManager::ReleaseItemL( CFavouritesItem &aItem, TBool aUpdate/*=ETrue*/ )
       
   486     {
       
   487     if( aUpdate )
       
   488         {
       
   489         User::LeaveIfError( iFavDb.Update( aItem, aItem.Uid(), ETrue ) );
       
   490         }
       
   491     }
       
   492 
       
   493 // -------------------------------------------------------------------------------------
       
   494 // CIdleSoftkeysWebTargetManager::SetCaptionL
       
   495 // -------------------------------------------------------------------------------------
       
   496 void CIdleSoftkeysWebTargetManager::SetCaptionL( const TDesC8& aURI, const TDesC8& aCaption )
       
   497     {
       
   498     RDEBUG( "CIdleSoftkeysWebTargetManager::SetCaptionL() >" );
       
   499 
       
   500     TInt index;
       
   501 
       
   502     CFavouritesItem *favItem = CFavouritesItem::NewLC();
       
   503     RDEBUG_2( "CIdleSoftkeysWebTargetManager::SetCaptionL() CFavouritesItem ALLOC %x", favItem);
       
   504 
       
   505     HBufC* newCaption = CTARMCharConv::ConvertFromUtf8LC( aCaption );
       
   506 
       
   507     PrepareItemL( aURI, *favItem, index );
       
   508     favItem->SetNameL( *newCaption );
       
   509     if( favItem->Name().Compare( *newCaption ) != 0 )
       
   510         {
       
   511         User::Leave( KErrGeneral );
       
   512         }
       
   513     ReleaseItemL( *favItem );
       
   514 
       
   515     CleanupStack::PopAndDestroy( newCaption );
       
   516     CleanupStack::PopAndDestroy( favItem );
       
   517 
       
   518     RDEBUG( "CIdleSoftkeysWebTargetManager::SetCaptionL() <" );
       
   519     }
       
   520 
       
   521 // -------------------------------------------------------------------------------------
       
   522 // CIdleSoftkeysWebTargetManager::FindWapApL
       
   523 // -------------------------------------------------------------------------------------
       
   524 void CIdleSoftkeysWebTargetManager::FindWapApL( const TDesC8& aURI, TInt &aWapAp )
       
   525     {
       
   526     TPtrC8  apURI     = NSmlDmURI::RemoveDotSlash( aURI );
       
   527     TInt    numOfSegs = NSmlDmURI::NumOfURISegs( apURI );
       
   528     TPtrC8I seg1      = NSmlDmURI::URISeg( apURI, 0 );
       
   529     TInt    value     = 0;
       
   530 
       
   531     if( (numOfSegs == 2) && (seg1.Compare( _L8("AP") ) == 0) )
       
   532         {
       
   533         HBufC8* buf = iCallBack->GetLuidAllocL( apURI );
       
   534         CleanupStack::PushL( buf );
       
   535         if( buf->Des().Length() == 0 )
       
   536             {
       
   537             CleanupStack::PopAndDestroy( buf );
       
   538             buf = iCallBack->GetLuidAllocL( aURI );
       
   539             CleanupStack::PushL( buf );
       
   540             if( buf->Des().Length() == 0 )
       
   541                 {
       
   542                 CleanupStack::PopAndDestroy( buf );
       
   543                 User::Leave( KErrNotFound );
       
   544                 }
       
   545             }
       
   546 
       
   547         TLex8 lex;
       
   548         lex.Assign( buf->Des() );
       
   549         User::LeaveIfError( lex.Val( value ) );
       
   550         CleanupStack::PopAndDestroy( buf );
       
   551         }
       
   552     else
       
   553         {
       
   554         User::Leave( KErrArgument );
       
   555         }
       
   556 
       
   557     aWapAp = value;
       
   558     }
       
   559 
       
   560 
       
   561 // -------------------------------------------------------------------------------------
       
   562 // CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL
       
   563 // -------------------------------------------------------------------------------------
       
   564 TInt CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL(const TDesC8& aURI, const TDesC8& aLUID, TInt &aIndex)
       
   565     {
       
   566     RDEBUG( "CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL() >" );
       
   567 
       
   568     TInt ret = KErrGeneral;
       
   569 
       
   570     CRepository* rep = CRepository::NewLC( KNSmlDMISAdapterCentRepUid );
       
   571     RDEBUG_2( "CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL() CRepository ALLOC %x", rep);
       
   572 
       
   573     HBufC8* data = HBufC8::NewLC( aURI.Length() + aLUID.Length() + 1 );
       
   574     RDEBUG_2( "CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL() HBufC8 ALLOC data %x", data);
       
   575     TPtr8 dataPtr( data->Des() );
       
   576 
       
   577     dataPtr.Copy(aURI);
       
   578     dataPtr.Append(TChar(' '));
       
   579     dataPtr.Append(aLUID);
       
   580 
       
   581     TInt count = 0;
       
   582 
       
   583     // Get / create the count
       
   584     //
       
   585     ret = rep->Get((TUint32)KRepositoryIdBookmarkCount, count);
       
   586     if( ret == KErrNotFound )
       
   587         {
       
   588         ret = rep->Create((TUint32)KRepositoryIdBookmarkCount, count);
       
   589         }
       
   590 
       
   591     if( KErrNone == ret )
       
   592         {
       
   593         // Replace old or ...
       
   594         //
       
   595         if( aIndex != -1 )
       
   596             {
       
   597             ret = rep->Set(aIndex, dataPtr );
       
   598             }
       
   599         else
       
   600         // ... Create new index
       
   601         //
       
   602             {
       
   603             TUint32 newIndex = (TUint32)KRepositoryIdBookmarkFirst + count;
       
   604 
       
   605             ret = rep->Create(newIndex, dataPtr);
       
   606             if(KErrAlreadyExists == ret)
       
   607                 {
       
   608                 ret = rep->Set(newIndex, dataPtr);
       
   609                 }
       
   610             
       
   611             if( KErrNone == ret )
       
   612                 {
       
   613                 HBufC8* check = HBufC8::NewLC( dataPtr.Length() );
       
   614                 RDEBUG_2( "CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL() HBufC8 ALLOC check %x", check);
       
   615                 TPtr8 checkPtr( check->Des() );
       
   616 
       
   617                 User::LeaveIfError( rep->Get(newIndex, checkPtr ) );
       
   618                 User::LeaveIfError( (dataPtr.Compare( checkPtr )==0)?KErrNone:KErrGeneral );
       
   619                 aIndex = newIndex;
       
   620 
       
   621                 CleanupStack::PopAndDestroy( check );
       
   622 
       
   623                 rep->Set((TUint32)KRepositoryIdBookmarkCount, count+1 );
       
   624                 }
       
   625             }
       
   626         }
       
   627 
       
   628     CleanupStack::PopAndDestroy( data );
       
   629     CleanupStack::PopAndDestroy( rep );
       
   630 
       
   631     RDEBUG_2( "CIdleSoftkeysWebTargetManager::UpdateLUIDDatabaseL() returns %d<", ret );
       
   632     if(ret == KErrNone && !iUiSettingsNotInitialized)
       
   633    	{
       
   634    		iUiSettings->ReadBookmarksL();   		
       
   635    	}
       
   636     return ret;
       
   637     }
       
   638 
       
   639 // -------------------------------------------------------------------------------------
       
   640 // CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL
       
   641 // -------------------------------------------------------------------------------------
       
   642 TInt CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL( TBool aCleanDatabase/*=ETrue*/ )
       
   643     {
       
   644     RDEBUG( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL() >" );
       
   645 
       
   646     TInt i;
       
   647     TInt j;
       
   648     TInt ret = KErrNone;
       
   649     TUint32 repIndex, repIndex2;
       
   650     TInt strIndex;
       
   651     TLex8 lex;
       
   652 	
       
   653 	if(iUiSettingsNotInitialized)
       
   654    	{
       
   655    		iUiSettings = CUiSettingsUtil::NewL( );
       
   656 		iUiSettings->ReadBookmarksL();   		
       
   657 		iUiSettingsNotInitialized = EFalse;
       
   658    	}
       
   659    	else
       
   660    	{
       
   661    		iUiSettings->ReadBookmarksL();
       
   662    	}
       
   663 	
       
   664     CRepository* rep = CRepository::NewLC( KNSmlDMISAdapterCentRepUid );
       
   665     RDEBUG_2( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL() CRepository ALLOC %x", rep);
       
   666 
       
   667     HBufC8* repDataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   668     RDEBUG_2("CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL() HBufC8 repDataH ALLOC %x", repDataH);
       
   669     TPtr8 repData( repDataH->Des() );
       
   670 
       
   671     HBufC8* repData2H = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   672     RDEBUG_2( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL() HBufC8 repData2H ALLOC %x", repData2H);
       
   673     TPtr8 repData2( repData2H->Des() );
       
   674 
       
   675     TInt count = 0;
       
   676     ret = rep->Get((TUint32)KRepositoryIdBookmarkCount, count);
       
   677 
       
   678     if( KErrNone == ret )
       
   679         {
       
   680         // DEBUG TEST S
       
   681 #ifdef __WINS__
       
   682         for( i=0; i<count; i++ )
       
   683             {
       
   684             repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   685             ret = rep->Get(repIndex, repData);
       
   686             if( KErrNone != ret )
       
   687                 {
       
   688                 User::Panic(_L("IS_DEBUG"), 1);
       
   689                 }
       
   690 
       
   691             strIndex = repData.Find( _L8(" ") );
       
   692             if( strIndex < 1 )
       
   693                 {
       
   694                 User::Panic(_L("IS_DEBUG"), 2);
       
   695                 }
       
   696 
       
   697             TInt theLuid, bmIndex = -1;
       
   698             lex.Assign( repData );
       
   699             lex.Inc( strIndex );
       
   700 
       
   701             TChar ch = lex.Get( );
       
   702             if( ch != TChar(' ') )
       
   703                 {
       
   704                 User::Panic(_L("IS_DEBUG"), 3);
       
   705                 }
       
   706             if( KErrNone != lex.Val( theLuid ) )
       
   707                 {
       
   708                 User::Panic(_L("IS_DEBUG"), 4);
       
   709                 }
       
   710             if( theLuid < 0 )
       
   711                 {
       
   712                 User::Panic(_L("IS_DEBUG"), 5);
       
   713                 }
       
   714             
       
   715             if( (KErrNone != iUiSettings->GetWebTargetIndex(theLuid, bmIndex) /*iUiSrv.GetShortcutTargetIndex( EUiSrvRtTypeBm, theLuid, bmIndex )*/ ) ||
       
   716                 (bmIndex == -1) )
       
   717                 {
       
   718                 RDEBUG( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL(): WARNING Non-existent BM-UID in IsAdapter!" );
       
   719                 }
       
   720             
       
   721             if( (NSmlDmURI::NumOfURISegs( repData.Left(strIndex) ) != 4) ||
       
   722                 (NSmlDmURI::URISeg( repData, 0 ) != KNSmlCustomizationNodeName()) ||
       
   723                 (NSmlDmURI::URISeg( repData, 1 ) != KNSmlIS_IdleSoftKeyNodeName()) ||
       
   724                 (NSmlDmURI::URISeg( repData, 2 ) != KNSmlIS_WebTargetsNodeName())
       
   725                 )
       
   726                 {
       
   727                 User::Panic(_L("IS_DEBUG"), 6);
       
   728                 }
       
   729             }
       
   730 
       
   731         for( i=0; i<count-1; i++ )
       
   732             {
       
   733             repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   734             rep->Get(repIndex, repData);
       
   735             strIndex = repData.Find( _L8(" ") );
       
   736             lex.Assign( repData );
       
   737             lex.Inc( strIndex ); lex.Inc( 1 );
       
   738             TInt theLuid;
       
   739             lex.Val( theLuid );
       
   740             for( j=i+1; j<count; j++ )
       
   741                 {
       
   742                 TInt strIndex2;
       
   743                 repIndex2 = (TUint32)j + KRepositoryIdBookmarkFirst;
       
   744                 rep->Get(repIndex2, repData2);
       
   745                 strIndex2 = repData2.Find( _L8(" ") );
       
   746                 lex.Assign( repData2 );
       
   747                 lex.Inc( strIndex2 ); lex.Inc( 1 );
       
   748                 TInt theLuid2;
       
   749                 lex.Val( theLuid2 );
       
   750 
       
   751                 if( repData.Left( strIndex+1 ).Compare( repData2.Left( strIndex+1 ) ) == 0 )
       
   752                     {
       
   753                     User::Panic(_L("IS_DEBUG"), 7);
       
   754                     }
       
   755                 if( theLuid == theLuid2 )
       
   756                     {
       
   757                     User::Panic(_L("IS_DEBUG"), 8);
       
   758                     }
       
   759                 }
       
   760             }
       
   761 #endif
       
   762         // DEBUG TEST E
       
   763 
       
   764         for( i=0; i<count; i++ )
       
   765             {
       
   766             repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   767 
       
   768             ret = rep->Get(repIndex, repData);
       
   769             if( KErrNone == ret )
       
   770                 {
       
   771                     strIndex = repData.Find( _L8(" ") );
       
   772                     if( strIndex > 0 )
       
   773                         {
       
   774                         TInt theLuid, bmIndex = -1;
       
   775                         lex.Assign( repData );
       
   776                         lex.Inc( strIndex+1 );
       
   777                         if( KErrNone == lex.Val( theLuid ) )
       
   778                             {
       
   779                             if( theLuid < 0 )
       
   780                                 {
       
   781                                 rep->Set( repIndex, KNullDesC() );
       
   782                                 }
       
   783                             
       
   784                             if( (KErrNone != iUiSettings->GetWebTargetIndex(theLuid, bmIndex) /*iUiSrv.GetShortcutTargetIndex( EUiSrvRtTypeBm, theLuid, bmIndex )*/ ) ||
       
   785                                 (bmIndex == -1) )
       
   786                                 {
       
   787                                 TBool exists = EFalse;
       
   788                                 iFavDb.ItemExists( theLuid, exists );
       
   789                                 if( !exists )
       
   790                                     {
       
   791                                     if( aCleanDatabase )
       
   792                                         {
       
   793                                         rep->Set( repIndex, KNullDesC() );
       
   794                                         RDEBUG( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL(): WARNING Removing invalid WebTarget LUID mapping" );
       
   795                                         }
       
   796                                     else
       
   797                                         {
       
   798                                         RDEBUG( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL(): WARNING Invalid WebTarget LUID" );
       
   799                                         }
       
   800                                     }
       
   801                                 }
       
   802                                 
       
   803                             }
       
   804                         if( (NSmlDmURI::NumOfURISegs( repData.Left(strIndex) ) != 4) ||
       
   805                             (NSmlDmURI::URISeg( repData, 0 ).Compare( KNSmlCustomizationNodeName() ) != 0) ||
       
   806                             (NSmlDmURI::URISeg( repData, 1 ).Compare( KNSmlIS_IdleSoftKeyNodeName() ) != 0) ||
       
   807                             (NSmlDmURI::URISeg( repData, 2 ).Compare( KNSmlIS_WebTargetsNodeName() ) != 0)
       
   808                             )
       
   809                             {
       
   810                             rep->Set( repIndex, KNullDesC() );
       
   811                             RDEBUG( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL(): WARNING Invalid WebTarget URI" );
       
   812                             }
       
   813                         }
       
   814                 }
       
   815             }
       
   816         }
       
   817 
       
   818     // Get rid of empty entries and update count
       
   819     count = 0;
       
   820     ret = rep->Get((TUint32)KRepositoryIdBookmarkCount, count);
       
   821     TInt oldcount = count;
       
   822     TInt newcount = count;
       
   823 	RArray<TInt32> remList;
       
   824 	CleanupClosePushL(remList);
       
   825     if( KErrNone == ret )
       
   826         {
       
   827         for( i=0; i<count; i++ )
       
   828             {
       
   829             repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   830 
       
   831             ret = rep->Get(repIndex, repData);
       
   832             if( KErrNone == ret )
       
   833                 {
       
   834                 if( repData.Length() == 0 )
       
   835                     {
       
   836                     for( j=count; j>i+1; j-- )
       
   837                         {
       
   838                         repIndex2 = (TUint32)j-1 + KRepositoryIdBookmarkFirst;
       
   839                         ret = rep->Get(repIndex2, repData2);
       
   840                         if( (KErrNone == ret) && (repData2.Length() > 0) )
       
   841                             {
       
   842                             repData.Copy(repData2);
       
   843                             repData2.Zero();
       
   844                             ret = rep->Set(repIndex, repData);
       
   845                             ret = rep->Set(repIndex2, repData2);
       
   846                             newcount --;
       
   847                             remList.Append(j);
       
   848                             break;
       
   849                             }
       
   850                         }
       
   851                     if( j == i+1 && remList.Find(j) == KErrNotFound)
       
   852                         {
       
   853                         // Did not find a replacement, just delete the entry
       
   854                         newcount --;
       
   855                         }
       
   856                     }
       
   857                 }
       
   858             }
       
   859         ret = rep->Set((TUint32)KRepositoryIdBookmarkCount, newcount);
       
   860         
       
   861         for(i=newcount; i<oldcount; i++)
       
   862             {
       
   863             repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   864             ret = rep->Delete( repIndex );
       
   865             }
       
   866 
       
   867         for(i=0; i<newcount; i++)
       
   868             {
       
   869             TUint32 repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   870             ret = rep->Get( repIndex, repData );
       
   871             if( (KErrNone != ret) || (repData.Length() == 0) )
       
   872                 {
       
   873                 count = i;
       
   874                 ret = rep->Set((TUint32)KRepositoryIdBookmarkCount, count);
       
   875                 break;
       
   876                 }
       
   877             }
       
   878         }
       
   879     CleanupStack::PopAndDestroy(&remList);
       
   880     CleanupStack::PopAndDestroy( repData2H );
       
   881     CleanupStack::PopAndDestroy( repDataH );
       
   882     CleanupStack::PopAndDestroy( rep );
       
   883 
       
   884     RDEBUG_2( "CIdleSoftkeysWebTargetManager::CheckLUIDDatabaseL() returns %d<", ret );
       
   885     //iUiSettings->ReadBookmarksL();
       
   886     return ret;
       
   887     }
       
   888 
       
   889 // -------------------------------------------------------------------------------------
       
   890 // CIdleSoftkeysWebTargetManager::FindLUIDByURIL
       
   891 // -------------------------------------------------------------------------------------
       
   892 TInt CIdleSoftkeysWebTargetManager::FindLUIDByURIL(const TDesC8& aURI, TDes8& aLUID, TInt &aIndex)
       
   893     {
       
   894     RDEBUG8_2( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL() > URI=%S", &aURI );
       
   895 
       
   896     TInt ret = KErrGeneral;
       
   897 
       
   898     CRepository* rep = CRepository::NewLC( KNSmlDMISAdapterCentRepUid );
       
   899     RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL() CRepository ALLOC %x", rep);
       
   900 
       
   901     HBufC8* repDataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   902     RDEBUG_2("CIdleSoftkeysWebTargetManager::FindLUIDByURIL() HBufC8 repDataH ALLOC %x", repDataH);
       
   903     TPtr8 repData( repDataH->Des() );
       
   904 
       
   905     TInt count;
       
   906 
       
   907     ret = rep->Get((TUint32)KRepositoryIdBookmarkCount, count);
       
   908     if( KErrNone == ret )
       
   909         {
       
   910         RDEBUG("CIdleSoftkeysWebTargetManager::FindLUIDByURIL() rep->Get((TUint32)KRepositoryIdBookmarkCount");
       
   911         TInt i;
       
   912         for( i=0; i<count; i++ )
       
   913             {
       
   914             TUint32 repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   915 
       
   916             ret = rep->Get(repIndex, repData);
       
   917             if( KErrNone == ret )
       
   918                 {
       
   919                 RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL() rep->Get(repIndex, repData), repIndex=%d", repIndex);
       
   920                 RDEBUG8_2( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL() rep->Get(repIndex, repData), repData=%S", &repData);
       
   921                 if(repData.Length() > aURI.Length())
       
   922                     {
       
   923                     if( repData.Left( aURI.Length() ).Compare( aURI ) == 0 )
       
   924                         {
       
   925                         RDEBUG( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL(), lexical analysis starts" );
       
   926                         TLex8 lex;
       
   927                         lex.Assign( repData );
       
   928                         lex.Inc( aURI.Length() );
       
   929                         TChar ch = lex.Get();
       
   930                         RDEBUG( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL(), lexical analysis more" );
       
   931                         if( ch == TChar(' ') )
       
   932                             {
       
   933                             aLUID.Copy( lex.Remainder() );
       
   934                             aIndex = repIndex;
       
   935                             ret = KErrNone;
       
   936                             RDEBUG( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL(), lexical analysis OK." );
       
   937                             break;
       
   938                             }
       
   939                         }
       
   940                     }
       
   941                 }
       
   942             }
       
   943 
       
   944         if( i==count )
       
   945             {
       
   946             ret = KErrNotFound;
       
   947             }
       
   948         }
       
   949 
       
   950     CleanupStack::PopAndDestroy( repDataH );
       
   951     CleanupStack::PopAndDestroy( rep );
       
   952 
       
   953     RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindLUIDByURIL() < %d", ret );
       
   954     return ret;
       
   955     }
       
   956 
       
   957 // -------------------------------------------------------------------------------------
       
   958 // CIdleSoftkeysWebTargetManager::FindURIByLUIDL
       
   959 // -------------------------------------------------------------------------------------
       
   960 TInt CIdleSoftkeysWebTargetManager::FindURIByLUIDL(TDes8& aURI, const TDesC8& aLUID, TInt &aIndex)
       
   961     {
       
   962     RDEBUG( "CIdleSoftkeysWebTargetManager::FindURIByLUIDL() >" );
       
   963 
       
   964     TInt ret = KErrGeneral;
       
   965 
       
   966     CRepository* rep = CRepository::NewLC( KNSmlDMISAdapterCentRepUid );
       
   967     RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindURIByLUIDL() CRepository ALLOC %x", rep);
       
   968 
       
   969     HBufC8* repDataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   970     RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindURIByLUIDL() HBufC8 repDataH ALLOC %x", repDataH);
       
   971     TPtr8 repData( repDataH->Des() );
       
   972 
       
   973     HBufC8* verifyDataH = HBufC8::NewLC( KRepositoryEntryMaxLength );
       
   974     RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindURIByLUIDL() HBufC8 verifyDataH ALLOC %x", verifyDataH);
       
   975     TPtr8 verifyData( verifyDataH->Des() );
       
   976 
       
   977     TInt count;
       
   978 
       
   979     ret = rep->Get((TUint32)KRepositoryIdBookmarkCount, count);
       
   980     if( KErrNone == ret )
       
   981         {
       
   982         TInt i;
       
   983         for( i=0; i<count; i++ )
       
   984             {
       
   985             TUint32 repIndex = (TUint32)i + KRepositoryIdBookmarkFirst;
       
   986 
       
   987             ret = rep->Get(repIndex, repData);
       
   988             if( KErrNone == ret )
       
   989                 {
       
   990                 if(repData.Length() > aLUID.Length())
       
   991                     {
       
   992                     TInt strIndex = repData.Find( aLUID );
       
   993 
       
   994                     if( strIndex > 0 )
       
   995                         {
       
   996                         verifyData.Copy( repData.Left( strIndex ) );
       
   997                         verifyData.Append( aLUID );
       
   998 
       
   999                         if( verifyData.Compare( repData ) == 0 )
       
  1000                             {
       
  1001                             aURI.Copy( repData.Left( strIndex - 1 ) );
       
  1002                             aIndex = repIndex;
       
  1003                             ret = KErrNone;
       
  1004                             break;
       
  1005                             }
       
  1006                         }
       
  1007                     }
       
  1008                 }
       
  1009             }
       
  1010         if( i==count )
       
  1011             {
       
  1012             ret = KErrNotFound;
       
  1013             }
       
  1014         }
       
  1015 
       
  1016     CleanupStack::PopAndDestroy( verifyDataH );
       
  1017     CleanupStack::PopAndDestroy( repDataH );
       
  1018     CleanupStack::PopAndDestroy( rep );
       
  1019 
       
  1020     RDEBUG_2( "CIdleSoftkeysWebTargetManager::FindURIByLUIDL() < %d", ret );
       
  1021     return ret;
       
  1022     }
       
  1023 
       
  1024 // End of file