phonebookui/Phonebook2/UIControls/src/Pbk2PhoneNumberFormatterFactory.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:26:27 +0300
branchRCL_3
changeset 39 a6539d1e8e43
parent 0 e686773b3f54
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2005-2007 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:  Phonebook 2 phone number formatter factory.
*
*/


#include <Pbk2PhoneNumberFormatterFactory.h>

// Phonebook 2
#include "CPbk2NumberGroupingFormatter.h"
#include "CPbk2DefaultPhoneNumberFormatter.h"

// System includes
#include <centralrepository.h>
#include <NumberGroupingCRKeys.h>

// --------------------------------------------------------------------------
// Pbk2PhoneNumberFormatterFactory::CreatePhoneNumberFormatterL
// --------------------------------------------------------------------------
//
EXPORT_C MPbk2PhoneNumberFormatter*
        Pbk2PhoneNumberFormatterFactory::CreatePhoneNumberFormatterL
            ( TInt aMaxDisplayLength )
    {
    MPbk2PhoneNumberFormatter* ret = NULL;
    CRepository* repository = NULL;
    TInt value( 0 );
    TRAPD( err, repository = CRepository::NewL( KCRUidNumberGrouping ) );
    if( err == KErrNone )
        {
        err = repository->Get( KNumberGrouping, value );
        }
    delete repository;

    if( value == 1 )
        {
        ret = CPbk2NumberGroupingFormatter::NewL( aMaxDisplayLength );
        }
    else
        {
        ret = CPbk2DefaultPhoneNumberFormatter::NewL( aMaxDisplayLength );
        }
    return ret;
    }

// End of File