phonebookengines/VirtualPhonebook/VPbkSimStore/src/CFindView.cpp
branchRCL_3
changeset 32 2828b4d142c0
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
26:0d28c1c5b6dd 32:2828b4d142c0
   181 // CFindView::MatchL
   181 // CFindView::MatchL
   182 // --------------------------------------------------------------------------
   182 // --------------------------------------------------------------------------
   183 //
   183 //
   184 void CFindView::MatchL( RPointerArray<MVPbkSimContact>& aMatchedContacts )
   184 void CFindView::MatchL( RPointerArray<MVPbkSimContact>& aMatchedContacts )
   185     {
   185     {
       
   186     CleanupResetAndDestroyPushL( aMatchedContacts );
   186     if (iAlwaysIncluded.Count() == 0)
   187     if (iAlwaysIncluded.Count() == 0)
   187         {
   188         {
   188         // No always included contacts. The match can be done using
   189         // No always included contacts. The match can be done using
   189         // only the SIM view matched contacts.
   190         // only the SIM view matched contacts.
   190         CViewContact* viewContact = CViewContact::NewL( iAllContactsView, 
   191         CViewContact* viewContact = CViewContact::NewL( iAllContactsView, 
   230             }
   231             }
   231         }
   232         }
   232     
   233     
   233     // Free the memory
   234     // Free the memory
   234     iSIMMatchedContacts.Reset(); 
   235     iSIMMatchedContacts.Reset(); 
       
   236     CleanupStack::Pop( &aMatchedContacts );
   235     }
   237     }
   236         
   238         
   237 // --------------------------------------------------------------------------
   239 // --------------------------------------------------------------------------
   238 // CFindView::ViewFindCompleted
   240 // CFindView::ViewFindCompleted
   239 // --------------------------------------------------------------------------
   241 // --------------------------------------------------------------------------
   305         MVPbkContactViewBase& aView, 
   307         MVPbkContactViewBase& aView, 
   306         TInt aIndex, 
   308         TInt aIndex, 
   307         const MVPbkContactLink& /*aContactLink*/,
   309         const MVPbkContactLink& /*aContactLink*/,
   308         RPointerArray<MVPbkSimContact>& aMatchedContacts )
   310         RPointerArray<MVPbkSimContact>& aMatchedContacts )
   309     {
   311     {
       
   312     CleanupResetAndDestroyPushL( aMatchedContacts );
   310     if ( &iParentView == &aView )
   313     if ( &iParentView == &aView )
   311         {
   314         {
   312         const CViewContact& viewContact = static_cast<const CViewContact&>(
   315         const CViewContact& viewContact = static_cast<const CViewContact&>(
   313             iParentView.ContactAtL( aIndex ) );
   316             iParentView.ContactAtL( aIndex ) );
   314         if ( IsMatchL( viewContact ) )
   317         if ( IsMatchL( viewContact ) )
   361                     }
   364                     }
   362                 CleanupStack::Pop( cnt );
   365                 CleanupStack::Pop( cnt );
   363                 }
   366                 }
   364             }
   367             }
   365         }
   368         }
       
   369     CleanupStack::Pop( &aMatchedContacts );
   366     }
   370     }
   367 
   371 
   368 // --------------------------------------------------------------------------
   372 // --------------------------------------------------------------------------
   369 // CFindView::ViewFindCompletedL
   373 // CFindView::ViewFindCompletedL
   370 // --------------------------------------------------------------------------
   374 // --------------------------------------------------------------------------
   405 // --------------------------------------------------------------------------
   409 // --------------------------------------------------------------------------
   406 //  
   410 //  
   407 void CFindView::MatchContactL( const CViewContact& aViewContact,
   411 void CFindView::MatchContactL( const CViewContact& aViewContact,
   408             RPointerArray<MVPbkSimContact>& aMatchedContacts )
   412             RPointerArray<MVPbkSimContact>& aMatchedContacts )
   409     {
   413     {
       
   414     CleanupResetAndDestroyPushL( aMatchedContacts );
   410     // aContact matches if it's one of the always included contacts OR
   415     // aContact matches if it's one of the always included contacts OR
   411     // (if it's one of Contacts Model matched contacts AND it also
   416     // (if it's one of Contacts Model matched contacts AND it also
   412     // passes our own match).
   417     // passes our own match).
   413     TInt matchArrayIndex = KErrNotFound;
   418     TInt matchArrayIndex = KErrNotFound;
   414     TBool matched = EFalse;
   419     TBool matched = EFalse;
   443             CleanupStack::PushL( cnt );
   448             CleanupStack::PushL( cnt );
   444             aMatchedContacts.AppendL( cnt );
   449             aMatchedContacts.AppendL( cnt );
   445             CleanupStack::Pop( cnt );
   450             CleanupStack::Pop( cnt );
   446             }
   451             }
   447         }
   452         }
       
   453     CleanupStack::Pop( &aMatchedContacts ); 
   448     }
   454     }
   449 
   455 
   450 // --------------------------------------------------------------------------
   456 // --------------------------------------------------------------------------
   451 // CFindView::RemoveFromMatchArrayIfFound
   457 // CFindView::RemoveFromMatchArrayIfFound
   452 // --------------------------------------------------------------------------
   458 // --------------------------------------------------------------------------