|
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 Screensaver Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* |
|
20 |
|
21 ./Customization -+--> ScreenSaver --+--> AvailableScreenSavers --> <X> * ---+---> Data |
|
22 | | |
|
23 |--> ActiveSc |---> ID |
|
24 | |
|
25 |---> Name |
|
26 | |
|
27 |---> Description |
|
28 | |
|
29 |---> CustomProperty |
|
30 | |
|
31 |---> Version |
|
32 | |
|
33 |---> InstallOptions |
|
34 |
|
35 */ |
|
36 |
|
37 |
|
38 |
|
39 #include <badesca.h> |
|
40 #include <implementationproxy.h> // For TImplementationProxy definition |
|
41 #include <sisregistrysession.h> |
|
42 #include <ScreensaverpluginIntDef.h> |
|
43 #include <mmfcontrollerpluginresolver.h> // For CleanupResetAndDestroyPushL |
|
44 |
|
45 //#ifdef __SAP_POLICY_MANAGEMENT |
|
46 #include <PolicyEngineXACML.h> |
|
47 //#endif |
|
48 |
|
49 #include "ScreenSaverAdapter.h" |
|
50 #include "ScreenSaverList.h" |
|
51 #include "nsmldmuri.h" |
|
52 #include "FileCoderB64.h" |
|
53 #include "debug.h" |
|
54 |
|
55 #include "ScreenSaverClient.h" |
|
56 #include "e32property.h" |
|
57 #include <ScreensaverInternalPSKeys.h> |
|
58 #include <featmgr.h> |
|
59 |
|
60 |
|
61 _LIT( KScreenSaverAdapterTmpInstallPath, "c:\\system\\temp\\DM_ScrSav.sisx" ); |
|
62 const TInt KPostInstallTimeOut = 10000000; // 10 seconds |
|
63 _LIT8( KScreenSaverActiveRef, "Customization/ScreenSavers/AvailableScreenSavers/" ); |
|
64 |
|
65 // ------------------------------------------------------------------------------------------------ |
|
66 // CScreenSaverAdapter* CScreenSaverAdapter::NewL( ) |
|
67 // ------------------------------------------------------------------------------------------------ |
|
68 CScreenSaverAdapter* CScreenSaverAdapter::NewL(MSmlDmCallback* aDmCallback ) |
|
69 { |
|
70 CScreenSaverAdapter* self = NewLC( aDmCallback ); |
|
71 CleanupStack::Pop(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // ------------------------------------------------------------------------------------------------ |
|
76 // CScreenSaverAdapter* CScreenSaverAdapter::NewLC( ) |
|
77 // ------------------------------------------------------------------------------------------------ |
|
78 CScreenSaverAdapter* CScreenSaverAdapter::NewLC(MSmlDmCallback* aDmCallback ) |
|
79 { |
|
80 CScreenSaverAdapter* self = new (ELeave) CScreenSaverAdapter( aDmCallback ); |
|
81 CleanupStack::PushL( self ); |
|
82 self->ConstructL(); |
|
83 return self; |
|
84 } |
|
85 |
|
86 |
|
87 // ------------------------------------------------------------------------------------------------ |
|
88 // CScreenSaverAdapter::CScreenSaverAdapter() |
|
89 // ------------------------------------------------------------------------------------------------ |
|
90 |
|
91 CScreenSaverAdapter::CScreenSaverAdapter( MSmlDmCallback* aDmCallback ) //: CSmlDmAdapter() |
|
92 : CTARMDmAdapter( aDmCallback ) |
|
93 , iCallBack( aDmCallback ) |
|
94 , iScreenSavers( 0 ) |
|
95 { |
|
96 } |
|
97 |
|
98 // ------------------------------------------------------------------------------------------------ |
|
99 // CScreenSaverAdapter::ConstructL() |
|
100 // ------------------------------------------------------------------------------------------------ |
|
101 void CScreenSaverAdapter::ConstructL( ) |
|
102 { |
|
103 |
|
104 TRAPD( errf, FeatureManager::InitializeLibL() ); |
|
105 if( errf != KErrNone ) |
|
106 { |
|
107 User::Leave(errf); |
|
108 } |
|
109 if(FeatureManager::FeatureSupported(KFeatureIdSapScreensaverAdapter)) |
|
110 { |
|
111 iScreenSavers = CScreenSaverList::NewL(); |
|
112 iScreensaverOff = EFalse; |
|
113 } |
|
114 else |
|
115 { |
|
116 FeatureManager::UnInitializeLib(); |
|
117 User::Leave( KErrNotSupported ); |
|
118 } |
|
119 } |
|
120 |
|
121 // ------------------------------------------------------------------------------------------------ |
|
122 // CScreenSaverAdapter::~CScreenSaverAdapter() |
|
123 // ------------------------------------------------------------------------------------------------ |
|
124 |
|
125 |
|
126 CScreenSaverAdapter::~CScreenSaverAdapter() |
|
127 { |
|
128 TInt error; |
|
129 FeatureManager::UnInitializeLib(); |
|
130 if (iScreensaverOff) |
|
131 { |
|
132 |
|
133 error = RProperty::Define( |
|
134 KPSUidScreenSaver, |
|
135 KScreenSaverAllowScreenSaver, |
|
136 RProperty::EInt, |
|
137 ECapabilityReadUserData, |
|
138 ECapabilityWriteUserData); |
|
139 if(error) |
|
140 RDEBUG_2("CScreenSaverInfo::KPSUidScreenSaver defined error %d",error); |
|
141 |
|
142 error=RProperty::Set(KPSUidScreenSaver,KScreenSaverAllowScreenSaver,KEnableScreensaver); |
|
143 if(error) |
|
144 RDEBUG_2("CScreenSaverInfo::KPSUidScreenSaver while setting error %d",error); |
|
145 } |
|
146 |
|
147 |
|
148 RDEBUG_2("CScreenSaverInfo::KScreenSaverOn set to one error %d",error); |
|
149 delete iScreenSavers; |
|
150 iScreenSavers = 0; |
|
151 } |
|
152 |
|
153 // ------------------------------------------------------------------------------------------------ |
|
154 // CScreenSaverAdapter::DDFVersionL() |
|
155 // ------------------------------------------------------------------------------------------------ |
|
156 void CScreenSaverAdapter::DDFVersionL(CBufBase& aDDFVersion) |
|
157 { |
|
158 aDDFVersion.InsertL(0,KNSmlSCDDFVersion); |
|
159 } |
|
160 |
|
161 |
|
162 // ------------------------------------------------------------------------------------------------ |
|
163 // CScreenSaverAdapter::DDFStructureL() |
|
164 // |
|
165 // ------------------------------------------------------------------------------------------------ |
|
166 void CScreenSaverAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) |
|
167 { |
|
168 |
|
169 |
|
170 TSmlDmAccessTypes accessTypesGet; |
|
171 accessTypesGet.SetGet(); |
|
172 |
|
173 TSmlDmAccessTypes accessTypesAddGet; |
|
174 accessTypesAddGet.SetAdd(); |
|
175 accessTypesAddGet.SetGet(); |
|
176 |
|
177 TSmlDmAccessTypes accessTypesGetReplace; |
|
178 accessTypesGetReplace.SetGet(); |
|
179 accessTypesGetReplace.SetReplace(); |
|
180 |
|
181 TSmlDmAccessTypes accessTypesReplace; |
|
182 accessTypesReplace.SetReplace(); |
|
183 |
|
184 TSmlDmAccessTypes accessTypesGetReplaceDelete; |
|
185 accessTypesGetReplaceDelete.SetGet(); |
|
186 accessTypesGetReplaceDelete.SetReplace(); |
|
187 accessTypesGetReplaceDelete.SetDelete(); |
|
188 //sf- For testing: |
|
189 accessTypesGetReplaceDelete.SetAdd(); |
|
190 //sf- For testing ends. |
|
191 |
|
192 /* |
|
193 Node: ./Customization |
|
194 This interior node is the common parent to all customization.. |
|
195 Status: Required |
|
196 Occurs: One |
|
197 Format: Node |
|
198 Access Types: Get |
|
199 Values: N/A |
|
200 */ |
|
201 MSmlDmDDFObject& customization = aDDF.AddChildObjectL(KNSmlCustomizationNodeName); |
|
202 FillNodeInfoL(customization, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
203 MSmlDmDDFObject::ENode, KNSmlSCDescription); |
|
204 |
|
205 /* |
|
206 Node: ./Customization/ScreenSavers |
|
207 ScreenSavers is a common parent node for nodes managing screen savers. . |
|
208 Status: Required |
|
209 Occurs: One |
|
210 Format: Node |
|
211 Access Types: Add,Get |
|
212 Values: N/A |
|
213 */ |
|
214 MSmlDmDDFObject& screenSavers = customization.AddChildObjectL(KNSmlSCScreenSavers); |
|
215 FillNodeInfoL(screenSavers, accessTypesGet, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
216 MSmlDmDDFObject::ENode, KNSmlSCScreenSaversNodeDescription); |
|
217 |
|
218 /* |
|
219 Node: ./Customization/ScreenSavers/AvailableScreenSavers |
|
220 This is parent node for currently existing screen savers.. |
|
221 Status: Required |
|
222 Occurs: One |
|
223 Format: Node |
|
224 Access Types: Add, Get |
|
225 Values: N/A |
|
226 */ |
|
227 MSmlDmDDFObject& availableScreenSavers = screenSavers.AddChildObjectL(KNSmlSCAvailableScreenSaversNodeName); |
|
228 FillNodeInfoL(availableScreenSavers, accessTypesAddGet, MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, |
|
229 MSmlDmDDFObject::ENode, KNSmlSCAvailableScreenSaversNodeDescription); |
|
230 |
|
231 /* |
|
232 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X> |
|
233 This is a placeholder to screen saver ID identifying a screen saver. |
|
234 Status: Required |
|
235 Occurs: ZeroOrMore |
|
236 Format: Node |
|
237 Access Types: Get, Replace, Delete |
|
238 Values: N/A |
|
239 */ |
|
240 MSmlDmDDFObject& dynNode = availableScreenSavers.AddChildObjectGroupL(); |
|
241 FillNodeInfoL(dynNode, accessTypesGetReplaceDelete, MSmlDmDDFObject::EZeroOrMore, MSmlDmDDFObject::EDynamic, |
|
242 MSmlDmDDFObject::ENode, KNSmlSCDynamicDescription); |
|
243 |
|
244 /* |
|
245 Node: ./Customization/ScreenSavers/ActiveSc |
|
246 This node is a link to the currently active screen saver. |
|
247 Status: Required |
|
248 Occurs: One |
|
249 Format: Chr (reference to management tree) |
|
250 Access Types: Get, Replace |
|
251 Values: N/A |
|
252 */ |
|
253 MSmlDmDDFObject& activescNode = screenSavers.AddChildObjectL(KNSmlSCActiveScNodeName); |
|
254 FillNodeInfoL(activescNode,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EPermanent, |
|
255 MSmlDmDDFObject::EChr,KNSmlSCActiveScNodeDescription); |
|
256 |
|
257 /* |
|
258 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/Data |
|
259 Replace command will install a screen saver that's in the data field of the command. |
|
260 Status: Optional |
|
261 Occurs: One |
|
262 Format: bin |
|
263 Access Types: Replace |
|
264 Values: N/A |
|
265 */ |
|
266 MSmlDmDDFObject& data = dynNode.AddChildObjectL(KNSmlSCDataNodeName); |
|
267 FillNodeInfoL(data, accessTypesReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
268 MSmlDmDDFObject::EBin, KNSmlSCDataNodeDescription); |
|
269 data.AddDFTypeMimeTypeL( SwiUI::KSisxMimeType() ); |
|
270 |
|
271 /* |
|
272 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/ID |
|
273 This leaf node holds the ID of the screen saver |
|
274 Status: Required |
|
275 Occurs: One |
|
276 Format: chr |
|
277 Access Types: Get, Replace |
|
278 Values: N/A |
|
279 */ |
|
280 MSmlDmDDFObject& idNode = dynNode.AddChildObjectL(KNSmlSCIDNodeName); |
|
281 FillNodeInfoL(idNode,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EDynamic, |
|
282 MSmlDmDDFObject::EChr,KNSmlSCIDNodeDescription); |
|
283 |
|
284 /* |
|
285 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/Name |
|
286 This leaf node holds the name of the screen saver. |
|
287 Status: Optional |
|
288 Occurs: One |
|
289 Format: chr |
|
290 Access Types: Get, Replace |
|
291 Values: N/A |
|
292 */ |
|
293 MSmlDmDDFObject& nameNode = dynNode.AddChildObjectL(KNSmlSCNameNodeName); |
|
294 FillNodeInfoL(nameNode,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EDynamic, |
|
295 MSmlDmDDFObject::EChr,KNSmlSCNameNodeDescription); |
|
296 |
|
297 /* |
|
298 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/Description |
|
299 This leaf node holds the description of the screen saver. |
|
300 Status: Optional |
|
301 Occurs: One |
|
302 Format: chr |
|
303 Access Types: Get, Replace |
|
304 Values: N/A |
|
305 */ |
|
306 MSmlDmDDFObject& descNode = dynNode.AddChildObjectL(KNSmlSCDescriptionNodeName); |
|
307 FillNodeInfoL(descNode,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EDynamic, |
|
308 MSmlDmDDFObject::EChr,KNSmlSCDescriptionNodeDescription); |
|
309 |
|
310 /* |
|
311 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/CustomProperty |
|
312 This leaf node holds the custom property value of the screen saver. |
|
313 Status: Optional |
|
314 Occurs: One |
|
315 Format: chr |
|
316 Access Types: Get, Replace |
|
317 Values: N/A |
|
318 */ |
|
319 MSmlDmDDFObject& customNode = dynNode.AddChildObjectL(KNSmlSCCustomPropertyNodeName); |
|
320 FillNodeInfoL(customNode,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EDynamic, |
|
321 MSmlDmDDFObject::EChr,KNSmlSCCustomPropertyNodeDescription); |
|
322 |
|
323 /* |
|
324 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/Version |
|
325 This leaf node holds the version of the screen saver. |
|
326 Status: Optional |
|
327 Occurs: One |
|
328 Format: chr |
|
329 Access Types: Get, Replace |
|
330 Values: N/A |
|
331 */ |
|
332 MSmlDmDDFObject& verNode = dynNode.AddChildObjectL(KNSmlSCVersionNodeName); |
|
333 FillNodeInfoL(verNode,accessTypesGetReplace,MSmlDmDDFObject::EOne,MSmlDmDDFObject::EDynamic, |
|
334 MSmlDmDDFObject::EChr,KNSmlSCVersionNodeDescription); |
|
335 |
|
336 /* |
|
337 Node: ./Customization/ScreenSavers/AvailableScreenSavers/<X>/InstallOptions |
|
338 Holds the install options for next install. |
|
339 Status: Optional |
|
340 Occurs: One |
|
341 Format: Chr |
|
342 Access Types: Replace |
|
343 Values: N/A |
|
344 */ |
|
345 MSmlDmDDFObject& installOptionsNode = dynNode.AddChildObjectL(KNSmlSCInstallOptionsNodeName); |
|
346 FillNodeInfoL(installOptionsNode, accessTypesReplace, MSmlDmDDFObject::EOne, MSmlDmDDFObject::EPermanent, |
|
347 MSmlDmDDFObject::EChr, KNSmlSCInstallOptionsNodeDescription); |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 } |
|
353 |
|
354 |
|
355 // ------------------------------------------------------------------------------------------------ |
|
356 // CScreenSaverAdapter::UpdateLeafObjectL() |
|
357 // |
|
358 // ------------------------------------------------------------------------------------------------ |
|
359 void CScreenSaverAdapter::_UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& /*aLUID*/, const TDesC8& aObject, const TDesC8& /*aType*/, const TInt aStatusRef ) |
|
360 { |
|
361 RDEBUG("CScreenSaverAdapter::UpdateLeafObjectL(): begin"); |
|
362 |
|
363 TError ret = EOk ; |
|
364 |
|
365 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
366 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
367 TNodeId nodeId = NodeId( uriPtrc ); |
|
368 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
369 #else |
|
370 TNodeId nodeId = NodeId( aURI ); |
|
371 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
372 #endif |
|
373 |
|
374 TPtrC8 screenSaverId = NSmlDmURI::LastURISeg( parentURI ); |
|
375 HBufC8* parentLUID = iCallBack->GetLuidAllocL( parentURI ); |
|
376 CleanupStack::PushL( parentLUID ); |
|
377 |
|
378 switch( nodeId ) |
|
379 { |
|
380 case ENodeActiveSc: |
|
381 { |
|
382 TPtrC8 activeName = NSmlDmURI::LastURISeg( aObject ); |
|
383 |
|
384 HBufC8* fullName = HBufC8::NewLC( KScreenSaverActiveRef().Length() + activeName.Length() + 1 ); |
|
385 fullName->Des().Copy( KScreenSaverActiveRef ); |
|
386 fullName->Des().Append( activeName ); |
|
387 HBufC8* luid = iCallBack->GetLuidAllocL( *fullName ); |
|
388 CleanupStack::PushL( luid ); |
|
389 |
|
390 ret = iScreenSavers->SetActiveL( *luid ); |
|
391 if( ret == MSmlDmAdapter::EOk ) |
|
392 { |
|
393 iScreensaverOff = ETrue; |
|
394 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
395 iCallBack->SetMappingL( uriPtrc, *fullName ); |
|
396 #else |
|
397 iCallBack->SetMappingL( aURI, *fullName ); |
|
398 #endif |
|
399 } |
|
400 |
|
401 CleanupStack::PopAndDestroy( luid ); |
|
402 CleanupStack::PopAndDestroy( fullName ); |
|
403 break; |
|
404 } |
|
405 case ENodeData: |
|
406 { |
|
407 RFs fs; |
|
408 User::LeaveIfError( fs.Connect() ); |
|
409 CleanupClosePushL( fs ); |
|
410 |
|
411 TFileCoderB64 decoder; |
|
412 TPtrC fileName( KScreenSaverAdapterTmpInstallPath ); |
|
413 TBool isEncoded = TFileCoderB64::CheckB64Encode( aObject ); |
|
414 if( isEncoded ) |
|
415 { |
|
416 decoder.DecodeToL( aObject, fileName ); |
|
417 } |
|
418 else |
|
419 { |
|
420 // aObject is original data, save it to fileName |
|
421 RFile file; |
|
422 User::LeaveIfError( file.Replace( fs, fileName, EFileWrite)); |
|
423 CleanupClosePushL( file ); |
|
424 User::LeaveIfError( file.Write( aObject ) ); |
|
425 |
|
426 CleanupStack::PopAndDestroy(); // file |
|
427 } |
|
428 |
|
429 // Get current status of installed packages and screen savers |
|
430 RArray< TUid > oldPackages; |
|
431 CleanupClosePushL( oldPackages ); |
|
432 |
|
433 RArray< TUid > newPackages; |
|
434 CleanupClosePushL( newPackages ); |
|
435 |
|
436 CDesCArrayFlat* oldScreenSavers = new (ELeave) CDesCArrayFlat( 8 ); |
|
437 CleanupStack::PushL( oldScreenSavers ); |
|
438 |
|
439 CDesCArrayFlat* newScreenSavers = new (ELeave) CDesCArrayFlat( 8 ); |
|
440 CleanupStack::PushL( newScreenSavers ); |
|
441 |
|
442 InstalledPackagesL( oldPackages ); |
|
443 InstalledScreenSaversL( *oldScreenSavers ); |
|
444 |
|
445 |
|
446 |
|
447 User::ResetInactivityTime(); |
|
448 TInt error = RProperty::Define( |
|
449 KPSUidScreenSaver, |
|
450 KScreenSaverAllowScreenSaver, |
|
451 RProperty::EInt, |
|
452 ECapabilityReadUserData, |
|
453 ECapabilityWriteUserData); |
|
454 |
|
455 error=RProperty::Set(KPSUidScreenSaver,KScreenSaverAllowScreenSaver,KDisableScreensaver); |
|
456 iScreensaverOff = ETrue; |
|
457 // Open ECom session and setup notifier |
|
458 REComSession& ecom = REComSession::OpenL(); |
|
459 CleanupClosePushL( ecom ); |
|
460 TRequestStatus ecomStatus; |
|
461 |
|
462 // Install screen saver |
|
463 ret = iScreenSavers->InstallL( fileName ); |
|
464 |
|
465 ecom.NotifyOnChange( ecomStatus ); |
|
466 |
|
467 // Wait until ECom server finds new plugin |
|
468 if (ret == EOk) |
|
469 { |
|
470 TRequestStatus timeoutStatus; |
|
471 RTimer timeout; |
|
472 User::LeaveIfError( timeout.CreateLocal() ); |
|
473 CleanupClosePushL( timeout ); |
|
474 timeout.After( timeoutStatus, KPostInstallTimeOut ); |
|
475 |
|
476 User::WaitForRequest( ecomStatus, timeoutStatus ); |
|
477 |
|
478 if( timeoutStatus.Int() == KRequestPending) |
|
479 { |
|
480 timeout.Cancel(); |
|
481 User::WaitForRequest( timeoutStatus ); |
|
482 } |
|
483 CleanupStack::PopAndDestroy( &timeout ); |
|
484 } |
|
485 |
|
486 // Close ECom session |
|
487 if (ecomStatus.Int() == KRequestPending) |
|
488 { |
|
489 ecom.CancelNotifyOnChange( ecomStatus ); |
|
490 User::WaitForRequest( ecomStatus ); |
|
491 } |
|
492 CleanupStack::PopAndDestroy( &ecom ); |
|
493 |
|
494 // Find out which package and screen savers where installed |
|
495 InstalledPackagesL( newPackages ); |
|
496 InstalledScreenSaversL( *newScreenSavers ); |
|
497 |
|
498 TInt count = 0; |
|
499 TInt i = 0; |
|
500 |
|
501 count = oldPackages.Count(); |
|
502 for (i = 0 ; i < count ; i++) |
|
503 { |
|
504 TInt idx = newPackages.FindInSignedKeyOrder( oldPackages[ i ] ); |
|
505 if (idx >= 0) |
|
506 { |
|
507 newPackages.Remove( idx ); |
|
508 } |
|
509 } |
|
510 |
|
511 count = oldScreenSavers->Count(); |
|
512 for (i = 0 ; i < count ; i++) |
|
513 { |
|
514 TInt idx = 0; |
|
515 TInt err = newScreenSavers->Find( (*oldScreenSavers)[ i ], idx ); |
|
516 if (err == 0) |
|
517 { |
|
518 newScreenSavers->Delete( idx ); |
|
519 } |
|
520 } |
|
521 |
|
522 RDEBUG_3("newPackages.Count() (%d) newScreenSavers->Count() (%d)", newPackages.Count(), newScreenSavers->Count()); |
|
523 |
|
524 // Save package uid to DMTree with LUID mapping |
|
525 // We can handle only situation where only one new package is found. |
|
526 if (newPackages.Count() == 1 && newScreenSavers->Count() > 0) |
|
527 { |
|
528 TUid pkgUid = newPackages[ 0 ]; |
|
529 |
|
530 HBufC8* luid = HBufC8::NewL( KMaxUidName + 1 + (*newScreenSavers)[0].Length() ); |
|
531 CleanupStack::PushL( luid ); |
|
532 TPtr8 luidPtr = luid->Des(); |
|
533 luidPtr.Copy( pkgUid.Name() ); |
|
534 luidPtr.Append( KPkgId_ScrId_Separator ); |
|
535 luidPtr.Append( (*newScreenSavers)[0] ); |
|
536 |
|
537 RDEBUG8_2("CScreenSaverAdapter::UpdateLeafObjectL() Luid for new screensaver (%S)", &luidPtr); |
|
538 iCallBack->SetMappingL( parentURI, *luid ); |
|
539 |
|
540 CleanupStack::PopAndDestroy( luid ); |
|
541 } |
|
542 else |
|
543 { |
|
544 ret = EError; |
|
545 } |
|
546 |
|
547 // Remove temporary installations file |
|
548 fs.Delete( fileName ); |
|
549 |
|
550 // Cleanup |
|
551 CleanupStack::PopAndDestroy( newScreenSavers ); |
|
552 CleanupStack::PopAndDestroy( oldScreenSavers ); |
|
553 CleanupStack::PopAndDestroy( &newPackages ); |
|
554 CleanupStack::PopAndDestroy( &oldPackages ); |
|
555 CleanupStack::PopAndDestroy( &fs ); |
|
556 } |
|
557 break; |
|
558 |
|
559 case ENodeInstallOptions: |
|
560 ret = iScreenSavers->SetInstallOptionsL( aObject ); |
|
561 break; |
|
562 |
|
563 case ENodeName: |
|
564 if (aObject.Length() > 0) |
|
565 { |
|
566 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
567 iCallBack->SetMappingL( uriPtrc, aObject ); |
|
568 #else |
|
569 iCallBack->SetMappingL( aURI, aObject ); |
|
570 #endif |
|
571 } |
|
572 else |
|
573 { |
|
574 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
575 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
576 #else |
|
577 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
578 #endif |
|
579 |
|
580 } |
|
581 |
|
582 if (parentLUID->Length() > 1) |
|
583 { |
|
584 screenSaverId.Set( *parentLUID ); |
|
585 ret = iScreenSavers->SetNameL( screenSaverId, aObject ); |
|
586 } |
|
587 else |
|
588 { |
|
589 ret = EError; |
|
590 } |
|
591 break; |
|
592 |
|
593 case ENodeDescription: |
|
594 if (aObject.Length() > 0) |
|
595 { |
|
596 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
597 iCallBack->SetMappingL( uriPtrc, aObject ); |
|
598 #else |
|
599 iCallBack->SetMappingL( aURI, aObject ); |
|
600 #endif |
|
601 } |
|
602 else |
|
603 { |
|
604 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
605 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
606 #else |
|
607 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
608 #endif |
|
609 } |
|
610 |
|
611 if (parentLUID->Length() > 1) |
|
612 { |
|
613 screenSaverId.Set( *parentLUID ); |
|
614 ret = iScreenSavers->SetDescriptionL( screenSaverId, aObject ); |
|
615 } |
|
616 else |
|
617 { |
|
618 ret = EError; |
|
619 } |
|
620 |
|
621 break; |
|
622 |
|
623 case ENodeCustomProperty: |
|
624 if (aObject.Length() > 0) |
|
625 { |
|
626 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
627 iCallBack->SetMappingL( uriPtrc, aObject ); |
|
628 #else |
|
629 iCallBack->SetMappingL( aURI, aObject ); |
|
630 #endif |
|
631 } |
|
632 else |
|
633 { |
|
634 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
635 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
636 #else |
|
637 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
638 #endif |
|
639 } |
|
640 |
|
641 if (parentLUID->Length() > 1) |
|
642 { |
|
643 screenSaverId.Set( *parentLUID ); |
|
644 ret = iScreenSavers->SetCustomPropertyL( screenSaverId, aObject ); |
|
645 } |
|
646 else |
|
647 { |
|
648 ret = EError; |
|
649 } |
|
650 |
|
651 break; |
|
652 |
|
653 case ENodeVersion: |
|
654 if (aObject.Length() > 0) |
|
655 { |
|
656 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
657 iCallBack->SetMappingL( uriPtrc, aObject ); |
|
658 #else |
|
659 iCallBack->SetMappingL( aURI, aObject ); |
|
660 #endif |
|
661 } |
|
662 else |
|
663 { |
|
664 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
665 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
666 #else |
|
667 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
668 #endif |
|
669 } |
|
670 |
|
671 if (parentLUID->Length() > 1) |
|
672 { |
|
673 screenSaverId.Set( *parentLUID ); |
|
674 ret = iScreenSavers->SetVersionL( screenSaverId, aObject ); |
|
675 } |
|
676 else |
|
677 { |
|
678 ret = EError; |
|
679 } |
|
680 |
|
681 break; |
|
682 |
|
683 case ENodeUnknown: |
|
684 ret = ENotFound; |
|
685 break; |
|
686 |
|
687 default: |
|
688 ret = EError; |
|
689 break; |
|
690 } |
|
691 |
|
692 CleanupStack::PopAndDestroy( parentLUID ); |
|
693 |
|
694 iCallBack->SetStatusL( aStatusRef, ret ); |
|
695 RDEBUG("CScreenSaverAdapter::UpdateLeafObjectL(): end"); |
|
696 } |
|
697 |
|
698 // ------------------------------------------------------------------------------------------------ |
|
699 // |
|
700 // ------------------------------------------------------------------------------------------------ |
|
701 void CScreenSaverAdapter::_UpdateLeafObjectL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
702 { |
|
703 RDEBUG( "CScreenSaverAdapter::UpdateLeafObjectL(...RWriteStream...): begin" ); |
|
704 //Not supported |
|
705 TError ret = EError; |
|
706 iCallBack->SetStatusL( aStatusRef, ret ); |
|
707 } |
|
708 |
|
709 |
|
710 // ------------------------------------------------------------------------------------------------ |
|
711 // CScreenSaverAdapter::DeleteObjectL( const TDesC& aURI, const TDesC& aLUID ) |
|
712 // ------------------------------------------------------------------------------------------------ |
|
713 void CScreenSaverAdapter::_DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TInt aStatusRef ) |
|
714 { |
|
715 RDEBUG( "CScreenSaverAdapter::DeleteObjectL(): begin" ); |
|
716 TError ret = EOk ; |
|
717 |
|
718 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
719 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
720 TNodeId nodeId = NodeId( uriPtrc ); |
|
721 TPtrC8 screenSaverId = NSmlDmURI::LastURISeg( uriPtrc ); |
|
722 #else |
|
723 TNodeId nodeId = NodeId( aURI ); |
|
724 TPtrC8 screenSaverId = NSmlDmURI::LastURISeg( aURI ); |
|
725 #endif |
|
726 |
|
727 switch( nodeId ) |
|
728 { |
|
729 case ENodeAvailableScreenSaversX: |
|
730 { |
|
731 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
732 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
733 #else |
|
734 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
735 #endif |
|
736 HBufC8* parentLUID = iCallBack->GetLuidAllocL( parentURI ); |
|
737 CleanupStack::PushL( parentLUID ); |
|
738 |
|
739 // Set default return code to ENotFound in case we can't event try to delete package |
|
740 ret = ENotFound; |
|
741 |
|
742 if (aLUID != *parentLUID) |
|
743 { |
|
744 ret = iScreenSavers->DeleteL( aLUID ); |
|
745 } |
|
746 |
|
747 CleanupStack::PopAndDestroy( parentLUID ); |
|
748 } |
|
749 break; |
|
750 |
|
751 case ENodeUnknown: |
|
752 ret = ENotFound; |
|
753 break; |
|
754 |
|
755 default: |
|
756 ret = EError; |
|
757 break; |
|
758 } |
|
759 |
|
760 iCallBack->SetStatusL( aStatusRef, ret ); |
|
761 RDEBUG( "CScreenSaverAdapter::DeleteObjectL(): end" ); |
|
762 } |
|
763 |
|
764 // ------------------------------------------------------------------------------------------------ |
|
765 // CScreenSaverAdapter::GetLeafObjectL() |
|
766 // ------------------------------------------------------------------------------------------------ |
|
767 void CScreenSaverAdapter::GetLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& /*aType*/, CBufBase& aResult, TError& aRet ) |
|
768 { |
|
769 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
770 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
771 TNodeId nodeId = NodeId( uriPtrc ); |
|
772 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
773 #else |
|
774 TNodeId nodeId = NodeId( aURI ); |
|
775 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
776 #endif |
|
777 |
|
778 TPtrC8 screenSaverId = NSmlDmURI::LastURISeg( parentURI ); |
|
779 |
|
780 HBufC8* parentLUID = iCallBack->GetLuidAllocL( parentURI ); |
|
781 CleanupStack::PushL( parentLUID ); |
|
782 |
|
783 HBufC8* trimmedLUID = aLUID.AllocL(); |
|
784 CleanupStack::PushL( trimmedLUID ); |
|
785 trimmedLUID->Des().Trim(); |
|
786 |
|
787 switch( nodeId ) |
|
788 { |
|
789 case ENodeActiveSc: |
|
790 { |
|
791 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
792 HBufC8* luid = iCallBack->GetLuidAllocL( uriPtrc ); |
|
793 #else |
|
794 HBufC8* luid = iCallBack->GetLuidAllocL( aURI ); |
|
795 #endif |
|
796 CleanupStack::PushL( luid ); |
|
797 aResult.InsertL( aResult.Size(), *luid ); |
|
798 CleanupStack::PopAndDestroy( luid ); |
|
799 } |
|
800 break; |
|
801 |
|
802 case ENodeID: |
|
803 { |
|
804 if (parentLUID->Length() > 1) |
|
805 { |
|
806 screenSaverId.Set( *parentLUID ); |
|
807 } |
|
808 aRet = iScreenSavers->GetIdL( screenSaverId, aResult ); |
|
809 } |
|
810 break; |
|
811 |
|
812 case ENodeName: |
|
813 if ( trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
814 { |
|
815 aResult.InsertL( aResult.Size(), aLUID ); |
|
816 } |
|
817 else |
|
818 { |
|
819 if (parentLUID->Length() > 1) |
|
820 { |
|
821 screenSaverId.Set( *parentLUID ); |
|
822 } |
|
823 aRet = iScreenSavers->GetNameL( screenSaverId, aResult ); |
|
824 } |
|
825 break; |
|
826 |
|
827 case ENodeDescription: |
|
828 if ( trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
829 { |
|
830 aResult.InsertL( aResult.Size(), aLUID ); |
|
831 } |
|
832 else |
|
833 { |
|
834 if (parentLUID->Length() > 1) |
|
835 { |
|
836 screenSaverId.Set( *parentLUID ); |
|
837 } |
|
838 aRet = iScreenSavers->GetDescriptionL( screenSaverId, aResult ); |
|
839 } |
|
840 break; |
|
841 |
|
842 case ENodeCustomProperty: |
|
843 if ( trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
844 { |
|
845 aResult.InsertL( aResult.Size(), aLUID ); |
|
846 } |
|
847 else |
|
848 { |
|
849 if (parentLUID->Length() > 1) |
|
850 { |
|
851 screenSaverId.Set( *parentLUID ); |
|
852 } |
|
853 aRet = iScreenSavers->GetCustomPropertyL( screenSaverId, aResult ); |
|
854 } |
|
855 break; |
|
856 |
|
857 case ENodeVersion: |
|
858 if ( trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
859 { |
|
860 aResult.InsertL( aResult.Size(), aLUID ); |
|
861 } |
|
862 else |
|
863 { |
|
864 if (parentLUID->Length() > 1) |
|
865 { |
|
866 screenSaverId.Set( *parentLUID ); |
|
867 } |
|
868 aRet = iScreenSavers->GetVersionL( screenSaverId, aResult ); |
|
869 } |
|
870 break; |
|
871 |
|
872 case ENodeUnknown: |
|
873 aRet = ENotFound; |
|
874 break; |
|
875 |
|
876 default: |
|
877 aRet = EError; |
|
878 break; |
|
879 } |
|
880 |
|
881 CleanupStack::PopAndDestroy( trimmedLUID ); |
|
882 CleanupStack::PopAndDestroy( parentLUID ); |
|
883 } |
|
884 |
|
885 // ------------------------------------------------------------------------------------------------ |
|
886 // CScreenSaverAdapter::FetchLeafObjectL( const TDesC& aURI, const TDesC& aLUID, const TDesC& aType, CBufBase& aObject ) |
|
887 // ------------------------------------------------------------------------------------------------ |
|
888 void CScreenSaverAdapter::_FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, const TInt aResultsRef, const TInt aStatusRef ) |
|
889 { |
|
890 RDEBUG("CScreenSaverAdapter::FetchLeafObjectL(): begin"); |
|
891 TError ret = EOk ; |
|
892 |
|
893 CBufBase *result = CBufFlat::NewL( 128 ); |
|
894 CleanupStack::PushL( result ); |
|
895 |
|
896 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
897 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
898 GetLeafObjectL( uriPtrc, aLUID, aType, *result, ret ); |
|
899 #else |
|
900 GetLeafObjectL( aURI, aLUID, aType, *result, ret ); |
|
901 #endif |
|
902 |
|
903 if( ret == EOk ) |
|
904 { |
|
905 iCallBack->SetResultsL( aResultsRef, *result, KNullDesC8 ); |
|
906 } |
|
907 |
|
908 iCallBack->SetStatusL( aStatusRef, ret ); |
|
909 |
|
910 CleanupStack::PopAndDestroy( result ); |
|
911 RDEBUG("CScreenSaverAdapter::FetchLeafObjectL(): end"); |
|
912 } |
|
913 |
|
914 // ------------------------------------------------------------------------------------------------ |
|
915 // |
|
916 // ------------------------------------------------------------------------------------------------ |
|
917 void CScreenSaverAdapter::_FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aType, TInt aResultsRef, TInt aStatusRef ) |
|
918 { |
|
919 RDEBUG("CScreenSaverAdapter::FetchLeafObjectSizeL(): begin"); |
|
920 TError ret = EOk ; |
|
921 |
|
922 CBufBase *result = CBufFlat::NewL( 128 ); |
|
923 CleanupStack::PushL( result ); |
|
924 |
|
925 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
926 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
927 GetLeafObjectL( uriPtrc, aLUID, aType, *result, ret ); |
|
928 #else |
|
929 GetLeafObjectL( aURI, aLUID, aType, *result, ret ); |
|
930 #endif |
|
931 |
|
932 if (ret == EOk) |
|
933 { |
|
934 TBuf8<20> len; |
|
935 len.AppendNum( result->Size() ); |
|
936 result->Reset(); |
|
937 result->InsertL( 0, len ); |
|
938 |
|
939 iCallBack->SetResultsL( aResultsRef, *result, KNullDesC8() ); |
|
940 } |
|
941 |
|
942 iCallBack->SetStatusL( aStatusRef, ret ); |
|
943 |
|
944 CleanupStack::PopAndDestroy( result ); |
|
945 RDEBUG("CScreenSaverAdapter::FetchLeafObjectSizeL(): end"); |
|
946 } |
|
947 |
|
948 // ------------------------------------------------------------------------------------------------ |
|
949 // CScreenSaverAdapter::ChildURIListL( const TDesC& aURI, const TDesC& aParentLUID, const CArrayFix<TNSmlDmMappingInfo>& aPreviousURISegmentList, CArrayFix<TPtrC>& aCurrentURISegmentList ) |
|
950 // ------------------------------------------------------------------------------------------------ |
|
951 void CScreenSaverAdapter::_ChildURIListL( const TDesC8& aURI, const TDesC8& /*aParentLUID*/, const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, const TInt aResultsRef, const TInt aStatusRef ) |
|
952 { |
|
953 RDEBUG("CScreenSaverAdapter::ChildURIListL(): begin"); |
|
954 TError ret = EOk; |
|
955 |
|
956 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
957 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
958 TNodeId nodeId = NodeId( uriPtrc ); |
|
959 #else |
|
960 TNodeId nodeId = NodeId( aURI ); |
|
961 #endif |
|
962 |
|
963 CBufBase *result = CBufFlat::NewL( 128 ); |
|
964 CleanupStack::PushL( result ); |
|
965 |
|
966 switch( nodeId ) |
|
967 { |
|
968 case ENodeCustomization: |
|
969 result->InsertL( result->Size(), KNSmlSCScreenSavers() ); |
|
970 break; |
|
971 case ENodeScreenSavers: |
|
972 result->InsertL( result->Size(), KNSmlSCAvailableScreenSaversNodeName() ); |
|
973 result->InsertL( result->Size(), KSlash() ); |
|
974 result->InsertL( result->Size(), KNSmlSCActiveScNodeName() ); |
|
975 break; |
|
976 case ENodeAvailableScreenSavers: |
|
977 ret = iScreenSavers->GetScreenSaverListL( aPreviousURISegmentList, *result ); |
|
978 break; |
|
979 case ENodeActiveSc: |
|
980 break; |
|
981 case ENodeInstallOptions: |
|
982 break; |
|
983 case ENodeAvailableScreenSaversX: |
|
984 result->InsertL( result->Size(), KNSmlSCDataNodeName() ); |
|
985 result->InsertL( result->Size(), KSlash() ); |
|
986 result->InsertL( result->Size(), KNSmlSCIDNodeName() ); |
|
987 result->InsertL( result->Size(), KSlash() ); |
|
988 result->InsertL( result->Size(), KNSmlSCNameNodeName() ); |
|
989 result->InsertL( result->Size(), KSlash() ); |
|
990 result->InsertL( result->Size(), KNSmlSCDescriptionNodeName() ); |
|
991 result->InsertL( result->Size(), KSlash() ); |
|
992 result->InsertL( result->Size(), KNSmlSCCustomPropertyNodeName() ); |
|
993 result->InsertL( result->Size(), KSlash() ); |
|
994 result->InsertL( result->Size(), KNSmlSCVersionNodeName() ); |
|
995 result->InsertL( result->Size(), KSlash() ); |
|
996 result->InsertL( result->Size(), KNSmlSCInstallOptionsNodeName() ); |
|
997 break; |
|
998 case ENodeData: |
|
999 break; |
|
1000 case ENodeID: |
|
1001 break; |
|
1002 case ENodeName: |
|
1003 break; |
|
1004 case ENodeDescription: |
|
1005 break; |
|
1006 case ENodeCustomProperty: |
|
1007 break; |
|
1008 case ENodeVersion: |
|
1009 break; |
|
1010 |
|
1011 case ENodeUnknown: |
|
1012 ret = ENotFound; |
|
1013 break; |
|
1014 |
|
1015 default: |
|
1016 ret = EError; |
|
1017 break; |
|
1018 } |
|
1019 |
|
1020 if( ret == EOk ) |
|
1021 { |
|
1022 iCallBack->SetResultsL( aResultsRef, *result, KNullDesC8 ); |
|
1023 } |
|
1024 |
|
1025 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1026 |
|
1027 CleanupStack::PopAndDestroy( result ); |
|
1028 RDEBUG("CScreenSaverAdapter::ChildURIListL(): end"); |
|
1029 } |
|
1030 |
|
1031 |
|
1032 // ------------------------------------------------------------------------------------------------ |
|
1033 // CScreenSaverAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID ) |
|
1034 // ------------------------------------------------------------------------------------------------ |
|
1035 void CScreenSaverAdapter::_AddNodeObjectL( const TDesC8& aURI, const TDesC8& /*aParentLUID*/, const TInt aStatusRef ) |
|
1036 { |
|
1037 RDEBUG("CScreenSaverAdapter::AddNodeObjectL(): begin"); |
|
1038 TError ret = EOk ; |
|
1039 |
|
1040 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1041 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
1042 TPtrC8 parentURI = NSmlDmURI::ParentURI( uriPtrc ); |
|
1043 #else |
|
1044 TPtrC8 parentURI = NSmlDmURI::ParentURI( aURI ); |
|
1045 #endif |
|
1046 |
|
1047 TNodeId parentNodeId = NodeId( parentURI ); |
|
1048 |
|
1049 |
|
1050 HBufC8* parentLUID = iCallBack->GetLuidAllocL( parentURI ); |
|
1051 CleanupStack::PushL( parentLUID ); |
|
1052 |
|
1053 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1054 HBufC8* trimmedLUID = iCallBack->GetLuidAllocL( uriPtrc ); |
|
1055 #else |
|
1056 HBufC8* trimmedLUID = iCallBack->GetLuidAllocL( aURI ); |
|
1057 #endif |
|
1058 |
|
1059 CleanupStack::PushL( trimmedLUID ); |
|
1060 trimmedLUID->Des().Trim(); |
|
1061 |
|
1062 |
|
1063 switch( parentNodeId ) |
|
1064 { |
|
1065 case ENodeAvailableScreenSavers: |
|
1066 // Set LUID mapping to make this new node permanent |
|
1067 if ( trimmedLUID->Length() > 0 && *trimmedLUID != *parentLUID) |
|
1068 { |
|
1069 ret = EAlreadyExists; |
|
1070 } |
|
1071 else |
|
1072 { |
|
1073 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1074 iCallBack->SetMappingL( uriPtrc, _L8(" ") ); |
|
1075 #else |
|
1076 iCallBack->SetMappingL( aURI, _L8(" ") ); |
|
1077 #endif |
|
1078 } |
|
1079 break; |
|
1080 |
|
1081 default: |
|
1082 ret = EError; |
|
1083 break; |
|
1084 } |
|
1085 |
|
1086 // Cleanup |
|
1087 CleanupStack::Pop( trimmedLUID ); |
|
1088 CleanupStack::Pop( parentLUID ); |
|
1089 |
|
1090 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1091 RDEBUG("CScreenSaverAdapter::AddNodeObjectL(): end"); |
|
1092 } |
|
1093 |
|
1094 // ------------------------------------------------------------------------------------------------ |
|
1095 // |
|
1096 // ------------------------------------------------------------------------------------------------ |
|
1097 void CScreenSaverAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1098 { |
|
1099 RDEBUG("CScreenSaverAdapter::ExecuteCommandL(): begin"); |
|
1100 // Not supported for any node |
|
1101 CSmlDmAdapter::TError ret = CSmlDmAdapter::EError; |
|
1102 iCallBack->SetStatusL(aStatusRef, ret); |
|
1103 RDEBUG("CScreenSaverAdapter::ExecuteCommandL(): end"); |
|
1104 } |
|
1105 |
|
1106 // ------------------------------------------------------------------------------------------------ |
|
1107 // |
|
1108 // ------------------------------------------------------------------------------------------------ |
|
1109 void CScreenSaverAdapter::_ExecuteCommandL( const TDesC8& /*aURI*/, const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1110 { |
|
1111 RDEBUG("CScreenSaverAdapter::ExecuteCommandL(...RWriteStream...): begin"); |
|
1112 //Not supported |
|
1113 TError ret = EError; |
|
1114 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1115 } |
|
1116 |
|
1117 // ------------------------------------------------------------------------------------------------ |
|
1118 // |
|
1119 // ------------------------------------------------------------------------------------------------ |
|
1120 void CScreenSaverAdapter::_CopyCommandL( const TDesC8& /*aTargetURI*/, const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, TInt aStatusRef ) |
|
1121 { |
|
1122 RDEBUG("CScreenSaverAdapter::CopyCommandL(): begin"); |
|
1123 //Not supported |
|
1124 TError ret = EError; |
|
1125 iCallBack->SetStatusL( aStatusRef, ret ); |
|
1126 } |
|
1127 |
|
1128 // ------------------------------------------------------------------------------------------------ |
|
1129 // |
|
1130 // ------------------------------------------------------------------------------------------------ |
|
1131 void CScreenSaverAdapter::StartAtomicL() |
|
1132 { |
|
1133 RDEBUG("CScreenSaverAdapter::StartAtomicL(): begin"); |
|
1134 //Not supported |
|
1135 } |
|
1136 |
|
1137 // ------------------------------------------------------------------------------------------------ |
|
1138 // |
|
1139 // ------------------------------------------------------------------------------------------------ |
|
1140 void CScreenSaverAdapter::CommitAtomicL() |
|
1141 { |
|
1142 RDEBUG("CScreenSaverAdapter::CommitAtomicL(): begin"); |
|
1143 //Not supported |
|
1144 } |
|
1145 |
|
1146 // ------------------------------------------------------------------------------------------------ |
|
1147 // |
|
1148 // ------------------------------------------------------------------------------------------------ |
|
1149 void CScreenSaverAdapter::RollbackAtomicL() |
|
1150 { |
|
1151 RDEBUG("CScreenSaverAdapter::RollbackAtomicL(): begin"); |
|
1152 //Not supported |
|
1153 } |
|
1154 |
|
1155 // ------------------------------------------------------------------------------------------------ |
|
1156 // |
|
1157 // ------------------------------------------------------------------------------------------------ |
|
1158 TBool CScreenSaverAdapter::StreamingSupport( TInt& /*aItemSize*/ ) |
|
1159 { |
|
1160 RDEBUG("CScreenSaverAdapter::StreamingSupport(): begin"); |
|
1161 return EFalse; |
|
1162 } |
|
1163 |
|
1164 // ------------------------------------------------------------------------------------------------ |
|
1165 // |
|
1166 // ------------------------------------------------------------------------------------------------ |
|
1167 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1168 void CScreenSaverAdapter::StreamCommittedL( RWriteStream& /*aStream*/ ) |
|
1169 #else |
|
1170 void CScreenSaverAdapter::StreamCommittedL() |
|
1171 #endif |
|
1172 { |
|
1173 RDEBUG("CScreenSaverAdapter::StreamCommittedL(): begin"); |
|
1174 RDEBUG("CScreenSaverAdapter::StreamCommittedL(): end"); |
|
1175 } |
|
1176 |
|
1177 // ------------------------------------------------------------------------------------------------ |
|
1178 // |
|
1179 // ------------------------------------------------------------------------------------------------ |
|
1180 void CScreenSaverAdapter::CompleteOutstandingCmdsL() |
|
1181 { |
|
1182 RDEBUG("CScreenSaverAdapter::CompleteOutstandingCmdsL(): begin"); |
|
1183 } |
|
1184 |
|
1185 // ----------------------------------------------------------------------------- |
|
1186 // |
|
1187 // ----------------------------------------------------------------------------- |
|
1188 // |
|
1189 //#ifdef __SAP_POLICY_MANAGEMENT |
|
1190 TPtrC8 CScreenSaverAdapter::PolicyRequestResourceL( const TDesC8& /*aURI*/ ) |
|
1191 { |
|
1192 if(!FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement )) |
|
1193 { |
|
1194 User::Leave(KErrNotSupported); |
|
1195 |
|
1196 } |
|
1197 return PolicyEngineXACML::KCustomizationManagement(); |
|
1198 } |
|
1199 //#endif |
|
1200 // ------------------------------------------------------------------------------------------------ |
|
1201 // |
|
1202 // ------------------------------------------------------------------------------------------------ |
|
1203 CScreenSaverAdapter::TNodeId CScreenSaverAdapter::NodeId( const TDesC8& aURI ) |
|
1204 { |
|
1205 TNodeId id = ENodeUnknown; |
|
1206 |
|
1207 #ifdef __TARM_SYMBIAN_CONVERGENCY |
|
1208 TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI ); |
|
1209 TInt cnt = NSmlDmURI::NumOfURISegs( uriPtrc ); |
|
1210 TPtrC8 app = NSmlDmURI::LastURISeg( uriPtrc ); |
|
1211 #else |
|
1212 TInt cnt = NSmlDmURI::NumOfURISegs( aURI ); |
|
1213 TPtrC8 app = NSmlDmURI::LastURISeg( aURI ); |
|
1214 #endif |
|
1215 |
|
1216 /* |
|
1217 ./Customization -+--> ScreenSaver --+----> CurrentScreenSavers --> <X> * ---+-----> ID |
|
1218 | | |
|
1219 |----> ActiveSc |-----> Name |
|
1220 | | |
|
1221 |----> InstallScreenSaver |-----> Description |
|
1222 | | |
|
1223 |----> InstallOptions |-----> CustomProperty |
|
1224 | |
|
1225 |-----> Version |
|
1226 |
|
1227 */ |
|
1228 |
|
1229 if ( cnt == 1 ) |
|
1230 { |
|
1231 if (app == KNSmlCustomizationNodeName) |
|
1232 { |
|
1233 id = ENodeCustomization; |
|
1234 } |
|
1235 } |
|
1236 else if ( cnt == 2 ) |
|
1237 { |
|
1238 if (app == KNSmlSCScreenSavers) |
|
1239 { |
|
1240 id = ENodeScreenSavers; |
|
1241 } |
|
1242 } |
|
1243 else if ( cnt == 3 ) |
|
1244 { |
|
1245 if (app == KNSmlSCAvailableScreenSaversNodeName) |
|
1246 { |
|
1247 id = ENodeAvailableScreenSavers; |
|
1248 } |
|
1249 else if (app == KNSmlSCActiveScNodeName) |
|
1250 { |
|
1251 id = ENodeActiveSc; |
|
1252 } |
|
1253 } |
|
1254 else if ( cnt == 4 ) |
|
1255 { |
|
1256 id = ENodeAvailableScreenSaversX; |
|
1257 } |
|
1258 else if ( cnt == 5 ) |
|
1259 { |
|
1260 if (app == KNSmlSCDataNodeName) |
|
1261 { |
|
1262 id = ENodeData; |
|
1263 } |
|
1264 else if (app == KNSmlSCIDNodeName) |
|
1265 { |
|
1266 id = ENodeID; |
|
1267 } |
|
1268 else if (app == KNSmlSCNameNodeName) |
|
1269 { |
|
1270 id = ENodeName; |
|
1271 } |
|
1272 else if (app == KNSmlSCDescriptionNodeName) |
|
1273 { |
|
1274 id = ENodeDescription; |
|
1275 } |
|
1276 else if (app == KNSmlSCCustomPropertyNodeName) |
|
1277 { |
|
1278 id = ENodeCustomProperty; |
|
1279 } |
|
1280 else if (app == KNSmlSCVersionNodeName) |
|
1281 { |
|
1282 id = ENodeVersion; |
|
1283 } |
|
1284 else if (app == KNSmlSCInstallOptionsNodeName) |
|
1285 { |
|
1286 id = ENodeInstallOptions; |
|
1287 } |
|
1288 } |
|
1289 |
|
1290 return id; |
|
1291 } |
|
1292 |
|
1293 // ------------------------------------------------------------------------------------------------ |
|
1294 // |
|
1295 // ------------------------------------------------------------------------------------------------ |
|
1296 const TImplementationProxy ImplementationTable[] = |
|
1297 { |
|
1298 { {KNSmlDMScreenSaverAdapterImplUid}, (TProxyNewLPtr)CScreenSaverAdapter::NewL } |
|
1299 }; |
|
1300 |
|
1301 // ------------------------------------------------------------------------------------------------ |
|
1302 // |
|
1303 // ------------------------------------------------------------------------------------------------ |
|
1304 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
1305 { |
|
1306 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
1307 return ImplementationTable; |
|
1308 } |
|
1309 |
|
1310 // ------------------------------------------------------------------------------------- |
|
1311 // CScreenSaverAdapter::FillNodeInfoL() |
|
1312 // Fills the node info in ddf structure |
|
1313 // ------------------------------------------------------------------------------------- |
|
1314 void CScreenSaverAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode,TSmlDmAccessTypes aAccTypes, |
|
1315 MSmlDmDDFObject::TOccurence aOccurrence, MSmlDmDDFObject::TScope aScope, |
|
1316 MSmlDmDDFObject::TDFFormat aFormat,const TDesC8& aDescription ) |
|
1317 { |
|
1318 aNode.SetAccessTypesL(aAccTypes); |
|
1319 aNode.SetOccurenceL(aOccurrence); |
|
1320 aNode.SetScopeL(aScope); |
|
1321 aNode.SetDFFormatL(aFormat); |
|
1322 if(aFormat!=MSmlDmDDFObject::ENode) |
|
1323 { |
|
1324 aNode.AddDFTypeMimeTypeL(KNSmlSCTextPlain); |
|
1325 } |
|
1326 aNode.SetDescriptionL(aDescription); |
|
1327 } |
|
1328 |
|
1329 // ------------------------------------------------------------------------------------- |
|
1330 // CScreenSaverAdapter::IsImage() |
|
1331 // Checks whether the given mime type is image format (that we support) |
|
1332 // ------------------------------------------------------------------------------------- |
|
1333 TBool CScreenSaverAdapter::IsImage(const TDesC8& aMime) |
|
1334 { |
|
1335 |
|
1336 if (aMime == _L8("image/jpeg") || aMime == _L8("image/gif")) |
|
1337 { |
|
1338 return ETrue; |
|
1339 } |
|
1340 return EFalse; |
|
1341 } |
|
1342 |
|
1343 // ------------------------------------------------------------------------------------- |
|
1344 // CScreenSaverAdapter:: |
|
1345 // ------------------------------------------------------------------------------------- |
|
1346 void CScreenSaverAdapter::InstalledPackagesL( RArray< TUid >& aUids ) |
|
1347 { |
|
1348 Swi::RSisRegistrySession reg; |
|
1349 User::LeaveIfError( reg.Connect() ); |
|
1350 CleanupClosePushL( reg ); |
|
1351 |
|
1352 reg.InstalledUidsL( aUids ); |
|
1353 aUids.SortSigned( ); |
|
1354 |
|
1355 CleanupStack::PopAndDestroy( ® ); |
|
1356 } |
|
1357 |
|
1358 |
|
1359 |
|
1360 // ------------------------------------------------------------------------------------- |
|
1361 // CScreenSaverAdapter:: |
|
1362 // ------------------------------------------------------------------------------------- |
|
1363 void CScreenSaverAdapter::InstalledScreenSaversL( CDesCArray& aIds ) |
|
1364 { |
|
1365 RDEBUG(" -> CScreenSaverAdapter: GetScreenSaverList ... START!"); |
|
1366 |
|
1367 RScreenSaverClient ssClient; |
|
1368 User::LeaveIfError( ssClient.Connect() ); |
|
1369 CleanupClosePushL( ssClient ); |
|
1370 ssClient.GetScreenSaverListL(aIds ); |
|
1371 CleanupStack::PopAndDestroy( &ssClient ); |
|
1372 |
|
1373 RDEBUG(" -> CScreenSaverAdapter: GetScreenSaverList ... END!"); |
|
1374 } |
|
1375 |
|
1376 |