phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_ccappcmscontactfetcher.cpp
branchRCL_3
changeset 21 b3431bff8c19
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
15:e8e3147d53eb 21:b3431bff8c19
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
       
    17 
       
    18 
    17 #include "ccappcommlauncherheaders.h"
    19 #include "ccappcommlauncherheaders.h"
    18 
    20 
    19 //#include "t_ccappcmscontactfetcher.h"
    21 
    20 // dummy class
    22 // ============================ MEMBER FUNCTIONS ===============================
    21 
    23 
    22 
    24 // -----------------------------------------------------------------------------
    23 CCCAppCmsContactFetcherWrapper::CCCAppCmsContactFetcherWrapper( ) 
    25 // CCmsContactField::ItemL()
    24     {
    26 // -----------------------------------------------------------------------------
    25     }
    27 //
       
    28 CCCAppCmsContactFetcherWrapper::CCCAppCmsContactFetcherWrapper( ):iTopContact(ETrue) 
       
    29     {
       
    30     }
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CCmsContactField::ItemL()
       
    34 // -----------------------------------------------------------------------------
       
    35 //
    26 void CCCAppCmsContactFetcherWrapper::ConstructL( ) 
    36 void CCCAppCmsContactFetcherWrapper::ConstructL( ) 
    27     {
    37     {
    28     iContactFieldInfo = CCmsContactFieldInfo::NewL();
    38     iContactFieldInfo = CCmsContactFieldInfo::NewL();
    29     CCmsContactField* field = new (ELeave) CCmsContactField( PHONE );
    39     CCmsContactField* field = new (ELeave) CCmsContactField( PHONE );
    30     iFieldArray.Append( field );
    40     iFieldArray.Append( field );
    31     }
    41     }
    32     
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CCmsContactField::ItemL()
       
    45 // -----------------------------------------------------------------------------
       
    46 //
    33 CCCAppCmsContactFetcherWrapper::~CCCAppCmsContactFetcherWrapper( ) 
    47 CCCAppCmsContactFetcherWrapper::~CCCAppCmsContactFetcherWrapper( ) 
    34     {
    48     {
    35     delete iContactFieldInfo;
    49     delete iContactFieldInfo;
    36     iObservers.Close();
    50     iObservers.Close();
    37     iFieldArray.ResetAndDestroy();
    51     iFieldArray.ResetAndDestroy();
    38     }
    52     }
    39 
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CCmsContactField::ItemL()
       
    56 // -----------------------------------------------------------------------------
       
    57 //
    40 CCCAppCmsContactFetcherWrapper* CCCAppCmsContactFetcherWrapper::InstanceL( CCCAParameter* /*aParameter*/ )
    58 CCCAppCmsContactFetcherWrapper* CCCAppCmsContactFetcherWrapper::InstanceL( CCCAParameter* /*aParameter*/ )
    41         {
    59         {
    42         CCCAppCmsContactFetcherWrapper* self = new (ELeave) CCCAppCmsContactFetcherWrapper( );
    60         CCCAppCmsContactFetcherWrapper* self = new (ELeave) CCCAppCmsContactFetcherWrapper( );
    43         CleanupStack::PushL( self );
    61         CleanupStack::PushL( self );
    44         self->ConstructL();
    62         self->ConstructL();
    45         CleanupStack::Pop( self );
    63         CleanupStack::Pop( self );
    46         return self;
    64         return self;
    47         }
    65         }
    48        
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CCmsContactField::ItemL()
       
    69 // -----------------------------------------------------------------------------
       
    70 //
    49 CCCAppCmsContactFetcherWrapper* CCCAppCmsContactFetcherWrapper::InstanceL()
    71 CCCAppCmsContactFetcherWrapper* CCCAppCmsContactFetcherWrapper::InstanceL()
    50         {
    72         {
    51         CCCAppCmsContactFetcherWrapper* self = new (ELeave) CCCAppCmsContactFetcherWrapper(  );
    73         CCCAppCmsContactFetcherWrapper* self = new (ELeave) CCCAppCmsContactFetcherWrapper(  );
    52         CleanupStack::PushL( self );
    74         CleanupStack::PushL( self );
    53         self->ConstructL();
    75         self->ConstructL();
    54         CleanupStack::Pop( self );
    76         CleanupStack::Pop( self );
    55         return self;
    77         return self;
    56         //return NULL;
    78         //return NULL;
    57         }
    79         }
    58 
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CCmsContactField::ItemL()
       
    83 // -----------------------------------------------------------------------------
       
    84 //
    59 void CCCAppCmsContactFetcherWrapper::Release()
    85 void CCCAppCmsContactFetcherWrapper::Release()
    60         {
    86         {
    61         delete this;
    87         delete this;
    62         } 
    88         } 
    63         
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CCmsContactField::ItemL()
       
    92 // -----------------------------------------------------------------------------
       
    93 //
    64 const CCmsContactFieldInfo* CCCAppCmsContactFetcherWrapper::ContactInfo()
    94 const CCmsContactFieldInfo* CCCAppCmsContactFetcherWrapper::ContactInfo()
    65         {
    95         {
    66         T_CTestSingleton* singleton = T_CTestSingleton::InstanceL();
    96         T_CTestSingleton* singleton = T_CTestSingleton::InstanceL();
    67         TInt command = singleton->GetValue();
    97         TInt command = singleton->GetValue();
    68         singleton->Release();
    98         singleton->Release();
    73             }
   103             }
    74         // first case
   104         // first case
    75         return iContactFieldInfo;
   105         return iContactFieldInfo;
    76         }
   106         }
    77 
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CCmsContactField::ItemL()
       
   110 // -----------------------------------------------------------------------------
       
   111 //
    78 RPointerArray<CCmsContactField>& CCCAppCmsContactFetcherWrapper::ContactFieldDataArray()
   112 RPointerArray<CCmsContactField>& CCCAppCmsContactFetcherWrapper::ContactFieldDataArray()
    79         {
   113         {
    80         return iFieldArray;
   114         return iFieldArray;
    81         }
   115         }
    82 
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CCmsContactField::ItemL()
       
   119 // -----------------------------------------------------------------------------
       
   120 //
    83 HBufC8* CCCAppCmsContactFetcherWrapper::ContactIdentifierLC( 
   121 HBufC8* CCCAppCmsContactFetcherWrapper::ContactIdentifierLC( 
    84         const TCmsContactIdentifierType /*aIdType = ECmsPackedContactLinkArray*/ )
   122         const TCmsContactIdentifierType /*aIdType = ECmsPackedContactLinkArray*/ )
    85         {
   123         {
    86         TPtrC8 ptr ( KTestString );
   124         TPtrC8 ptr ( KTestString );
    87         HBufC8* buf = ptr.AllocLC();
   125         HBufC8* buf = ptr.AllocLC();
    88         return buf;
   126         return buf;
    89         }
   127         }
    90 
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CCmsContactField::ItemL()
       
   131 // -----------------------------------------------------------------------------
       
   132 //
    91 void CCCAppCmsContactFetcherWrapper::AddObserverL( MCCAppContactFieldDataObserver& aObserver )
   133 void CCCAppCmsContactFetcherWrapper::AddObserverL( MCCAppContactFieldDataObserver& aObserver )
    92     {
   134     {
    93     const TInt index = iObservers.Find( &aObserver );
   135     const TInt index = iObservers.Find( &aObserver );
    94     if ( KErrNotFound == index )
   136     if ( KErrNotFound == index )
    95         {
   137         {
    96         iObservers.AppendL( &aObserver );
   138         iObservers.AppendL( &aObserver );
    97         }
   139         }
    98     }
   140     }
    99 
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CCmsContactField::ItemL()
       
   144 // -----------------------------------------------------------------------------
       
   145 //
   100 void CCCAppCmsContactFetcherWrapper::RemoveObserver( MCCAppContactFieldDataObserver& aObserver )
   146 void CCCAppCmsContactFetcherWrapper::RemoveObserver( MCCAppContactFieldDataObserver& aObserver )
   101     {
   147     {
   102     const TInt index = iObservers.Find( &aObserver );
   148     const TInt index = iObservers.Find( &aObserver );
   103     if ( KErrNotFound != index )
   149     if ( KErrNotFound != index )
   104         {
   150         {
   105         iObservers.Remove( index );
   151         iObservers.Remove( index );
   106         }
   152         }
   107     }
   153     }
   108 
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 // CCmsContactField::ItemL()
       
   157 // -----------------------------------------------------------------------------
       
   158 //
   109 TBool CCCAppCmsContactFetcherWrapper::IsServiceAvailable(
   159 TBool CCCAppCmsContactFetcherWrapper::IsServiceAvailable(
   110     VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction */)
   160     VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction */)
   111     {
   161     {
   112     return ETrue;//iCmsContactDataFetcher.IsServiceAvailable( aContactAction );
   162     return ETrue;//iCmsContactDataFetcher.IsServiceAvailable( aContactAction );
   113     }
   163     }
   114 
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // CCmsContactField::ItemL()
       
   167 // -----------------------------------------------------------------------------
       
   168 //
   115 TCmsContactStore CCCAppCmsContactFetcherWrapper::ContactStore() const
   169 TCmsContactStore CCCAppCmsContactFetcherWrapper::ContactStore() const
   116     {
   170     {
   117     const_cast<TBool&>(iContactStore_called) = ETrue;
   171     const_cast<TBool&>(iContactStore_called) = ETrue;
   118     }
   172     return ECmsContactStorePbk;
   119 
   173     }
   120 
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CCmsContactField::ItemL()
       
   177 // -----------------------------------------------------------------------------
       
   178 //
   121 TInt CCCAppCmsContactFetcherWrapper::GetContactActionFieldCount(
   179 TInt CCCAppCmsContactFetcherWrapper::GetContactActionFieldCount(
   122         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction*/)
   180         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction*/ )
   123     {
   181     {
   124     return ETrue; //iCmsContactDataFetcher.GetContactActionFieldCount(aContactAction);
   182     return ETrue; //iCmsContactDataFetcher.GetContactActionFieldCount(aContactAction);
   125     }
   183     }
   126 
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // CCmsContactField::ItemL()
       
   187 // -----------------------------------------------------------------------------
       
   188 //
   127 void CCCAppCmsContactFetcherWrapper::RefetchContactL()
   189 void CCCAppCmsContactFetcherWrapper::RefetchContactL()
   128     {
   190     {
   129     
   191     
   130     }
   192     }
   131   
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // CCCAppCmsContactFetcherWrapper::IsTopContact()
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 TBool CCCAppCmsContactFetcherWrapper::IsTopContact()
       
   199        {
       
   200        return iTopContact;
       
   201        }
       
   202 //  End of File