phoneapp/phoneuiutils/src/cphonepubsubproxy.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 21 92ab7f8d0eab
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
   168     const TUint aKey, 
   168     const TUint aKey, 
   169     MPhonePubSubObserver* aObserver )
   169     MPhonePubSubObserver* aObserver )
   170     {
   170     {
   171     __ASSERT_DEBUG( aObserver, Panic( EPhoneUtilsParameterNotInitialized ) );
   171     __ASSERT_DEBUG( aObserver, Panic( EPhoneUtilsParameterNotInitialized ) );
   172     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhonePubSubProxy::NotifyChangeL() ");
   172     __LOGMETHODSTARTEND(EPhoneUIUtils, "CPhonePubSubProxy::NotifyChangeL() ");
   173     
   173 
   174     // make sure this a new item in iObserverArray
   174     // make sure this a new item in iObserverArray
   175     TBool requestIssued = EFalse;
   175     TBool requestIssued = EFalse;
   176     TBool sameRequestIssuedByObserver = EFalse;
   176     TBool sameRequestIssuedByObserver = EFalse;
   177     TInt count = iObserverArray->Count();
   177     TInt count = iObserverArray->Count();
   178 
   178 
   289 void CPhonePubSubProxy::CancelAllObserverNotifies( 
   289 void CPhonePubSubProxy::CancelAllObserverNotifies( 
   290     MPhonePubSubObserver* aObserver )
   290     MPhonePubSubObserver* aObserver )
   291     {
   291     {
   292     TInt count = iObserverArray->Count();
   292     TInt count = iObserverArray->Count();
   293 
   293 
   294     // Remove the observer and its subscriptions
   294     // Remove the observer
   295     TBool observerRemoved = EFalse;
   295     TBool observerRemoved = EFalse;
   296     for( TInt i = count - 1; i >= 0 && !observerRemoved; i-- ) 
   296     for( TInt i = count - 1; i >= 0 && !observerRemoved; i-- ) 
   297         {
   297         {
   298         const TPubSubObserverTag& observerTag = iObserverArray->At( i );
   298         const TPubSubObserverTag& observerTag = iObserverArray->At( i );
   299         if ( observerTag.iObserver == aObserver )
   299         if ( observerTag.iObserver == aObserver )
   300             {
   300             {
   301             // Remove observer 
   301             // Remove observer 
   302             observerRemoved = ETrue;
   302             observerRemoved = ETrue;
   303             iObserverArray->Delete( i );
   303             iObserverArray->Delete( i );
   304 
       
   305             // Remove this observers' subscriptions
       
   306             TInt pubSubCount = iPublishSubscriberArray->Count();
       
   307      
       
   308             for ( TInt j = pubSubCount - 1; j >= 0; j++ )
       
   309                 {
       
   310                 CPhonePublishSubscriberAO* publishSubscriber = 
       
   311                     iPublishSubscriberArray->At( j );
       
   312 
       
   313                 if ( publishSubscriber->Category() == observerTag.iCategory && 
       
   314                     publishSubscriber->Key() == observerTag.iKey )
       
   315                     {
       
   316                     iPublishSubscriberArray->Delete( i );
       
   317                     delete publishSubscriber;
       
   318                     }
       
   319                 }
       
   320             }
   304             }
   321         }
   305         }
   322     }
   306     }
   323 
   307 
   324 //  End of File  
   308 //  End of File