|
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: DM Themes Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* |
|
20 |
|
21 ./Customization -+--> Themes -+--> AvailableThemes -+--> <X> * -+--> ID |
|
22 | | |
|
23 | |--> Name |
|
24 | | |
|
25 | |--> Version |
|
26 | | |
|
27 | |--> Data |
|
28 | | |
|
29 | |--> InstallOptions |
|
30 | |
|
31 |--> ActiveTheme |
|
32 |
|
33 */ |
|
34 |
|
35 |
|
36 #include <badesca.h> |
|
37 #include <fbs.h> |
|
38 #include <imcvcodc.h> |
|
39 #include "debug.h" |
|
40 #include "ThemesAdapter.h" |
|
41 #include "ThemesList.h" |
|
42 #include "nsmldmuri.h" |
|
43 #include <implementationproxy.h> // For TImplementationProxy definition |
|
44 #include <f32file.h> |
|
45 #include <e32def.h> |
|
46 #include "FileCoderB64.h" |
|
47 #include "aminstalloptions.h" |
|
48 #include "AknsSrvClient.h" |
|
49 #include <AknSkinsInternalCRKeys.h> |
|
50 #include <centralrepository.h> |
|
51 #include <utf.h> |
|
52 //#ifdef __SAP_POLICY_MANAGEMENT |
|
53 #include <PolicyEngineXACML.h> |
|
54 #include <SettingEnforcementInfo.h> |
|
55 //#endif |
|
56 #include <featmgr.h> |
|
57 |
|
58 |
|
59 _LIT( KThemesAdapterTmpInstallPath, "c:\\system\\temp\\DMTheme.sis" ); |
|
60 _LIT8(KOpenBrace, "("); |
|
61 _LIT8(KCloseBrace, ")"); |
|
62 |
|
63 // ------------------------------------------------------------------------------------------------ |
|
64 // CThemesAdapter* CThemesAdapter::NewL( ) |
|
65 // ------------------------------------------------------------------------------------------------ |
|
66 CThemesAdapter* CThemesAdapter::NewL( MSmlDmCallback* aDmCallback ) |
|
67 { |
|
68 RDEBUG("CThemesAdapter::NewL(): begin"); |
|
69 |
|
70 CThemesAdapter* self = NewLC( aDmCallback ); |
|
71 CleanupStack::Pop(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // ------------------------------------------------------------------------------------------------ |
|
76 // CThemesAdapter* CThemesAdapter::NewLC( ) |
|
77 // ------------------------------------------------------------------------------------------------ |
|
78 CThemesAdapter* CThemesAdapter::NewLC( MSmlDmCallback* aDmCallback ) |
|
79 { |
|
80 RDEBUG("CThemesAdapter::NewLC(): begin"); |
|
81 CThemesAdapter* self = new( ELeave ) CThemesAdapter( aDmCallback ); |
|
82 CleanupStack::PushL( self ); |
|
83 self->ConstructL( ); |
|
84 return self; |
|
85 } |
|
86 |
|
87 |
|
88 // ------------------------------------------------------------------------------------------------ |
|
89 // CThemesAdapter::CThemesAdapter() |
|
90 // ------------------------------------------------------------------------------------------------ |
|
91 CThemesAdapter::CThemesAdapter( MSmlDmCallback* aDmCallback ) |
|
92 : CTARMDmAdapter( aDmCallback ) |
|
93 , iCallBack( aDmCallback ) |
|
94 , iThemes( 0 ) |
|
95 { |
|
96 RDEBUG("CThemesAdapter::CThemesAdapter(): begin"); |
|
97 } |
|
98 |
|
99 // ------------------------------------------------------------------------------------------------ |
|
100 // CThemesAdapter::ConstructL() |
|
101 // ------------------------------------------------------------------------------------------------ |
|
102 void CThemesAdapter::ConstructL( ) |
|
103 { |
|
104 TRAPD( errf, FeatureManager::InitializeLibL() ); |
|
105 if( errf != KErrNone ) |
|
106 { |
|
107 User::Leave(errf); |
|
108 } |
|
109 |
|
110 if(FeatureManager::FeatureSupported(KFeatureIdSapThemesAdapter)) |
|
111 { |
|
112 RDEBUG("CThemesAdapter::ConstructL(): begin"); |
|
113 iThemes = CThemesList::NewL(); |
|
114 } |
|
115 else |
|
116 { |
|
117 FeatureManager::UnInitializeLib(); |
|
118 User::Leave( KErrNotSupported ); |
|
119 } |
|
120 } |
|
121 |
|
122 // ------------------------------------------------------------------------------------------------ |
|
123 // CThemesAdapter::~CThemesAdapter() |
|
124 // ------------------------------------------------------------------------------------------------ |
|
125 |
|
126 |
|
127 CThemesAdapter::~CThemesAdapter() |
|
128 { |
|
129 RDEBUG("CThemesAdapter::~CThemesAdapter(): begin"); |
|
130 |
|
131 FeatureManager::UnInitializeLib(); |
|
132 delete iThemes; |
|
133 delete iActiveTheme; |
|
134 } |
|
135 |
|
136 // ------------------------------------------------------------------------------------------------ |
|
137 // CThemesAdapter::DDFVersionL() |
|
138 // ------------------------------------------------------------------------------------------------ |
|
139 void CThemesAdapter::DDFVersionL( CBufBase& aDDFVersion ) |
|
140 { |
|
141 RDEBUG("CThemesAdapter::DDFVersionL(): begin"); |
|
142 aDDFVersion.InsertL( 0, KThemesAdapterDDFVersion ); |
|
143 } |
|
144 |
|
145 |
|
146 // ------------------------------------------------------------------------------------------------ |
|
147 // CThemesAdapter::DDFStructureL() |
|
148 // |
|
149 // ------------------------------------------------------------------------------------------------ |
|
150 void CThemesAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) |
|
151 { |
|
152 RDEBUG( "CThemesAdapter::DDFStructureL(): begin" ); |
|
153 |
|
154 TSmlDmAccessTypes accessTypesGet; |
|
155 accessTypesGet.SetGet(); |
|
156 |
|
157 TSmlDmAccessTypes accessTypesAddGet; |
|
158 accessTypesAddGet.SetAdd(); |
|
159 accessTypesAddGet.SetGet(); |
|
160 |
|
161 TSmlDmAccessTypes accessTypesGetReplace; |
|
162 accessTypesGetReplace.SetGet(); |
|
163 accessTypesGetReplace.SetReplace(); |
|
164 |
|
165 TSmlDmAccessTypes accessTypesDeleteGetReplace; |
|
166 accessTypesDeleteGetReplace.SetDelete(); |
|
167 accessTypesDeleteGetReplace.SetGet(); |
|
168 accessTypesDeleteGetReplace.SetReplace(); |
|
169 //sf- For testing: |
|
170 accessTypesDeleteGetReplace.SetAdd(); |
|
171 //sf- For testing ends. |
|
172 |
|
173 TSmlDmAccessTypes accessTypesReplace; |
|
174 accessTypesReplace.SetReplace(); |
|
175 |
|
176 /* |
|
177 Node: ./Customization |
|
178 This interior node is the common parent to all customization.. |
|
179 Status: Required |
|
180 Occurs: One |
|
181 Format: Node |
|
182 Access Types: Get |
|
183 Values: N/A |
|
184 */ |
|
185 // Customization |
|
186 MSmlDmDDFObject& customization = aDDF.AddChildObjectL( KThemesAdapterCustomization ); |
|
187 FillNodeInfoL(customization, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
188 MSmlDmDDFObject::ENode, KThemesAdapterCustomizationD, ETrue ); |
|
189 |
|
190 /* |
|
191 Node: ./Customization/Themes |
|
192 |
|
193 Status: Required |
|
194 Occurs: One |
|
195 Format: Node |
|
196 Access Types: Get |
|
197 Values: N/A |
|
198 */ |
|
199 MSmlDmDDFObject& themes = customization.AddChildObjectL( KThemesAdapterThemes ); |
|
200 FillNodeInfoL( themes, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
201 MSmlDmDDFObject::ENode, KThemesAdapterThemesD, ETrue ); |
|
202 |
|
203 /* |
|
204 Node: ./Customization/Themes/AvailableThemes |
|
205 |
|
206 Status: Required |
|
207 Occurs: One |
|
208 Format: Node |
|
209 Access Types: Add, Get |
|
210 Values: N/A |
|
211 */ |
|
212 MSmlDmDDFObject& availableThemes = themes.AddChildObjectL( KThemesAdapterAvailableThemes); |
|
213 FillNodeInfoL( availableThemes, accessTypesAddGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
214 MSmlDmDDFObject::ENode, KThemesAdapterAvailableThemesD, ETrue ); |
|
215 |
|
216 /* |
|
217 Node: ./Customization/Themes/AvailableThemes/<X> |
|
218 |
|
219 Status: Required |
|
220 Occurs: Zero or more |
|
221 Format: Node |
|
222 Access Types: Delete, Get, Replace |
|
223 Values: N/A |
|
224 */ |
|
225 MSmlDmDDFObject& oneCurTheme = availableThemes.AddChildObjectGroupL(); |
|
226 FillNodeInfoL( oneCurTheme, accessTypesDeleteGetReplace, MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, |
|
227 MSmlDmDDFObject::ENode, KThemesAdapterDynamicNodeD, ETrue ); |
|
228 |
|
229 /* |
|
230 Node: ./Customization/Themes/AvailableThemes/<X>/ID |
|
231 |
|
232 Status: Required |
|
233 Occurs: One |
|
234 Format: Chr |
|
235 Access Types: Get |
|
236 Values: N/A |
|
237 */ |
|
238 MSmlDmDDFObject& id = oneCurTheme.AddChildObjectL( KThemesAdapterXId ); |
|
239 FillNodeInfoL( id, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
240 MSmlDmDDFObject::EChr, KThemesAdapterXIdD, ETrue ); |
|
241 |
|
242 /* |
|
243 Node: ./Customization/Themes/AvailableThemes/<X>/Name |
|
244 |
|
245 Status: Optional |
|
246 Occurs: One |
|
247 Format: Chr |
|
248 Access Types: Get, Replace |
|
249 Values: N/A |
|
250 */ |
|
251 MSmlDmDDFObject& name = oneCurTheme.AddChildObjectL( KThemesAdapterXName ); |
|
252 FillNodeInfoL( name, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, |
|
253 MSmlDmDDFObject::EChr, KThemesAdapterXNameD, ETrue ); |
|
254 |
|
255 /* |
|
256 Node: ./Customization/Themes/AvailableThemes/<X>/Version |
|
257 |
|
258 Status: Optional |
|
259 Occurs: One |
|
260 Format: Chr |
|
261 Access Types: Get, Replace |
|
262 Values: N/A |
|
263 */ |
|
264 MSmlDmDDFObject& version = oneCurTheme.AddChildObjectL( KThemesAdapterXVersion ); |
|
265 FillNodeInfoL( version, accessTypesGetReplace, MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EPermanent, |
|
266 MSmlDmDDFObject::EChr, KThemesAdapterXVersionD, ETrue ); |
|
267 |
|
268 /* |
|
269 Node: ./Customization/Themes/AvailableThemes/<X>/Data |
|
270 |
|
271 Status: Required |
|
272 Occurs: One |
|
273 Format: Chr |
|
274 Access Types: Get |
|
275 Values: N/A |
|
276 */ |
|
277 MSmlDmDDFObject& data = oneCurTheme.AddChildObjectL( KThemesAdapterXData ); |
|
278 FillNodeInfoL( data, accessTypesReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
279 MSmlDmDDFObject::EBin, KThemesAdapterXDataD, ETrue ); |
|
280 |
|
281 |
|
282 /* |
|
283 Node: ./Customization/Themes/AvailableThemes/<X>/InstallOptions |
|
284 |
|
285 Status: ? |
|
286 Occurs: One |
|
287 Format: Chr |
|
288 Access Types: Get |
|
289 Values: N/A |
|
290 */ |
|
291 MSmlDmDDFObject& installOptions = oneCurTheme.AddChildObjectL( KThemesAdapterXInstallOptions ); |
|
292 FillNodeInfoL( installOptions, accessTypesReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
293 MSmlDmDDFObject::EXml, KThemesAdapterXInstallOptionsD, ETrue ); |
|
294 |
|
295 |
|
296 /* |
|
297 Node: ./Customization/Themes/ActiveTheme |
|
298 |
|
299 Status: Required |
|
300 Occurs: One |
|
301 Format: Chr |
|
302 Access Types: Get, Replace |
|
303 Values: N/A |
|
304 */ |
|
305 MSmlDmDDFObject& activeTheme = themes.AddChildObjectL( KThemesAdapterActiveTheme ); |
|
306 FillNodeInfoL( activeTheme, accessTypesGetReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
307 MSmlDmDDFObject::EChr, KThemesAdapterActiveThemeD, ETrue ); |
|
308 |
|
309 } |
|
310 |
|
311 // ------------------------------------------------------------------------------------------------ |
|
312 // CThemesAdapter::UpdateLeafObjectL() |
|
313 // |
|
314 // ------------------------------------------------------------------------------------------------ |
|
315 void CThemesAdapter::_UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TDesC8& aObject, const TDesC8& /*aType*/, const TInt aStatusRef ) |
|
316 { |
|
317 RDEBUG( "CThemesAdapter::UpdateLeafObjectL(): begin" ); |
|
318 |
|
319 TError ret = EOk ; |
|
320 |
|
321 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
322 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
323 TNodeId nodeId = NodeId( uriPtrc ); |
|
324 #else |
|
325 TNodeId nodeId = NodeId( aURI ); |
|
326 #endif |
|
327 |
|
328 switch( nodeId ) |
|
329 { |
|
330 case ENodeXName: |
|
331 if (aObject.Length() > 0) |
|
332 { |
|
333 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
334 iCallBack->SetMappingL( uriPtrc, aObject ); |
|
335 #else |
|
336 iCallBack->SetMappingL( aURI, aObject ); |
|
337 #endif |
|
338 } |
|
339 else |
|
340 { |
|
341 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
342 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
343 #else |
|
344 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
345 #endif |
|
346 } |
|
347 break; |
|
348 |
|
349 case ENodeXVersion: |
|
350 if (aObject.Length() > 0) |
|
351 { |
|
352 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
353 iCallBack->SetMappingL( uriPtrc, aObject ); |
|
354 #else |
|
355 iCallBack->SetMappingL( aURI, aObject ); |
|
356 #endif |
|
357 } |
|
358 else |
|
359 { |
|
360 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
361 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
362 #else |
|
363 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
364 #endif |
|
365 } |
|
366 break; |
|
367 |
|
368 case ENodeXData: |
|
369 { |
|
370 RFs fs; |
|
371 User::LeaveIfError( fs.Connect() ); |
|
372 CleanupClosePushL( fs ); |
|
373 |
|
374 TFileCoderB64 decoder; |
|
375 TPtrC fileName( KThemesAdapterTmpInstallPath ); |
|
376 |
|
377 TBool isEncoded = TFileCoderB64::CheckB64Encode( aObject ); |
|
378 if( isEncoded ) |
|
379 { |
|
380 decoder.DecodeToL( aObject, fileName ); |
|
381 } |
|
382 else |
|
383 { |
|
384 // aData is original data, save it to fileName |
|
385 RFile file; |
|
386 User::LeaveIfError( file.Replace( fs, fileName, EFileWrite)); |
|
387 CleanupClosePushL( file ); |
|
388 file.Write( aObject ); |
|
389 |
|
390 CleanupStack::PopAndDestroy(); // file |
|
391 } |
|
392 |
|
393 TBuf8<KMaxUidName+20> sisPkgUid; |
|
394 TBuf8<KAknsPkgIDDesSize> themePkgId; |
|
395 |
|
396 // Install using options if given and otherwise with default options |
|
397 ret = iThemes->InstallThemeL( fileName, sisPkgUid, themePkgId ); |
|
398 |
|
399 // Set LUIDs for theme and theme/id |
|
400 if (ret == KErrNone) |
|
401 { |
|
402 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
403 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
404 #else |
|
405 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
406 #endif |
|
407 HBufC8* dataURI = HBufC8::NewLC( parentURI.Length() + KThemesAdapterXData().Length() + 1 ); |
|
408 HBufC8* idURI = HBufC8::NewLC( parentURI.Length() + KThemesAdapterXId().Length() + 1 ); |
|
409 dataURI->Des().Copy( parentURI ); |
|
410 dataURI->Des().Append( KSlash ); |
|
411 dataURI->Des().Append( KThemesAdapterXData ); |
|
412 idURI->Des().Copy( parentURI ); |
|
413 |
|
414 iCallBack->SetMappingL( *dataURI, sisPkgUid ); |
|
415 iCallBack->SetMappingL( *idURI, themePkgId ); |
|
416 |
|
417 CleanupStack::PopAndDestroy( idURI ); |
|
418 CleanupStack::PopAndDestroy( dataURI ); |
|
419 |
|
420 if( iActiveTheme != NULL ) |
|
421 { |
|
422 TPtrC8 pid = NSmlDmURI::LastURISeg( *iActiveTheme ); |
|
423 HBufC8* themeRef = HBufC8::NewLC( KThemesAdapterActiveThemeRef().Length() + pid.Length() + 1 ); |
|
424 themeRef->Des().Copy( KThemesAdapterActiveThemeRef ); |
|
425 themeRef->Des().Append( pid ); |
|
426 HBufC8* luid = iCallBack->GetLuidAllocL( *themeRef ); |
|
427 CleanupStack::PushL( luid ); |
|
428 |
|
429 if (luid->Length() > 1) |
|
430 { |
|
431 pid.Set( *luid ); |
|
432 ret = iThemes->SetActiveThemeL( pid ); |
|
433 delete iActiveTheme; |
|
434 iActiveTheme = NULL; |
|
435 } |
|
436 |
|
437 CleanupStack::PopAndDestroy( luid ); |
|
438 CleanupStack::PopAndDestroy( themeRef ); |
|
439 |
|
440 } |
|
441 |
|
442 } |
|
443 |
|
444 // Remove temporary installations file |
|
445 fs.Delete( fileName ); |
|
446 CleanupStack::PopAndDestroy( &fs ); |
|
447 } |
|
448 break; |
|
449 |
|
450 case ENodeXInstallOptions: |
|
451 ret = iThemes->SetInstallOptionsL( aObject ); |
|
452 break; |
|
453 |
|
454 case ENodeActiveTheme: |
|
455 { |
|
456 if( iActiveTheme != NULL ) |
|
457 { |
|
458 delete iActiveTheme; |
|
459 iActiveTheme = NULL; |
|
460 } |
|
461 iActiveTheme = aObject.AllocL(); |
|
462 TPtrC8 pid = NSmlDmURI::LastURISeg( aObject ); |
|
463 HBufC8* themeRef = HBufC8::NewLC( KThemesAdapterActiveThemeRef().Length() + pid.Length() + 1 ); |
|
464 themeRef->Des().Copy( KThemesAdapterActiveThemeRef ); |
|
465 themeRef->Des().Append( pid ); |
|
466 HBufC8* luid = iCallBack->GetLuidAllocL( *themeRef ); |
|
467 CleanupStack::PushL( luid ); |
|
468 |
|
469 if (luid->Length() > 1) |
|
470 { |
|
471 pid.Set( *luid ); |
|
472 } |
|
473 ret = iThemes->SetActiveThemeL( pid ); |
|
474 if( ret == MSmlDmAdapter::EOk ) |
|
475 { |
|
476 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
477 iCallBack->SetMappingL( uriPtrc, *themeRef ); |
|
478 #else |
|
479 iCallBack->SetMappingL( aURI, *themeRef ); |
|
480 #endif |
|
481 } |
|
482 else |
|
483 { |
|
484 ret = EError; |
|
485 } |
|
486 |
|
487 delete iActiveTheme; |
|
488 iActiveTheme = NULL; |
|
489 |
|
490 CleanupStack::PopAndDestroy( luid ); |
|
491 CleanupStack::PopAndDestroy( themeRef ); |
|
492 } |
|
493 break; |
|
494 |
|
495 default: |
|
496 ret = EError; |
|
497 break; |
|
498 } |
|
499 |
|
500 iCallBack->SetStatusL( aStatusRef, ret ); |
|
501 } |
|
502 |
|
503 // ------------------------------------------------------------------------------------------------ |
|
504 // |
|
505 // ------------------------------------------------------------------------------------------------ |
|
506 void CThemesAdapter::_UpdateLeafObjectL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
507 { |
|
508 RDEBUG( "CThemesAdapter::UpdateLeafObjectL(...RWriteStream...): begin" ); |
|
509 TError ret = EError ; |
|
510 iCallBack->SetStatusL( aStatusRef, ret ); |
|
511 } |
|
512 |
|
513 // ------------------------------------------------------------------------------------------------ |
|
514 // CThemesAdapter::DeleteObjectL( const TDesC& aURI, const TDesC& aLUID ) |
|
515 // ------------------------------------------------------------------------------------------------ |
|
516 void CThemesAdapter::_DeleteObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TInt aStatusRef) |
|
517 { |
|
518 RDEBUG( "CThemesAdapter::DeleteObjectL(): begin" ); |
|
519 |
|
520 TError ret = EOk ; |
|
521 |
|
522 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
523 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
524 TNodeId nodeId = NodeId( uriPtrc ); |
|
525 #else |
|
526 TNodeId nodeId = NodeId( aURI ); |
|
527 #endif |
|
528 |
|
529 switch( nodeId ) |
|
530 { |
|
531 case ENodeX: |
|
532 { |
|
533 TUint pkgUid = 0; |
|
534 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
535 HBufC8* dataURI = HBufC8::NewLC( uriPtrc.Length() + KThemesAdapterXData().Length() + 1 ); |
|
536 dataURI->Des().Append( uriPtrc ); |
|
537 #else |
|
538 HBufC8* dataURI = HBufC8::NewLC( aURI.Length() + KThemesAdapterXData().Length() + 1 ); |
|
539 dataURI->Des().Append( aURI ); |
|
540 #endif |
|
541 |
|
542 HBufC8* themeId = iCallBack->GetLuidAllocL( *dataURI ); |
|
543 CleanupStack::PushL( themeId ); |
|
544 |
|
545 dataURI->Des().Append( KSlash ); |
|
546 dataURI->Des().Append( KThemesAdapterXData ); |
|
547 HBufC8* luid = iCallBack->GetLuidAllocL( *dataURI ); |
|
548 CleanupStack::PushL( luid ); |
|
549 |
|
550 if (luid->CompareF(KNullDesC8) == 0 ) |
|
551 { |
|
552 ret = ENotFound; |
|
553 CleanupStack::PopAndDestroy( 3 ); //luid, themeId, dataURI |
|
554 break; |
|
555 } |
|
556 |
|
557 TLex8 parser( *luid ); |
|
558 if ((parser.Get() == '[') && |
|
559 (parser.Val( pkgUid, EHex ) == KErrNone) && |
|
560 (parser.Get() == ']')) |
|
561 { |
|
562 //luid for getting index |
|
563 ret = iThemes->DeleteThemeL( *themeId, TUid::Uid( pkgUid ),luid); |
|
564 } |
|
565 else |
|
566 { |
|
567 ret = ENotAllowed; |
|
568 } |
|
569 |
|
570 CleanupStack::PopAndDestroy( 3 ); |
|
571 |
|
572 } |
|
573 break; |
|
574 |
|
575 default: |
|
576 ret = EError; |
|
577 break; |
|
578 } |
|
579 |
|
580 iCallBack->SetStatusL( aStatusRef, ret ); |
|
581 } |
|
582 |
|
583 // ------------------------------------------------------------------------------------------------ |
|
584 // CThemesAdapter::GetLeafObjectL( const TDesC& aURI, const TDesC& aLUID, const TDesC& aType, CBufBase& aObject, TError& aRet ) |
|
585 // ------------------------------------------------------------------------------------------------ |
|
586 void CThemesAdapter::GetLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& /*aType*/, CBufBase& aResult, TError& aRet ) |
|
587 { |
|
588 RDEBUG("CThemesAdapter::GetLeafObjectL(): begin"); |
|
589 aRet = EOk; |
|
590 |
|
591 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
592 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
593 TNodeId nodeId = NodeId( uriPtrc ); |
|
594 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
595 #else |
|
596 TNodeId nodeId = NodeId( aURI ); |
|
597 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
598 #endif |
|
599 |
|
600 TPtrC8 pid = NSmlDmURI::LastURISeg( parentURI ); |
|
601 |
|
602 HBufC8* parentLUID = iCallBack->GetLuidAllocL(parentURI); |
|
603 CleanupStack::PushL(parentLUID); |
|
604 |
|
605 //Check for Active theme; if it is not, then only check for DM installed parent node |
|
606 if (nodeId != ENodeActiveTheme && parentLUID->CompareF(KNullDesC8) == 0) |
|
607 { |
|
608 aRet = ENotFound; |
|
609 } |
|
610 |
|
611 if (aRet == EOk) |
|
612 { |
|
613 HBufC8* trimmedLUID = aLUID.AllocL(); |
|
614 CleanupStack::PushL(trimmedLUID); |
|
615 trimmedLUID->Des().Trim(); |
|
616 |
|
617 switch (nodeId) |
|
618 { |
|
619 case ENodeXId: |
|
620 if (trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
621 { |
|
622 aResult.InsertL(aResult.Size(), aLUID); |
|
623 } |
|
624 else |
|
625 { |
|
626 if (parentLUID->Length() > 1) |
|
627 { |
|
628 pid.Set(*parentLUID); |
|
629 } |
|
630 aRet = iThemes->GetThemeIdL(pid, aResult); |
|
631 } |
|
632 break; |
|
633 |
|
634 case ENodeXName: |
|
635 { |
|
636 |
|
637 if (trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
638 { |
|
639 aResult.InsertL(aResult.Size(), aLUID); |
|
640 } |
|
641 if (parentLUID->Length() > 1) |
|
642 { |
|
643 pid.Set(*parentLUID); |
|
644 aResult.InsertL(aResult.Size(), KOpenBrace); |
|
645 aRet = iThemes->GetThemeNameL(pid, aResult); |
|
646 aResult.InsertL(aResult.Size(), KCloseBrace); |
|
647 } |
|
648 } |
|
649 break; |
|
650 |
|
651 case ENodeXVersion: |
|
652 if (trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
653 { |
|
654 aResult.InsertL(aResult.Size(), aLUID); |
|
655 } |
|
656 else |
|
657 { |
|
658 if (parentLUID->Length() > 1) |
|
659 { |
|
660 pid.Set(*parentLUID); |
|
661 } |
|
662 aRet = iThemes->GetThemeVersionL(pid, aResult); |
|
663 } |
|
664 break; |
|
665 |
|
666 case ENodeActiveTheme: |
|
667 { |
|
668 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
669 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
670 HBufC8* luid = iCallBack->GetLuidAllocL( uriPtrc ); |
|
671 #else |
|
672 HBufC8* luid = iCallBack->GetLuidAllocL(aURI); |
|
673 #endif |
|
674 CleanupStack::PushL(luid); |
|
675 |
|
676 HBufC8* themePID = iCallBack->GetLuidAllocL(aLUID); |
|
677 CleanupStack::PushL(themePID); |
|
678 // Get the current active theme UID |
|
679 TAknsPkgIDBuf buf; |
|
680 CRepository* skinsRepository = CRepository::NewLC( |
|
681 KCRUidPersonalisation); |
|
682 TInt errCode = skinsRepository->Get(KPslnActiveSkinUid, buf); |
|
683 |
|
684 HBufC16* themePID16 = HBufC16::NewLC(themePID->Length()); |
|
685 themePID16->Des().Copy(themePID->Des()); |
|
686 |
|
687 if (themePID16->Compare(buf) == 0) |
|
688 { |
|
689 RDEBUG("CThemesAdapter::GetLeafObjectL(): UIDs MATCH "); |
|
690 aResult.InsertL(aResult.Size(), *luid); |
|
691 aResult.InsertL(aResult.Size(), KOpenBrace); |
|
692 aRet = iThemes->GetThemeNameL(*themePID, aResult); |
|
693 aResult.InsertL(aResult.Size(), KCloseBrace); |
|
694 } |
|
695 else |
|
696 { |
|
697 //means Active theme set by DM server is changed to some other theme |
|
698 //manually from settings |
|
699 RDEBUG( |
|
700 "CThemesAdapter::GetLeafObjectL(): UIDs Doesn't MATCH "); |
|
701 HBufC8* buf8 = HBufC8::NewLC(KAknsPkgIDDesSize); |
|
702 buf8->Des().Copy(buf); |
|
703 aRet = iThemes->GetThemeNameL(*buf8, aResult); |
|
704 CleanupStack::PopAndDestroy(buf8); |
|
705 } |
|
706 CleanupStack::PopAndDestroy(themePID16); |
|
707 CleanupStack::PopAndDestroy(skinsRepository); |
|
708 CleanupStack::PopAndDestroy(themePID); |
|
709 CleanupStack::PopAndDestroy(luid); |
|
710 } |
|
711 break; |
|
712 |
|
713 default: |
|
714 aRet = EError; |
|
715 break; |
|
716 } |
|
717 |
|
718 CleanupStack::PopAndDestroy(trimmedLUID); |
|
719 } |
|
720 CleanupStack::PopAndDestroy( parentLUID ); |
|
721 } |
|
722 |
|
723 // ------------------------------------------------------------------------------------------------ |
|
724 // CThemesAdapter::FetchLeafObjectL( const TDesC& aURI, const TDesC& aLUID, const TDesC& aType, CBufBase& aObject ) |
|
725 // ------------------------------------------------------------------------------------------------ |
|
726 void CThemesAdapter::_FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef ) |
|
727 { |
|
728 RDEBUG("CThemesAdapter::FetchLeafObjectL(): begin"); |
|
729 |
|
730 TError ret = EOk ; |
|
731 |
|
732 CBufBase *result = CBufFlat::NewL( 128 ); |
|
733 CleanupStack::PushL( result ); |
|
734 |
|
735 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
736 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
737 GetLeafObjectL( uriPtrc, aLUID, aType, *result, ret ); |
|
738 #else |
|
739 GetLeafObjectL( aURI, aLUID, aType, *result, ret ); |
|
740 #endif |
|
741 |
|
742 if (ret == EOk) |
|
743 { |
|
744 iCallBack->SetResultsL( aResultsRef, *result, KThemesAdapterTextPlain() ); |
|
745 } |
|
746 |
|
747 iCallBack->SetStatusL( aStatusRef, ret ); |
|
748 |
|
749 CleanupStack::PopAndDestroy( result ); |
|
750 } |
|
751 |
|
752 // ------------------------------------------------------------------------------------------------ |
|
753 // |
|
754 // ------------------------------------------------------------------------------------------------ |
|
755 void CThemesAdapter::_FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ) |
|
756 { |
|
757 RDEBUG("CThemesAdapter::FetchLeafObjectSizeL(): begin"); |
|
758 |
|
759 TError ret = EOk ; |
|
760 |
|
761 CBufBase *result = CBufFlat::NewL( 128 ); |
|
762 CleanupStack::PushL( result ); |
|
763 |
|
764 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
765 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
766 GetLeafObjectL( uriPtrc, aLUID, aType, *result, ret ); |
|
767 #else |
|
768 GetLeafObjectL( aURI, aLUID, aType, *result, ret ); |
|
769 #endif |
|
770 |
|
771 if (ret == EOk) |
|
772 { |
|
773 TBuf8<20> len; |
|
774 len.AppendNum( result->Size() ); |
|
775 result->Reset(); |
|
776 result->InsertL( 0, len ); |
|
777 |
|
778 iCallBack->SetResultsL( aResultsRef, *result, KThemesAdapterTextPlain() ); |
|
779 } |
|
780 |
|
781 iCallBack->SetStatusL( aStatusRef, ret ); |
|
782 |
|
783 CleanupStack::PopAndDestroy( result ); |
|
784 } |
|
785 |
|
786 // ------------------------------------------------------------------------------------------------ |
|
787 // CThemesAdapter::ChildURIListL( const TDesC& aURI, const TDesC& aParentLUID, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, CArrayFix<TPtrC>& aCurrentURISegmentList ) |
|
788 // ------------------------------------------------------------------------------------------------ |
|
789 void CThemesAdapter::_ChildURIListL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, const TInt aResultsRef, const TInt aStatusRef ) |
|
790 { |
|
791 RDEBUG("CThemesAdapter::ChildURIListL(): begin"); |
|
792 |
|
793 TError ret = EOk ; |
|
794 |
|
795 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
796 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
797 TNodeId nodeId = NodeId( uriPtrc ); |
|
798 #else |
|
799 TNodeId nodeId = NodeId( aURI ); |
|
800 #endif |
|
801 |
|
802 CBufBase *currentList = CBufFlat::NewL( 128 ); |
|
803 CleanupStack::PushL( currentList ); |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 switch (nodeId) |
|
809 { |
|
810 case ENodeCustomization: |
|
811 currentList->InsertL(currentList->Size(), KThemesAdapterThemes); |
|
812 break; |
|
813 |
|
814 case ENodeThemes: |
|
815 currentList->InsertL(currentList->Size(), |
|
816 KThemesAdapterAvailableThemes); |
|
817 currentList->InsertL(currentList->Size(), KSlash); |
|
818 currentList->InsertL(currentList->Size(), |
|
819 KThemesAdapterActiveTheme); |
|
820 break; |
|
821 |
|
822 case ENodeAvailableThemes: |
|
823 { |
|
824 CDesC8ArrayFlat* newThemes = new (ELeave) CDesC8ArrayFlat(16); |
|
825 CleanupStack::PushL(newThemes); |
|
826 |
|
827 CDesC8ArrayFlat* themes = new (ELeave) CDesC8ArrayFlat(32); |
|
828 CleanupStack::PushL(themes); |
|
829 |
|
830 iThemes->GetInstalledPIDListL(aPreviousURISegmentList, *themes, |
|
831 *newThemes); |
|
832 |
|
833 SyncWithAvkonSkinDB(*themes); |
|
834 //get actual theme names and send to DM server |
|
835 TInt i = 0; |
|
836 TPtrC8 pid; |
|
837 for (i = 0; i < themes->Count(); i++) |
|
838 { |
|
839 |
|
840 HBufC8* themeRef = HBufC8::NewLC( |
|
841 KThemesAdapterActiveThemeRef().Length() |
|
842 + (*themes)[i].Length() + 1); |
|
843 themeRef->Des().Copy(KThemesAdapterActiveThemeRef); |
|
844 themeRef->Des().Append((*themes)[i]); |
|
845 HBufC8* luid = iCallBack->GetLuidAllocL(*themeRef); |
|
846 CleanupStack::PushL(luid); |
|
847 |
|
848 if (luid->Length() > 1) |
|
849 { |
|
850 if (currentList->Size() > 0) |
|
851 { |
|
852 currentList->InsertL(currentList->Size(), KSlash); |
|
853 } |
|
854 pid.Set(*luid); |
|
855 currentList->InsertL(currentList->Size(), (*themes)[i]); |
|
856 currentList->InsertL(currentList->Size(), KOpenBrace); |
|
857 TInt ret = iThemes->GetThemeNameL(pid, *currentList); |
|
858 currentList->InsertL(currentList->Size(), KCloseBrace); |
|
859 } |
|
860 CleanupStack::PopAndDestroy(luid); |
|
861 CleanupStack::PopAndDestroy(themeRef); |
|
862 } |
|
863 for (i = 0; i < newThemes->Count(); i++) |
|
864 { |
|
865 if (currentList->Size() > 0) |
|
866 { |
|
867 currentList->InsertL(currentList->Size(), KSlash); |
|
868 } |
|
869 pid.Set((*newThemes)[i]); |
|
870 TInt ret = iThemes->GetThemeNameL(pid, *currentList); |
|
871 } |
|
872 |
|
873 CleanupStack::PopAndDestroy(themes); |
|
874 CleanupStack::PopAndDestroy(newThemes); |
|
875 } |
|
876 break; |
|
877 |
|
878 case ENodeX: |
|
879 { |
|
880 //Determine whether the node is DM installed node |
|
881 HBufC8* lUID = iCallBack->GetLuidAllocL(aURI); |
|
882 |
|
883 if (lUID->CompareF(KNullDesC8) == 0) |
|
884 { |
|
885 ret = ENotFound; |
|
886 } |
|
887 |
|
888 delete lUID; |
|
889 |
|
890 if (ret == EOk) |
|
891 { |
|
892 currentList->InsertL(currentList->Size(), KThemesAdapterXId); |
|
893 currentList->InsertL(currentList->Size(), KSlash); |
|
894 currentList->InsertL(currentList->Size(), KThemesAdapterXName); |
|
895 currentList->InsertL(currentList->Size(), KSlash); |
|
896 currentList->InsertL(currentList->Size(), |
|
897 KThemesAdapterXVersion); |
|
898 currentList->InsertL(currentList->Size(), KSlash); |
|
899 currentList->InsertL(currentList->Size(), KThemesAdapterXData); |
|
900 currentList->InsertL(currentList->Size(), KSlash); |
|
901 currentList->InsertL(currentList->Size(), |
|
902 KThemesAdapterXInstallOptions); |
|
903 } |
|
904 |
|
905 break; |
|
906 } |
|
907 |
|
908 case ENodeXId: |
|
909 // No children, leave list empty |
|
910 break; |
|
911 |
|
912 case ENodeXName: |
|
913 // No children, leave list empty |
|
914 break; |
|
915 |
|
916 case ENodeXVersion: |
|
917 // No children, leave list empty |
|
918 break; |
|
919 |
|
920 case ENodeXData: |
|
921 // No children, leave list empty |
|
922 break; |
|
923 |
|
924 case ENodeXInstallOptions: |
|
925 // No children, leave list empty |
|
926 break; |
|
927 |
|
928 case ENodeActiveTheme: |
|
929 // No children, leave list empty |
|
930 break; |
|
931 |
|
932 case ENodeUnknown: |
|
933 ret = ENotFound; |
|
934 break; |
|
935 |
|
936 default: |
|
937 break; |
|
938 } |
|
939 if( ret == EOk ) |
|
940 { |
|
941 iCallBack->SetResultsL( aResultsRef, *currentList, KNullDesC8 ); |
|
942 } |
|
943 |
|
944 iCallBack->SetStatusL(aStatusRef, ret); |
|
945 |
|
946 CleanupStack::PopAndDestroy(currentList); //currentList |
|
947 } |
|
948 |
|
949 |
|
950 // ------------------------------------------------------------------------------------------------ |
|
951 // CThemesAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID ) |
|
952 // ------------------------------------------------------------------------------------------------ |
|
953 void CThemesAdapter::_AddNodeObjectL( const TDesC8& aURI, const TDesC8& /*aParentLUID*/, const TInt aStatusRef ) |
|
954 { |
|
955 RDEBUG("CThemesAdapter::AddNodeObjectL(): begin"); |
|
956 |
|
957 TError ret = EOk ; |
|
958 |
|
959 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
960 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
961 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
962 #else |
|
963 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
964 #endif |
|
965 |
|
966 TNodeId parentNodeId = NodeId( parentURI ); |
|
967 |
|
968 |
|
969 HBufC8* parentLUID = iCallBack->GetLuidAllocL( parentURI ); |
|
970 CleanupStack::PushL( parentLUID ); |
|
971 |
|
972 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
973 HBufC8* trimmedLUID = iCallBack->GetLuidAllocL( uriPtrc ); |
|
974 #else |
|
975 HBufC8* trimmedLUID = iCallBack->GetLuidAllocL( aURI ); |
|
976 #endif |
|
977 |
|
978 CleanupStack::PushL( trimmedLUID ); |
|
979 trimmedLUID->Des().Trim(); |
|
980 |
|
981 switch( parentNodeId ) |
|
982 { |
|
983 case ENodeAvailableThemes: |
|
984 // Set LUID mapping to make this new node permanent |
|
985 if ( trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
986 { |
|
987 ret = EAlreadyExists; |
|
988 } |
|
989 else |
|
990 { |
|
991 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
992 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
993 #else |
|
994 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
995 #endif |
|
996 } |
|
997 break; |
|
998 |
|
999 default: |
|
1000 ret = EError; |
|
1001 break; |
|
1002 } |
|
1003 |
|
1004 // Cleanup |
|
1005 CleanupStack::Pop( trimmedLUID ); |
|
1006 CleanupStack::Pop( parentLUID ); |
|
1007 |
|
1008 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1009 } |
|
1010 |
|
1011 |
|
1012 // ------------------------------------------------------------------------------------------------ |
|
1013 // |
|
1014 // ------------------------------------------------------------------------------------------------ |
|
1015 void CThemesAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1016 { |
|
1017 RDEBUG("CThemesAdapter::ExecuteCommandL(): begin"); |
|
1018 //Not supported |
|
1019 TError ret = EError; |
|
1020 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1021 } |
|
1022 |
|
1023 // ------------------------------------------------------------------------------------------------ |
|
1024 // |
|
1025 // ------------------------------------------------------------------------------------------------ |
|
1026 void CThemesAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1027 { |
|
1028 RDEBUG("CThemesAdapter::ExecuteCommandL(...RWriteStream...): begin"); |
|
1029 //Not supported |
|
1030 TError ret = EError; |
|
1031 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1032 } |
|
1033 |
|
1034 // ------------------------------------------------------------------------------------------------ |
|
1035 // |
|
1036 // ------------------------------------------------------------------------------------------------ |
|
1037 void CThemesAdapter::_CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1038 { |
|
1039 RDEBUG("CThemesAdapter::CopyCommandL(): begin"); |
|
1040 //Not supported |
|
1041 TError ret = EError; |
|
1042 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1043 } |
|
1044 |
|
1045 // ------------------------------------------------------------------------------------------------ |
|
1046 // |
|
1047 // ------------------------------------------------------------------------------------------------ |
|
1048 void CThemesAdapter::StartAtomicL() |
|
1049 { |
|
1050 RDEBUG("CThemesAdapter::StartAtomicL(): begin"); |
|
1051 //Not supported |
|
1052 } |
|
1053 |
|
1054 // ------------------------------------------------------------------------------------------------ |
|
1055 // |
|
1056 // ------------------------------------------------------------------------------------------------ |
|
1057 void CThemesAdapter::CommitAtomicL() |
|
1058 { |
|
1059 RDEBUG("CThemesAdapter::CommitAtomicL(): begin"); |
|
1060 //Not supported |
|
1061 } |
|
1062 |
|
1063 // ------------------------------------------------------------------------------------------------ |
|
1064 // |
|
1065 // ------------------------------------------------------------------------------------------------ |
|
1066 void CThemesAdapter::RollbackAtomicL() |
|
1067 { |
|
1068 RDEBUG("CThemesAdapter::RollbackAtomicL(): begin"); |
|
1069 //Not supported |
|
1070 } |
|
1071 |
|
1072 // ------------------------------------------------------------------------------------------------ |
|
1073 // |
|
1074 // ------------------------------------------------------------------------------------------------ |
|
1075 TBool CThemesAdapter::StreamingSupport( TInt& /*aItemSize*/ ) |
|
1076 { |
|
1077 RDEBUG("CThemesAdapter::StreamingSupport(): begin"); |
|
1078 return EFalse; |
|
1079 } |
|
1080 |
|
1081 // ------------------------------------------------------------------------------------------------ |
|
1082 // |
|
1083 // ------------------------------------------------------------------------------------------------ |
|
1084 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1085 void CThemesAdapter::StreamCommittedL( RWriteStream& /*aStream*/ ) |
|
1086 #else |
|
1087 void CThemesAdapter::StreamCommittedL() |
|
1088 #endif |
|
1089 { |
|
1090 RDEBUG("CThemesAdapter::StreamCommittedL(): begin"); |
|
1091 RDEBUG("CThemesAdapter::StreamCommittedL(): end"); |
|
1092 } |
|
1093 |
|
1094 // ------------------------------------------------------------------------------------------------ |
|
1095 // |
|
1096 // ------------------------------------------------------------------------------------------------ |
|
1097 void CThemesAdapter::CompleteOutstandingCmdsL() |
|
1098 { |
|
1099 RDEBUG("CThemesAdapter::CompleteOutstandingCmdsL(): begin"); |
|
1100 } |
|
1101 |
|
1102 // ----------------------------------------------------------------------------- |
|
1103 // |
|
1104 // ----------------------------------------------------------------------------- |
|
1105 // |
|
1106 //#ifdef __SAP_POLICY_MANAGEMENT |
|
1107 TPtrC8 CThemesAdapter::PolicyRequestResourceL( const TDesC8& /*aURI*/ ) |
|
1108 { |
|
1109 if(!FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement )) |
|
1110 { |
|
1111 User::Leave(KErrNotSupported); |
|
1112 } |
|
1113 RDEBUG("CThemesAdapter::PolicyRequestResourceL(): begin"); |
|
1114 return PolicyEngineXACML::KCustomizationManagement(); |
|
1115 } |
|
1116 //#endif |
|
1117 // ------------------------------------------------------------------------------------------------ |
|
1118 // |
|
1119 // ------------------------------------------------------------------------------------------------ |
|
1120 CThemesAdapter::TNodeId CThemesAdapter::NodeId( const TDesC8& aURI ) |
|
1121 { |
|
1122 TNodeId id = ENodeUnknown; |
|
1123 |
|
1124 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1125 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
1126 TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) ); |
|
1127 TPtrC8 app( NSmlDmURI::LastURISeg( uriPtrc ) ); |
|
1128 #else |
|
1129 TInt cnt( NSmlDmURI::NumOfURISegs( aURI ) ); |
|
1130 TPtrC8 app( NSmlDmURI::LastURISeg( aURI ) ); |
|
1131 #endif |
|
1132 |
|
1133 if ( cnt == 1 ) |
|
1134 { |
|
1135 // /Customization (G) |
|
1136 if (app == KThemesAdapterCustomization) |
|
1137 { |
|
1138 id = ENodeCustomization; |
|
1139 } |
|
1140 } |
|
1141 else if ( cnt == 2 ) |
|
1142 { |
|
1143 // /Customization/Themes (G) |
|
1144 if (app == KThemesAdapterThemes) |
|
1145 { |
|
1146 id = ENodeThemes; |
|
1147 } |
|
1148 } |
|
1149 else if ( cnt == 3 ) |
|
1150 { |
|
1151 // /Customization/Themes/AvailableThemes (AG) |
|
1152 // /Customization/Themes/ActiveTheme (GR) |
|
1153 if (app == KThemesAdapterAvailableThemes) |
|
1154 { |
|
1155 id = ENodeAvailableThemes; |
|
1156 } |
|
1157 else if (app == KThemesAdapterActiveTheme) |
|
1158 { |
|
1159 id = ENodeActiveTheme; |
|
1160 } |
|
1161 } |
|
1162 else if (cnt == 4) |
|
1163 { |
|
1164 // /Customization/Themes/CurrentThemes/<X> (DGR) |
|
1165 id = ENodeX; |
|
1166 } |
|
1167 else if (cnt == 5) |
|
1168 { |
|
1169 // /Customization/Themes/CurrentThemes/<X>/ID (G) |
|
1170 // /Customization/Themes/CurrentThemes/<X>/Name (GR) |
|
1171 // /Customization/Themes/CurrentThemes/<X>/Version (GR) |
|
1172 // /Customization/Themes/CurrentThemes/<X>/Data (R) |
|
1173 // /Customization/Themes/CurrentThemes/<X>/InstallOptions (R) |
|
1174 if (app == KThemesAdapterXId) |
|
1175 { |
|
1176 id = ENodeXId; |
|
1177 } |
|
1178 else if (app == KThemesAdapterXName) |
|
1179 { |
|
1180 id = ENodeXName; |
|
1181 } |
|
1182 else if (app == KThemesAdapterXVersion) |
|
1183 { |
|
1184 id = ENodeXVersion; |
|
1185 } |
|
1186 else if (app == KThemesAdapterXData) |
|
1187 { |
|
1188 id = ENodeXData; |
|
1189 } |
|
1190 else if (app == KThemesAdapterXInstallOptions) |
|
1191 { |
|
1192 id = ENodeXInstallOptions; |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 return id; |
|
1197 } |
|
1198 |
|
1199 // ------------------------------------------------------------------------------------------------ |
|
1200 // |
|
1201 // ------------------------------------------------------------------------------------------------ |
|
1202 const TImplementationProxy ImplementationTable[] = |
|
1203 { |
|
1204 { {KThemesAdapterImplUid}, (TProxyNewLPtr)CThemesAdapter::NewL } |
|
1205 }; |
|
1206 |
|
1207 // ------------------------------------------------------------------------------------------------ |
|
1208 // |
|
1209 // ------------------------------------------------------------------------------------------------ |
|
1210 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
1211 { |
|
1212 aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); |
|
1213 return ImplementationTable; |
|
1214 } |
|
1215 |
|
1216 // ------------------------------------------------------------------------------------- |
|
1217 // CThemesAdapter::FillNodeInfoL() |
|
1218 // Fills the node info in ddf structure |
|
1219 // ------------------------------------------------------------------------------------- |
|
1220 void CThemesAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, |
|
1221 MSmlDmDDFObject::TOccurence aOccurrence, MSmlDmDDFObject::TScope aScope, |
|
1222 MSmlDmDDFObject::TDFFormat aFormat,const TDesC8& aDescription,TBool /*aObjectGroup*/) |
|
1223 { |
|
1224 aNode.SetAccessTypesL(aAccTypes); |
|
1225 aNode.SetOccurenceL(aOccurrence); |
|
1226 aNode.SetScopeL(aScope); |
|
1227 aNode.SetDFFormatL(aFormat); |
|
1228 if(aFormat!=MSmlDmDDFObject::ENode) |
|
1229 { |
|
1230 aNode.AddDFTypeMimeTypeL(KThemesAdapterTextPlain); |
|
1231 } |
|
1232 aNode.SetDescriptionL(aDescription); |
|
1233 } |
|
1234 |
|
1235 // ------------------------------------------------------------------------------------- |
|
1236 // CThemesAdapter::IsImage() |
|
1237 // Checks whether the given mime type is image format (that we support) |
|
1238 // ------------------------------------------------------------------------------------- |
|
1239 TBool CThemesAdapter::IsImage(const TDesC& aMime) |
|
1240 { |
|
1241 |
|
1242 if (aMime == _L("image/jpeg") || aMime == _L("image/gif")) |
|
1243 { |
|
1244 return ETrue; |
|
1245 } |
|
1246 return ETrue ; |
|
1247 //return EFalse; |
|
1248 } |
|
1249 void CThemesAdapter::SyncWithAvkonSkinDB(CDesC8ArrayFlat& themes) |
|
1250 { |
|
1251 TInt i = 0; |
|
1252 TPtrC8 pid; |
|
1253 for (i=0; i<themes.Count(); i++) |
|
1254 { |
|
1255 HBufC8* themeRef = HBufC8::NewLC(KThemesAdapterActiveThemeRef().Length() + themes[i].Length() + 1); |
|
1256 themeRef->Des().Copy(KThemesAdapterActiveThemeRef); |
|
1257 themeRef->Des().Append(themes[i]); |
|
1258 HBufC8* luid = iCallBack->GetLuidAllocL( *themeRef); |
|
1259 CleanupStack::PushL(luid); |
|
1260 |
|
1261 if (luid->Length() > 1) |
|
1262 { |
|
1263 pid.Set( *luid); |
|
1264 } |
|
1265 CBufBase *themeName = CBufFlat::NewL( 128); |
|
1266 CleanupStack::PushL(themeName); |
|
1267 TInt ret = iThemes->GetThemeNameL(pid, *themeName); |
|
1268 if (themeName->Size()== 0) |
|
1269 { |
|
1270 iCallBack->SetMappingL( *themeRef, KNullDesC8); |
|
1271 } |
|
1272 CleanupStack::PopAndDestroy(themeName); |
|
1273 CleanupStack::PopAndDestroy(luid); |
|
1274 CleanupStack::PopAndDestroy(themeRef); |
|
1275 } |
|
1276 } |