phonebookui/Phonebook2/GroupExtension/src/CPguAddMembersCmd.cpp
branchRCL_3
changeset 17 2666d9724c76
parent 12 4ae315f230bc
equal deleted inserted replaced
15:34879f5cfc63 17:2666d9724c76
   112     if ( iFilteredView )
   112     if ( iFilteredView )
   113         {
   113         {
   114         iFilteredView->RemoveObserver( *this );
   114         iFilteredView->RemoveObserver( *this );
   115         delete iFilteredView;
   115         delete iFilteredView;
   116         }
   116         }
       
   117     else
       
   118         {
       
   119         Phonebook2::Pbk2AppUi()->
       
   120             ApplicationServices().ViewSupplier().
       
   121             AllContactsViewL()->RemoveObserver( *this );
       
   122         }
   117     if( iUiControl )
   123     if( iUiControl )
   118         {
   124         {
   119         iUiControl->RegisterCommand( NULL );
   125         iUiControl->RegisterCommand( NULL );
   120         }
   126         }
   121     
   127     
   413 // --------------------------------------------------------------------------
   419 // --------------------------------------------------------------------------
   414 // CPguAddMembersCmd::ContactViewError
   420 // CPguAddMembersCmd::ContactViewError
   415 // --------------------------------------------------------------------------
   421 // --------------------------------------------------------------------------
   416 //
   422 //
   417 void CPguAddMembersCmd::ContactViewError
   423 void CPguAddMembersCmd::ContactViewError
   418         ( MVPbkContactViewBase& PBK2_DEBUG_ONLY( aView ),
   424         ( MVPbkContactViewBase&/*aView */,
   419         TInt aError, TBool /*aErrorNotified*/ )
   425         TInt aError, TBool /*aErrorNotified*/ )
   420     {
   426     {
   421     __ASSERT_DEBUG( iFilteredView == &aView, Panic( EInvalidView ) );
       
   422 
       
   423     FinishCommand( aError );
   427     FinishCommand( aError );
   424     }
   428     }
   425 
   429 
   426 // --------------------------------------------------------------------------
   430 // --------------------------------------------------------------------------
   427 // CPguAddMembersCmd::IsContactIncluded
   431 // CPguAddMembersCmd::IsContactIncluded
   633 //
   637 //
   634 void CPguAddMembersCmd::HandleContactLockedEventL()
   638 void CPguAddMembersCmd::HandleContactLockedEventL()
   635     {
   639     {
   636     delete iFilteredView;
   640     delete iFilteredView;
   637     iFilteredView = NULL;
   641     iFilteredView = NULL;
   638     iFilteredView = CVPbkFilteredContactView::NewL
   642     MPbk2ApplicationServices& appServices = Phonebook2::Pbk2AppUi()->ApplicationServices();
   639         ( *Phonebook2::Pbk2AppUi()->ApplicationServices().ViewSupplier().
   643     TInt count = KErrNotFound;
   640           AllContactsViewL(), *this, *this,
   644     if ( !iContactsInGroup && iContactGroup )
   641           Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager().
   645         {
   642             FieldTypes() );
   646         iContactsInGroup = iContactGroup->ItemsContainedLC();
       
   647         CleanupStack::Pop(); // iContactsInGroup
       
   648         }
       
   649     if ( iContactsInGroup )
       
   650         {
       
   651         count = iContactsInGroup->Count();
       
   652         }
       
   653     if ( count > 0 || count == KErrNotFound )
       
   654         {
       
   655         iFilteredView = CVPbkFilteredContactView::NewL
       
   656             ( *appServices.ViewSupplier().AllContactsViewL(), *this, *this,
       
   657                     appServices.ContactManager().FieldTypes() );
       
   658         }
   643 
   659 
   644     DoLaunchFetchDialogL();
   660     DoLaunchFetchDialogL();
   645     }
   661     }
   646 
   662 
   647 // --------------------------------------------------------------------------
   663 // --------------------------------------------------------------------------
   650 //
   666 //
   651 void CPguAddMembersCmd::DoLaunchFetchDialogL()
   667 void CPguAddMembersCmd::DoLaunchFetchDialogL()
   652     {
   668     {
   653     CPbk2FetchDlg::TParams params;
   669     CPbk2FetchDlg::TParams params;
   654     params.iResId = R_PBK2_MULTIPLE_ENTRY_FETCH_NO_GROUPS_DLG;
   670     params.iResId = R_PBK2_MULTIPLE_ENTRY_FETCH_NO_GROUPS_DLG;
   655     // Fetch dlg uses this view instead of AllNameslistView
   671     if ( iFilteredView )
   656     params.iNamesListView = iFilteredView;
   672         {
       
   673         // Fetch dlg uses this view instead of AllNameslistView
       
   674         params.iNamesListView = iFilteredView;
       
   675         }
       
   676     else
       
   677         {
       
   678         MVPbkContactViewBase* view = Phonebook2::Pbk2AppUi()
       
   679             ->ApplicationServices().ViewSupplier().AllContactsViewL();
       
   680         view->AddObserverL( *this );
       
   681         params.iNamesListView = view;
       
   682         }
   657     params.iFlags = CPbk2FetchDlg::EFetchMultiple;
   683     params.iFlags = CPbk2FetchDlg::EFetchMultiple;
   658     params.iNaviPaneId = R_PBK2_GROUP_MEMBER_FETCH_NAVILABEL;
   684     params.iNaviPaneId = R_PBK2_GROUP_MEMBER_FETCH_NAVILABEL;
   659 
   685 
   660     CPbk2FetchDlg* dlg = CPbk2FetchDlg::NewL( params, *this );
   686     CPbk2FetchDlg* dlg = CPbk2FetchDlg::NewL( params, *this );
   661     // Fetch dialog is not waiting dialog, so we just launch it
   687     // Fetch dialog is not waiting dialog, so we just launch it