cmmanager/cmmgr/Framework/Src/cmmanagerimpl.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 2 086aae6fc07e
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
     1 /*
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2006-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".
   153 
   153 
   154     Dll::SetTls( this );
   154     Dll::SetTls( this );
   155     }
   155     }
   156 
   156 
   157 //-----------------------------------------------------------------------------
   157 //-----------------------------------------------------------------------------
   158 //  CCmManagerImpl::CCmManagerImpl()
   158 //  CCmManagerImpl::~CCmManagerImpl()
   159 //-----------------------------------------------------------------------------
   159 //-----------------------------------------------------------------------------
   160 //
   160 //
   161 CCmManagerImpl::~CCmManagerImpl()
   161 CCmManagerImpl::~CCmManagerImpl()
   162     {
   162     {
   163     CLOG_WRITE( "CCmManagerImpl::~CCmManagerImpl" );
   163     CLOG_WRITE( "CCmManagerImpl::~CCmManagerImpl" );
   194     
   194     
   195     iFs.Close();
   195     iFs.Close();
   196     
   196     
   197     delete iPluginImpl;
   197     delete iPluginImpl;
   198 
   198 
   199     delete &Session();
   199     if (iTrans)
   200     delete iTrans;
   200         {
       
   201         delete &Session();
       
   202         delete iTrans;
       
   203         }
   201 
   204 
   202     if( iIsFeatureManagerInitialised )
   205     if( iIsFeatureManagerInitialised )
   203         {
   206         {
   204         FeatureManager::UnInitializeLib();
   207         FeatureManager::UnInitializeLib();
   205         }
   208         }
   707 void CCmManagerImpl::StartCommsDatNotifierL()
   710 void CCmManagerImpl::StartCommsDatNotifierL()
   708     {
   711     {
   709     // Two instances of class CCmCommsDatNotifier are created here and
   712     // Two instances of class CCmCommsDatNotifier are created here and
   710     // referred by all watchers in CmManager. One is to watch change in Iap Table
   713     // referred by all watchers in CmManager. One is to watch change in Iap Table
   711     // and the other is to watch change in Snap Table.
   714     // and the other is to watch change in Snap Table.
   712     iCommsDatIapNotifier = CCmCommsDatNotifier::NewL( KCDTIdIAPRecord );
   715     
   713     
   716     if ( iCommsDatIapNotifier == NULL )
   714     TUint32 snapTableId = GetSnapTableIdL();
   717         {
   715     iCommsDatSnapNotifier = CCmCommsDatNotifier::NewL( snapTableId );
   718         iCommsDatIapNotifier = CCmCommsDatNotifier::NewL( KCDTIdIAPRecord );
       
   719         }
       
   720     
       
   721     if ( iCommsDatSnapNotifier == NULL )
       
   722         {
       
   723         TUint32 snapTableId = GetSnapTableIdL();
       
   724         iCommsDatSnapNotifier = CCmCommsDatNotifier::NewL( snapTableId );
       
   725         }
   716     }
   726     }
   717 
   727 
   718 //=============================================================================
   728 //=============================================================================
   719 // CREATION / DELETION API
   729 // CREATION / DELETION API
   720 //=============================================================================
   730 //=============================================================================
  2584 //
  2594 //
  2585 EXPORT_C void CCmManagerImpl::FilterOutVirtualsL( RPointerArray<CCmPluginBase>& aCmDataArray )
  2595 EXPORT_C void CCmManagerImpl::FilterOutVirtualsL( RPointerArray<CCmPluginBase>& aCmDataArray )
  2586     {
  2596     {
  2587     LOGGER_ENTERFN( "CCmManagerImpl::FilterOutVirtualsL" );
  2597     LOGGER_ENTERFN( "CCmManagerImpl::FilterOutVirtualsL" );
  2588 
  2598 
  2589     TInt count = aCmDataArray.Count();
       
  2590     
       
  2591     for ( TInt i = 0; i < aCmDataArray.Count(); i++ )
  2599     for ( TInt i = 0; i < aCmDataArray.Count(); i++ )
  2592         {
  2600         {
  2593         if ( aCmDataArray[i]->GetBoolAttributeL( ECmVirtual ) )
  2601         if ( aCmDataArray[i]->GetBoolAttributeL( ECmVirtual ) )
  2594             {
  2602             {
  2595             delete aCmDataArray[i];
  2603             delete aCmDataArray[i];
  2632         }
  2640         }
  2633     
  2641     
  2634     // get the possible embedded destinations to be able to list their content, too
  2642     // get the possible embedded destinations to be able to list their content, too
  2635     // we only have to check in cmArray
  2643     // we only have to check in cmArray
  2636     // put them in a sep. array and get their data into another.    
  2644     // put them in a sep. array and get their data into another.    
  2637     TInt cmCount = aCmArray.Count();
       
  2638     RArray<TUint32> cmEmbDestArray ( KCmArrayMediumGranularity );
  2645     RArray<TUint32> cmEmbDestArray ( KCmArrayMediumGranularity );
  2639     CleanupClosePushL( cmEmbDestArray );
  2646     CleanupClosePushL( cmEmbDestArray );
  2640     for ( TInt i = 0; i < cmCount; i++ )
  2647     for ( TInt i = 0; i < aCmArray.Count(); i++ )
  2641         {
  2648         {
  2642         if ( aCmArray[i]->GetBoolAttributeL( ECmDestination ) )
  2649         if ( aCmArray[i]->GetBoolAttributeL( ECmDestination ) )
  2643             {
  2650             {
  2644             cmEmbDestArray.AppendL( aCmArray[i]->GetIntAttributeL( ECmId ) );
  2651             cmEmbDestArray.AppendL( aCmArray[i]->GetIntAttributeL( ECmId ) );
  2645             //remove embedded destination right now
  2652             //remove embedded destination right now
  2646             delete aCmArray[i];
  2653             delete aCmArray[i];
  2647             aCmArray.Remove(i);
  2654             aCmArray.Remove(i);
  2648            // i--;
  2655             i--; // Array gets re-indexed after calling Remove().
  2649             }
  2656             }
  2650         }
  2657         }
  2651     // now we stored the needed emb.dest, 
  2658     // now we stored the needed emb.dest, 
  2652     // we can filter out all virtual ones
  2659     // we can filter out all virtual ones
  2653     //iCmManager.FilterOutVirtualsL( cmArray ); //no filtering here, we can do it later
  2660     //iCmManager.FilterOutVirtualsL( cmArray ); //no filtering here, we can do it later
  2759                     }
  2766                     }
  2760                 }
  2767                 }
  2761                 // now we either found a correct place or 
  2768                 // now we either found a correct place or 
  2762                 // we are at the end of the list
  2769                 // we are at the end of the list
  2763                 // ( we break-ed for cycle when found the correct place )
  2770                 // ( we break-ed for cycle when found the correct place )
  2764                 if ( ii == cc )
  2771             if ( ii == cc )
  2765                     {
  2772                 {
  2766                     // end of the list, append
  2773                 // end of the list, append
  2767                     aCmArray.AppendL( aCmLinkedArray[i]);
  2774                 aCmArray.AppendL( aCmLinkedArray[i]);
  2768                     }
  2775                 }
  2769                 else
  2776             else
  2770                     {
  2777                 {
  2771                     // we found the place to be inserted
  2778                 // we found the place to be inserted
  2772                     aCmArray.InsertL( aCmLinkedArray[i], ii );
  2779                 aCmArray.InsertL( aCmLinkedArray[i], ii );
  2773                     }   
  2780                 }   
  2774             }
  2781             }
  2775         else
  2782         else
  2776             {
  2783             {
  2777             // no elements in original array yet, 
  2784             // no elements in original array yet, 
  2778             // so simply append
  2785             // so simply append