|
1 /* |
|
2 * Copyright (c) 2007-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: CCenRepAttributesNonMasked class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cenrepattributesnonmasked.h" |
|
20 #include "cenreptrace.h" |
|
21 |
|
22 // ======== LOCAL FUNCTIONS ========= |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 CCenRepAttributesNonMasked* CCenRepAttributesNonMasked::NewL( |
|
27 MCFContextInterface& aCF, |
|
28 CCFContextSourceSettingArray& aSettings ) |
|
29 { |
|
30 FUNC_LOG; |
|
31 |
|
32 CCenRepAttributesNonMasked* self = CCenRepAttributesNonMasked::NewLC( |
|
33 aCF, |
|
34 aSettings ); |
|
35 CleanupStack::Pop( self ); |
|
36 |
|
37 return self; |
|
38 } |
|
39 |
|
40 CCenRepAttributesNonMasked* CCenRepAttributesNonMasked::NewLC( |
|
41 MCFContextInterface& aCF, |
|
42 CCFContextSourceSettingArray& aSettings ) |
|
43 { |
|
44 FUNC_LOG; |
|
45 |
|
46 CCenRepAttributesNonMasked* self = |
|
47 new( ELeave ) CCenRepAttributesNonMasked( aCF, aSettings ); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL(); |
|
50 |
|
51 return self; |
|
52 } |
|
53 |
|
54 CCenRepAttributesNonMasked::~CCenRepAttributesNonMasked() |
|
55 { |
|
56 FUNC_LOG; |
|
57 } |
|
58 |
|
59 CCenRepAttributesNonMasked::CCenRepAttributesNonMasked( |
|
60 MCFContextInterface& aCF, |
|
61 CCFContextSourceSettingArray& aSettings ) : |
|
62 CCenRepAttributes ( aCF, aSettings ) |
|
63 { |
|
64 FUNC_LOG; |
|
65 } |
|
66 |
|
67 void CCenRepAttributesNonMasked::ConstructL() |
|
68 { |
|
69 FUNC_LOG; |
|
70 |
|
71 iContext = CCFContextObject::NewL(); |
|
72 } |
|
73 |
|
74 //---------------------------------------------------------------------------- |
|
75 // CCenRepAttributesNonMasked::UpdateContextL |
|
76 //---------------------------------------------------------------------------- |
|
77 // |
|
78 void CCenRepAttributesNonMasked::UpdateContextL( const TInt aKeyValue ) |
|
79 { |
|
80 FUNC_LOG; |
|
81 |
|
82 TInt valueValue = 0; |
|
83 TPtrC value( KNullDesC ); |
|
84 TPtrC key( KNullDesC ); |
|
85 |
|
86 TPtrC conTypePtr ( KNullDesC ); |
|
87 TPtrC conSourcePtr ( KNullDesC ); |
|
88 TPtrC conValuePtr ( KNullDesC ); |
|
89 |
|
90 for( TInt i = 0; i < iParamCount; i++ ) |
|
91 { |
|
92 TBool publishOk( ETrue ); |
|
93 const RKeyValueArray& paramAttr = iParamArray[i]->Attributes(); |
|
94 TInt paramAttrCount = paramAttr.Count(); |
|
95 for( TInt j = 0; j < paramAttrCount; j++ ) |
|
96 { |
|
97 key.Set( paramAttr[j]->Key() ); |
|
98 value.Set( paramAttr[j]->Value() ); |
|
99 |
|
100 if ( value.Length() <= 0 ) |
|
101 { |
|
102 publishOk = EFalse; |
|
103 } |
|
104 |
|
105 // Check Value |
|
106 if ( key.CompareF( KValue ) == KErrNone ) |
|
107 { |
|
108 TInt err = ConvertToInt( value, valueValue ); |
|
109 } |
|
110 |
|
111 // Check ContextSource |
|
112 else if ( key.CompareF( KContextSource ) == KErrNone ) |
|
113 { |
|
114 conSourcePtr.Set( value ); |
|
115 } |
|
116 |
|
117 // Check ContextType |
|
118 else if ( key.CompareF( KContextType ) == KErrNone ) |
|
119 { |
|
120 conTypePtr.Set( value); |
|
121 } |
|
122 |
|
123 // Check ContextValue |
|
124 else if ( key.CompareF( KContextValue ) == KErrNone ) |
|
125 { |
|
126 conValuePtr.Set( value ); |
|
127 } |
|
128 } |
|
129 |
|
130 if ( aKeyValue == valueValue ) |
|
131 { |
|
132 iContext->SetSourceL( conSourcePtr ); |
|
133 iContext->SetTypeL( conTypePtr ); |
|
134 iContext->SetValueL( conValuePtr ); |
|
135 |
|
136 if ( publishOk ) |
|
137 { |
|
138 PublishContext(); |
|
139 } |
|
140 } |
|
141 } |
|
142 } |