phonebookengines/VirtualPhonebook/VPbkCntModel/src/CViewBase.cpp
branchRCL_3
changeset 57 2666d9724c76
parent 23 5586b4d2ec3e
child 64 c1e8ba0c2b16
equal deleted inserted replaced
45:34879f5cfc63 57:2666d9724c76
   244 //
   244 //
   245 TInt CViewBase::IndexOfLinkL(const MVPbkContactLink& aContactLink) const
   245 TInt CViewBase::IndexOfLinkL(const MVPbkContactLink& aContactLink) const
   246     {
   246     {
   247     TInt result = KErrNotFound;
   247     TInt result = KErrNotFound;
   248 
   248 
   249     if (&aContactLink.ContactStore() == &ContactStore())
   249     if (&aContactLink.ContactStore() == &ContactStore() && iView )
   250         {
   250         {
   251         const CContactLink& link = static_cast<const CContactLink&>(aContactLink);
   251         const CContactLink& link = static_cast<const CContactLink&>(aContactLink);
   252         result = iView->FindL(link.ContactId());
   252         result = iView->FindL(link.ContactId());
   253         }
   253         }
   254 
   254 
   771 //
   771 //
   772 void CViewBase::InitializeViewL( 
   772 void CViewBase::InitializeViewL( 
   773         const CVPbkContactViewDefinition& aViewDefinition,
   773         const CVPbkContactViewDefinition& aViewDefinition,
   774         const MVPbkFieldTypeList& aSortOrder )
   774         const MVPbkFieldTypeList& aSortOrder )
   775     {
   775     {
   776     iCurrentContact = CViewContact::NewL( *this, aSortOrder );
   776     
   777 
   777     CViewContact* vievContact = CViewContact::NewL( *this, aSortOrder );
       
   778     if ( iCurrentContact )
       
   779         {
       
   780         delete iCurrentContact;
       
   781         iCurrentContact = NULL;
       
   782         }
       
   783     iCurrentContact = vievContact;
       
   784     vievContact = NULL;
       
   785     
   778     RContactViewSortOrder viewSortOrder = CreateSortOrderL( aSortOrder );
   786     RContactViewSortOrder viewSortOrder = CreateSortOrderL( aSortOrder );
   779     CleanupClosePushL( viewSortOrder );
   787     CleanupClosePushL( viewSortOrder );
   780 
   788 
   781     // Let sub class create the concrete view to iView
   789     // Let sub class create the concrete view to iView
   782     DoInitializeViewL( aViewDefinition, viewSortOrder );
   790     DoInitializeViewL( aViewDefinition, viewSortOrder );
   793         iView->SetViewFindConfigPlugin( TUid::Uid( KFindPluginUID ) );
   801         iView->SetViewFindConfigPlugin( TUid::Uid( KFindPluginUID ) );
   794         }
   802         }
   795 
   803 
   796     CleanupStack::PopAndDestroy(); // viewSortOrder
   804     CleanupStack::PopAndDestroy(); // viewSortOrder
   797 
   805 
   798     iEventLink = CContactLink::NewLC( iParentStore, KNullContactId );
   806     CContactLink* contactLink= CContactLink::NewLC( iParentStore, KNullContactId );
   799     CleanupStack::Pop( iEventLink );
   807     CleanupStack::Pop( contactLink );
       
   808     if ( iEventLink )
       
   809         {
       
   810         delete iEventLink;
       
   811         iEventLink = NULL;
       
   812         }
       
   813     iEventLink = contactLink;
       
   814     contactLink = NULL;
   800     }
   815     }
   801 
   816 
   802 // --------------------------------------------------------------------------
   817 // --------------------------------------------------------------------------
   803 // CViewBase::TeardownView
   818 // CViewBase::TeardownView
   804 // --------------------------------------------------------------------------
   819 // --------------------------------------------------------------------------