phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlgPage.cpp
branchRCL_3
changeset 9 0d28c1c5b6dd
parent 5 81f8547efd4f
equal deleted inserted replaced
8:5586b4d2ec3e 9:0d28c1c5b6dd
    25 #include <CPbk2StoreConfiguration.h>
    25 #include <CPbk2StoreConfiguration.h>
    26 #include <MPbk2Command.h>
    26 #include <MPbk2Command.h>
    27 #include <Pbk2UIControls.hrh>
    27 #include <Pbk2UIControls.hrh>
    28 #include <Pbk2UIControls.rsg>
    28 #include <Pbk2UIControls.rsg>
    29 #include <CPbk2ViewState.h>
    29 #include <CPbk2ViewState.h>
    30 #include <MPbk2AppUi.h>
       
    31 #include <MPbk2ApplicationServices.h>
       
    32 #include <MPbk2ContactViewSupplier.h>
       
    33 
    30 
    34 // Virtual Phonebook
    31 // Virtual Phonebook
    35 #include <MVPbkContactViewBase.h>
    32 #include <MVPbkContactViewBase.h>
    36 #include <CVPbkContactLinkArray.h>
    33 #include <CVPbkContactLinkArray.h>
    37 #include <MVPbkContactLink.h>
    34 #include <MVPbkContactLink.h>
    88     {
    85     {
    89     if (iContactView)
    86     if (iContactView)
    90         {
    87         {
    91         iContactView->RemoveObserver( *iControl );
    88         iContactView->RemoveObserver( *iControl );
    92         }
    89         }
    93     if ( iStoreConfiguration )
       
    94         {
       
    95         iStoreConfiguration->RemoveObserver( *this );
       
    96         }
       
    97     }
    90     }
    98 
    91 
    99 // --------------------------------------------------------------------------
    92 // --------------------------------------------------------------------------
   100 // CPbk2FetchDlgPage::ConstructL
    93 // CPbk2FetchDlgPage::ConstructL
   101 // --------------------------------------------------------------------------
    94 // --------------------------------------------------------------------------
   106         ( iParentDlg.FetchDlgControl( iControlId ) );
    99         ( iParentDlg.FetchDlgControl( iControlId ) );
   107     iContactView = &iParentDlg.FetchDlgViewL( iControlId );
   100     iContactView = &iParentDlg.FetchDlgViewL( iControlId );
   108 
   101 
   109     iControl->AddObserverL( *this );
   102     iControl->AddObserverL( *this );
   110     iContactView->AddObserverL( *iControl );
   103     iContactView->AddObserverL( *iControl );
   111     iStoreConfiguration = &Phonebook2::Pbk2AppUi()->ApplicationServices().StoreConfiguration();
       
   112     iStoreConfiguration->AddObserverL( *this );
       
   113 
   104 
   114     AknLayoutUtils::LayoutControl
   105     AknLayoutUtils::LayoutControl
   115         ( iControl, iParentDlg.FetchDlgClientRect(),
   106         ( iControl, iParentDlg.FetchDlgClientRect(),
   116           AknLayout::list_gen_pane( 0 ) );
   107           AknLayout::list_gen_pane( 0 ) );
   117     }
   108     }
   389             break;
   380             break;
   390             }
   381             }
   391         }
   382         }
   392     return text;
   383     return text;
   393     }
   384     }
   394 
       
   395 // --------------------------------------------------------------------------
       
   396 // CPbk2FetchDlgPage::ConfigurationChanged
       
   397 // --------------------------------------------------------------------------
       
   398 //
       
   399 void CPbk2FetchDlgPage::ConfigurationChanged()
       
   400     {
       
   401     if ( iControl )
       
   402         {
       
   403         iControl->Reset();
       
   404         }
       
   405     }
       
   406 
       
   407 // --------------------------------------------------------------------------
       
   408 // CPbk2FetchDlgPage::ConfigurationChangedComplete
       
   409 // --------------------------------------------------------------------------
       
   410 //
       
   411 void CPbk2FetchDlgPage::ConfigurationChangedComplete()
       
   412     {
       
   413     if ( iControl )
       
   414         {
       
   415         MVPbkContactViewBase* allContactsView = NULL;
       
   416 
       
   417         TRAPD( res, allContactsView = Phonebook2::Pbk2AppUi()->
       
   418             ApplicationServices().ViewSupplier().AllContactsViewL() );
       
   419 
       
   420         if ( res == KErrNone )
       
   421             {
       
   422             TRAP( res, iControl->SetViewL( *allContactsView ) );
       
   423             iControl->DrawNow();
       
   424             }
       
   425 
       
   426         if ( res != KErrNone )
       
   427             {
       
   428             CCoeEnv::Static()->HandleError( res );
       
   429             iControl->Reset();
       
   430             }
       
   431         }
       
   432     }
       
   433 // End of File
   385 // End of File