psmservices/psmserver/src/engine/psmbackupstorage.cpp
branchRCL_3
changeset 5 1a73e8f1b64d
parent 0 4e1aa6a622a0
child 21 ccb4f6b3db21
equal deleted inserted replaced
3:a811597961f0 5:1a73e8f1b64d
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   192     COMPONENT_TRACE( ( _L( "PSM Server - CPsmBackupStorage::FindSetItemL()" ) ) );
   192     COMPONENT_TRACE( ( _L( "PSM Server - CPsmBackupStorage::FindSetItemL()" ) ) );
   193 
   193 
   194     // Search correct set item for aKey
   194     // Search correct set item for aKey
   195     TBool setFound( EFalse );
   195     TBool setFound( EFalse );
   196     RXmlEngNodeList<TXmlEngElement> nodeList;
   196     RXmlEngNodeList<TXmlEngElement> nodeList;
       
   197     CleanupClosePushL(nodeList);
   197     aConfigSet.GetElementsByTagNameL(nodeList, KPsmSetItem);
   198     aConfigSet.GetElementsByTagNameL(nodeList, KPsmSetItem);
   198     TXmlEngElement setItem = nodeList.Next().AsElement();       
   199     TXmlEngElement setItem = nodeList.Next().AsElement();       
   199 
   200 
   200     // Loop until correct set item is found
   201     // Loop until correct set item is found
   201     while ( setItem.NotNull() && !setFound )    
   202     while ( setItem.NotNull() && !setFound )    
   203         // Read key from storage
   204         // Read key from storage
   204         TInt setItemKey = GetAttributeIntValueL( setItem, KPsmSetItemKey );
   205         TInt setItemKey = GetAttributeIntValueL( setItem, KPsmSetItemKey );
   205 
   206 
   206         if ( aKey == setItemKey )
   207         if ( aKey == setItemKey )
   207             {
   208             {
   208             // Set found, no need to loop anumore
   209             // Set found, no need to loop any more
   209             setFound = ETrue;
   210             setFound = ETrue;
   210             }
   211             }
   211         else
   212         else
   212             {
   213             {
   213             // Set not found, continue loop with next config set
   214             // Set not found, continue loop with next config set
   214             setItem = nodeList.Next().AsElement();            
   215             setItem = nodeList.Next().AsElement();            
   215             }
   216             }
   216         }
   217         }
   217 
   218         
       
   219     CleanupStack::PopAndDestroy(&nodeList);
   218     if ( !setFound )
   220     if ( !setFound )
   219         {
   221         {
   220         COMPONENT_TRACE( ( _L( "PSM Server - CPsmBackupStorage::FindSetItemL() - Not found id:%i, LEAVE" ), aKey ) );
   222         COMPONENT_TRACE( ( _L( "PSM Server - CPsmBackupStorage::FindSetItemL() - Not found id:%i, LEAVE" ), aKey ) );
   221         User::Leave( KErrNotFound );
   223         User::Leave( KErrNotFound );
   222         }
   224         }