|
1 /* |
|
2 * Copyright (c) 2008 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: Client-side API implementation of Installation and Maintenence |
|
15 * Services of Application Management Service APIs. |
|
16 * See hspsThemeManagement.h. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #include <e32svr.h> |
|
23 |
|
24 #include "hsps_builds_cfg.hrh" |
|
25 |
|
26 #include "hspsclient.h" |
|
27 #include "hspsodt.h" |
|
28 #include "hspsresult.h" |
|
29 #include "hspspluginidlist.h" |
|
30 #include "hspsdomdocument.h" |
|
31 |
|
32 #include <s32mem.h> |
|
33 #include <s32file.h> |
|
34 |
|
35 #ifdef HSPS_LOG_ACTIVE |
|
36 #include <hspslogbus.h> |
|
37 #endif |
|
38 |
|
39 // ========================= MEMBER FUNCTIONS ================================== |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // ChspsClient::NewL() |
|
43 // Two-phased constructor. |
|
44 // ----------------------------------------------------------------------------- |
|
45 EXPORT_C ChspsClient* ChspsClient::NewL( MhspsThemeManagementServiceObserver& aObserver ) |
|
46 { |
|
47 ChspsClient* self = NewLC( aObserver ); |
|
48 CleanupStack::Pop( self ); |
|
49 return( self ) ; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // ChspsClient::NewLC() |
|
54 // Two-phased constructor. |
|
55 // ----------------------------------------------------------------------------- |
|
56 EXPORT_C ChspsClient* ChspsClient::NewLC( MhspsThemeManagementServiceObserver& aObserver ) |
|
57 { |
|
58 ChspsClient* self = new ( ELeave ) ChspsClient( aObserver ); |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // ChspsClient::ConstructL() |
|
66 // Symbian 2nd phase constructor can leave. |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 void ChspsClient::ConstructL() |
|
70 { |
|
71 User::LeaveIfError( iSession.Connect() ); |
|
72 iOdt = ChspsODT::NewL(); |
|
73 iResult = ChspsResult::NewL(); |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // ChspsClient::ChspsClient() |
|
78 // C++ default constructor can NOT contain any code, that might leave. |
|
79 // ----------------------------------------------------------------------------- |
|
80 ChspsClient::ChspsClient( MhspsThemeManagementServiceObserver& aObserver) |
|
81 : CActive( EPriorityStandard ), iObserver( aObserver ) |
|
82 { |
|
83 CActiveScheduler::Add( this ); |
|
84 iCancelRequestMessage = (ThspsServiceRequestMessage)KErrNone; |
|
85 iODTMode = EFalse; |
|
86 iSubscription = EFalse; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // ChspsClient::~ChspsClient() |
|
91 // Destructor. |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 ChspsClient::~ChspsClient() |
|
95 { |
|
96 Cancel(); // Causes call to DoCancel() |
|
97 iSession.Close(); |
|
98 delete iOdt; |
|
99 delete iSearchMaskData; |
|
100 delete iSetMaskData; |
|
101 delete iResult; |
|
102 } |
|
103 |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // ChspsClient::hspsInstallTheme |
|
107 // (other items were commented in a header). |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsInstallTheme(const TDesC& aManifestFileName, |
|
111 ChspsODT& aHeader) |
|
112 { |
|
113 ThspsServiceCompletedMessage ret = EhspsInstallThemeFailed; |
|
114 TBuf8<KMaxHeaderDataLength8> headerData; |
|
115 TInt errorCode = KErrNone; |
|
116 iODTMode = ETrue; |
|
117 ret = (ThspsServiceCompletedMessage) iSession.InstallTheme( iResultData, aManifestFileName, |
|
118 headerData ); |
|
119 UpdatehspsResult( iResultData ); |
|
120 if ( ret == EhspsInstallThemeSuccess || ret == EhspsInstallPhaseSuccess ) |
|
121 { |
|
122 |
|
123 TRAP( errorCode, aHeader.UnMarshalHeaderL(headerData) ); |
|
124 if ( errorCode ) |
|
125 { |
|
126 ret = EhspsInstallThemeFailed; |
|
127 |
|
128 #ifdef HSPS_LOG_ACTIVE |
|
129 if( iLogBus ) |
|
130 { |
|
131 iLogBus->LogText( _L( "ChspsClient::hspsInstallTheme(): - failed, bad headerdata returned, system error %d." ), |
|
132 errorCode ); |
|
133 } |
|
134 #endif |
|
135 |
|
136 iResult->iSystemError = errorCode; |
|
137 iResult->iXuikonError = errorCode; |
|
138 } |
|
139 } |
|
140 |
|
141 return ret; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // ChspsClient::hspsInstallTheme |
|
146 // (other items were commented in a header). |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsInstallTheme(const TDesC& /*aManifestFileName*/ |
|
150 , TDes8& /*aHeaderData*/) |
|
151 { |
|
152 return EhspsServiceNotSupported; |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // ChspsClient::hspsInstallNextPhaseL |
|
157 // (other items were commented in a header). |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsInstallNextPhaseL( ChspsODT& aHeader ) |
|
161 { |
|
162 ThspsServiceCompletedMessage ret = EhspsServiceRequestError; |
|
163 iResult->ResetData(); |
|
164 if ( !IsActive() ) |
|
165 { |
|
166 iODTMode = ETrue; |
|
167 iCancelRequestMessage = EhspsCancelInstallTheme; |
|
168 iHeader = &aHeader; |
|
169 iStatus = KRequestPending; |
|
170 SetActive(); |
|
171 iSession.InstallNextPhase( iResultData, iHeaderData, iStatus ); |
|
172 ret = EhspsServiceRequestSheduled; |
|
173 } |
|
174 else |
|
175 { |
|
176 ret = EhspsServiceRequestError; |
|
177 } |
|
178 return ret; |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // ChspsClient::hspsInstallNextPhaseL |
|
183 // (other items were commented in a header). |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsInstallNextPhaseL( TDes8& /*aHeaderData*/ ) |
|
187 { |
|
188 return EhspsServiceNotSupported; |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // ChspsClient::hspsCancelInstallTheme() |
|
193 // (other items were commented in a header). |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsCancelInstallTheme() |
|
197 { |
|
198 ThspsServiceCompletedMessage ret = EhspsServiceRequestError; |
|
199 iResult->ResetData(); |
|
200 if ( IsActive() ) |
|
201 { |
|
202 Cancel(); |
|
203 ret = EhspsServiceRequestCanceled; |
|
204 } |
|
205 else |
|
206 { |
|
207 ret = EhspsServiceRequestError; |
|
208 } |
|
209 return ret; |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // ChspsClient::hspsReinstallConf |
|
214 // (other items were commented in a header). |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsReinstallConf( |
|
218 TInt aAppUid, |
|
219 TInt aConfUid ) |
|
220 { |
|
221 ThspsServiceCompletedMessage ret = EhspsReinstallConfFailed; |
|
222 |
|
223 ThspsParamReinstallConf params; |
|
224 params.appUid = aAppUid; |
|
225 params.confUId = aConfUid; |
|
226 |
|
227 ret = ( ThspsServiceCompletedMessage )iSession.ReinstallConf( iResultData, params ); |
|
228 |
|
229 UpdatehspsResult( iResultData ); |
|
230 |
|
231 return ret; |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // ChspsClient::hspsGetListHeaders |
|
236 // (other items were commented in a header). |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsGetListHeaders( |
|
240 const ChspsODT& aSearchMask, |
|
241 const TBool aCopyLogos, |
|
242 CArrayPtrFlat<ChspsODT>& aHeaderList ) |
|
243 { |
|
244 ThspsServiceCompletedMessage ret = EhspsServiceRequestError; |
|
245 TBuf8<KMaxHeaderDataLength8> headerData; |
|
246 TInt errorCode = 0; |
|
247 iHeaderList = &aHeaderList; |
|
248 if (iSearchMaskData) |
|
249 { |
|
250 delete iSearchMaskData; |
|
251 iSearchMaskData = NULL; |
|
252 } |
|
253 TRAP(errorCode, iSearchMaskData = aSearchMask.MarshalHeaderL()); |
|
254 if (errorCode) |
|
255 { |
|
256 ret = EhspsServiceRequestError; |
|
257 iResult->iSystemError = errorCode; |
|
258 iResult->iXuikonError = errorCode; |
|
259 } |
|
260 else |
|
261 { |
|
262 iODTMode = ETrue; |
|
263 if ( IsActive() ) |
|
264 { |
|
265 // cancel previous subscription first |
|
266 hspsCancelGetListHeaders(); |
|
267 } |
|
268 ret = (ThspsServiceCompletedMessage)iSession.GetListHeaders( |
|
269 iResultData, |
|
270 iSearchMaskData->Des(), |
|
271 aCopyLogos, |
|
272 headerData ); |
|
273 |
|
274 #ifdef HSPS_LOG_ACTIVE |
|
275 if( iLogBus ) |
|
276 { |
|
277 iLogBus->LogText( _L( "ChspsClient::hspsGetListHeaders(): - theme query sent for RootUid %d." ), |
|
278 aSearchMask.RootUid() ); |
|
279 } |
|
280 #endif |
|
281 |
|
282 UpdatehspsResult( iResultData ); |
|
283 } |
|
284 return ret; |
|
285 } |
|
286 |
|
287 |
|
288 // ----------------------------------------------------------------------------- |
|
289 // ChspsClient::hspsGetListHeaders |
|
290 // (other items were commented in a header). |
|
291 // ----------------------------------------------------------------------------- |
|
292 // |
|
293 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsGetListHeaders(const TDesC8& /*aSearchMaskData*/, |
|
294 CArrayPtrSeg<HBufC8>& /*aHeaderDataList*/) |
|
295 { |
|
296 return EhspsServiceNotSupported; |
|
297 } |
|
298 |
|
299 // ----------------------------------------------------------------------------- |
|
300 // ChspsClient::hspsGetNextHeader() |
|
301 // (other items were commented in a header). |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsGetNextHeader() |
|
305 { |
|
306 ThspsServiceCompletedMessage ret = EhspsServiceRequestError; |
|
307 iResult->ResetData(); |
|
308 if ( !IsActive() ) |
|
309 { |
|
310 iCancelRequestMessage = EhspsCancelGetListHeaders; |
|
311 iStatus = KRequestPending; |
|
312 SetActive(); |
|
313 iSession.GetNextHeader( iResultData, iHeaderData, iStatus ); |
|
314 iSubscription = ETrue; |
|
315 |
|
316 #ifdef HSPS_LOG_ACTIVE |
|
317 if( iLogBus ) |
|
318 { |
|
319 iLogBus->LogText( _L( "ChspsClient::hspsGetNextHeader(): - themes subscribed." ) ); |
|
320 } |
|
321 #endif |
|
322 |
|
323 ret = EhspsServiceRequestSheduled; |
|
324 } |
|
325 else |
|
326 { |
|
327 ret = EhspsServiceRequestError; |
|
328 } |
|
329 return ret; |
|
330 } |
|
331 |
|
332 // ----------------------------------------------------------------------------- |
|
333 // ChspsClient::hspsCancelGetListHeaders() |
|
334 // (other items were commented in a header). |
|
335 // ----------------------------------------------------------------------------- |
|
336 // |
|
337 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsCancelGetListHeaders() |
|
338 { |
|
339 ThspsServiceCompletedMessage ret = EhspsServiceRequestError; |
|
340 iResult->ResetData(); |
|
341 if ( IsActive() ) |
|
342 { |
|
343 iSubscription = EFalse; |
|
344 Cancel(); |
|
345 ret = EhspsServiceRequestCanceled; |
|
346 } |
|
347 else |
|
348 { |
|
349 ret = EhspsServiceRequestError; |
|
350 } |
|
351 return ret; |
|
352 } |
|
353 |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // ChspsClient::hspsSetActiveTheme |
|
357 // (other items were commented in a header). |
|
358 // ----------------------------------------------------------------------------- |
|
359 // |
|
360 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsSetActiveTheme(const ChspsODT& aSetMask, |
|
361 ChspsODT& aHeader) |
|
362 { |
|
363 TInt errorCode = 0; |
|
364 ThspsServiceCompletedMessage ret = EhspsSetActiveThemeFailed; |
|
365 TBuf8<KMaxHeaderDataLength8> headerData; |
|
366 if (iSetMaskData) |
|
367 { |
|
368 delete iSetMaskData; |
|
369 iSetMaskData = NULL; |
|
370 } |
|
371 TRAP( errorCode, iSetMaskData = aSetMask.MarshalHeaderL() ); |
|
372 if ( errorCode ) |
|
373 { |
|
374 ret = EhspsServiceRequestError; |
|
375 iResult->iSystemError = errorCode; |
|
376 iResult->iXuikonError = errorCode; |
|
377 } |
|
378 else |
|
379 { |
|
380 #ifdef HSPS_LOG_ACTIVE |
|
381 if( iLogBus ) |
|
382 { |
|
383 iLogBus->LogText( _L( "ChspsClient::hspsSetActiveTheme(): - requested for: AppUid = %d, ThemeUid = %d." ), |
|
384 aSetMask.RootUid(), |
|
385 aSetMask.ThemeUid() ); |
|
386 } |
|
387 #endif |
|
388 |
|
389 ret = (ThspsServiceCompletedMessage)iSession.SetActiveTheme( iResultData, |
|
390 iSetMaskData->Des(), headerData ); |
|
391 if (ret == EhspsSetActiveThemeSuccess) |
|
392 { |
|
393 TRAP(errorCode, aHeader.UnMarshalHeaderL(headerData)); |
|
394 if ( errorCode ) |
|
395 { |
|
396 ret = EhspsServiceRequestError; |
|
397 iResult->iSystemError = errorCode; |
|
398 iResult->iXuikonError = errorCode; |
|
399 |
|
400 #ifdef HSPS_LOG_ACTIVE |
|
401 if( iLogBus ) |
|
402 { |
|
403 iLogBus->LogText( _L( "ChspsClient::hspsSetActiveTheme(): - failed, bad ODT returned, system error %d." ), |
|
404 errorCode ); |
|
405 } |
|
406 #endif |
|
407 } |
|
408 else |
|
409 { |
|
410 #ifdef HSPS_LOG_ACTIVE |
|
411 if( iLogBus ) |
|
412 { |
|
413 iLogBus->LogText( _L( "ChspsClient::hspsSetActiveTheme(): - activated for AppUid = %d, ThemeUid = %d." ), |
|
414 aHeader.RootUid(), |
|
415 aHeader.ThemeUid() ); |
|
416 } |
|
417 #endif |
|
418 |
|
419 UpdatehspsResult( iResultData ); |
|
420 } |
|
421 } |
|
422 else |
|
423 { |
|
424 UpdatehspsResult( iResultData ); |
|
425 } |
|
426 } |
|
427 return ret; |
|
428 } |
|
429 |
|
430 |
|
431 // ----------------------------------------------------------------------------- |
|
432 // ChspsClient::hspsRestoreDefault |
|
433 // (other items were commented in a header). |
|
434 // ----------------------------------------------------------------------------- |
|
435 // |
|
436 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsRestoreDefault(const ChspsODT& aSetMask, |
|
437 ChspsODT& aHeader) |
|
438 { |
|
439 TInt errorCode = 0; |
|
440 ThspsServiceCompletedMessage ret = EhspsRestoreDefaultFailed; |
|
441 TBuf8<KMaxHeaderDataLength8> headerData; |
|
442 if ( iSetMaskData ) |
|
443 { |
|
444 delete iSetMaskData; |
|
445 iSetMaskData = NULL; |
|
446 } |
|
447 |
|
448 TRAP( errorCode, iSetMaskData = aSetMask.MarshalHeaderL() ); |
|
449 if ( errorCode ) |
|
450 { |
|
451 ret = EhspsServiceRequestError; |
|
452 iResult->iSystemError = errorCode; |
|
453 iResult->iXuikonError = errorCode; |
|
454 } |
|
455 else |
|
456 { |
|
457 ret = ( ThspsServiceCompletedMessage )iSession.RestoreDefault( iResultData, |
|
458 iSetMaskData->Des(), headerData ); |
|
459 if ( ret == EhspsRestoreDefaultSuccess ) |
|
460 { |
|
461 TRAP( errorCode, aHeader.UnMarshalHeaderL( headerData ) ); |
|
462 if ( errorCode ) |
|
463 { |
|
464 ret = EhspsServiceRequestError; |
|
465 iResult->iSystemError = errorCode; |
|
466 iResult->iXuikonError = errorCode; |
|
467 } |
|
468 else |
|
469 { |
|
470 UpdatehspsResult( iResultData ); |
|
471 } |
|
472 } |
|
473 else |
|
474 { |
|
475 UpdatehspsResult( iResultData ); |
|
476 } |
|
477 } |
|
478 return ret; |
|
479 } |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // ChspsClient::hspsSetRemoveThemeL |
|
483 // (other items were commented in a header). |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsRemoveThemeL(const ChspsODT& aSetMask) |
|
487 { |
|
488 TInt errorCode = 0; |
|
489 ThspsServiceCompletedMessage ret = EhspsRemoveThemeFailed; |
|
490 if (iSetMaskData) |
|
491 { |
|
492 delete iSetMaskData; |
|
493 iSetMaskData = NULL; |
|
494 } |
|
495 TRAP(errorCode, iSetMaskData = aSetMask.MarshalHeaderL()); |
|
496 if (errorCode) |
|
497 { |
|
498 ret = EhspsServiceRequestError; |
|
499 iResult->iSystemError = errorCode; |
|
500 iResult->iXuikonError = errorCode; |
|
501 } |
|
502 else |
|
503 { |
|
504 ret = (ThspsServiceCompletedMessage)iSession.RemoveTheme(iResultData, iSetMaskData->Des()); |
|
505 UpdatehspsResult( iResultData ); |
|
506 } |
|
507 return ret; |
|
508 } |
|
509 |
|
510 |
|
511 // ----------------------------------------------------------------------------- |
|
512 // ChspsClient::hspsSetActiveTheme |
|
513 // (other items were commented in a header). |
|
514 // ----------------------------------------------------------------------------- |
|
515 // |
|
516 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsSetActiveTheme(const TDesC8& /*aSetMaskData*/ |
|
517 , TDes8& /*aHeaderData*/) |
|
518 { |
|
519 return EhspsServiceNotSupported; |
|
520 } |
|
521 |
|
522 |
|
523 // ----------------------------------------------------------------------------- |
|
524 // ChspsRequestClient::GethspsResultL |
|
525 // ?implementation_description |
|
526 // (other items were commented in a header). |
|
527 // ----------------------------------------------------------------------------- |
|
528 // |
|
529 EXPORT_C void ChspsClient::GethspsResult(ChspsResult& aResult) |
|
530 { |
|
531 aResult.iSystemError = iResult->iSystemError; |
|
532 aResult.iXuikonError = iResult->iXuikonError; |
|
533 aResult.iIntValue1 = iResult->iIntValue1; |
|
534 aResult.iIntValue2 = iResult->iIntValue2; |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // ChspsClient::hspsGetHeaders |
|
539 // (other items were commented in a header). |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 EXPORT_C TInt ChspsClient::hspsGetHeaders( |
|
543 const ChspsODT& aSearchMask, |
|
544 const TBool aCopyLogos, |
|
545 CArrayPtrFlat<ChspsODT>& aHeaderList ) |
|
546 { |
|
547 iHeaderList = &aHeaderList; |
|
548 // Convert search mask ODT to binary stream |
|
549 if (iSearchMaskData) |
|
550 { |
|
551 delete iSearchMaskData; |
|
552 iSearchMaskData = NULL; |
|
553 } |
|
554 TRAPD( err, iSearchMaskData = aSearchMask.MarshalHeaderL() ); |
|
555 |
|
556 if ( err == KErrNone ) |
|
557 { |
|
558 // Get the header count |
|
559 ThspsServiceCompletedMessage ret = |
|
560 ( ThspsServiceCompletedMessage )iSession.GetListHeaders( |
|
561 iResultData, |
|
562 iSearchMaskData->Des(), |
|
563 aCopyLogos, |
|
564 iHeaderData ); |
|
565 |
|
566 if ( ret == EhspsGetListHeadersSuccess ) |
|
567 { |
|
568 // Header count > 0 |
|
569 UpdatehspsResult( iResultData ); |
|
570 TInt headerCount = iResult->iIntValue1; |
|
571 // Get headers |
|
572 for ( TInt i = 0; |
|
573 i < headerCount && err == KErrNone; |
|
574 i++ ) |
|
575 { |
|
576 ret = ( ThspsServiceCompletedMessage )iSession.GetNextHeader( |
|
577 iResultData, |
|
578 iHeaderData ); |
|
579 if ( ret == EhspsGetListHeadersUpdate ) |
|
580 { |
|
581 TRAP( err, AppendHeaderListL( iHeaderData) ); |
|
582 } |
|
583 else |
|
584 { |
|
585 // Request failed |
|
586 err = KErrGeneral; |
|
587 } |
|
588 } |
|
589 } |
|
590 else if ( ret == EhspsGetListHeadersEmpty ) |
|
591 { |
|
592 // Empty header list |
|
593 err = KErrNotFound; |
|
594 } |
|
595 else |
|
596 { |
|
597 // Header count request failed |
|
598 err = KErrGeneral; |
|
599 } |
|
600 } |
|
601 |
|
602 return err; |
|
603 } |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // ChspsClient::hspsAddPlugin |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsAddPlugin( |
|
610 const TInt aAppUid, |
|
611 const TInt aConfId, |
|
612 const TInt aPluginUid, |
|
613 const TInt aPosition, |
|
614 TInt& aAddedPluginId ) |
|
615 { |
|
616 ThspsServiceCompletedMessage ret = EhspsAddPluginFailed; |
|
617 |
|
618 if ( aAppUid > 0 && aPluginUid > 0 ) |
|
619 { |
|
620 ThpsParamAddPlugin params; |
|
621 params.appUid = aAppUid; |
|
622 params.configurationId = aConfId; |
|
623 params.pluginUid = aPluginUid; |
|
624 params.positionIndex = aPosition; |
|
625 |
|
626 // Try adding the plugin configuration |
|
627 ret = ( ThspsServiceCompletedMessage )iSession.AddPlugin( iResultData, params, aAddedPluginId ); |
|
628 |
|
629 // Get error codes from the server op. |
|
630 UpdatehspsResult( iResultData ); |
|
631 } |
|
632 |
|
633 return ret; |
|
634 } |
|
635 |
|
636 // ----------------------------------------------------------------------------- |
|
637 // ChspsClient::hspsRemovePlugin |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsRemovePlugin( |
|
641 const TInt aAppUid, |
|
642 const TInt aPluginId ) |
|
643 { |
|
644 ThspsServiceCompletedMessage ret = EhspsRemovePluginFailed; |
|
645 |
|
646 if ( aAppUid > 0 && aPluginId > 0 ) |
|
647 { |
|
648 ThpsParamRemovePlugin params; |
|
649 params.appUid = aAppUid; |
|
650 params.pluginId = aPluginId; |
|
651 |
|
652 // Try removing the plugin configuration instance |
|
653 ret = ( ThspsServiceCompletedMessage )iSession.RemovePlugin( iResultData, params ); |
|
654 |
|
655 // Get error codes from the server op. |
|
656 UpdatehspsResult( iResultData ); |
|
657 } |
|
658 |
|
659 return ret; |
|
660 } |
|
661 |
|
662 // ----------------------------------------------------------------------------- |
|
663 // ChspsClient::hspsSetActivePlugin |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsSetActivePlugin( const TInt aAppUid, |
|
667 const TInt aPluginId ) |
|
668 { |
|
669 ThspsServiceCompletedMessage ret = EhspsSetActivePluginFailed; |
|
670 |
|
671 if( aPluginId > 0 ) |
|
672 { |
|
673 ThpsParamSetActivePlugin params; |
|
674 params.appUid = aAppUid; |
|
675 params.pluginId = aPluginId; |
|
676 |
|
677 // Try activation. |
|
678 ret = ( ThspsServiceCompletedMessage )iSession.SetActivePlugin( iResultData, params ); |
|
679 |
|
680 // Get error codes from the server op. |
|
681 UpdatehspsResult( iResultData ); |
|
682 } |
|
683 |
|
684 return ret; |
|
685 } |
|
686 |
|
687 // ----------------------------------------------------------------------------- |
|
688 // ChspsClient::hspsReplacePlugin |
|
689 // ----------------------------------------------------------------------------- |
|
690 // |
|
691 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsReplacePlugin( |
|
692 const TInt aAppUid, |
|
693 const TInt aPluginId, |
|
694 const TInt aConfUid ) |
|
695 { |
|
696 ThspsServiceCompletedMessage ret = EhspsReplacePluginFailed; |
|
697 |
|
698 if ( aPluginId > 0 && aConfUid > 0 ) |
|
699 { |
|
700 ThspsParamReplacePlugin params; |
|
701 params.appUid = aAppUid; |
|
702 params.pluginId = aPluginId; |
|
703 params.confUid = aConfUid; |
|
704 |
|
705 // Try adding the plugin configuration |
|
706 ret = ( ThspsServiceCompletedMessage )iSession.ReplacePlugin( iResultData, params ); |
|
707 |
|
708 // Get error codes from the server op. |
|
709 UpdatehspsResult( iResultData ); |
|
710 } |
|
711 |
|
712 return ret; |
|
713 } |
|
714 |
|
715 // ----------------------------------------------------------------------------- |
|
716 // ChspsClient::hspsSetPluginSettings |
|
717 // ----------------------------------------------------------------------------- |
|
718 // |
|
719 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsSetPluginSettings( |
|
720 const ChspsODT& aHeader, |
|
721 const TInt aPluginId, |
|
722 ChspsDomDocument& aDom, |
|
723 const TBool aPluginStoringStatus ) |
|
724 { |
|
725 ThspsServiceCompletedMessage ret = EhspsSetPluginSettingsFailed; |
|
726 |
|
727 TInt errorCode = 0; |
|
728 TBuf8<KMaxHeaderDataLength8> searchMaskData; |
|
729 HBufC8* temp = NULL; |
|
730 HBufC8* tempDom = NULL; |
|
731 |
|
732 TRAP( errorCode, temp = aHeader.MarshalHeaderL() ); |
|
733 TRAP( errorCode, tempDom = aDom.MarshallL() ); |
|
734 |
|
735 if( errorCode ) |
|
736 { |
|
737 ret = EhspsServiceRequestError; |
|
738 iResult->iSystemError = errorCode; |
|
739 iResult->iXuikonError = errorCode; |
|
740 } |
|
741 else |
|
742 { |
|
743 searchMaskData = temp->Des(); |
|
744 TPtr8 tempDomPtr = tempDom->Des(); |
|
745 |
|
746 ThspsParamSetPluginSettings params; |
|
747 params.pluginId = aPluginId; |
|
748 params.storingStatus = aPluginStoringStatus; |
|
749 |
|
750 |
|
751 // Try set settings of the plugin Id given in params |
|
752 ret = ( ThspsServiceCompletedMessage )iSession.SetPluginSettings( iResultData, searchMaskData, params, tempDomPtr ); |
|
753 // Get error codes from the server op. |
|
754 UpdatehspsResult( iResultData ); |
|
755 } |
|
756 |
|
757 delete tempDom; |
|
758 delete temp; |
|
759 return ret; |
|
760 } |
|
761 |
|
762 // ----------------------------------------------------------------------------- |
|
763 // ChspsClient::hspsGetPluginDomL |
|
764 // ----------------------------------------------------------------------------- |
|
765 // |
|
766 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsGetPluginOdtL( |
|
767 const TInt aAppUid, |
|
768 const TInt aPluginUid, |
|
769 ChspsODT* aPluginOdt ) |
|
770 { |
|
771 ThspsServiceCompletedMessage ret = EhspsGetPluginOdtFailed; |
|
772 |
|
773 if ( aAppUid > 0 && aPluginUid > 0 ) |
|
774 { |
|
775 ThspsParamGetPluginOdt params; |
|
776 params.appUid = aAppUid; |
|
777 params.pluginUid = aPluginUid; |
|
778 TPath odtPath; |
|
779 |
|
780 ret = ( ThspsServiceCompletedMessage )iSession.GetPluginOdt( iResultData, params, odtPath ); |
|
781 |
|
782 // Get error codes from the server op. |
|
783 UpdatehspsResult( iResultData ); |
|
784 |
|
785 if( ret == EhspsGetPluginOdtSuccess ) |
|
786 { |
|
787 // Streaming odt from file |
|
788 TInt success = StreamOdtL( odtPath, aAppUid, aPluginOdt ); |
|
789 |
|
790 if( success != KErrNone ) |
|
791 { |
|
792 ret = EhspsGetPluginOdtFailed; |
|
793 } |
|
794 } |
|
795 } |
|
796 return ret; |
|
797 } |
|
798 |
|
799 // ----------------------------------------------------------------------------- |
|
800 // ChspsClient::hspsMovePluginsL |
|
801 // ----------------------------------------------------------------------------- |
|
802 // |
|
803 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsMovePluginsL( |
|
804 const TInt aAppUid, |
|
805 const TInt aConfId, |
|
806 const CArrayFixFlat<TInt>& aPluginIdList ) |
|
807 { |
|
808 ThspsServiceCompletedMessage ret = EhspsMovePluginsFailed; |
|
809 |
|
810 if ( aAppUid > 0 && aConfId > 0 && aPluginIdList.Count() ) |
|
811 { |
|
812 ThpsParamMovePlugins params; |
|
813 params.appUid = aAppUid; |
|
814 params.configurationId = aConfId; |
|
815 |
|
816 // Setup an array that can be externalized |
|
817 const TInt KGranularity = 6; |
|
818 ChspsPluginIdList* idArray = new ( ELeave )ChspsPluginIdList( KGranularity ); |
|
819 CleanupStack::PushL( idArray ); |
|
820 for( TInt idIndex=0; idIndex < aPluginIdList.Count(); idIndex++ ) |
|
821 { |
|
822 idArray->AppendL( aPluginIdList.At(idIndex) ); |
|
823 } |
|
824 |
|
825 // Externalize array into the params.pluginIdBuf descriptor |
|
826 RDesWriteStream writeBuf( params.pluginIdsBuf ); |
|
827 CleanupClosePushL( writeBuf ); |
|
828 TRAPD( errorCode, idArray->ExternalizeL( writeBuf ) ); |
|
829 CleanupStack::PopAndDestroy( &writeBuf ); |
|
830 |
|
831 if ( !errorCode ) |
|
832 { |
|
833 // Try updating of the plugins list |
|
834 ret = ( ThspsServiceCompletedMessage )iSession.MovePlugins( iResultData, params ); |
|
835 |
|
836 // Get error codes from the server op. |
|
837 UpdatehspsResult( iResultData ); |
|
838 } |
|
839 |
|
840 CleanupStack::PopAndDestroy( idArray ); |
|
841 } |
|
842 |
|
843 return ret; |
|
844 } |
|
845 |
|
846 // ----------------------------------------------------------------------------- |
|
847 // ChspsClient::hspsSetConfState |
|
848 // ----------------------------------------------------------------------------- |
|
849 // |
|
850 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsSetConfState( |
|
851 const TInt aAppUid, |
|
852 const TInt aConfId, |
|
853 const ThspsConfigurationState aState, |
|
854 const ThspsConfStateChangeFilter aFilter ) |
|
855 { |
|
856 ThspsServiceCompletedMessage ret = EhspsSetConfStateFailed; |
|
857 |
|
858 ThspsParamSetConfState params; |
|
859 params.appUid = aAppUid; |
|
860 params.confId = aConfId; |
|
861 params.state = aState; |
|
862 params.filter = aFilter; |
|
863 |
|
864 ret = ( ThspsServiceCompletedMessage )iSession.SetConfState( iResultData, params ); |
|
865 |
|
866 UpdatehspsResult( iResultData ); |
|
867 |
|
868 return ret; |
|
869 } |
|
870 |
|
871 // ----------------------------------------------------------------------------- |
|
872 // ChspsClient::hspsRestoreActiveAppConf |
|
873 // ----------------------------------------------------------------------------- |
|
874 // |
|
875 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsRestoreActiveAppConf( |
|
876 const TInt aAppUid ) |
|
877 { |
|
878 ThspsServiceCompletedMessage ret = EhspsRestoreActiveAppConfFailed; |
|
879 |
|
880 ThspsParamRestoreActiveAppConf params; |
|
881 params.appUid = aAppUid; |
|
882 |
|
883 ret = ( ThspsServiceCompletedMessage )iSession.RestoreActiveAppConf( iResultData, params ); |
|
884 |
|
885 UpdatehspsResult( iResultData ); |
|
886 |
|
887 return ret; |
|
888 } |
|
889 |
|
890 |
|
891 // ----------------------------------------------------------------------------- |
|
892 // ChspsClient::hspsRestoreConfigurations |
|
893 // ----------------------------------------------------------------------------- |
|
894 // |
|
895 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsRestoreConfigurations( |
|
896 const TInt aAppUid, |
|
897 const ThspsRestore aRestore ) |
|
898 { |
|
899 ThspsServiceCompletedMessage ret = EhspsRestoreConfigurationsFailed; |
|
900 |
|
901 ThspsParamRestoreConfigurations params; |
|
902 params.appUid = aAppUid; |
|
903 params.restore = aRestore; |
|
904 |
|
905 ret = ( ThspsServiceCompletedMessage )iSession.RestoreConfigurations( iResultData, params ); |
|
906 |
|
907 UpdatehspsResult( iResultData ); |
|
908 |
|
909 return ret; |
|
910 } |
|
911 |
|
912 // ----------------------------------------------------------------------------- |
|
913 // ChspsClient::hspsPluginUpdateL |
|
914 // ----------------------------------------------------------------------------- |
|
915 // |
|
916 EXPORT_C ThspsServiceCompletedMessage ChspsClient::hspsPluginUpdateL( |
|
917 const ChspsODT& /*aPluginUid*/ ) |
|
918 { |
|
919 return EhspsUpdatePluginFailed; |
|
920 } |
|
921 |
|
922 // ----------------------------------------------------------------------------- |
|
923 // ChspsClient::SetLogBus |
|
924 // Set log bus. |
|
925 // ----------------------------------------------------------------------------- |
|
926 #ifdef HSPS_LOG_ACTIVE |
|
927 EXPORT_C void ChspsClient::SetLogBus( void* aLogBus ) |
|
928 { |
|
929 iLogBus = (ChspsLogBus*)aLogBus; |
|
930 } |
|
931 #else |
|
932 EXPORT_C void ChspsClient::SetLogBus( void* /*aLogBus*/ ) |
|
933 { |
|
934 } |
|
935 #endif |
|
936 |
|
937 // ----------------------------------------------------------------------------- |
|
938 // ChspsClient::UpdatehspsResult |
|
939 // (other items were commented in a header). |
|
940 // ----------------------------------------------------------------------------- |
|
941 // |
|
942 void ChspsClient::UpdatehspsResult( TDesC8& aResultData ) |
|
943 { |
|
944 TInt errorCode = KErrNone; |
|
945 if( aResultData.Length() ) |
|
946 { |
|
947 RDesReadStream readBuf(iResultData); |
|
948 TRAP( errorCode, iResult->InternalizeL( readBuf ) ); |
|
949 readBuf.Close(); |
|
950 if( errorCode ) |
|
951 { |
|
952 iResult->ResetData(); |
|
953 } |
|
954 } |
|
955 else |
|
956 { |
|
957 iResult->ResetData(); |
|
958 } |
|
959 } |
|
960 |
|
961 // ----------------------------------------------------------------------------- |
|
962 // ChspsClient::AppendHeaderListL |
|
963 // (other items were commented in a header). |
|
964 // ----------------------------------------------------------------------------- |
|
965 // |
|
966 void ChspsClient::AppendHeaderListL( TDesC8& aHeaderData ) |
|
967 { |
|
968 ChspsODT* header = ChspsODT::NewL(); |
|
969 CleanupStack::PushL( header ); |
|
970 header->UnMarshalHeaderL( aHeaderData ); |
|
971 iHeaderList->AppendL( header ); |
|
972 CleanupStack::Pop( header ); |
|
973 } |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // ChspsClient::RunError |
|
977 // From CActive. Called when error occurred in asynchronous request |
|
978 // Notifies the observer |
|
979 // (other items were commented in a header). |
|
980 // ----------------------------------------------------------------------------- |
|
981 // |
|
982 TInt ChspsClient::RunError( TInt aError ) |
|
983 { |
|
984 iResult->iSystemError = aError; |
|
985 iResult->iXuikonError = aError; |
|
986 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
987 return KErrNone; |
|
988 } |
|
989 |
|
990 |
|
991 // ----------------------------------------------------------------------------- |
|
992 // ChspsClient::RunL() |
|
993 // (other items were commented in a header). |
|
994 // ----------------------------------------------------------------------------- |
|
995 // |
|
996 void ChspsClient::RunL() |
|
997 { |
|
998 TInt errorCode = KErrNone; |
|
999 switch ( iStatus.Int() ) |
|
1000 { |
|
1001 // the server has completed the request, signalled the client |
|
1002 // thread and the clients active scheduler runs the active object. |
|
1003 // Now do something with it |
|
1004 case EhspsInstallThemeSuccess: |
|
1005 // the request was successful and installation is completed |
|
1006 if ( iODTMode ) |
|
1007 { |
|
1008 TRAP( errorCode, iHeader->UnMarshalHeaderL(iHeaderData) ); |
|
1009 if ( errorCode ) |
|
1010 { |
|
1011 iResult->iSystemError = errorCode; |
|
1012 iResult->iXuikonError = errorCode; |
|
1013 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1014 } |
|
1015 else |
|
1016 { |
|
1017 UpdatehspsResult( iResultData ); |
|
1018 iObserver.HandlehspsClientMessage(EhspsInstallThemeSuccess); |
|
1019 } |
|
1020 } |
|
1021 else |
|
1022 { |
|
1023 UpdatehspsResult( iResultData ); |
|
1024 iObserver.HandlehspsClientMessage(EhspsInstallThemeSuccess); |
|
1025 } |
|
1026 |
|
1027 break; |
|
1028 |
|
1029 case EhspsInstallPhaseSuccess: |
|
1030 // the request was successful |
|
1031 if ( iODTMode ) |
|
1032 { |
|
1033 TRAP( errorCode, iHeader->UnMarshalHeaderL(iHeaderData)); |
|
1034 if ( errorCode ) |
|
1035 { |
|
1036 iResult->iSystemError = errorCode; |
|
1037 iResult->iXuikonError = errorCode; |
|
1038 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1039 } |
|
1040 else |
|
1041 { |
|
1042 UpdatehspsResult( iResultData ); |
|
1043 iObserver.HandlehspsClientMessage(EhspsInstallPhaseSuccess); |
|
1044 // send request to install next phase |
|
1045 hspsInstallNextPhaseL( *iHeader ); |
|
1046 } |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 UpdatehspsResult( iResultData ); |
|
1051 // send request to install next phase |
|
1052 iObserver.HandlehspsClientMessage(EhspsInstallPhaseSuccess); |
|
1053 hspsInstallNextPhaseL(iHeaderData); |
|
1054 } |
|
1055 break; |
|
1056 |
|
1057 case EhspsInstallThemeFailed: |
|
1058 // the request was unsuccessful |
|
1059 UpdatehspsResult( iResultData ); |
|
1060 iObserver.HandlehspsClientMessage( EhspsInstallThemeFailed ); |
|
1061 break ; |
|
1062 |
|
1063 case EhspsGetListHeadersUpdate: |
|
1064 if (iODTMode) |
|
1065 { |
|
1066 ChspsODT* odt = ChspsODT::NewL(); |
|
1067 CleanupStack::PushL( odt ); |
|
1068 odt->UnMarshalHeaderL(iHeaderData); |
|
1069 iHeaderList->AppendL(odt); |
|
1070 CleanupStack::Pop( odt ); |
|
1071 // inform observer |
|
1072 if (errorCode ) |
|
1073 { |
|
1074 iResult->iSystemError = errorCode; |
|
1075 iResult->iXuikonError = errorCode; |
|
1076 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1077 } |
|
1078 else |
|
1079 { |
|
1080 UpdatehspsResult( iResultData ); |
|
1081 |
|
1082 #ifdef HSPS_LOG_ACTIVE |
|
1083 if( iLogBus ) |
|
1084 { |
|
1085 iLogBus->LogText( _L( "ChspsClient::RunL(): - a theme header received. AppUid = %d, ThemeUid = %d." ), |
|
1086 odt->RootUid(), |
|
1087 odt->ThemeUid() ); |
|
1088 } |
|
1089 #endif |
|
1090 |
|
1091 iObserver.HandlehspsClientMessage( EhspsGetListHeadersUpdate ); |
|
1092 |
|
1093 // request next |
|
1094 hspsGetNextHeader(); |
|
1095 } |
|
1096 } |
|
1097 else |
|
1098 { |
|
1099 HBufC8* hd = iHeaderData.AllocL(); |
|
1100 CleanupStack::PushL( hd ); |
|
1101 iHeaderDataList->AppendL(hd); |
|
1102 CleanupStack::Pop( hd ); |
|
1103 |
|
1104 // inform observer |
|
1105 if (errorCode ) |
|
1106 { |
|
1107 iResult->iSystemError = errorCode; |
|
1108 iResult->iXuikonError = errorCode; |
|
1109 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1110 } |
|
1111 else |
|
1112 { |
|
1113 UpdatehspsResult( iResultData ); |
|
1114 iObserver.HandlehspsClientMessage( EhspsGetListHeadersUpdateData ); |
|
1115 // request next |
|
1116 hspsGetNextHeader(); |
|
1117 } |
|
1118 } |
|
1119 break; |
|
1120 |
|
1121 case EhspsGetListHeadersRestart: |
|
1122 // header list has changed radically |
|
1123 // resetting the list and start filling it again |
|
1124 if (iODTMode) |
|
1125 { |
|
1126 // resetting and start filling the header list again |
|
1127 iHeaderList->ResetAndDestroy(); |
|
1128 ChspsODT* odt = ChspsODT::NewL(); |
|
1129 CleanupStack::PushL( odt ); |
|
1130 odt->UnMarshalHeaderL(iHeaderData); |
|
1131 iHeaderList->AppendL(odt); |
|
1132 CleanupStack::Pop( odt ); |
|
1133 |
|
1134 // inform observer |
|
1135 if (errorCode ) |
|
1136 { |
|
1137 iResult->iSystemError = errorCode; |
|
1138 iResult->iXuikonError = errorCode; |
|
1139 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1140 } |
|
1141 else |
|
1142 { |
|
1143 UpdatehspsResult( iResultData ); |
|
1144 |
|
1145 #ifdef HSPS_LOG_ACTIVE |
|
1146 if( iLogBus ) |
|
1147 { |
|
1148 iLogBus->LogText( _L( "ChspsClient::RunL(): - list restarted." ) ); |
|
1149 } |
|
1150 #endif |
|
1151 |
|
1152 iObserver.HandlehspsClientMessage( EhspsGetListHeadersRestart ); |
|
1153 // request next |
|
1154 hspsGetNextHeader(); |
|
1155 } |
|
1156 } |
|
1157 else |
|
1158 { |
|
1159 // resetting and starting filling the header data list again |
|
1160 iHeaderDataList->Reset(); |
|
1161 HBufC8* hd = iHeaderData.AllocL(); |
|
1162 CleanupStack::PushL( hd ); |
|
1163 iHeaderDataList->AppendL(hd); |
|
1164 CleanupStack::Pop( hd ); |
|
1165 |
|
1166 // inform observer |
|
1167 if ( errorCode ) |
|
1168 { |
|
1169 iResult->iSystemError = errorCode; |
|
1170 iResult->iXuikonError = errorCode; |
|
1171 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1172 } |
|
1173 else |
|
1174 { |
|
1175 UpdatehspsResult( iResultData ); |
|
1176 iObserver.HandlehspsClientMessage( EhspsGetListHeadersRestartData ); |
|
1177 // request next |
|
1178 hspsGetNextHeader(); |
|
1179 } |
|
1180 } |
|
1181 break; |
|
1182 |
|
1183 case EhspsGetListHeadersEmpty: |
|
1184 // header list is empty |
|
1185 UpdatehspsResult( iResultData ); |
|
1186 if (iODTMode) |
|
1187 { |
|
1188 // resetting and start filling the header list again |
|
1189 iHeaderList->ResetAndDestroy(); |
|
1190 |
|
1191 #ifdef HSPS_LOG_ACTIVE |
|
1192 if( iLogBus ) |
|
1193 { |
|
1194 iLogBus->LogText( _L( "ChspsClient::RunL(): - list empty." ) ); |
|
1195 } |
|
1196 #endif |
|
1197 |
|
1198 // inform observer |
|
1199 iObserver.HandlehspsClientMessage(EhspsGetListHeadersEmpty); |
|
1200 } |
|
1201 else |
|
1202 { |
|
1203 iHeaderDataList->Reset(); |
|
1204 // inform observer |
|
1205 iObserver.HandlehspsClientMessage(EhspsGetListHeadersEmpty); |
|
1206 } |
|
1207 // requesting possible update |
|
1208 hspsGetNextHeader(); |
|
1209 break; |
|
1210 |
|
1211 case EhspsGetListHeadersFailed: |
|
1212 // service failure occurred |
|
1213 UpdatehspsResult( iResultData ); |
|
1214 iObserver.HandlehspsClientMessage(EhspsGetListHeadersFailed); |
|
1215 break; |
|
1216 |
|
1217 case EhspsServiceRequestCanceled: |
|
1218 // the request was canceled |
|
1219 UpdatehspsResult( iResultData ); |
|
1220 iObserver.HandlehspsClientMessage( EhspsServiceRequestCanceled ); |
|
1221 break; |
|
1222 |
|
1223 case EhspsServiceNotSupported: |
|
1224 // the request was canceled |
|
1225 UpdatehspsResult( iResultData ); |
|
1226 iObserver.HandlehspsClientMessage( EhspsServiceNotSupported ); |
|
1227 break; |
|
1228 |
|
1229 default: |
|
1230 UpdatehspsResult( iResultData ); |
|
1231 iObserver.HandlehspsClientMessage( EhspsServiceRequestError ); |
|
1232 } |
|
1233 } |
|
1234 |
|
1235 // ----------------------------------------------------------------------------- |
|
1236 // ChspsClient::DoCancel() |
|
1237 // Cancels any outstanding operation. |
|
1238 // (other items were commented in a header). |
|
1239 // ----------------------------------------------------------------------------- |
|
1240 // |
|
1241 void ChspsClient::DoCancel() |
|
1242 { |
|
1243 iSession.CancelRequest( (TInt) iCancelRequestMessage, iResultData ); |
|
1244 } |
|
1245 |
|
1246 // ----------------------------------------------------------------------------- |
|
1247 // ChspsClient::StreamOdtL() |
|
1248 // (other items were commented in a header). |
|
1249 // ----------------------------------------------------------------------------- |
|
1250 // |
|
1251 TInt ChspsClient::StreamOdtL( TDes& aPath, const TInt aAppUid, ChspsODT* aOdt ) |
|
1252 { |
|
1253 TInt errorCode = KErrNotFound; |
|
1254 RFile odtfile; |
|
1255 ThspsConfiguration conf; |
|
1256 conf.rootUid = aAppUid; |
|
1257 // conf.themeUid is not needed in AccessResourceFile() |
|
1258 TInt fileSubSessionHandle; |
|
1259 |
|
1260 // get fs handle |
|
1261 TInt fileServerHandle = iSession.AccessResourceFile( |
|
1262 iResultData, |
|
1263 conf, |
|
1264 aPath, |
|
1265 fileSubSessionHandle ); |
|
1266 |
|
1267 // If we got valid handles |
|
1268 if ( fileServerHandle > 0 && fileSubSessionHandle > 0 ) |
|
1269 { |
|
1270 // Adopt the file |
|
1271 errorCode = odtfile.AdoptFromServer( fileServerHandle, fileSubSessionHandle ); |
|
1272 } |
|
1273 |
|
1274 if ( errorCode != KErrNone ) |
|
1275 { |
|
1276 // Failure |
|
1277 iResult->iSystemError = errorCode; |
|
1278 iResult->iXuikonError = errorCode; |
|
1279 } |
|
1280 else |
|
1281 { |
|
1282 // Success |
|
1283 UpdatehspsResult( iResultData ); |
|
1284 |
|
1285 CleanupClosePushL( odtfile ); |
|
1286 |
|
1287 // set stream on file |
|
1288 CFileStore* store = CDirectFileStore::FromLC( odtfile ); |
|
1289 RStoreReadStream instream; |
|
1290 CleanupClosePushL( instream ); |
|
1291 |
|
1292 instream.OpenLC( *store, store->Root() ); |
|
1293 |
|
1294 // stream in the ODT |
|
1295 instream >> *aOdt; |
|
1296 |
|
1297 TInt count = aOdt->DomDocument().DomNodeCount(); |
|
1298 |
|
1299 // Destroy the stream object and close the instream |
|
1300 #ifdef _DEBUG |
|
1301 CleanupStack::PopAndDestroy( 2, &instream ); |
|
1302 |
|
1303 // Destroy the direct file store object (closes the file) |
|
1304 CleanupStack::PopAndDestroy( store ); |
|
1305 CleanupStack::PopAndDestroy(); // odtfile |
|
1306 #else |
|
1307 CleanupStack::PopAndDestroy(4); |
|
1308 #endif |
|
1309 |
|
1310 errorCode = KErrNone; |
|
1311 } |
|
1312 |
|
1313 |
|
1314 return errorCode; |
|
1315 } |
|
1316 |
|
1317 // End of File |