30
|
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: HSPS Theme Server Session. For more information, see the header.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <f32file.h>
|
|
21 |
|
|
22 |
#include "hsps_builds_cfg.hrh"
|
|
23 |
#ifdef _hsps_PERFORMANCE_TEST_
|
|
24 |
#include "hspstimemon.h"
|
|
25 |
#endif //_hsps_PERFORMANCE_TEST_
|
|
26 |
#include "hspsthemeserversession.h"
|
|
27 |
#include "hspsthemeserver.h"
|
|
28 |
#include "hspsinstallationhandler.h"
|
|
29 |
#include "hspsmaintenancehandler.h"
|
|
30 |
#include "hspsclientrequesthandler.h"
|
|
31 |
#include "hspsserverutil.h"
|
|
32 |
#include "hspsrominstaller.h"
|
|
33 |
#ifdef HSPS_LOG_ACTIVE
|
|
34 |
#include <hspsodtdump.h>
|
|
35 |
#include <hspslogbusfile.h>
|
|
36 |
#endif
|
|
37 |
|
|
38 |
// CONSTANTS
|
|
39 |
|
|
40 |
//
|
|
41 |
//
|
|
42 |
// Class ChspsThemeServerSession
|
|
43 |
//
|
|
44 |
//
|
|
45 |
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
// ChspsThemeServerSession::ChspsThemeServerSession
|
|
48 |
// (other items were commented in a header).
|
|
49 |
// -----------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
ChspsThemeServerSession::ChspsThemeServerSession(
|
|
52 |
const TInt aAppUid ) :
|
|
53 |
iAppUid( aAppUid ),
|
|
54 |
iIconFileCopyRequired( ETrue ),
|
|
55 |
iResourceFileCopyRequired( ETrue )
|
|
56 |
{
|
|
57 |
}
|
|
58 |
|
|
59 |
// -----------------------------------------------------------------------------
|
|
60 |
// ChspsThemeServerSession::ChspsThemeServerSession
|
|
61 |
// 2nd phase construct for sessions - called by the CServer framework
|
|
62 |
// (other items were commented in a header).
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
void ChspsThemeServerSession::CreateL()
|
|
66 |
{
|
|
67 |
#ifdef HSPS_LOG_ACTIVE
|
|
68 |
iLogBus = ChspsLogBusFile::NewL( ChspsLogBusFile::CreateLogFilename( _L("themeserver_session") ) );
|
|
69 |
iLogBus->LogText( _L( "ChspsThemeServerSession::CreateL" ) );
|
|
70 |
iLogBus->LogText( _L( "--------------------------------------------------------" ) );
|
|
71 |
#endif
|
|
72 |
|
|
73 |
Server().AddSession( this );
|
|
74 |
iHoldingResources = EFalse;
|
|
75 |
User::LeaveIfError( iFs.Connect() );
|
|
76 |
Server().CheckConfigurationL( iAppUid );
|
|
77 |
}
|
|
78 |
|
|
79 |
// Destructor
|
|
80 |
ChspsThemeServerSession::~ChspsThemeServerSession()
|
|
81 |
{
|
|
82 |
iFs.Close();
|
|
83 |
|
|
84 |
if ( iInstallationHandler )
|
|
85 |
{
|
|
86 |
delete iInstallationHandler;
|
|
87 |
Server().DefinitionRepository().Unlock();
|
|
88 |
}
|
|
89 |
|
|
90 |
delete iMaintenanceHandler;
|
|
91 |
// decrease number of resource holders if this sessions did hold one
|
|
92 |
if ( iHoldingResources )
|
|
93 |
{
|
|
94 |
Server().DecreaseRequestClientCount();
|
|
95 |
}
|
|
96 |
delete iClientRequestHandler;
|
|
97 |
|
|
98 |
Server().DropSession( this );
|
|
99 |
|
|
100 |
#ifdef HSPS_LOG_ACTIVE
|
|
101 |
if( iLogBus )
|
|
102 |
{
|
|
103 |
iLogBus->LogText( _L( "ChspsThemeServerSession::~ChspsThemeServerSession" ) );
|
|
104 |
iLogBus->LogText( _L( "--------------------------------------------------------" ) );
|
|
105 |
}
|
|
106 |
// Delete as last if another components use this log bus instance.
|
|
107 |
delete iLogBus;
|
|
108 |
iLogBus = NULL;
|
|
109 |
#endif
|
|
110 |
}
|
|
111 |
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
// ChspsThemeServerSession::Server
|
|
114 |
// ?implementation_description
|
|
115 |
// (other items were commented in a header).
|
|
116 |
// -----------------------------------------------------------------------------
|
|
117 |
//
|
|
118 |
inline ChspsThemeServer& ChspsThemeServerSession::Server()
|
|
119 |
{
|
|
120 |
return *static_cast<ChspsThemeServer*>(const_cast<CServer2*>(CSession2::Server()));
|
|
121 |
}
|
|
122 |
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
// ChspsThemeServerSession::ServiceL
|
|
125 |
// Handle a client request.
|
|
126 |
// Leaving is handled by ChspsThemeServerSession::ServiceError() which reports
|
|
127 |
// the error code to the client
|
|
128 |
// (other items were commented in a header).
|
|
129 |
// -----------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
void ChspsThemeServerSession::ServiceL( const RMessage2& aMessage )
|
|
132 |
{
|
|
133 |
TRAPD( errorCode, DoServiceL( aMessage ) );
|
|
134 |
if ( errorCode && !aMessage.IsNull() )
|
|
135 |
{
|
|
136 |
aMessage.Complete( EhspsServiceRequestError );
|
|
137 |
#ifdef HSPS_LOG_ACTIVE
|
|
138 |
iLogBus->LogText( _L( "ServiceL: - error in calling function %d." ), aMessage.Function() );
|
|
139 |
#endif
|
|
140 |
}
|
|
141 |
|
|
142 |
#ifdef HSPS_LOG_ACTIVE
|
|
143 |
iLogBus->LogText( _L( "ServiceL completed with code: %d" ), errorCode );
|
|
144 |
iLogBus->LogText( _L( "--------------------------------------------------------" ) );
|
|
145 |
#endif
|
|
146 |
}
|
|
147 |
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
// ChspsThemeServerSession::DoServiceL
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
void ChspsThemeServerSession::DoServiceL( const RMessage2& aMessage )
|
|
152 |
{
|
|
153 |
switch ( aMessage.Function() )
|
|
154 |
{
|
|
155 |
// installation:
|
|
156 |
case EhspsInstallTheme:
|
|
157 |
{
|
|
158 |
#ifdef HSPS_LOG_ACTIVE
|
|
159 |
iLogBus->LogText( _L( "DoServiceL: EhspsInstallTheme" ) );
|
|
160 |
#endif
|
|
161 |
InstallThemeL( aMessage );
|
|
162 |
break;
|
|
163 |
}
|
|
164 |
|
|
165 |
case EhspsInstallNextPhase:
|
|
166 |
{
|
|
167 |
#ifdef HSPS_LOG_ACTIVE
|
|
168 |
iLogBus->LogText( _L( "DoServiceL: EhspsInstallNextPhase" ) );
|
|
169 |
#endif
|
|
170 |
InstallNextPhaseL( aMessage );
|
|
171 |
break;
|
|
172 |
}
|
|
173 |
|
|
174 |
case EhspsCancelInstallTheme:
|
|
175 |
{
|
|
176 |
#ifdef HSPS_LOG_ACTIVE
|
|
177 |
iLogBus->LogText( _L( "DoServiceL: EhspsCancelInstallTheme" ) );
|
|
178 |
#endif
|
|
179 |
CancelInstallThemeL( aMessage );
|
|
180 |
break;
|
|
181 |
}
|
|
182 |
|
|
183 |
case EhspsReinstallConf:
|
|
184 |
{
|
|
185 |
#ifdef HSPS_LOG_ACTIVE
|
|
186 |
iLogBus->LogText( _L( "DoServiceL: EhspsReinstallConf" ) );
|
|
187 |
#endif
|
|
188 |
ReinstallConfL( aMessage );
|
|
189 |
break;
|
|
190 |
}
|
|
191 |
|
|
192 |
// maintenance
|
|
193 |
case EhspsGetListHeaders:
|
|
194 |
{
|
|
195 |
#ifdef HSPS_LOG_ACTIVE
|
|
196 |
iLogBus->LogText( _L( "DoServiceL: EhspsGetListHeaders" ) );
|
|
197 |
#endif
|
|
198 |
GetListHeadersL( aMessage );
|
|
199 |
break;
|
|
200 |
}
|
|
201 |
|
|
202 |
case EhspsGetNextHeader:
|
|
203 |
{
|
|
204 |
#ifdef HSPS_LOG_ACTIVE
|
|
205 |
iLogBus->LogText( _L( "DoServiceL: EhspsGetNextHeader" ) );
|
|
206 |
#endif
|
|
207 |
GetNextHeaderL( aMessage );
|
|
208 |
break;
|
|
209 |
}
|
|
210 |
|
|
211 |
case EhspsCancelGetListHeaders:
|
|
212 |
{
|
|
213 |
#ifdef HSPS_LOG_ACTIVE
|
|
214 |
iLogBus->LogText( _L( "DoServiceL: EhspsCancelGetListHeaders" ) );
|
|
215 |
#endif
|
|
216 |
CancelGetListHeadersL( aMessage );
|
|
217 |
break;
|
|
218 |
}
|
|
219 |
|
|
220 |
case EhspsSetActiveTheme:
|
|
221 |
{
|
|
222 |
#ifdef HSPS_LOG_ACTIVE
|
|
223 |
iLogBus->LogText( _L( "DoServiceL: EhspsSetActiveTheme" ) );
|
|
224 |
#endif
|
|
225 |
SetActiveThemeL( aMessage );
|
|
226 |
break;
|
|
227 |
}
|
|
228 |
|
|
229 |
case EhspsRestoreDefault:
|
|
230 |
{
|
|
231 |
#ifdef HSPS_LOG_ACTIVE
|
|
232 |
iLogBus->LogText( _L( "DoServiceL: EhspsRestoreDefault" ) );
|
|
233 |
#endif
|
|
234 |
RestoreDefaultL( aMessage );
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
|
|
238 |
case EhspsRemoveTheme:
|
|
239 |
{
|
|
240 |
#ifdef HSPS_LOG_ACTIVE
|
|
241 |
iLogBus->LogText( _L( "DoServiceL: EhspsRemoveTheme" ) );
|
|
242 |
#endif
|
|
243 |
RemoveThemeL( aMessage );
|
|
244 |
break;
|
|
245 |
}
|
|
246 |
|
|
247 |
// client request
|
|
248 |
case EhspsGetODT:
|
|
249 |
{
|
|
250 |
#ifdef HSPS_LOG_ACTIVE
|
|
251 |
iLogBus->LogText( _L( "DoServiceL: EhspsGetODT" ) );
|
|
252 |
#endif
|
|
253 |
GetOdtL( aMessage );
|
|
254 |
break;
|
|
255 |
}
|
|
256 |
|
|
257 |
case EhspsGetODTUpdate:
|
|
258 |
{
|
|
259 |
#ifdef HSPS_LOG_ACTIVE
|
|
260 |
iLogBus->LogText( _L( "DoServiceL: EhspsGetODTUpdate" ) );
|
|
261 |
#endif
|
|
262 |
GetOdtUpdateL( aMessage );
|
|
263 |
break;
|
|
264 |
}
|
|
265 |
|
|
266 |
case EhspsCancelGetODTUpdate:
|
|
267 |
{
|
|
268 |
#ifdef HSPS_LOG_ACTIVE
|
|
269 |
iLogBus->LogText( _L( "DoServiceL: EhspsCancelGetODTUpdate" ) );
|
|
270 |
#endif
|
|
271 |
CancelGetOdtUpdateL( aMessage );
|
|
272 |
break;
|
|
273 |
}
|
|
274 |
|
|
275 |
case EhspsAccessResourceFile:
|
|
276 |
{
|
|
277 |
#ifdef HSPS_LOG_ACTIVE
|
|
278 |
iLogBus->LogText( _L( "DoServiceL: EhspsAccessResourceFile" ) );
|
|
279 |
#endif
|
|
280 |
AccessResourceFileL( aMessage );
|
|
281 |
break;
|
|
282 |
}
|
|
283 |
|
|
284 |
case EhspsCopyResources:
|
|
285 |
{
|
|
286 |
#ifdef HSPS_LOG_ACTIVE
|
|
287 |
iLogBus->LogText( _L( "DoServiceL: EhspsCopyResources" ) );
|
|
288 |
#endif
|
|
289 |
if( iResourceFileCopyRequired )
|
|
290 |
{
|
|
291 |
CopyResourceFilesL( aMessage );
|
|
292 |
iResourceFileCopyRequired = EFalse;
|
|
293 |
}
|
|
294 |
else
|
|
295 |
{
|
|
296 |
aMessage.Complete( EhspsResourceCopySuccess );
|
|
297 |
}
|
|
298 |
break;
|
|
299 |
}
|
|
300 |
case EhspsAddPlugin:
|
|
301 |
{
|
|
302 |
#ifdef HSPS_LOG_ACTIVE
|
|
303 |
iLogBus->LogText( _L( "DoServiceL: EhspsAddPlugin" ) );
|
|
304 |
#endif
|
|
305 |
AddPluginL( aMessage );
|
|
306 |
break;
|
|
307 |
}
|
|
308 |
case EhspsRemovePlugin:
|
|
309 |
{
|
|
310 |
#ifdef HSPS_LOG_ACTIVE
|
|
311 |
iLogBus->LogText( _L( "DoServiceL: EhspsRemovePlugin" ) );
|
|
312 |
#endif
|
|
313 |
RemovePluginL( aMessage );
|
|
314 |
break;
|
|
315 |
}
|
|
316 |
case EhspsSetActivePlugin:
|
|
317 |
{
|
|
318 |
#ifdef HSPS_LOG_ACTIVE
|
|
319 |
iLogBus->LogText( _L( "DoServiceL: EhspsSetActivePlugin" ) );
|
|
320 |
#endif
|
|
321 |
SetActivePluginL( aMessage );
|
|
322 |
break;
|
|
323 |
}
|
|
324 |
case EhspsReplacePlugin:
|
|
325 |
{
|
|
326 |
#ifdef HSPS_LOG_ACTIVE
|
|
327 |
iLogBus->LogText( _L( "DoServiceL: EhspsReplacePlugin" ) );
|
|
328 |
#endif
|
|
329 |
ReplacePluginL( aMessage );
|
|
330 |
break;
|
|
331 |
}
|
|
332 |
case EhspsSetPluginSettings:
|
|
333 |
{
|
|
334 |
#ifdef HSPS_LOG_ACTIVE
|
|
335 |
iLogBus->LogText( _L( "DoServiceL: EhspsSetPluginSettings" ) );
|
|
336 |
#endif
|
|
337 |
SetPluginSettingsL( aMessage );
|
|
338 |
break;
|
|
339 |
}
|
|
340 |
case EhspsGetPluginOdt:
|
|
341 |
{
|
|
342 |
#ifdef HSPS_LOG_ACTIVE
|
|
343 |
iLogBus->LogText( _L( "DoServiceL: EhspsGetPluginOdt" ) );
|
|
344 |
#endif
|
|
345 |
GetPluginOdtL( aMessage );
|
|
346 |
break;
|
|
347 |
}
|
|
348 |
case EhspsMovePlugins:
|
|
349 |
{
|
|
350 |
#ifdef HSPS_LOG_ACTIVE
|
|
351 |
iLogBus->LogText( _L( "DoServiceL: EhspsMovePlugins" ) );
|
|
352 |
#endif
|
|
353 |
MovePluginsL( aMessage );
|
|
354 |
break;
|
|
355 |
}
|
|
356 |
case EhspsSetConfState:
|
|
357 |
{
|
|
358 |
#ifdef HSPS_LOG_ACTIVE
|
|
359 |
iLogBus->LogText( _L( "DoServiceL: EhspsSetConfState" ) );
|
|
360 |
#endif
|
|
361 |
SetConfStateL( aMessage );
|
|
362 |
break;
|
|
363 |
}
|
|
364 |
case EhspsRestoreActiveAppConf:
|
|
365 |
{
|
|
366 |
#ifdef HSPS_LOG_ACTIVE
|
|
367 |
iLogBus->LogText( _L( "DoServiceL: EhspsRestoreActiveAppConf" ) );
|
|
368 |
#endif
|
|
369 |
RestoreActiveAppConfL( aMessage );
|
|
370 |
break;
|
|
371 |
}
|
|
372 |
case EhspsRestoreConfigurations:
|
|
373 |
{
|
|
374 |
#ifdef HSPS_LOG_ACTIVE
|
|
375 |
iLogBus->LogText( _L( "DoServiceL: EhspsRestoreConfigurations" ) );
|
|
376 |
#endif
|
|
377 |
RestoreConfigurationsL( aMessage );
|
|
378 |
break;
|
|
379 |
}
|
|
380 |
default:
|
|
381 |
{
|
|
382 |
#ifdef HSPS_LOG_ACTIVE
|
|
383 |
iLogBus->LogText( _L( "DoServiceL: - unrecognized function %d called." ), aMessage.Function() );
|
|
384 |
#endif
|
|
385 |
User::Leave( KErrNotSupported );
|
|
386 |
break;
|
|
387 |
}
|
|
388 |
|
|
389 |
} // switch
|
|
390 |
}
|
|
391 |
|
|
392 |
|
|
393 |
// -----------------------------------------------------------------------------
|
|
394 |
// ChspsThemeServerSession::ServiceError
|
|
395 |
// Handle an error from ChspsThemeServerSession::ServiceL()
|
|
396 |
// (other items were commented in a header).
|
|
397 |
// -----------------------------------------------------------------------------
|
|
398 |
//
|
|
399 |
void ChspsThemeServerSession::ServiceError(const RMessage2& aMessage,TInt aError)
|
|
400 |
{
|
|
401 |
#ifdef HSPS_LOG_ACTIVE
|
|
402 |
iLogBus->LogText( _L( "hspsThemeServer: ChspsThemeServerSession::ServiceError(): %d" ), aError );
|
|
403 |
#endif
|
|
404 |
|
|
405 |
CSession2::ServiceError(aMessage,aError);
|
|
406 |
}
|
|
407 |
|
|
408 |
// Installation
|
|
409 |
// ************
|
|
410 |
// -----------------------------------------------------------------------------
|
|
411 |
// ChspsThemeServerSession::InstallThemeL
|
|
412 |
// (other items were commented in a header).
|
|
413 |
// -----------------------------------------------------------------------------
|
|
414 |
//
|
|
415 |
void ChspsThemeServerSession::InstallThemeL(const RMessage2& aMessage)
|
|
416 |
{
|
|
417 |
// delete previous handler and create new one for this installation
|
|
418 |
if ( iInstallationHandler )
|
|
419 |
{
|
|
420 |
delete iInstallationHandler;
|
|
421 |
iInstallationHandler = NULL;
|
|
422 |
}
|
|
423 |
iInstallationHandler = ChspsInstallationHandler::NewL( Server() );
|
|
424 |
|
|
425 |
#ifdef HSPS_LOG_ACTIVE
|
|
426 |
// set logging bus.
|
|
427 |
iInstallationHandler->SetLogBus( iLogBus );
|
|
428 |
#endif
|
|
429 |
|
|
430 |
// call the service
|
|
431 |
iInstallationHandler->ServiceInstallThemeL(aMessage);
|
|
432 |
}
|
|
433 |
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
// ChspsThemeServerSession::InstallNextPhaseL
|
|
436 |
// (other items were commented in a header).
|
|
437 |
// -----------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
void ChspsThemeServerSession::InstallNextPhaseL(const RMessage2& aMessage)
|
|
440 |
{
|
|
441 |
// make an asynchronous request
|
|
442 |
if (!iInstallationHandler)
|
|
443 |
{
|
|
444 |
User::Leave( KErrNotReady );
|
|
445 |
}
|
|
446 |
else
|
|
447 |
{
|
|
448 |
// call the service
|
|
449 |
iInstallationHandler->ServiceInstallNextPhaseL( aMessage );
|
|
450 |
}
|
|
451 |
}
|
|
452 |
|
|
453 |
// -----------------------------------------------------------------------------
|
|
454 |
// ChspsThemeServerSession::CancelInstallTheme
|
|
455 |
// (other items were commented in a header).
|
|
456 |
// -----------------------------------------------------------------------------
|
|
457 |
//
|
|
458 |
void ChspsThemeServerSession::CancelInstallThemeL(const RMessage2& aMessage)
|
|
459 |
{
|
|
460 |
if ( iInstallationHandler )
|
|
461 |
{
|
|
462 |
// wait until service has finalised itself
|
|
463 |
ThspsServiceCompletedMessage ret = iInstallationHandler->hspsCancelInstallTheme();
|
|
464 |
// clean up the service
|
|
465 |
delete iInstallationHandler;
|
|
466 |
iInstallationHandler = NULL;
|
|
467 |
if ( !aMessage.IsNull() )
|
|
468 |
{
|
|
469 |
aMessage.Complete( ret );
|
|
470 |
}
|
|
471 |
}
|
|
472 |
else
|
|
473 |
{
|
|
474 |
User::Leave( KErrNotReady );
|
|
475 |
}
|
|
476 |
}
|
|
477 |
|
|
478 |
// -----------------------------------------------------------------------------
|
|
479 |
// ChspsThemeServerSession::ReinstallConf
|
|
480 |
// (other items were commented in a header).
|
|
481 |
// -----------------------------------------------------------------------------
|
|
482 |
//
|
|
483 |
void ChspsThemeServerSession::ReinstallConfL( const RMessage2& aMessage )
|
|
484 |
{
|
|
485 |
|
|
486 |
ThspsParamReinstallConf params;
|
|
487 |
TPckg<ThspsParamReinstallConf> packagedStruct( params );
|
|
488 |
aMessage.ReadL( 1, packagedStruct );
|
|
489 |
|
|
490 |
Server().ReinstallConfL( params.appUid, params.confUId );
|
|
491 |
|
|
492 |
aMessage.Complete( EhspsReinstallConfSuccess );
|
|
493 |
|
|
494 |
}
|
|
495 |
|
|
496 |
|
|
497 |
// Maintenance
|
|
498 |
// ***********
|
|
499 |
// -----------------------------------------------------------------------------
|
|
500 |
// ChspsThemeServerSession::GetListHeadersL
|
|
501 |
// (other items were commented in a header).
|
|
502 |
// -----------------------------------------------------------------------------
|
|
503 |
//
|
|
504 |
void ChspsThemeServerSession::GetListHeadersL(const RMessage2& aMessage)
|
|
505 |
{
|
|
506 |
// Exception: should be reset since previous instance might be pending
|
|
507 |
if ( iMaintenanceHandler )
|
|
508 |
{
|
|
509 |
delete iMaintenanceHandler;
|
|
510 |
iMaintenanceHandler = NULL;
|
|
511 |
}
|
|
512 |
|
|
513 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
514 |
iMaintenanceHandler->ServiceGetListHeadersL( aMessage );
|
|
515 |
}
|
|
516 |
|
|
517 |
// -----------------------------------------------------------------------------
|
|
518 |
// ChspsThemeServerSession::GetNextHeaderL
|
|
519 |
// ?implementation_description
|
|
520 |
// (other items were commented in a header).
|
|
521 |
// -----------------------------------------------------------------------------
|
|
522 |
//
|
|
523 |
void ChspsThemeServerSession::GetNextHeaderL(const RMessage2& aMessage)
|
|
524 |
{
|
|
525 |
if ( !iMaintenanceHandler )
|
|
526 |
{
|
|
527 |
User::Leave( KErrNotReady );
|
|
528 |
}
|
|
529 |
else
|
|
530 |
{
|
|
531 |
iMaintenanceHandler->ServiceGetNextHeaderL(aMessage);
|
|
532 |
}
|
|
533 |
}
|
|
534 |
|
|
535 |
// -----------------------------------------------------------------------------
|
|
536 |
// ChspsThemeServerSession::CancelGetListHeaders
|
|
537 |
// (other items were commented in a header).
|
|
538 |
// -----------------------------------------------------------------------------
|
|
539 |
//
|
|
540 |
void ChspsThemeServerSession::CancelGetListHeadersL(const RMessage2& aMessage)
|
|
541 |
{
|
|
542 |
if ( iMaintenanceHandler )
|
|
543 |
{
|
|
544 |
ThspsServiceCompletedMessage ret = iMaintenanceHandler->hspsCancelGetListHeaders();
|
|
545 |
delete iMaintenanceHandler;
|
|
546 |
iMaintenanceHandler = NULL;
|
|
547 |
if ( !aMessage.IsNull() )
|
|
548 |
{
|
|
549 |
aMessage.Complete( EhspsServiceRequestCanceled );
|
|
550 |
}
|
|
551 |
}
|
|
552 |
else
|
|
553 |
{
|
|
554 |
User::Leave( KErrNotReady );
|
|
555 |
}
|
|
556 |
}
|
|
557 |
|
|
558 |
|
|
559 |
// -----------------------------------------------------------------------------
|
|
560 |
// ChspsThemeServerSession::SetActiveThemeL
|
|
561 |
// (other items were commented in a header).
|
|
562 |
// -----------------------------------------------------------------------------
|
|
563 |
//
|
|
564 |
void ChspsThemeServerSession::SetActiveThemeL(const RMessage2& aMessage)
|
|
565 |
{
|
|
566 |
// make a synchronous request
|
|
567 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
568 |
iMaintenanceHandler->ServiceSetActiveThemeL(aMessage);
|
|
569 |
}
|
|
570 |
|
|
571 |
|
|
572 |
// -----------------------------------------------------------------------------
|
|
573 |
// ChspsThemeServerSession::RestoreDefaultL
|
|
574 |
// (other items were commented in a header).
|
|
575 |
// -----------------------------------------------------------------------------
|
|
576 |
//
|
|
577 |
void ChspsThemeServerSession::RestoreDefaultL(const RMessage2& aMessage)
|
|
578 |
{
|
|
579 |
// make a synchronous request
|
|
580 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
581 |
iMaintenanceHandler->ServiceRestoreDefaultL(aMessage);
|
|
582 |
}
|
|
583 |
|
|
584 |
// -----------------------------------------------------------------------------
|
|
585 |
// ChspsThemeServerSession::RemoveThemeL
|
|
586 |
// (other items were commented in a header).
|
|
587 |
// -----------------------------------------------------------------------------
|
|
588 |
//
|
|
589 |
void ChspsThemeServerSession::RemoveThemeL(const RMessage2& aMessage)
|
|
590 |
{
|
|
591 |
// make a synchronous request
|
|
592 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
593 |
iMaintenanceHandler->ServiceRemoveThemeL(aMessage);
|
|
594 |
}
|
|
595 |
|
|
596 |
// -----------------------------------------------------------------------------
|
|
597 |
// ChspsThemeServerSession::AddPluginL
|
|
598 |
// -----------------------------------------------------------------------------
|
|
599 |
//
|
|
600 |
void ChspsThemeServerSession::AddPluginL(const RMessage2& aMessage)
|
|
601 |
{
|
|
602 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
603 |
iMaintenanceHandler->ServiceAddPluginL( aMessage );
|
|
604 |
}
|
|
605 |
|
|
606 |
// -----------------------------------------------------------------------------
|
|
607 |
// ChspsThemeServerSession::RemovePluginL
|
|
608 |
// -----------------------------------------------------------------------------
|
|
609 |
//
|
|
610 |
void ChspsThemeServerSession::RemovePluginL(const RMessage2& aMessage)
|
|
611 |
{
|
|
612 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
613 |
iMaintenanceHandler->ServiceRemovePluginL( aMessage );
|
|
614 |
}
|
|
615 |
|
|
616 |
// -----------------------------------------------------------------------------
|
|
617 |
// ChspsThemeServerSession::SetActivePluginL
|
|
618 |
// -----------------------------------------------------------------------------
|
|
619 |
//
|
|
620 |
void ChspsThemeServerSession::SetActivePluginL(const RMessage2& aMessage)
|
|
621 |
{
|
|
622 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
623 |
iMaintenanceHandler->ServiceSetActivePluginL( aMessage );
|
|
624 |
}
|
|
625 |
|
|
626 |
// -----------------------------------------------------------------------------
|
|
627 |
// ChspsThemeServerSession::ReplacePluginL
|
|
628 |
// -----------------------------------------------------------------------------
|
|
629 |
//
|
|
630 |
void ChspsThemeServerSession::ReplacePluginL(const RMessage2& aMessage)
|
|
631 |
{
|
|
632 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
633 |
iMaintenanceHandler->ServiceReplacePluginL( aMessage );
|
|
634 |
}
|
|
635 |
|
|
636 |
// -----------------------------------------------------------------------------
|
|
637 |
// ChspsThemeServerSession::SetPluginSettingsL
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
void ChspsThemeServerSession::SetPluginSettingsL(const RMessage2& aMessage)
|
|
641 |
{
|
|
642 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
643 |
iMaintenanceHandler->ServiceSetPluginSettingsL( aMessage );
|
|
644 |
}
|
|
645 |
|
|
646 |
// -----------------------------------------------------------------------------
|
|
647 |
// ChspsThemeServerSession::GetPluginOdtL
|
|
648 |
// -----------------------------------------------------------------------------
|
|
649 |
//
|
|
650 |
void ChspsThemeServerSession::GetPluginOdtL(const RMessage2& aMessage)
|
|
651 |
{
|
|
652 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
653 |
iMaintenanceHandler->ServiceGetPluginOdtL( aMessage );
|
|
654 |
}
|
|
655 |
|
|
656 |
// -----------------------------------------------------------------------------
|
|
657 |
// ChspsThemeServerSession::MovePluginsL
|
|
658 |
// -----------------------------------------------------------------------------
|
|
659 |
//
|
|
660 |
void ChspsThemeServerSession::MovePluginsL(const RMessage2& aMessage)
|
|
661 |
{
|
|
662 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
663 |
iMaintenanceHandler->ServiceMovePluginsL( aMessage );
|
|
664 |
}
|
|
665 |
|
|
666 |
// -----------------------------------------------------------------------------
|
|
667 |
// ChspsThemeServerSession::SetConfStateL
|
|
668 |
// -----------------------------------------------------------------------------
|
|
669 |
//
|
|
670 |
void ChspsThemeServerSession::SetConfStateL(const RMessage2& aMessage)
|
|
671 |
{
|
|
672 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
673 |
iMaintenanceHandler->ServiceSetConfStateL( aMessage );
|
|
674 |
}
|
|
675 |
|
|
676 |
// -----------------------------------------------------------------------------
|
|
677 |
// ChspsThemeServerSession::RestoreActiveAppConfL
|
|
678 |
// -----------------------------------------------------------------------------
|
|
679 |
//
|
|
680 |
void ChspsThemeServerSession::RestoreActiveAppConfL(const RMessage2& aMessage)
|
|
681 |
{
|
|
682 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
683 |
iMaintenanceHandler->ServiceRestoreActiveAppConfL( aMessage );
|
|
684 |
}
|
|
685 |
|
|
686 |
// Client Request
|
|
687 |
// **************
|
|
688 |
// -----------------------------------------------------------------------------
|
|
689 |
// ChspsThemeServerSession::GetOdtL
|
|
690 |
// (other items were commented in a header).
|
|
691 |
// -----------------------------------------------------------------------------
|
|
692 |
//
|
|
693 |
void ChspsThemeServerSession::GetOdtL(const RMessage2& aMessage)
|
|
694 |
{
|
|
695 |
//Make an asynchronous request
|
|
696 |
CreateClientRequestHandlerL();
|
|
697 |
iClientRequestHandler->ServiceGetOdtL( aMessage );
|
|
698 |
}
|
|
699 |
|
|
700 |
// -----------------------------------------------------------------------------
|
|
701 |
// ChspsThemeServerSession::GetOdtUpdateL
|
|
702 |
// (other items were commented in a header).
|
|
703 |
// -----------------------------------------------------------------------------
|
|
704 |
//
|
|
705 |
void ChspsThemeServerSession::GetOdtUpdateL(const RMessage2& aMessage)
|
|
706 |
{
|
|
707 |
// make an asynchronous request
|
|
708 |
if (!iClientRequestHandler)
|
|
709 |
{
|
|
710 |
User::Leave( KErrNotReady );
|
|
711 |
}
|
|
712 |
else
|
|
713 |
{
|
|
714 |
iClientRequestHandler->ServiceGetOdtUpdateL(aMessage);
|
|
715 |
}
|
|
716 |
}
|
|
717 |
|
|
718 |
// -----------------------------------------------------------------------------
|
|
719 |
// ChspsThemeServerSession::RestoreConfigurationsL
|
|
720 |
// -----------------------------------------------------------------------------
|
|
721 |
void ChspsThemeServerSession::RestoreConfigurationsL( const RMessage2& aMessage )
|
|
722 |
{
|
|
723 |
CreateMaintenanceHandlerL( aMessage.SecureId().iId );
|
|
724 |
iMaintenanceHandler->ServiceRestoreConfigurationsL( aMessage );
|
|
725 |
}
|
|
726 |
|
|
727 |
// -----------------------------------------------------------------------------
|
|
728 |
// ChspsThemeServerSession::CancelGetOdtUpdate
|
|
729 |
// (other items were commented in a header).
|
|
730 |
// -----------------------------------------------------------------------------
|
|
731 |
//
|
|
732 |
void ChspsThemeServerSession::CancelGetOdtUpdateL(const RMessage2& aMessage)
|
|
733 |
{
|
|
734 |
if ( iClientRequestHandler )
|
|
735 |
{
|
|
736 |
ThspsServiceCompletedMessage ret = iClientRequestHandler->hspsCancelGetODTUpdate();
|
|
737 |
if ( !aMessage.IsNull() )
|
|
738 |
{
|
|
739 |
aMessage.Complete( EhspsServiceRequestCanceled );
|
|
740 |
}
|
|
741 |
}
|
|
742 |
else
|
|
743 |
{
|
|
744 |
User::Leave( KErrNotReady );
|
|
745 |
}
|
|
746 |
}
|
|
747 |
|
|
748 |
// -----------------------------------------------------------------------------
|
|
749 |
// ChspsThemeServerSession::AccessResourceFileL
|
|
750 |
// (other items were commented in a header).
|
|
751 |
// -----------------------------------------------------------------------------
|
|
752 |
//
|
|
753 |
void ChspsThemeServerSession::AccessResourceFileL(const RMessage2& aMessage)
|
|
754 |
{
|
|
755 |
//Make a synchronous request
|
|
756 |
CreateClientRequestHandlerL();
|
|
757 |
|
|
758 |
#ifdef _hsps_PERFORMANCE_TEST_
|
|
759 |
ChspsTimeMon::PrintUserMem( _L("hspsThemeServer::AccessResourceFileL(): - accessing..") );
|
|
760 |
#endif //_hsps_PERFORMANCE_TEST_
|
|
761 |
|
|
762 |
// call the service with TRAP
|
|
763 |
iClientRequestHandler->ServiceAccessResourceFileL( aMessage );
|
|
764 |
if ( !iHoldingResources )
|
|
765 |
{
|
|
766 |
iHoldingResources = ETrue;
|
|
767 |
// add number of resource holders
|
|
768 |
Server().IncreaseRequestClientCount();
|
|
769 |
}
|
|
770 |
|
|
771 |
#ifdef _hsps_PERFORMANCE_TEST_
|
|
772 |
ChspsTimeMon::PrintUserMem( _L("hspsThemeServer::AccessResourceFileL(): - file accessed.") );
|
|
773 |
#endif //_hsps_PERFORMANCE_TEST_
|
|
774 |
|
|
775 |
}
|
|
776 |
|
|
777 |
// -----------------------------------------------------------------------------
|
|
778 |
// ChspsThemeServerSession::FindWidgetUids
|
|
779 |
// -----------------------------------------------------------------------------
|
|
780 |
void ChspsThemeServerSession::FindWidgetUidsL(
|
|
781 |
ChspsODT& aAppODT,
|
|
782 |
RArray<TInt>& aUidArray )
|
|
783 |
{
|
|
784 |
aUidArray.Reset();
|
|
785 |
const TInt resourceCount = aAppODT.ResourceCount();
|
|
786 |
for( TInt resourceIndex = 0; resourceIndex < resourceCount; resourceIndex++ )
|
|
787 |
{
|
|
788 |
ChspsResource& r = aAppODT.ResourceL( resourceIndex );
|
|
789 |
const TInt uid = r.ConfigurationUid();
|
|
790 |
if ( uid > 0 &&
|
|
791 |
aUidArray.Find( uid ) == KErrNotFound )
|
|
792 |
{
|
|
793 |
aUidArray.Append( uid );
|
|
794 |
}
|
|
795 |
}
|
|
796 |
}
|
|
797 |
|
|
798 |
// -----------------------------------------------------------------------------
|
|
799 |
// ChspsThemeServerSession::CopyResourceFilesL
|
|
800 |
// (other items were commented in a header).
|
|
801 |
// -----------------------------------------------------------------------------
|
|
802 |
//
|
|
803 |
void ChspsThemeServerSession::CopyResourceFilesL(const RMessage2& aMessage)
|
|
804 |
{
|
|
805 |
// read paths from the buffer
|
|
806 |
TFileName odtPath;
|
|
807 |
TPath destinationPath; // Private root folder of the client application
|
|
808 |
aMessage.ReadL( 1, odtPath, 0 );
|
|
809 |
aMessage.ReadL( 2, destinationPath, 0 );
|
|
810 |
|
|
811 |
ChspsODT* odt = ChspsODT::NewL();
|
|
812 |
CleanupStack::PushL( odt );
|
|
813 |
|
|
814 |
// phase counter for cleaning and debug prints
|
|
815 |
TInt phaseCounter = 1;
|
|
816 |
|
|
817 |
RFile odtfile;
|
|
818 |
CleanupClosePushL( odtfile );
|
|
819 |
TInt error = odtfile.Open( iFs, odtPath, EFileRead );
|
|
820 |
if( error == KErrNone )
|
|
821 |
{
|
|
822 |
phaseCounter++;
|
|
823 |
|
|
824 |
// set stream on file
|
|
825 |
CFileStore* store = CDirectFileStore::FromLC( odtfile );
|
|
826 |
RStoreReadStream instream;
|
|
827 |
CleanupClosePushL( instream );
|
|
828 |
instream.OpenLC( *store, store->Root() );
|
|
829 |
|
|
830 |
// stream in the ODT
|
|
831 |
instream >> *odt;
|
|
832 |
|
|
833 |
// the file is no longer needed
|
|
834 |
odtfile.Close();
|
|
835 |
|
|
836 |
// destroy the stream object and close the instream
|
|
837 |
CleanupStack::PopAndDestroy(3); // instream,store
|
|
838 |
}
|
|
839 |
|
|
840 |
CleanupStack::PopAndDestroy(1, &odtfile); // odtfile
|
|
841 |
|
|
842 |
if( error == KErrNone )
|
|
843 |
{
|
|
844 |
phaseCounter++;
|
|
845 |
|
|
846 |
RArray<TInt> uidArray;
|
|
847 |
CleanupClosePushL( uidArray );
|
|
848 |
|
|
849 |
// Find unique configuration UIDs from the resource array
|
|
850 |
FindWidgetUidsL( *odt, uidArray );
|
|
851 |
|
|
852 |
CFileMan* fileManager = NULL;
|
|
853 |
fileManager = CFileMan::NewL( iFs );
|
|
854 |
CleanupStack::PushL( fileManager );
|
|
855 |
|
|
856 |
// Loop widgets belonging to the root configuration
|
|
857 |
const TInt uidCount = uidArray.Count();
|
|
858 |
for( TInt i = 0; i < uidCount && !error; i++ )
|
|
859 |
{
|
|
860 |
// Copy widget's resources to client's private folder
|
|
861 |
error = hspsServerUtil::CopyResourceFilesL(
|
|
862 |
*odt,
|
|
863 |
iFs,
|
|
864 |
*fileManager,
|
|
865 |
Server().DeviceLanguage(),
|
|
866 |
uidArray[i],
|
|
867 |
destinationPath );
|
|
868 |
}
|
|
869 |
|
|
870 |
uidArray.Reset();
|
|
871 |
|
|
872 |
CleanupStack::PopAndDestroy( 2, &uidArray ); // fileManager, uidArray
|
|
873 |
} // KErrNone
|
|
874 |
|
|
875 |
//Tidy-up
|
|
876 |
if ( odt )
|
|
877 |
{
|
|
878 |
CleanupStack::PopAndDestroy( odt );
|
|
879 |
}
|
|
880 |
|
|
881 |
if( error )
|
|
882 |
{
|
|
883 |
#ifdef HSPS_LOG_ACTIVE
|
|
884 |
iLogBus->LogText( _L( "ChspsThemeServerSession::CopyResourceFilesL(): - creating target directory failed! ( error : %d in phase: %d)." ),
|
|
885 |
error,
|
|
886 |
phaseCounter );
|
|
887 |
#endif
|
|
888 |
|
|
889 |
aMessage.Complete( EhspsResourceCopyFailed );
|
|
890 |
}
|
|
891 |
else
|
|
892 |
{
|
|
893 |
aMessage.Complete( EhspsResourceCopySuccess );
|
|
894 |
}
|
|
895 |
}
|
|
896 |
// -----------------------------------------------------------------------------
|
|
897 |
// ChspsThemeServerSession::CreateMaintenanceHandlerL
|
|
898 |
// (other items were commented in a header).
|
|
899 |
// -----------------------------------------------------------------------------
|
|
900 |
//
|
|
901 |
void ChspsThemeServerSession::CreateMaintenanceHandlerL(
|
|
902 |
const TUint aSecureId )
|
|
903 |
{
|
|
904 |
if( !iMaintenanceHandler )
|
|
905 |
{
|
|
906 |
iMaintenanceHandler = ChspsMaintenanceHandler::NewL( Server(), aSecureId );
|
|
907 |
iMaintenanceHandler->SetServerSession( this );
|
|
908 |
#ifdef HSPS_LOG_ACTIVE
|
|
909 |
iMaintenanceHandler->SetLogBus( iLogBus );
|
|
910 |
#endif
|
|
911 |
}
|
|
912 |
|
|
913 |
}
|
|
914 |
|
|
915 |
// -----------------------------------------------------------------------------
|
|
916 |
// ChspsThemeServerSession::CreateClientRequestHandlerL
|
|
917 |
// (other items were commented in a header).
|
|
918 |
// -----------------------------------------------------------------------------
|
|
919 |
//
|
|
920 |
void ChspsThemeServerSession::CreateClientRequestHandlerL()
|
|
921 |
{
|
|
922 |
if( !iClientRequestHandler )
|
|
923 |
{
|
|
924 |
iClientRequestHandler = ChspsClientRequestHandler::NewL( Server() );
|
|
925 |
|
|
926 |
#ifdef HSPS_LOG_ACTIVE
|
|
927 |
iClientRequestHandler->SetLogBus( iLogBus );
|
|
928 |
#endif
|
|
929 |
}
|
|
930 |
}
|
|
931 |
|
|
932 |
// -----------------------------------------------------------------------------
|
|
933 |
// ChspsThemeServerSession::FileSystem
|
|
934 |
// -----------------------------------------------------------------------------
|
|
935 |
//
|
|
936 |
RFs& ChspsThemeServerSession::FileSystem()
|
|
937 |
{
|
|
938 |
return iFs;
|
|
939 |
}
|
|
940 |
|
|
941 |
// -----------------------------------------------------------------------------
|
|
942 |
// ChspsThemeServerSession::IconFileCopyRequired
|
|
943 |
// -----------------------------------------------------------------------------
|
|
944 |
//
|
|
945 |
TBool ChspsThemeServerSession::IconFileCopyRequired() const
|
|
946 |
{
|
|
947 |
return iIconFileCopyRequired;
|
|
948 |
}
|
|
949 |
|
|
950 |
// -----------------------------------------------------------------------------
|
|
951 |
// ChspsThemeServerSession::SetIconFileCopyRequired
|
|
952 |
// -----------------------------------------------------------------------------
|
|
953 |
//
|
|
954 |
void ChspsThemeServerSession::SetIconFileCopyRequired( const TBool aCopyRequired )
|
|
955 |
{
|
|
956 |
iIconFileCopyRequired = aCopyRequired;
|
|
957 |
}
|
|
958 |
|
|
959 |
// -----------------------------------------------------------------------------
|
|
960 |
// ChspsThemeServerSession::ResourceFileCopyRequired
|
|
961 |
// -----------------------------------------------------------------------------
|
|
962 |
//
|
|
963 |
TBool ChspsThemeServerSession::ResourceFileCopyRequired() const
|
|
964 |
{
|
|
965 |
return iResourceFileCopyRequired;
|
|
966 |
}
|
|
967 |
|
|
968 |
// -----------------------------------------------------------------------------
|
|
969 |
// ChspsThemeServerSession::SetResourceFileCopyRequired
|
|
970 |
// -----------------------------------------------------------------------------
|
|
971 |
//
|
|
972 |
void ChspsThemeServerSession::SetResourceFileCopyRequired( const TBool aCopyRequired )
|
|
973 |
{
|
|
974 |
iResourceFileCopyRequired = aCopyRequired;
|
|
975 |
}
|
|
976 |
|
|
977 |
// -----------------------------------------------------------------------------
|
|
978 |
// ChspsThemeServerSession::AppUid
|
|
979 |
// -----------------------------------------------------------------------------
|
|
980 |
//
|
|
981 |
TBool ChspsThemeServerSession::AppUid() const
|
|
982 |
{
|
|
983 |
return iAppUid;
|
|
984 |
}
|
|
985 |
|
|
986 |
// end of file
|
|
987 |
|