phonebookui/Phonebook2/UIControls/src/Pbk2PhoneNumberFormatterFactory.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Phonebook 2 phone number formatter factory.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <Pbk2PhoneNumberFormatterFactory.h>
       
    20 
       
    21 // Phonebook 2
       
    22 #include "CPbk2NumberGroupingFormatter.h"
       
    23 #include "CPbk2DefaultPhoneNumberFormatter.h"
       
    24 
       
    25 // System includes
       
    26 #include <centralrepository.h>
       
    27 #include <NumberGroupingCRKeys.h>
       
    28 
       
    29 // --------------------------------------------------------------------------
       
    30 // Pbk2PhoneNumberFormatterFactory::CreatePhoneNumberFormatterL
       
    31 // --------------------------------------------------------------------------
       
    32 //
       
    33 EXPORT_C MPbk2PhoneNumberFormatter*
       
    34         Pbk2PhoneNumberFormatterFactory::CreatePhoneNumberFormatterL
       
    35             ( TInt aMaxDisplayLength )
       
    36     {
       
    37     MPbk2PhoneNumberFormatter* ret = NULL;
       
    38     CRepository* repository = NULL;
       
    39     TInt value( 0 );
       
    40     TRAPD( err, repository = CRepository::NewL( KCRUidNumberGrouping ) );
       
    41     if( err == KErrNone )
       
    42         {
       
    43         err = repository->Get( KNumberGrouping, value );
       
    44         }
       
    45     delete repository;
       
    46 
       
    47     if( value == 1 )
       
    48         {
       
    49         ret = CPbk2NumberGroupingFormatter::NewL( aMaxDisplayLength );
       
    50         }
       
    51     else
       
    52         {
       
    53         ret = CPbk2DefaultPhoneNumberFormatter::NewL( aMaxDisplayLength );
       
    54         }
       
    55     return ret;
       
    56     }
       
    57 
       
    58 // End of File