52 |
53 |
53 _LIT(KMatchSkeleton, ".o0000"); |
54 _LIT(KMatchSkeleton, ".o0000"); |
54 |
55 |
55 const TInt KTIntMahspsumbers( 11 ); |
56 const TInt KTIntMahspsumbers( 11 ); |
56 |
57 |
|
58 _LIT_SECURITY_POLICY_C1( KPSReadPolicy, ECapabilityReadDeviceData ); |
|
59 _LIT_SECURITY_POLICY_C1( KPSWritePolicy, ECapabilityWriteDeviceData ); |
|
60 |
|
61 |
57 // ============================= LOCAL FUNCTIONS =============================== |
62 // ============================= LOCAL FUNCTIONS =============================== |
58 |
63 |
59 // ============================ MEMBER FUNCTIONS =============================== |
64 // ============================ MEMBER FUNCTIONS =============================== |
60 |
65 |
61 // ----------------------------------------------------------------------------- |
66 // ----------------------------------------------------------------------------- |
62 // ChspsDefinitionRepository::ChspsDefinitionRepository |
67 // ChspsDefinitionRepository::ChspsDefinitionRepository |
63 // C++ default constructor can NOT contain any code, that |
68 // C++ default constructor can NOT contain any code, that |
64 // might leave. |
69 // might leave. |
65 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
66 // |
71 // |
67 ChspsDefinitionRepository::ChspsDefinitionRepository() : |
72 ChspsDefinitionRepository::ChspsDefinitionRepository( |
68 iCacheLastODT( NULL ) |
73 CRepository& aCentralRepository ) : |
|
74 iCacheLastODT( NULL ), |
|
75 iCentralRepository( aCentralRepository ) |
69 { |
76 { |
70 } |
77 } |
71 |
78 |
72 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
73 // ChspsDefinitionRepository::ConstructL |
80 // ChspsDefinitionRepository::ConstructL |
74 // Symbian 2nd phase constructor can leave. |
81 // Symbian 2nd phase constructor can leave. |
75 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
76 // |
83 // |
77 void ChspsDefinitionRepository::ConstructL() |
84 void ChspsDefinitionRepository::ConstructL() |
78 { |
85 { |
|
86 // Setup RProperty keys for the client applications |
|
87 SetupPropertiesL( KPropertyAI3Key ); |
|
88 SetupPropertiesL( KPropertyMTKey ); |
|
89 |
79 User::LeaveIfError( iFs.Connect() ); |
90 User::LeaveIfError( iFs.Connect() ); |
80 //Create private path if it doesn't exist already |
91 //Create private path if it doesn't exist already |
81 TInt err=iFs.CreatePrivatePath(EDriveC); |
92 TInt err = iFs.CreatePrivatePath(EDriveC); |
82 if (err!=KErrNone && err!=KErrAlreadyExists) |
93 if (err!=KErrNone && err!=KErrAlreadyExists) |
83 { |
94 { |
84 User::Leave(err); |
95 User::Leave(err); |
85 } |
96 } |
86 HBufC* path = HBufC::NewLC( KMaxFileName ); |
97 HBufC* path = HBufC::NewLC( KMaxFileName ); |
101 // ----------------------------------------------------------------------------- |
112 // ----------------------------------------------------------------------------- |
102 // ChspsDefinitionRepository::NewL |
113 // ChspsDefinitionRepository::NewL |
103 // Two-phased constructor. |
114 // Two-phased constructor. |
104 // ----------------------------------------------------------------------------- |
115 // ----------------------------------------------------------------------------- |
105 // |
116 // |
106 EXPORT_C ChspsDefinitionRepository* ChspsDefinitionRepository::NewL() |
117 EXPORT_C ChspsDefinitionRepository* ChspsDefinitionRepository::NewL( |
107 { |
118 CRepository& aCentralRepository ) |
108 ChspsDefinitionRepository* self = new( ELeave ) ChspsDefinitionRepository; |
119 { |
|
120 ChspsDefinitionRepository* self = |
|
121 new( ELeave ) ChspsDefinitionRepository( aCentralRepository ); |
109 |
122 |
110 CleanupStack::PushL( self ); |
123 CleanupStack::PushL( self ); |
111 self->ConstructL(); |
124 self->ConstructL(); |
112 CleanupStack::Pop( self ); |
125 CleanupStack::Pop( self ); |
113 |
126 |
126 |
140 |
127 delete iCacheLastODT; |
141 delete iCacheLastODT; |
128 |
142 |
129 iTempFileName1 = KNullDesC; |
143 iTempFileName1 = KNullDesC; |
130 iTempFileName2 = KNullDesC; |
144 iTempFileName2 = KNullDesC; |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // ChspsDefinitionRepository::SetupPropertiesL |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 void ChspsDefinitionRepository::SetupPropertiesL( const TUint aKey ) |
|
152 { |
|
153 TInt err = RProperty::Define( |
|
154 KPropertyHspsCat, |
|
155 aKey, |
|
156 RProperty::EInt, |
|
157 KPSReadPolicy, |
|
158 KPSWritePolicy ); |
|
159 if( err != KErrAlreadyExists && err != KErrNone ) |
|
160 { |
|
161 User::LeaveIfError( err ); |
|
162 } |
|
163 // Init |
|
164 User::LeaveIfError( |
|
165 RProperty::Set( |
|
166 KPropertyHspsCat, |
|
167 aKey, |
|
168 KPropertyKeyDefault ) |
|
169 ); |
131 } |
170 } |
132 |
171 |
133 // ----------------------------------------------------------------------------- |
172 // ----------------------------------------------------------------------------- |
134 // ChspsDefinitionRepository::SetLocaleL |
173 // ChspsDefinitionRepository::SetLocaleL |
135 // Saves the dtd-file into the repository. |
174 // Saves the dtd-file into the repository. |
206 |
245 |
207 if( aODT.ConfigurationType() == EhspsAppConfiguration ) |
246 if( aODT.ConfigurationType() == EhspsAppConfiguration ) |
208 { |
247 { |
209 delete iCacheLastODT; |
248 delete iCacheLastODT; |
210 iCacheLastODT = NULL; |
249 iCacheLastODT = NULL; |
211 iCacheLastODT = aODT.CloneL(); |
250 iCacheLastODT = aODT.CloneL(); |
|
251 |
|
252 // Check whether we updated active application configuration |
|
253 TInt configurationUid = -1; |
|
254 User::LeaveIfError( |
|
255 iCentralRepository.Get( iCacheLastODT->RootUid(), configurationUid ) |
|
256 ); |
|
257 if( configurationUid == aODT.ThemeUid() ) |
|
258 { |
|
259 |
|
260 const TUint key = iCacheLastODT->RootUid(); |
|
261 |
|
262 // Get current value |
|
263 TInt version( 0 ); |
|
264 User::LeaveIfError( |
|
265 RProperty::Get( |
|
266 KPropertyHspsCat, |
|
267 key, |
|
268 version ) |
|
269 ); |
|
270 |
|
271 // Increment the version, each client session should update the ODT copies |
|
272 version++; |
|
273 if( version < 1 ) |
|
274 { |
|
275 version = 1; |
|
276 } |
|
277 User::LeaveIfError( |
|
278 RProperty::Set( |
|
279 KPropertyHspsCat, |
|
280 key, |
|
281 version ) |
|
282 ); |
|
283 } |
212 } |
284 } |
213 |
285 |
214 return ret; |
286 return ret; |
215 } |
287 } |
216 |
288 |