|
1 /* |
|
2 * Copyright (c) 2002 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 FILES |
|
20 #include "CPbkLocalVariationManager.h" |
|
21 #include "PbkUID.h" |
|
22 |
|
23 #include <PbkGlobalSettingFactory.h> |
|
24 #include <MPbkGlobalSetting.h> |
|
25 |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ======================= |
|
28 |
|
29 CPbkLocalVariationManager* CPbkLocalVariationManager::NewL() |
|
30 { |
|
31 CPbkLocalVariationManager* self = new(ELeave) CPbkLocalVariationManager(); |
|
32 CleanupStack::PushL(self); |
|
33 self->ConstructL(); |
|
34 CleanupStack::Pop(self); |
|
35 return self; |
|
36 } |
|
37 |
|
38 void CPbkLocalVariationManager::ConstructL() |
|
39 { |
|
40 // Construct shared data client for local variation needs |
|
41 iLocalVariationSetting = PbkGlobalSettingFactory::CreatePersistentSettingL(); |
|
42 iLocalVariationSetting->ConnectL(MPbkGlobalSetting::ELocalVariationCategory); |
|
43 |
|
44 // Get flags |
|
45 iLocalVariationFlags = GetLocalVariationFlags(); |
|
46 } |
|
47 |
|
48 inline CPbkLocalVariationManager::CPbkLocalVariationManager() |
|
49 { |
|
50 } |
|
51 |
|
52 CPbkLocalVariationManager::~CPbkLocalVariationManager() |
|
53 { |
|
54 if (iLocalVariationSetting) |
|
55 { |
|
56 iLocalVariationSetting->Close(); |
|
57 delete iLocalVariationSetting; |
|
58 } |
|
59 } |
|
60 |
|
61 TInt CPbkLocalVariationManager::GetLocalVariationFlags() |
|
62 { |
|
63 TInt flags = 0; |
|
64 TInt result = iLocalVariationSetting->Get |
|
65 (MPbkGlobalSetting::ELocalVariationFlags, flags); |
|
66 if (result != KErrNone) |
|
67 { |
|
68 // If there were problems reading the flags, assume everything is off |
|
69 flags = 0; |
|
70 } |
|
71 return flags; |
|
72 } |
|
73 |
|
74 TBool CPbkLocalVariationManager::LocallyVariatedFeatureEnabled |
|
75 (TPbkLocalVariantFlags aFeature) |
|
76 { |
|
77 TBool ret = EFalse; |
|
78 |
|
79 // Check is the feature enabled or not |
|
80 if (iLocalVariationFlags & aFeature) |
|
81 { |
|
82 ret = ETrue; |
|
83 } |
|
84 |
|
85 return ret; |
|
86 } |
|
87 |
|
88 // End of File |