psmservices/psmserver/src/engine/psmstorage.cpp
branchRCL_3
changeset 7 1a73e8f1b64d
parent 0 4e1aa6a622a0
child 59 0f7422b6b602
equal deleted inserted replaced
3:a811597961f0 7: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".
   110 
   110 
   111     // Search correct settings for aUid
   111     // Search correct settings for aUid
   112     TBool setFound( EFalse );
   112     TBool setFound( EFalse );
   113     TXmlEngElement settings;
   113     TXmlEngElement settings;
   114     RXmlEngNodeList<TXmlEngElement> nodeList;   
   114     RXmlEngNodeList<TXmlEngElement> nodeList;   
       
   115     CleanupClosePushL(nodeList);
   115 
   116 
   116     if ( iStorageRoot.NotNull() )
   117     if ( iStorageRoot.NotNull() )
   117         {
   118         {
   118         iStorageRoot.GetElementsByTagNameL(nodeList, KPsmPluginGroupTag);
   119         iStorageRoot.GetElementsByTagNameL(nodeList, KPsmPluginGroupTag);
   119         settings = nodeList.Next().AsElement();
   120         settings = nodeList.Next().AsElement();
   139             {
   140             {
   140             // Set not found, continue loop with next config set
   141             // Set not found, continue loop with next config set
   141             settings = nodeList.Next().AsElement();            
   142             settings = nodeList.Next().AsElement();            
   142             }
   143             }
   143         }
   144         }
   144 
   145     CleanupStack::PopAndDestroy(&nodeList);
   145     if ( !setFound )
   146     if ( !setFound )
   146         {
   147         {
   147         COMPONENT_TRACE( ( _L( "PSM Server - CPsmStorage::FindConfigurationSet() - Mode not found: %i, LEAVE" ), aMode ) );
   148         COMPONENT_TRACE( ( _L( "PSM Server - CPsmStorage::FindConfigurationSet() - Mode not found: %i, LEAVE" ), aMode ) );
   148         User::Leave( KErrNotFound );
   149         User::Leave( KErrNotFound );
   149         }
   150         }
   164     // Search correct settings for current mode
   165     // Search correct settings for current mode
   165     TXmlEngElement settings = FindConfigurationSetL( aMode );
   166     TXmlEngElement settings = FindConfigurationSetL( aMode );
   166 
   167 
   167     // Get first setElemens
   168     // Get first setElemens
   168     RXmlEngNodeList<TXmlEngElement> nodeList;
   169     RXmlEngNodeList<TXmlEngElement> nodeList;
       
   170     CleanupClosePushL(nodeList);
   169     settings.GetElementsByTagNameL(nodeList, KPsmSetItem);
   171     settings.GetElementsByTagNameL(nodeList, KPsmSetItem);
   170     TXmlEngElement setElement = nodeList.Next().AsElement();
   172     TXmlEngElement setElement = nodeList.Next().AsElement();
   171 
   173 
   172     // Loop through all set elements and update values to array
   174     // Loop through all set elements and update values to array
   173     while( setElement.NotNull() )
   175     while( setElement.NotNull() )
   205         aPsmConfigArray.Append( configInfo );
   207         aPsmConfigArray.Append( configInfo );
   206 
   208 
   207         // handle next element set
   209         // handle next element set
   208         setElement = nodeList.Next().AsElement();
   210         setElement = nodeList.Next().AsElement();
   209         }
   211         }
   210 
   212     CleanupStack::PopAndDestroy(&nodeList);
   211     COMPONENT_TRACE( ( _L( "PSM Server - CPsmStorage::CreateConfigArrayL() - return" ) ) );
   213     COMPONENT_TRACE( ( _L( "PSM Server - CPsmStorage::CreateConfigArrayL() - return" ) ) );
   212     }
   214     }
   213 
   215 
   214 // -----------------------------------------------------------------------------
   216 // -----------------------------------------------------------------------------
   215 // CPsmStorage::GetConfigurationL
   217 // CPsmStorage::GetConfigurationL
   225     // Search correct settings for current mode
   227     // Search correct settings for current mode
   226     TXmlEngElement settings = FindConfigurationSetL( iMode );    
   228     TXmlEngElement settings = FindConfigurationSetL( iMode );    
   227 
   229 
   228     // Get first setElemens
   230     // Get first setElemens
   229     RXmlEngNodeList<TXmlEngElement> nodeList;
   231     RXmlEngNodeList<TXmlEngElement> nodeList;
       
   232     CleanupClosePushL(nodeList);
   230     settings.GetElementsByTagNameL(nodeList, KPsmSetItem);
   233     settings.GetElementsByTagNameL(nodeList, KPsmSetItem);
   231     TXmlEngElement setElement = nodeList.Next().AsElement();
   234     TXmlEngElement setElement = nodeList.Next().AsElement();
   232 
   235 
   233     // Loop through all set elements and update values to array
   236     // Loop through all set elements and update values to array
   234     while( setElement.NotNull() )
   237     while( setElement.NotNull() )
   285             }
   288             }
   286         // handle next element set
   289         // handle next element set
   287         setElement = nodeList.Next().AsElement();
   290         setElement = nodeList.Next().AsElement();
   288         }
   291         }
   289 
   292 
       
   293     CleanupStack::PopAndDestroy(&nodeList);
   290     COMPONENT_TRACE( ( _L( "PSM Server - CPsmStorage::GetConfigurationL() - return" ) ) );
   294     COMPONENT_TRACE( ( _L( "PSM Server - CPsmStorage::GetConfigurationL() - return" ) ) );
   291     }
   295     }
   292 
   296 
   293 // ---------------------------------------------------------------------------
   297 // ---------------------------------------------------------------------------
   294 // CPsmStorage::GetAttributeIntValueL
   298 // CPsmStorage::GetAttributeIntValueL