phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkLocalVariationManager.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  Virtual Phonebook Local variation manager.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CVPbkLocalVariationManager.h"
       
    21 #include "PhonebookPrivateCRKeys.h"
       
    22 #include <centralrepository.h>
       
    23 
       
    24 // ================= MEMBER FUNCTIONS =======================
       
    25 
       
    26 inline void CVPbkLocalVariationManager::ConstructL()
       
    27 	{
       
    28     TUid uid;
       
    29     uid.iUid = KCRUidPhonebook;
       
    30     // Construct central repository client for local variation needs
       
    31     iRepository = CRepository::NewL(uid);
       
    32 
       
    33     // Get flags
       
    34     iLocalVariationFlags = DoGetLocalVariationFlags();
       
    35 	}
       
    36 
       
    37 inline CVPbkLocalVariationManager::CVPbkLocalVariationManager()
       
    38 	{
       
    39     }
       
    40 
       
    41 EXPORT_C CVPbkLocalVariationManager* CVPbkLocalVariationManager::NewL()
       
    42 	{
       
    43 	CVPbkLocalVariationManager* self = new(ELeave) CVPbkLocalVariationManager();
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL();
       
    46 	CleanupStack::Pop(self);
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 CVPbkLocalVariationManager::~CVPbkLocalVariationManager()
       
    51 	{
       
    52     delete iRepository;
       
    53     }
       
    54 
       
    55 EXPORT_C TBool CVPbkLocalVariationManager::LocallyVariatedFeatureEnabled
       
    56         (TVPbkLocalVariantFlags aFeature)
       
    57     {
       
    58     TBool ret = EFalse;
       
    59 
       
    60     // Check is the feature enabled or not
       
    61     if (iLocalVariationFlags & aFeature)
       
    62         {
       
    63         ret = ETrue;
       
    64         }
       
    65     
       
    66     return ret;
       
    67     }
       
    68 
       
    69 TInt CVPbkLocalVariationManager::DoGetLocalVariationFlags()
       
    70 	{
       
    71 	TInt flags = 0;
       
    72     TInt result = iRepository->Get(KPhonebookLocalVariationFlags, flags);
       
    73     if (result != KErrNone)
       
    74         {
       
    75         // If there were problems reading the flags, assume everything is off
       
    76         flags = 0;
       
    77         }
       
    78 	return flags;
       
    79 	}
       
    80 
       
    81 
       
    82 //  End of File