featuremgmt/featuremgr/src/clientdll/featurenotifier.cpp
branchRCL_3
changeset 9 667e88a979d7
parent 0 08ec8eefde2f
equal deleted inserted replaced
8:fa9941cf3867 9:667e88a979d7
    74     FUNC_LOG
    74     FUNC_LOG
    75 
    75 
    76     iFeatMgrClient = new (ELeave) RFeatMgrClient;
    76     iFeatMgrClient = new (ELeave) RFeatMgrClient;
    77     // Connect to Feature Manager server
    77     // Connect to Feature Manager server
    78     TInt err( iFeatMgrClient->Connect() );
    78     TInt err( iFeatMgrClient->Connect() );
       
    79     if (err!=KErrNone)
       
    80       {
       
    81       delete iFeatMgrClient;
       
    82       iFeatMgrClient=NULL;
       
    83       }
    79     User::LeaveIfError(err);
    84     User::LeaveIfError(err);
    80 
    85 
    81     CActiveScheduler::Add( this );
    86     CActiveScheduler::Add( this );
    82     }
    87     }
    83 
    88 
   110         {
   115         {
   111         return KErrAlreadyExists;
   116         return KErrAlreadyExists;
   112         }
   117         }
   113 
   118 
   114     iFeatures.Reset();
   119     iFeatures.Reset();
   115     iFeatures.Append( aFeature );
   120     TInt err=iFeatures.Append( aFeature );
   116     TInt err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
   121     if (err!=KErrNone)
       
   122       {
       
   123       return err;
       
   124       }
       
   125     err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
   117     if ( err == KErrNone )
   126     if ( err == KErrNone )
   118     	{
   127     	{
   119         SetActive();
   128         SetActive();
   120      	}
   129      	}
       
   130     else
       
   131       {
       
   132       iFeatures.Reset();
       
   133       }
   121      	    
   134      	    
   122     return err;
   135     return err;
   123     }
   136     }
   124     
   137     
   125 // -----------------------------------------------------------------------------
   138 // -----------------------------------------------------------------------------
   133         return KErrAlreadyExists;
   146         return KErrAlreadyExists;
   134         }
   147         }
   135 
   148 
   136     iFeatures.Reset();
   149     iFeatures.Reset();
   137     TInt count = aFeatures.Count();
   150     TInt count = aFeatures.Count();
   138     
   151     TInt err=KErrNone;
   139     for(TInt i = 0; i < count; i++ )
   152     for(TInt i = 0; i < count; i++ )
   140         {
   153         {
   141         // Do not append duplicate entries
   154         // Do not append duplicate entries
   142         const TUid& uid( aFeatures[i] );
   155         const TUid& uid( aFeatures[i] );
   143         TInt index = iFeatures.Find( uid, FindByUid );
   156         TInt index = iFeatures.Find( uid, FindByUid );
   144         if( index == KErrNotFound )
   157         if( index == KErrNotFound )
   145             {
   158             {
   146             iFeatures.Append( uid );
   159             err=iFeatures.Append( uid );
       
   160             if (err!=KErrNone)
       
   161               {
       
   162               iFeatures.Reset();
       
   163               return err;
       
   164               }
   147             }
   165             }
   148         }
   166         }
   149 
   167 
   150     TInt err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
   168     err = iFeatMgrClient->RequestNotification( iFeatures, iFeatureChanged, iStatus );
   151     if ( err == KErrNone )
   169     if ( err == KErrNone )
   152     	{
   170     	{
   153         SetActive();
   171         SetActive();
   154      	}
   172      	}
   155     
   173     else
       
   174       {
       
   175       iFeatures.Reset();
       
   176       }
   156     return err;
   177     return err;
   157     }
   178     }
   158     
   179     
   159 // -----------------------------------------------------------------------------
   180 // -----------------------------------------------------------------------------
   160 // CFeatureNotifier::NotifyCancel(TUid aFeature)
   181 // CFeatureNotifier::NotifyCancel(TUid aFeature)