phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp
branchRCL_3
changeset 6 e8e3147d53eb
parent 0 e686773b3f54
child 7 b3431bff8c19
equal deleted inserted replaced
5:81f8547efd4f 6:e8e3147d53eb
    56 #include <gulicon.h>
    56 #include <gulicon.h>
    57 #include <AknIconArray.h>
    57 #include <AknIconArray.h>
    58 #include <eikclbd.h>
    58 #include <eikclbd.h>
    59 #include <aknlists.h>
    59 #include <aknlists.h>
    60 #include <aknPopup.h>
    60 #include <aknPopup.h>
       
    61 
       
    62 // For checking mailbox accounts
       
    63 #include <EmailInterfaceFactory.h>
       
    64 #include <MEmailMailbox.h>
    61 
    65 
    62 // Debugging headers
    66 // Debugging headers
    63 #include <Pbk2Debug.h>
    67 #include <Pbk2Debug.h>
    64 
    68 
    65 // LOCAL CONSTANTS AND MACROS
    69 // LOCAL CONSTANTS AND MACROS
   796 TBool CPbk2MemoryEntryDefaultsDlg::IsSupported
   800 TBool CPbk2MemoryEntryDefaultsDlg::IsSupported
   797         ( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const
   801         ( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const
   798     {
   802     {
   799     TBool ret(ETrue);
   803     TBool ret(ETrue);
   800 
   804 
   801     // Skip the line if Email field not supported
   805     // Skip the line if Email field not supported or having no mailbox
   802     if ( aSelectorID == VPbkFieldTypeSelectorFactory::EEmailEditorSelector &&
   806     if ( aSelectorID == VPbkFieldTypeSelectorFactory::EEmailEditorSelector )
   803          !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) )
   807         {
   804         {
   808         if ( !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) || !HasMailboxAccountsL() )
   805         ret = EFalse;
   809         	{
       
   810         	ret = EFalse;
       
   811         	}
   806         }
   812         }
   807     // Do not add video fields if they are not enabled
   813     // Do not add video fields if they are not enabled
   808     else if ( ( aSelectorID == VPbkFieldTypeSelectorFactory::EVideoCallSelector ) &&
   814     else if ( ( aSelectorID == VPbkFieldTypeSelectorFactory::EVideoCallSelector ) &&
   809               !( iLVFlags & EVPbkLVAddVideoTelephonyFields ) )
   815               !( iLVFlags & EVPbkLVAddVideoTelephonyFields ) )
   810         {
   816         {
   824         }
   830         }
   825 
   831 
   826     return ret;
   832     return ret;
   827     }
   833     }
   828 
   834 
       
   835 // --------------------------------------------------------------------------
       
   836 // CPbk2MemoryEntryDefaultsDlg::HasMailboxAccountsL
       
   837 // --------------------------------------------------------------------------
       
   838 //
       
   839 TBool CPbk2MemoryEntryDefaultsDlg::HasMailboxAccountsL() const
       
   840 	{
       
   841 	using namespace EmailInterface;
       
   842 
       
   843 	TBool result = EFalse;
       
   844 	CEmailInterfaceFactory* factory = CEmailInterfaceFactory::NewL();
       
   845 	CleanupStack::PushL( factory );
       
   846 	MEmailInterface* ifPtr = factory->InterfaceL( KEmailClientApiInterface );
       
   847 	MEmailClientApi* clientApi = static_cast<MEmailClientApi*>( ifPtr );
       
   848 	CleanupReleasePushL( *clientApi );
       
   849 	
       
   850 	// Get mailboxs
       
   851 	RMailboxPtrArray mailboxes;
       
   852 	clientApi->GetMailboxesL( mailboxes );
       
   853 	TInt count = mailboxes.Count();	
       
   854 	if ( count > 0 )
       
   855 		{
       
   856 		result = ETrue;
       
   857 		}
       
   858 	
       
   859 	// Release mailboxs before releasing clientapi
       
   860 	for ( TInt i=0; i<count; i++ )
       
   861 		{
       
   862 		MEmailMailbox* mailbox = mailboxes[i];
       
   863 		mailbox->Release();
       
   864 		}	
       
   865 	mailboxes.Close();	
       
   866 	CleanupStack::PopAndDestroy( 2 ); // clientApi and factory
       
   867 	
       
   868 	return result;
       
   869 	}
   829 // --------------------------------------------------------------------------
   870 // --------------------------------------------------------------------------
   830 // CPbk2MemoryEntryDefaultsDlg::IsAvailable
   871 // CPbk2MemoryEntryDefaultsDlg::IsAvailable
   831 // --------------------------------------------------------------------------
   872 // --------------------------------------------------------------------------
   832 //
   873 //
   833 TBool CPbk2MemoryEntryDefaultsDlg::IsAvailableL
   874 TBool CPbk2MemoryEntryDefaultsDlg::IsAvailableL