phonebookui/Phonebook2/spbcontentprovider/src/spbcontentprovider.cpp
changeset 0 e686773b3f54
child 35 4ae315f230bc
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  .
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "spbcontentprovider.h"
       
    20 #include "spbcontentproviderprivate.h"
       
    21 #include <featmgr.h>
       
    22 
       
    23 // LOCAL METHODS AND CONSTANTS
       
    24 namespace {
       
    25 
       
    26 inline void RemoveFlag( TInt32& aFlags, TInt aFlag )
       
    27     {
       
    28     aFlags &= ~aFlag;
       
    29     }
       
    30 }
       
    31 
       
    32 // ----------------------------------------------------------------------------
       
    33 // CSpbContentProvider::NewL
       
    34 // ----------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CSpbContentProvider* CSpbContentProvider::NewL(
       
    37         CVPbkContactManager& aContactManager,
       
    38         CPbk2StoreManager& aStoreManager,
       
    39         TInt32 aFeatures)
       
    40     {
       
    41     CSpbContentProvider* self = new (ELeave) CSpbContentProvider;
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL( aContactManager, aStoreManager, aFeatures );
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ----------------------------------------------------------------------------
       
    49 // CSpbContentProvider::CSpbContentProvider
       
    50 // ----------------------------------------------------------------------------
       
    51 //
       
    52 inline CSpbContentProvider::CSpbContentProvider()
       
    53     {
       
    54     }
       
    55 
       
    56 // ----------------------------------------------------------------------------
       
    57 // CSpbContentProvider::ConstructL
       
    58 // ----------------------------------------------------------------------------
       
    59 //
       
    60 inline void CSpbContentProvider::ConstructL(
       
    61         CVPbkContactManager& aContactManager,
       
    62         CPbk2StoreManager& aStoreManager,
       
    63         TInt32 aFeatures )
       
    64     {
       
    65     FeatureManager::InitializeLibL();
       
    66     if( !FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) )
       
    67         {
       
    68         // Status message and service icon is not fetched if FF_CONTACTS_SOCIAL
       
    69         // feature flag is not defined
       
    70         RemoveFlag( aFeatures, EStatusMessage ); 
       
    71         RemoveFlag( aFeatures, EServiceIcon ); 
       
    72         }
       
    73     FeatureManager::UnInitializeLib();
       
    74     iImpl = CSpbContentProviderPrivate::NewL(aContactManager, aStoreManager, aFeatures);
       
    75     }
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // CSpbContentProvider::~CSpbContentProvider
       
    79 // ----------------------------------------------------------------------------
       
    80 //
       
    81 CSpbContentProvider::~CSpbContentProvider()
       
    82     {
       
    83     delete iImpl;
       
    84     }
       
    85 
       
    86 // ----------------------------------------------------------------------------
       
    87 // CSpbContentProvider::AddObserverL
       
    88 // ----------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C void CSpbContentProvider::AddObserverL( 
       
    91         MSpbContentProviderObserver& aObserver )
       
    92     {
       
    93     iImpl->AddObserverL( aObserver );
       
    94     }
       
    95 
       
    96 // ----------------------------------------------------------------------------
       
    97 // CSpbContentProvider::RemoveObserver
       
    98 // ----------------------------------------------------------------------------
       
    99 //
       
   100 EXPORT_C void CSpbContentProvider::RemoveObserver( 
       
   101         MSpbContentProviderObserver& aObserver )
       
   102     {
       
   103     iImpl->RemoveObserver( aObserver );
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // CSpbContentProvider::GetContentL
       
   108 // ----------------------------------------------------------------------------
       
   109 //
       
   110 EXPORT_C void CSpbContentProvider::GetContentL(
       
   111         MVPbkContactLink& aLink,
       
   112         HBufC*& aText,
       
   113         TPbk2IconId& aIconId,
       
   114         TSpbContentType& aType )
       
   115     {
       
   116     iImpl->GetContentL( aLink, aText, aIconId, aType );
       
   117     }
       
   118 
       
   119 // ----------------------------------------------------------------------------
       
   120 // CSpbContentProvider::CreateServiceIconLC
       
   121 // ----------------------------------------------------------------------------
       
   122 //
       
   123 EXPORT_C CGulIcon* CSpbContentProvider::CreateServiceIconLC(
       
   124     const TPbk2IconId& aIconId )
       
   125     {
       
   126     return iImpl->CreateServiceIconLC( aIconId );
       
   127     }
       
   128 
       
   129 // end of file