phonebookui/Phonebook2/spbcontentprovider/src/spbcontentprovider.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:29:52 +0100
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  .
*
*/


#include "spbcontentprovider.h"
#include "spbcontentproviderprivate.h"
#include <featmgr.h>
#include <MVPbkContactStore.h>

// LOCAL METHODS AND CONSTANTS
namespace {

inline void RemoveFlag( TInt32& aFlags, TInt aFlag )
    {
    aFlags &= ~aFlag;
    }
}

// ----------------------------------------------------------------------------
// CSpbContentProvider::NewL
// ----------------------------------------------------------------------------
//
EXPORT_C CSpbContentProvider* CSpbContentProvider::NewL(
        CVPbkContactManager& aContactManager,
        CPbk2StoreManager& aStoreManager,
        TInt32 aFeatures)
    {
    CSpbContentProvider* self = new (ELeave) CSpbContentProvider;
    CleanupStack::PushL( self );
    self->ConstructL( aContactManager, aStoreManager, aFeatures );
    CleanupStack::Pop( self );
    return self;
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::CSpbContentProvider
// ----------------------------------------------------------------------------
//
inline CSpbContentProvider::CSpbContentProvider()
    {
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::ConstructL
// ----------------------------------------------------------------------------
//
inline void CSpbContentProvider::ConstructL(
        CVPbkContactManager& aContactManager,
        CPbk2StoreManager& aStoreManager,
        TInt32 aFeatures )
    {
    FeatureManager::InitializeLibL();
    if( !FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) )
        {
        // Status message and service icon is not fetched if FF_CONTACTS_SOCIAL
        // feature flag is not defined
        RemoveFlag( aFeatures, EStatusMessage ); 
        RemoveFlag( aFeatures, EServiceIcon ); 
        }
    FeatureManager::UnInitializeLib();
    iImpl = CSpbContentProviderPrivate::NewL(aContactManager, aStoreManager, aFeatures);
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::~CSpbContentProvider
// ----------------------------------------------------------------------------
//
CSpbContentProvider::~CSpbContentProvider()
    {
    delete iImpl;
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::AddObserverL
// ----------------------------------------------------------------------------
//
EXPORT_C void CSpbContentProvider::AddObserverL( 
        MSpbContentProviderObserver& aObserver )
    {
    iImpl->AddObserverL( aObserver );
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::RemoveObserver
// ----------------------------------------------------------------------------
//
EXPORT_C void CSpbContentProvider::RemoveObserver( 
        MSpbContentProviderObserver& aObserver )
    {
    iImpl->RemoveObserver( aObserver );
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::GetContentL
// ----------------------------------------------------------------------------
//
EXPORT_C void CSpbContentProvider::GetContentL(
        MVPbkContactLink& aLink,
        HBufC*& aText,
        TPbk2IconId& aIconId,
        TSpbContentType& aType )
    {
    iImpl->GetContentL( aLink, aText, aIconId, aType );
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::CreateServiceIconLC
// ----------------------------------------------------------------------------
//
EXPORT_C CGulIcon* CSpbContentProvider::CreateServiceIconLC(
    const TPbk2IconId& aIconId )
    {
    return iImpl->CreateServiceIconLC( aIconId );
    }

// ----------------------------------------------------------------------------
// CSpbContentProvider::CleanContentL
// ----------------------------------------------------------------------------
//
EXPORT_C void CSpbContentProvider::CleanContentL( MVPbkContactStore& aStore )
    {
    return iImpl->CleanContentL( aStore );
    }

// end of file