|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Implementation of customization components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "UISettingsSrvConstants.h" |
|
22 #include "UISettingsSrv.h" |
|
23 #include <e32svr.h> |
|
24 #include <e32math.h> |
|
25 #include <e32uid.h> |
|
26 |
|
27 #include <eikapp.h> |
|
28 #include <avkon.hrh> |
|
29 #include <akncontext.h> |
|
30 #include <aknnavi.h> |
|
31 #include <aknnavide.h> |
|
32 #include <akntabgrp.h> |
|
33 #include <akntitle.h> |
|
34 #include <aknnotedialog.h> |
|
35 #include <AknWaitDialog.h> |
|
36 #include <aknslider.h> |
|
37 #include <AknQueryDialog.h> |
|
38 #include <aknsettingpage.h> |
|
39 #include <aknradiobuttonsettingpage.h> |
|
40 #include <aknslidersettingpage.h> |
|
41 #include <akntextsettingpage.h> |
|
42 #include <AknDateFormatUtils.h> |
|
43 #include <AknUtils.h> |
|
44 #include <AknsConstants.h> //for determining skin change |
|
45 #include <barsread.h> |
|
46 #include <hal.h> |
|
47 #include <e32property.h> |
|
48 #include <centralrepository.h> |
|
49 #include <AknSkinsInternalCRKeys.h> |
|
50 #include <AknIconSrvClient.h> |
|
51 #include <startupdomaincrkeys.h> |
|
52 |
|
53 |
|
54 // #include <ScShortcut.h> |
|
55 // #include <ScShortcutUids.h> |
|
56 // #include <ScShortcutBase.h> |
|
57 // #include <ScShortcutEngine.h> |
|
58 // #include <ScSelectableShortcutList.h> |
|
59 // #include <ScShortcutCustomOperations.h> |
|
60 |
|
61 |
|
62 #include <gsasyncimagehandling.h> |
|
63 #include <backgroundimage.h> |
|
64 #include <imageconversion.h> |
|
65 |
|
66 #include "debug.h" |
|
67 |
|
68 // Type defintions |
|
69 typedef TInt TScBookmarkEngineId; // NOTE ! This is copied from ScBookmarkDbManager.h |
|
70 // to avoid illegal userinclude |
|
71 |
|
72 const TUid KUidIdleApp = { 0x101FD64C }; |
|
73 /****************************************************************************************** |
|
74 |
|
75 Security policies of this server are defined here: |
|
76 |
|
77 */ |
|
78 |
|
79 /** |
|
80 Ranges (inclusive): |
|
81 0: EUISettingsSrvSetStartupImage to (EUISettingsSrvLastCmd-1) |
|
82 1: EUISettingsSrvLastCmd to KMaxTInt |
|
83 */ |
|
84 const TInt CUISettingsSrvServer::iRanges[UISETTINGSSRV_POLICYCOUNT] = |
|
85 {EUISettingsSrvSetStartupImage, EUISettingsSrvLastCmd}; |
|
86 |
|
87 /** |
|
88 For range 0: Always pass |
|
89 For range 1: Not supported |
|
90 */ |
|
91 const TUint8 CUISettingsSrvServer::iElementsIndex[UISETTINGSSRV_POLICYCOUNT] = |
|
92 {CPolicyServer::EAlwaysPass, CPolicyServer::ENotSupported}; |
|
93 |
|
94 /** |
|
95 The policy |
|
96 */ |
|
97 const CPolicyServer::TPolicy CUISettingsSrvServer::iConnectionPolicy = |
|
98 { |
|
99 CPolicyServer::ECustomCheck, // Check connection |
|
100 UISETTINGSSRV_POLICYCOUNT, |
|
101 iRanges, |
|
102 iElementsIndex, |
|
103 0 |
|
104 }; |
|
105 |
|
106 // MACROS |
|
107 #define WELCOME_NOTE_MAX_LENGTH 100 |
|
108 //_LIT( KTempFilePath, "c:\\system\\temp\\" ); |
|
109 _LIT( KUISSWelcomeImagePath, "c:\\system\\data\\welcomedata.mbm"); |
|
110 //_LIT8( KMimeTypeImageMbm, "image/x-epoc-mbm"); |
|
111 |
|
112 // ---------------------------------------------------------------------------------------- |
|
113 // CShutDown |
|
114 // ---------------------------------------------------------------------------------------- |
|
115 |
|
116 inline CShutdown::CShutdown() |
|
117 :CTimer(-1) |
|
118 { |
|
119 CActiveScheduler::Add(this); |
|
120 } |
|
121 |
|
122 inline void CShutdown::ConstructL() |
|
123 { |
|
124 CTimer::ConstructL(); |
|
125 } |
|
126 |
|
127 inline void CShutdown::Start() |
|
128 { |
|
129 RDEBUG( "UiSettingsSrv: Starting shutdown timeout" ); |
|
130 After( KUISettingsSrvShutdownDelay ); |
|
131 } |
|
132 |
|
133 void CShutdown::RunL() |
|
134 { |
|
135 RDEBUG( "UiSettingsSrv: Timeout ... closing" ); |
|
136 CEikonEnv::Static()->EikAppUi()->HandleCommandL( EEikCmdExit ); |
|
137 } |
|
138 |
|
139 // ---------------------------------------------------------------------------------------- |
|
140 // CUISettingsSrvServer |
|
141 // ---------------------------------------------------------------------------------------- |
|
142 CUISettingsSrvServer::CUISettingsSrvServer(TInt aPriority) |
|
143 : CPolicyServer ( |
|
144 aPriority, // Active object priority |
|
145 iConnectionPolicy, |
|
146 EUnsharableSessions |
|
147 ) |
|
148 , iActive( 0 ) |
|
149 , iSessionCount( 0 ) |
|
150 // , iShortcuts( 0 ) |
|
151 , iImgHandling( 0 ) |
|
152 , iAppList( 0 ) |
|
153 , iIdleBitmapUid( KUidIdleApp ) |
|
154 , iAIBitmapUid( KUidIdleApp ) |
|
155 { |
|
156 } |
|
157 |
|
158 // ---------------------------------------------------------------------------------------- |
|
159 // CTerminalControlServer::CustomSecurityCheckL |
|
160 // ---------------------------------------------------------------------------------------- |
|
161 CPolicyServer::TCustomResult CUISettingsSrvServer::CustomSecurityCheckL(const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/) |
|
162 { |
|
163 RDEBUG("CUISettingsSrvServer::CustomSecurityCheckL"); |
|
164 |
|
165 _LIT_SECURITY_POLICY_C7( |
|
166 KRequiredCapabilities1, |
|
167 ECapabilityNetworkServices, |
|
168 ECapabilityLocalServices, |
|
169 ECapabilityLocation, |
|
170 ECapabilityReadUserData, |
|
171 ECapabilityWriteUserData, |
|
172 ECapabilityReadDeviceData, |
|
173 ECapabilityWriteDeviceData |
|
174 ); |
|
175 |
|
176 _LIT_SECURITY_POLICY_C3( |
|
177 KRequiredCapabilities2, |
|
178 ECapabilitySwEvent, |
|
179 ECapabilityUserEnvironment, |
|
180 ECapabilityNetworkControl |
|
181 ); |
|
182 |
|
183 TInt policy1 = KRequiredCapabilities1().CheckPolicy( aMsg ); |
|
184 if( !policy1 ) |
|
185 { |
|
186 RDEBUG("CUISettingsSrvServer::CustomSecurityCheckL Capabilities ERROR"); |
|
187 return EFail; |
|
188 } |
|
189 |
|
190 TInt policy2 = KRequiredCapabilities2().CheckPolicy( aMsg ); |
|
191 if( !policy2 ) |
|
192 { |
|
193 RDEBUG("CUISettingsSrvServer::CustomSecurityCheckL Capabilities ERROR"); |
|
194 return EFail; |
|
195 } |
|
196 |
|
197 RDEBUG("CUISettingsSrvServer::CustomSecurityCheckL Capabilities OK"); |
|
198 return EPass; |
|
199 } |
|
200 |
|
201 CUISettingsSrvServer::~CUISettingsSrvServer() |
|
202 { |
|
203 iShutdownTimer.Cancel(); |
|
204 |
|
205 // delete iAppList; |
|
206 |
|
207 // delete iShortcuts; |
|
208 |
|
209 if( iTemporaryImageFile.Length() > 0 ) |
|
210 { |
|
211 RDEBUG( "CUISettingsSrvServer::~CUISettingsSrvServer() Deleting temporary file" ); |
|
212 iFs.Delete( iTemporaryImageFile ); |
|
213 iTemporaryImageFile.Zero(); |
|
214 } |
|
215 |
|
216 iFs.Close(); |
|
217 |
|
218 iIndeces.Reset(); |
|
219 iNotifyChanges.Reset(); |
|
220 |
|
221 delete iImgHandling; |
|
222 |
|
223 delete iStartupRep; |
|
224 } |
|
225 |
|
226 |
|
227 void CUISettingsSrvServer::ConstructL() |
|
228 { |
|
229 RDEBUG( "CUISettingsSrvServer::ConstructL" ); |
|
230 |
|
231 User::LeaveIfError( iFs.Connect() ); |
|
232 // iShortcuts = CScShortcutEngine::NewL(iFs, *this); |
|
233 // RDEBUG_2( "CUISettingsSrvServer::ConstructL CScShortcutEngine ALLOC %x", iShortcuts ); |
|
234 |
|
235 iShutdownTimer.ConstructL(); |
|
236 iShutdownTimer.Start(); |
|
237 StartL(KUISettingsSrvName); |
|
238 |
|
239 iImgHandling = CGSAsyncImageHandling::NewL( |
|
240 iFs, this, KUISSWelcomeImagePath() ); |
|
241 |
|
242 RDEBUG_2( "CUISettingsSrvServer::ConstructL CGSAsyncImageHandling ALLOC %x", iImgHandling ); |
|
243 |
|
244 iStartupRep = CRepository::NewL( KCRUidStartupConf ); |
|
245 RDEBUG_2( "CUISettingsSrvServer::ConstructL CRepository ALLOC %x", iStartupRep ); |
|
246 } |
|
247 |
|
248 // Create and start a new count server. |
|
249 CUISettingsSrvServer* CUISettingsSrvServer::NewL() |
|
250 { |
|
251 RDEBUG( "CUISettingsSrvServer::NewL" ); |
|
252 |
|
253 CUISettingsSrvServer *pS = 0; |
|
254 pS = new (ELeave) CUISettingsSrvServer( EPriorityStandard ); |
|
255 RDEBUG_2( "CUISettingsSrvServer::NewL CUISettingsSrvServer ALLOC %x", pS ); |
|
256 |
|
257 CleanupStack::PushL( pS ); |
|
258 |
|
259 pS->ConstructL(); |
|
260 |
|
261 CleanupStack::Pop( pS ); |
|
262 return pS; |
|
263 } |
|
264 |
|
265 |
|
266 // Create a new server session. |
|
267 CSession2 *CUISettingsSrvServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/) const |
|
268 { |
|
269 RDEBUG( "CUISettingsSrvServer::NewSessionL" ); |
|
270 |
|
271 // check we're the right version |
|
272 TVersion v(KUISettingsSrvMajorVersionNumber,KUISettingsSrvMinorVersionNumber,KUISettingsSrvBuildVersionNumber); |
|
273 if (!User::QueryVersionSupported(v,aVersion)) |
|
274 { |
|
275 User::Leave(KErrNotSupported); |
|
276 } |
|
277 |
|
278 // make new session |
|
279 return CUISettingsSrvSession::NewL( ( CUISettingsSrvServer*) this ); |
|
280 } |
|
281 |
|
282 void CUISettingsSrvServer::AddSession() |
|
283 { |
|
284 RDEBUG( "CUISettingsSrvServer::AddSession" ); |
|
285 |
|
286 iSessionCount++; |
|
287 iShutdownTimer.Cancel(); |
|
288 } |
|
289 |
|
290 void CUISettingsSrvServer::RemoveSession() |
|
291 { |
|
292 RDEBUG( "CUISettingsSrvServer::RemoveSession" ); |
|
293 |
|
294 iSessionCount--; |
|
295 if (iSessionCount <= 0) |
|
296 { |
|
297 iShutdownTimer.Start(); |
|
298 } |
|
299 } |
|
300 |
|
301 void CUISettingsSrvServer::Shutdown() |
|
302 { |
|
303 RDEBUG( "CUISettingsSrvServer::Shutdown" ); |
|
304 } |
|
305 |
|
306 // From MScSelectableShortcutListObserver |
|
307 void CUISettingsSrvServer::ScSSLOHandleListChangedL() |
|
308 { |
|
309 RDEBUG( "CUISettingsSrvServer::ScSSLOHandleListChangedL" ); |
|
310 |
|
311 // Shortcut list has changed, notify sessions about the situation! |
|
312 for(TInt i=0; i<iNotifyChanges.Count(); i++) |
|
313 { |
|
314 TInt* flag = iNotifyChanges[ i ]; |
|
315 if( flag != 0 ) |
|
316 { |
|
317 *flag = 1; |
|
318 } |
|
319 } |
|
320 } |
|
321 |
|
322 // From MScSelectableShortcutListObserver |
|
323 void CUISettingsSrvServer::ScSSLOHandleListConstructionComplete(TInt /*aError*/) |
|
324 { |
|
325 RDEBUG( "CUISettingsSrvServer::ScSSLOHandleListConstructionComplete" ); |
|
326 |
|
327 if( iASWait.IsStarted() ) |
|
328 { |
|
329 iASWait.AsyncStop(); |
|
330 } |
|
331 } |
|
332 |
|
333 // From MScEngineObserver |
|
334 // TBool CUISettingsSrvServer::MScEngineHandleShortcutEvent( |
|
335 // TScShortcutEvent /*aEvent*/, |
|
336 // TScActionType /*aType*/ |
|
337 // ) |
|
338 // { |
|
339 // RDEBUG( "CUISettingsSrvServer::MScEngineHandleShortcutEvent" ); |
|
340 |
|
341 // return EFalse; |
|
342 // } */ |
|
343 |
|
344 void CUISettingsSrvServer::GetShortcutTargetListL() |
|
345 { |
|
346 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetListL" ); |
|
347 |
|
348 if( iASWait.IsStarted() ) |
|
349 { |
|
350 User::Leave( KErrServerBusy ); |
|
351 } |
|
352 |
|
353 // Remember count of previous list |
|
354 TInt oldCount = 0; |
|
355 if( iAppList != 0 ) |
|
356 { |
|
357 oldCount = iAppList->Count(); |
|
358 } |
|
359 |
|
360 delete iAppList; |
|
361 iAppList = 0; |
|
362 |
|
363 delete iShortcuts; |
|
364 iShortcuts = 0; |
|
365 |
|
366 iShortcuts = CScShortcutEngine::NewL(iFs, *this); |
|
367 RDEBUG_2( "CUISettingsSrvServer::GetShortcutTargetListL CScShortcutEngine ALLOC %x", iShortcuts ); |
|
368 |
|
369 const CScSelectableShortcutList::TCaptionType typeSettings = |
|
370 CScSelectableShortcutList::ECaptionTypeSoftkey; |
|
371 iAppList = iShortcuts->SelectableApplicationListLC( typeSettings, *this ); |
|
372 |
|
373 iASWait.Start(); |
|
374 CleanupStack::Pop( iAppList ); |
|
375 |
|
376 // |
|
377 // If list had already changed (and engine had not notified that to us) |
|
378 // set flag to indicate that clients data is most probably outdated |
|
379 // |
|
380 if( (oldCount > 0) && (oldCount != iAppList->Count()) ) |
|
381 { |
|
382 ScSSLOHandleListChangedL(); |
|
383 } |
|
384 |
|
385 */ |
|
386 } |
|
387 |
|
388 void CUISettingsSrvServer::SetShortcutListMaskL(CScSelectableShortcutList& aScAppList, TInt aMask) |
|
389 { |
|
390 /* RDEBUG( "CUISettingsSrvServer::SetShortcutListMaskL" ); |
|
391 |
|
392 iIndeces.Reset(); |
|
393 TInt i, count = aScAppList.Count(); |
|
394 |
|
395 for(i=0; i<count; i++) |
|
396 { |
|
397 TScRtType rtType = aScAppList.At( i ).MScRtType(); |
|
398 TInt rt = EUiSrvRtTypeNul; |
|
399 |
|
400 if( aMask == EUiSrvRtTypeNul) |
|
401 { |
|
402 iIndeces.AppendL( i ); |
|
403 } |
|
404 else |
|
405 { |
|
406 switch( rtType.iUid ) |
|
407 { |
|
408 case KScRtTypeUidValueNativeApp: |
|
409 case KScRtTypeUidValueMailbox: |
|
410 case KScRtTypeUidValueMsgEditor: |
|
411 case KScRtTypeUidValueNewMessage: |
|
412 case KScRtTypeUidValueNoEffect: |
|
413 default: |
|
414 rt |= EUiSrvRtTypeApp; |
|
415 break; |
|
416 |
|
417 case KScRtTypeUidValueBookmark: |
|
418 { |
|
419 rt |= EUiSrvRtTypeBm; |
|
420 TUid uid = TUid::Uid( KScCustomOpValueBookmarkGetURL ); |
|
421 HBufC* url = (HBufC*) |
|
422 aScAppList.At( i ).MScCustomOperationL( |
|
423 uid, |
|
424 (TAny*)0, |
|
425 (TAny*)0 |
|
426 ); |
|
427 delete url; |
|
428 } |
|
429 break; |
|
430 } |
|
431 |
|
432 if( (aMask & rt) == rt ) |
|
433 { |
|
434 iIndeces.AppendL( i ); |
|
435 } |
|
436 } |
|
437 } |
|
438 |
|
439 */ |
|
440 } |
|
441 |
|
442 void CUISettingsSrvServer::AddListChangeNotifierL(TInt *aFlag) |
|
443 { |
|
444 RDEBUG( "CUISettingsSrvServer::AddListChangeNotifierL" ); |
|
445 |
|
446 iNotifyChanges.AppendL( aFlag ); |
|
447 } |
|
448 |
|
449 void CUISettingsSrvServer::RemoveListChangeNotifierL(TInt *aFlag) |
|
450 { |
|
451 RDEBUG( "CUISettingsSrvServer::RemoveListChangeNotifierL" ); |
|
452 |
|
453 iNotifyChanges.Remove( iNotifyChanges.FindL(aFlag) ); |
|
454 } |
|
455 |
|
456 void CUISettingsSrvServer::GetShortcutTargetCountL( |
|
457 const RMessage2 &aMessage ) |
|
458 { |
|
459 RDEBUG( "CUISettingsSrvServer::GetShortcutTargetCountL" ); |
|
460 |
|
461 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
462 |
|
463 TInt count = iIndeces.Count(); |
|
464 TPckg<TInt> countp( count ); |
|
465 aMessage.Write(1, countp); |
|
466 } |
|
467 |
|
468 void CUISettingsSrvServer::GetShortcutTargetTypeL( const RMessage2 &aMessage ) |
|
469 { |
|
470 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetTypeL" ); |
|
471 |
|
472 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
473 |
|
474 TInt index = aMessage.Int1(); |
|
475 TInt type = iAppList->At( iIndeces[ index ] ).MScRtType().iUid; |
|
476 TPckg<TInt> typep( type ); |
|
477 aMessage.Write(2, typep); |
|
478 |
|
479 */ |
|
480 } |
|
481 |
|
482 void CUISettingsSrvServer::GetShortcutTargetCaptionL( const RMessage2 &aMessage ) |
|
483 { |
|
484 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetCaptionL" ); |
|
485 |
|
486 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
487 |
|
488 TInt index = aMessage.Int1(); |
|
489 TPtrC caption( iAppList->At( iIndeces[ index ] ).MScCaption( MScShortcut::EScCaptionTypeSoftkey ) ); |
|
490 aMessage.Write(2, caption); |
|
491 */ |
|
492 } |
|
493 |
|
494 void CUISettingsSrvServer::GetShortcutTargetAppUidL( const RMessage2 &aMessage ) |
|
495 { |
|
496 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetAppUidL" ); |
|
497 |
|
498 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
499 |
|
500 TInt index = aMessage.Int1(); |
|
501 |
|
502 TInt appUid = 0; |
|
503 |
|
504 const CScShortcutBase &sc = iAppList->At( iIndeces[ index ] ); |
|
505 if( sc.MScRtType() == KScRtTypeUidBookmark ) |
|
506 { |
|
507 appUid = (TInt)iAppList->At( iIndeces[ index ] ).CustomOperationL( KScCustomOpBookmarkGetBookmarkId, NULL, NULL ); |
|
508 } |
|
509 else |
|
510 { |
|
511 appUid = (TInt)iAppList->At( iIndeces[ index ] ).CustomOperationL( KScCustomOpNativeAppGetUid, NULL, NULL ); |
|
512 } |
|
513 TPckg<TInt> uidp( appUid ); |
|
514 aMessage.Write(2, uidp); |
|
515 |
|
516 */ |
|
517 } |
|
518 |
|
519 void CUISettingsSrvServer::GetShortcutTargetIndexFromATL( const RMessage2 &aMessage ) |
|
520 { |
|
521 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetIndexFromATL" ); |
|
522 |
|
523 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
524 |
|
525 TInt i, index = -1; |
|
526 TInt actionType = aMessage.Int1(); |
|
527 const CScShortcutBase &sc = iShortcuts->ShortcutL( TUid::Uid( actionType ) ); |
|
528 |
|
529 for(i=0; i<iIndeces.Count(); i++) |
|
530 { |
|
531 if( iAppList->At( iIndeces[ i ] ).IsEqual( sc ) ) |
|
532 { |
|
533 index = i; |
|
534 break; |
|
535 } |
|
536 } |
|
537 |
|
538 TPckg<TInt> indexp( index ); |
|
539 aMessage.Write(2, indexp); |
|
540 |
|
541 */ |
|
542 |
|
543 } |
|
544 |
|
545 void CUISettingsSrvServer::GetShortcutTargetIndexL( const RMessage2 &aMessage ) |
|
546 { |
|
547 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetIndexL" ); |
|
548 |
|
549 TInt type = aMessage.Int0(); |
|
550 |
|
551 SetShortcutListMaskL( *iAppList, type ); |
|
552 |
|
553 TInt i, index = -1; |
|
554 TInt theUid = aMessage.Int1(); |
|
555 |
|
556 for(i=0; i<iIndeces.Count(); i++) |
|
557 { |
|
558 if( (type & EUiSrvRtTypeBm) == EUiSrvRtTypeBm ) |
|
559 { |
|
560 TScBookmarkEngineId bmUid = -1; |
|
561 |
|
562 TRAPD |
|
563 ( |
|
564 reason, |
|
565 bmUid = (TScBookmarkEngineId)iAppList->At( iIndeces[ i ] ).CustomOperationL( KScCustomOpBookmarkGetBookmarkId, NULL, NULL ) |
|
566 ); |
|
567 |
|
568 if( (KErrNone == reason) && (bmUid == theUid) ) |
|
569 { |
|
570 index = i; |
|
571 break; |
|
572 } |
|
573 } |
|
574 if( (type & EUiSrvRtTypeApp) == EUiSrvRtTypeApp ) |
|
575 { |
|
576 TInt appUid = -1; |
|
577 |
|
578 TRAPD |
|
579 ( |
|
580 reason, |
|
581 appUid = (TInt)iAppList->At( iIndeces[ i ] ).CustomOperationL( KScCustomOpNativeAppGetUid, NULL, NULL ) |
|
582 ); |
|
583 |
|
584 if( (KErrNone == reason) && (appUid == theUid) ) |
|
585 { |
|
586 index = i; |
|
587 break; |
|
588 } |
|
589 } |
|
590 } |
|
591 |
|
592 TPckg<TInt> indexp( index ); |
|
593 aMessage.Write(2, indexp); |
|
594 */ |
|
595 } |
|
596 |
|
597 void CUISettingsSrvServer::SetShortcutTargetAppIndexL(const RMessage2 &aMessage) |
|
598 { |
|
599 /* RDEBUG( "CUISettingsSrvServer::SetShortcutTargetAppIndexL >" ); |
|
600 |
|
601 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
602 |
|
603 TInt actionType = aMessage.Int1(); |
|
604 TInt index = aMessage.Int2(); |
|
605 |
|
606 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetAppIndexL get Shortcut index" ); |
|
607 TInt scIndex = iIndeces[ index ]; |
|
608 |
|
609 if( scIndex >= iAppList->Count() ) |
|
610 { |
|
611 RDEBUG_3( "CUISettingsSrvServer::SetShortcutTargetAppIndexL Index out of bound! %d >= %d", scIndex, iAppList->Count() ); |
|
612 User::Leave( KErrArgument ); |
|
613 } |
|
614 |
|
615 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetAppIndexL get Shortcut from the list" ); |
|
616 const CScShortcutBase &newSc = iAppList->At( scIndex ); |
|
617 |
|
618 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetAppIndexL entering iShortcuts->SetShortcutL" ); |
|
619 iShortcuts->SetShortcutL( TUid::Uid( actionType ), newSc ); |
|
620 |
|
621 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetAppIndexL <" ); |
|
622 */ |
|
623 } |
|
624 |
|
625 void CUISettingsSrvServer::GetShortcutRtTypeL(const RMessage2 &aMessage) |
|
626 { |
|
627 /* RDEBUG( "CUISettingsSrvServer::GetShortcutRtTypeL" ); |
|
628 |
|
629 |
|
630 TInt actionType = aMessage.Int0(); |
|
631 const CScShortcutBase &sc = iShortcuts->ShortcutL( TUid::Uid( actionType ) ); |
|
632 |
|
633 TInt rtType = sc.RtType().iUid; |
|
634 |
|
635 TPckg<TInt> rttypep( rtType ); |
|
636 aMessage.Write(1, rttypep); |
|
637 */ |
|
638 } |
|
639 |
|
640 void CUISettingsSrvServer::SetShortcutTargetCaptionL(const RMessage2 &aMessage) |
|
641 { |
|
642 /* RDEBUG( "CUISettingsSrvServer::SetShortcutTargetCaptionL" ); |
|
643 |
|
644 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
645 |
|
646 HBufC16 *caption = CUISettingsSrvSession::CopyParameter16L( aMessage, 2 ); |
|
647 CleanupStack::PushL( caption ); |
|
648 |
|
649 CleanupStack::PopAndDestroy( caption ); |
|
650 */ |
|
651 } |
|
652 |
|
653 void CUISettingsSrvServer::SetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
654 { |
|
655 /* RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL >" ); |
|
656 |
|
657 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
658 |
|
659 TInt index = aMessage.Int1(); |
|
660 |
|
661 HBufC16 *filename = CUISettingsSrvSession::CopyParameter16L( aMessage, 2 ); |
|
662 CleanupStack::PushL( filename ); |
|
663 |
|
664 HBufC8 *mimetype = CUISettingsSrvSession::CopyParameter8L( aMessage, 3 ); |
|
665 CleanupStack::PushL( mimetype ); |
|
666 |
|
667 CFbsBitmap *bitmap = LoadBitmapL( *filename, *mimetype ); |
|
668 CleanupStack::PushL( bitmap ); |
|
669 |
|
670 CScShortcutBase &sc = (CScShortcutBase&)iAppList->At( iIndeces[ index ] ); |
|
671 CScShortcutBitmapArray &scBitmapArray = sc.MScMultipleBitmapsL(); |
|
672 |
|
673 CScShortcutBitmap *oldBitmap = 0; |
|
674 CScShortcutBitmap *newBitmap = 0; |
|
675 |
|
676 TRAP_IGNORE( |
|
677 oldBitmap = & scBitmapArray.BitmapL( iIdleBitmapUid ) ); |
|
678 |
|
679 if( 0 == oldBitmap ) |
|
680 { |
|
681 if( aIsMask ) |
|
682 { |
|
683 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL ERROR Trying to set mask when there is no image"); |
|
684 User::Leave( KErrNotSupported ); |
|
685 } |
|
686 newBitmap = CScShortcutBitmap::NewL( iIdleBitmapUid ); |
|
687 RDEBUG_2( "CUISettingsSrvServer::SetShortcutTargetBitmapL CScShortcutBitmap::NewL ALLOC %x", newBitmap ); |
|
688 } |
|
689 else |
|
690 { |
|
691 newBitmap = CScShortcutBitmap::NewCopyL( *oldBitmap ); |
|
692 RDEBUG_2( "CUISettingsSrvServer::SetShortcutTargetBitmapL CScShortcutBitmap::NewCopyL ALLOC %x", newBitmap ); |
|
693 } |
|
694 |
|
695 CleanupStack::PushL( newBitmap ); |
|
696 |
|
697 // Set image or mask |
|
698 if( ! aIsMask ) |
|
699 { |
|
700 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL Setting BITMAP" ); |
|
701 newBitmap->SetImageL( bitmap ); |
|
702 } |
|
703 else |
|
704 { |
|
705 if( !newBitmap->HasBitmap() ) |
|
706 { |
|
707 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL ERROR Trying to set mask when there is no image 2"); |
|
708 User::Leave( KErrNotSupported ); |
|
709 } |
|
710 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL Setting MASK" ); |
|
711 newBitmap->SetMaskL( bitmap ); |
|
712 } |
|
713 |
|
714 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL Updating shortcut bitmaps" ); |
|
715 scBitmapArray.SetBitmapL( iIdleBitmapUid, newBitmap ); |
|
716 |
|
717 CleanupStack::Pop( newBitmap ); |
|
718 CleanupStack::Pop( bitmap ); |
|
719 CleanupStack::PopAndDestroy( mimetype ); |
|
720 CleanupStack::PopAndDestroy( filename ); |
|
721 |
|
722 RDEBUG( "CUISettingsSrvServer::SetShortcutTargetBitmapL <" ); |
|
723 */ |
|
724 } |
|
725 |
|
726 void CUISettingsSrvServer::GetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
727 { |
|
728 /* RDEBUG( "CUISettingsSrvServer::GetShortcutTargetBitmapL >" ); |
|
729 |
|
730 SetShortcutListMaskL( *iAppList, aMessage.Int0() ); |
|
731 TInt index = aMessage.Int1(); |
|
732 |
|
733 CScShortcutBase &sc = (CScShortcutBase&)iAppList->At( iIndeces[ index ] ); |
|
734 CScShortcutBitmapArray &scBitmapArray = sc.MScMultipleBitmapsL(); |
|
735 CScShortcutBitmap *scBitmap = 0; |
|
736 |
|
737 TRAP_IGNORE( |
|
738 scBitmap = & scBitmapArray.BitmapL( iIdleBitmapUid ) ); |
|
739 |
|
740 if( 0 == scBitmap ) |
|
741 { |
|
742 User::Leave( KErrNotFound ); |
|
743 } |
|
744 |
|
745 CFbsBitmap *bitmap = 0; |
|
746 |
|
747 if( !aIsMask ) |
|
748 { |
|
749 bitmap = &scBitmap->ImageL(); |
|
750 } |
|
751 else |
|
752 { |
|
753 bitmap = &scBitmap->MaskL(); |
|
754 } |
|
755 |
|
756 CleanupStack::PushL( bitmap ); |
|
757 |
|
758 // |
|
759 // Delete previous temp file |
|
760 // |
|
761 if( iTemporaryImageFile.Length() > 0 ) |
|
762 { |
|
763 iFs.Delete( iTemporaryImageFile ); |
|
764 iTemporaryImageFile.Zero(); |
|
765 } |
|
766 |
|
767 // |
|
768 // Create new temp file |
|
769 // |
|
770 RFile file; |
|
771 User::LeaveIfError( file.Temp( iFs, KTempFilePath, iTemporaryImageFile, EFileWrite ) ); |
|
772 CleanupClosePushL( file ); |
|
773 |
|
774 bitmap->Save( file ); |
|
775 |
|
776 // Close file |
|
777 CleanupStack::PopAndDestroy( &file ); |
|
778 |
|
779 CleanupStack::PopAndDestroy( bitmap ); |
|
780 |
|
781 RDEBUG( "CUISettingsSrvServer::GetShortcutTargetBitmapL <" ); |
|
782 |
|
783 */ |
|
784 } |
|
785 |
|
786 void CUISettingsSrvServer::SetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
787 { |
|
788 /* RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL >" ); |
|
789 |
|
790 TUid imageUid ( iIdleBitmapUid ); |
|
791 TInt softkeyUid = aMessage.Int0(); |
|
792 switch( softkeyUid ) |
|
793 { |
|
794 default: |
|
795 case KScActionTypeUidValueNull: |
|
796 User::Leave( KErrArgument ); |
|
797 break; |
|
798 |
|
799 case KScActionTypeUidValueSoftkeyLeft: |
|
800 case KScActionTypeUidValueSoftkeyRight: |
|
801 case KScActionTypeUidValueScrollkeyLeft: |
|
802 case KScActionTypeUidValueScrollkeyRight: |
|
803 case KScActionTypeUidValueScrollkeyUp: |
|
804 case KScActionTypeUidValueScrollkeyDown: |
|
805 case KScActionTypeUidValueScrollkeySelect: |
|
806 imageUid = iIdleBitmapUid; |
|
807 break; |
|
808 |
|
809 case KActiveIdleScUidValueItem1: |
|
810 case KActiveIdleScUidValueItem2: |
|
811 case KActiveIdleScUidValueItem3: |
|
812 case KActiveIdleScUidValueItem4: |
|
813 case KActiveIdleScUidValueItem5: |
|
814 imageUid = iAIBitmapUid; |
|
815 break; |
|
816 } |
|
817 |
|
818 HBufC16 *filename = CUISettingsSrvSession::CopyParameter16L( aMessage, 1 ); |
|
819 CleanupStack::PushL( filename ); |
|
820 |
|
821 HBufC8 *mimetype = CUISettingsSrvSession::CopyParameter8L( aMessage, 2 ); |
|
822 CleanupStack::PushL( mimetype ); |
|
823 |
|
824 CFbsBitmap *bitmap = LoadBitmapL( *filename, *mimetype ); |
|
825 CleanupStack::PushL( bitmap ); |
|
826 |
|
827 CScShortcutBase& shortcut = iShortcuts->ShortcutL( TUid::Uid( softkeyUid ) ); |
|
828 CScShortcutBitmapArray &scBitmapArray = shortcut.MScMultipleBitmapsL(); |
|
829 |
|
830 CScShortcutBitmap *oldBitmap = 0; |
|
831 CScShortcutBitmap *newBitmap = 0; |
|
832 |
|
833 TRAP_IGNORE( |
|
834 oldBitmap = & scBitmapArray.BitmapL( imageUid ) ); |
|
835 |
|
836 if( 0 == oldBitmap ) |
|
837 { |
|
838 if( aIsMask ) |
|
839 { |
|
840 RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL ERROR Trying to set mask when there is no image"); |
|
841 User::Leave( KErrNotSupported ); |
|
842 } |
|
843 newBitmap = CScShortcutBitmap::NewL( imageUid ); |
|
844 RDEBUG_2( "CUISettingsSrvServer::SetSoftkeyBitmapL CScShortcutBitmap::NewL ALLOC %x", newBitmap ); |
|
845 } |
|
846 else |
|
847 { |
|
848 newBitmap = CScShortcutBitmap::NewCopyL( *oldBitmap ); |
|
849 RDEBUG_2( "CUISettingsSrvServer::SetSoftkeyBitmapL CScShortcutBitmap::NewCopyL ALLOC %x", newBitmap ); |
|
850 } |
|
851 |
|
852 CleanupStack::PushL( newBitmap ); |
|
853 |
|
854 // Set image or mask |
|
855 if( ! aIsMask ) |
|
856 { |
|
857 RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL Setting BITMAP" ); |
|
858 newBitmap->SetImageL( bitmap ); |
|
859 } |
|
860 else |
|
861 { |
|
862 if( !newBitmap->HasBitmap() ) |
|
863 { |
|
864 RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL ERROR Trying to set mask when there is no image 2"); |
|
865 User::Leave( KErrNotSupported ); |
|
866 } |
|
867 RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL Setting MASK" ); |
|
868 newBitmap->SetMaskL( bitmap ); |
|
869 } |
|
870 |
|
871 RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL Updating shortcut bitmaps" ); |
|
872 scBitmapArray.SetBitmapL( imageUid, newBitmap ); |
|
873 |
|
874 // Shortcut is updated ... |
|
875 iShortcuts->SetShortcutL( TUid::Uid( softkeyUid ), shortcut ); |
|
876 |
|
877 CleanupStack::Pop( newBitmap ); |
|
878 CleanupStack::Pop( bitmap ); |
|
879 CleanupStack::PopAndDestroy( mimetype ); |
|
880 CleanupStack::PopAndDestroy( filename ); |
|
881 |
|
882 RDEBUG( "CUISettingsSrvServer::SetSoftkeyBitmapL <" ); |
|
883 */ |
|
884 } |
|
885 |
|
886 void CUISettingsSrvServer::GetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
887 { |
|
888 /* RDEBUG( "CUISettingsSrvServer::GetSoftkeyBitmapL" ); |
|
889 |
|
890 TUid imageUid ( iIdleBitmapUid ); |
|
891 TInt softkeyUid = aMessage.Int0(); |
|
892 switch( softkeyUid ) |
|
893 { |
|
894 default: |
|
895 case KScActionTypeUidValueNull: |
|
896 User::Leave( KErrArgument ); |
|
897 break; |
|
898 |
|
899 case KScActionTypeUidValueSoftkeyLeft: |
|
900 case KScActionTypeUidValueSoftkeyRight: |
|
901 case KScActionTypeUidValueScrollkeyLeft: |
|
902 case KScActionTypeUidValueScrollkeyRight: |
|
903 case KScActionTypeUidValueScrollkeyUp: |
|
904 case KScActionTypeUidValueScrollkeyDown: |
|
905 case KScActionTypeUidValueScrollkeySelect: |
|
906 imageUid = iIdleBitmapUid; |
|
907 break; |
|
908 |
|
909 case KActiveIdleScUidValueItem1: |
|
910 case KActiveIdleScUidValueItem2: |
|
911 case KActiveIdleScUidValueItem3: |
|
912 case KActiveIdleScUidValueItem4: |
|
913 case KActiveIdleScUidValueItem5: |
|
914 imageUid = iAIBitmapUid; |
|
915 break; |
|
916 } |
|
917 |
|
918 CScShortcutBase& shortcut = iShortcuts->ShortcutL( TUid::Uid( softkeyUid ) ); |
|
919 CScShortcutBitmapArray &scBitmapArray = shortcut.MScMultipleBitmapsL(); |
|
920 CScShortcutBitmap *scBitmap = 0; |
|
921 |
|
922 TRAP_IGNORE( |
|
923 scBitmap = & scBitmapArray.BitmapL( imageUid ) ); |
|
924 |
|
925 if( 0 == scBitmap ) |
|
926 { |
|
927 User::Leave( KErrNotFound ); |
|
928 } |
|
929 |
|
930 CFbsBitmap *bitmap = 0; |
|
931 |
|
932 if( !aIsMask ) |
|
933 { |
|
934 bitmap = &scBitmap->ImageL(); |
|
935 } |
|
936 else |
|
937 { |
|
938 bitmap = &scBitmap->MaskL(); |
|
939 } |
|
940 |
|
941 CleanupStack::PushL( bitmap ); |
|
942 |
|
943 // |
|
944 // Delete previous temp file |
|
945 // |
|
946 if( iTemporaryImageFile.Length() > 0 ) |
|
947 { |
|
948 iFs.Delete( iTemporaryImageFile ); |
|
949 iTemporaryImageFile.Zero(); |
|
950 } |
|
951 |
|
952 // |
|
953 // Create new temp file |
|
954 // |
|
955 RFile file; |
|
956 User::LeaveIfError( file.Temp( iFs, KTempFilePath, iTemporaryImageFile, EFileWrite ) ); |
|
957 CleanupClosePushL( file ); |
|
958 |
|
959 bitmap->Save( file ); |
|
960 |
|
961 aMessage.Write(1, iTemporaryImageFile); |
|
962 aMessage.Write(2, KMimeTypeImageMbm); |
|
963 |
|
964 // Close file |
|
965 CleanupStack::PopAndDestroy( &file ); |
|
966 |
|
967 CleanupStack::PopAndDestroy( bitmap ); |
|
968 */ |
|
969 } |
|
970 |
|
971 void CUISettingsSrvServer::SetStartupImageL( const TDesC &aFilePath ) |
|
972 { |
|
973 RDEBUG( "CUISettingsSrvServer::SetStartupImageL" ); |
|
974 |
|
975 if( iASWait.IsStarted() ) |
|
976 { |
|
977 User::Leave( KErrServerBusy ); |
|
978 } |
|
979 |
|
980 if( iImgHandling->IsActive() ) |
|
981 { |
|
982 iASWait.Start(); |
|
983 } |
|
984 |
|
985 CGSBackgroundImage *bgImage = CGSBackgroundImage::NewL(); |
|
986 RDEBUG_2( "CUISettingsSrvServer::SetShortcutTargetBitmapL CGSBackgroundImage::NewL ALLOC %x", bgImage ); |
|
987 |
|
988 CleanupStack::PushL( bgImage ); |
|
989 bgImage->SetWelcomeNoteImageL( aFilePath, *iImgHandling ); |
|
990 iImageHandlingError = KErrNone; |
|
991 User::LeaveIfError( iImageHandlingError ); |
|
992 |
|
993 User::LeaveIfError( iStartupRep->Set( KStartupWelcomeNoteImage, KUISSWelcomeImagePath ) ); |
|
994 |
|
995 CleanupStack::PopAndDestroy( bgImage ); |
|
996 } |
|
997 |
|
998 void CUISettingsSrvServer::SetStartupImageL(const RMessage2 &aMessage) |
|
999 { |
|
1000 RDEBUG( "CUISettingsSrvServer::SetStartupImageL" ); |
|
1001 |
|
1002 HBufC16* text = CUISettingsSrvSession::CopyParameter16L( aMessage, 0 ); |
|
1003 CleanupStack::PushL( text ); |
|
1004 |
|
1005 SetStartupImageL( *text ); |
|
1006 |
|
1007 CleanupStack::PopAndDestroy( text ); |
|
1008 } |
|
1009 |
|
1010 void CUISettingsSrvServer::GetStartupImagePathL(const RMessage2 &aMessage) |
|
1011 { |
|
1012 RDEBUG( "CUISettingsSrvServer::GetStartupImagePathL" ); |
|
1013 |
|
1014 TFileName imageLocation; |
|
1015 |
|
1016 CRepository* rep = CRepository::NewLC( KCRUidStartupConf ); |
|
1017 RDEBUG_2( "CUISettingsSrvServer::GetStartupImagePathL CRepository::NewLC ALLOC %x", rep ); |
|
1018 |
|
1019 User::LeaveIfError( rep->Get( KStartupWelcomeNoteImage, imageLocation ) ); |
|
1020 |
|
1021 CleanupStack::PopAndDestroy( rep ); |
|
1022 |
|
1023 aMessage.Write(0, imageLocation); |
|
1024 } |
|
1025 |
|
1026 void CUISettingsSrvServer::SetStartupTextL(const RMessage2 &aMessage) |
|
1027 { |
|
1028 RDEBUG( "CUISettingsSrvServer::SetStartupTextL" ); |
|
1029 |
|
1030 HBufC16* text = CUISettingsSrvSession::CopyParameter16L( aMessage, 0 ); |
|
1031 CleanupStack::PushL( text ); |
|
1032 |
|
1033 User::LeaveIfError( iStartupRep->Set( KStartupWelcomeNoteText, *text ) ); |
|
1034 |
|
1035 CleanupStack::PopAndDestroy( text ); |
|
1036 } |
|
1037 |
|
1038 void CUISettingsSrvServer::GetStartupTextL(const RMessage2 &aMessage) |
|
1039 { |
|
1040 RDEBUG( "CUISettingsSrvServer::GetStartupTextL" ); |
|
1041 |
|
1042 TBuf<WELCOME_NOTE_MAX_LENGTH> welcomeText; |
|
1043 |
|
1044 User::LeaveIfError( iStartupRep->Get( KStartupWelcomeNoteText, welcomeText ) ); |
|
1045 |
|
1046 aMessage.Write(0, welcomeText); |
|
1047 } |
|
1048 |
|
1049 void CUISettingsSrvServer::GetStartupTextSizeL(const RMessage2 &aMessage) |
|
1050 { |
|
1051 RDEBUG( "CUISettingsSrvServer::GetStartupTextSizeL" ); |
|
1052 |
|
1053 TBuf<WELCOME_NOTE_MAX_LENGTH> welcomeText; |
|
1054 |
|
1055 User::LeaveIfError( iStartupRep->Get( KStartupWelcomeNoteText, welcomeText ) ); |
|
1056 |
|
1057 TInt len = welcomeText.Length(); |
|
1058 TPckg<TInt> lenp( len ); |
|
1059 aMessage.Write(0, lenp); |
|
1060 } |
|
1061 |
|
1062 void CUISettingsSrvServer::SetStartupNoteTypeL(const RMessage2 &aMessage) |
|
1063 { |
|
1064 RDEBUG( "CUISettingsSrvServer::SetStartupNoteTypeL" ); |
|
1065 |
|
1066 TInt type = aMessage.Int0(); |
|
1067 |
|
1068 User::LeaveIfError( iStartupRep->Set( KStartupWelcomeNoteType, type ) ); |
|
1069 } |
|
1070 |
|
1071 void CUISettingsSrvServer::GetStartupNoteTypeL(const RMessage2 &aMessage) |
|
1072 { |
|
1073 RDEBUG( "CUISettingsSrvServer::GetStartupNoteTypeL" ); |
|
1074 |
|
1075 TInt type = 0; |
|
1076 |
|
1077 User::LeaveIfError( iStartupRep->Get( KStartupWelcomeNoteType, type ) ); |
|
1078 |
|
1079 TPckg<TInt> typep( type ); |
|
1080 aMessage.Write(0, typep); |
|
1081 } |
|
1082 |
|
1083 // ------------------------------------------------------------------------------------- |
|
1084 // CUISettingsSrvServer::LoadBitmapL |
|
1085 // ------------------------------------------------------------------------------------- |
|
1086 CFbsBitmap* CUISettingsSrvServer::LoadBitmapL( const TDesC& aFileName, const TDesC8& aType ) |
|
1087 { |
|
1088 RDEBUG( "CUISettingsSrvServer::LoadBitmapL" ); |
|
1089 |
|
1090 if( aType.Length() == 0 ) |
|
1091 { |
|
1092 RDEBUG( "CUISettingsSrvServer::LoadBitmapL ERROR Mime type is missing!" ); |
|
1093 User::Leave( KErrArgument ); |
|
1094 } |
|
1095 |
|
1096 RDEBUG_2( "CUISettingsSrvServer::LoadBitmapL Filename: %S", &aFileName ); |
|
1097 RDEBUG8_2( "CUISettingsSrvServer::LoadBitmapL Mime type: %S", &aType ); |
|
1098 |
|
1099 // |
|
1100 // Convert to CFbsImages |
|
1101 // |
|
1102 const CImageDecoder::TOptions options = CImageDecoder::EOptionAlwaysThread; |
|
1103 |
|
1104 CImageDecoder* img = CImageDecoder::FileNewL( |
|
1105 iFs, |
|
1106 aFileName, |
|
1107 aType, |
|
1108 options); |
|
1109 |
|
1110 RDEBUG_2( "CUISettingsSrvServer::LoadBitmapL CImageDecoder::FileNewL ALLOC %x", img ); |
|
1111 |
|
1112 CleanupStack::PushL( img ); |
|
1113 |
|
1114 CFbsBitmap* bitmap = 0; |
|
1115 |
|
1116 if( img != 0 ) |
|
1117 { |
|
1118 TFrameInfo frameInfo = img->FrameInfo(); |
|
1119 TRequestStatus rs( KErrNone ); |
|
1120 |
|
1121 bitmap = new (ELeave) CFbsBitmap(); |
|
1122 RDEBUG_2( "CUISettingsSrvServer::LoadBitmapL CFbsBitmap bitmap ALLOC %x", bitmap ); |
|
1123 |
|
1124 CleanupStack::PushL( bitmap ); |
|
1125 bitmap->Create( frameInfo.iOverallSizeInPixels, frameInfo.iFrameDisplayMode ); |
|
1126 |
|
1127 CFbsBitmap* mask = new (ELeave) CFbsBitmap(); |
|
1128 RDEBUG_2( "CUISettingsSrvServer::LoadBitmapL CFbsBitmap mask ALLOC %x", mask ); |
|
1129 |
|
1130 CleanupStack::PushL( mask ); |
|
1131 mask->Create( frameInfo.iOverallSizeInPixels, frameInfo.iFrameDisplayMode ); |
|
1132 |
|
1133 mask->SetDisplayMode( EGray2 ); |
|
1134 |
|
1135 img->Convert( &rs, *bitmap, *mask ); |
|
1136 User::WaitForRequest( rs ); |
|
1137 |
|
1138 User::LeaveIfError( rs.Int() ); |
|
1139 |
|
1140 CleanupStack::PopAndDestroy( mask ); |
|
1141 CleanupStack::Pop( bitmap ); |
|
1142 } |
|
1143 |
|
1144 CleanupStack::PopAndDestroy( img ); |
|
1145 |
|
1146 return bitmap; |
|
1147 } |
|
1148 |
|
1149 void CUISettingsSrvServer::ImageHandlingCompleteL( TInt aError ) |
|
1150 { |
|
1151 if( iASWait.IsStarted() ) |
|
1152 { |
|
1153 iASWait.AsyncStop(); |
|
1154 } |
|
1155 iImageHandlingError = aError; |
|
1156 RDEBUG( "CUISettingsSrvServer::ImageHandlingCompleteL" ); |
|
1157 } |
|
1158 |
|
1159 // ---------------------------------------------------------------------------------------- |
|
1160 // CUISettingsSrvSession |
|
1161 // ---------------------------------------------------------------------------------------- |
|
1162 |
|
1163 |
|
1164 // constructor |
|
1165 CUISettingsSrvSession::CUISettingsSrvSession(CUISettingsSrvServer * aServer) |
|
1166 : iServer( aServer ) |
|
1167 , iListChanged( 0 ) |
|
1168 { |
|
1169 RDEBUG( "CUISettingsSrvSession::CUISettingsSrvSession" ); |
|
1170 |
|
1171 } |
|
1172 |
|
1173 void CUISettingsSrvSession::ConstructL() |
|
1174 { |
|
1175 iServer->AddSession(); |
|
1176 iServer->AddListChangeNotifierL( &iListChanged ); |
|
1177 } |
|
1178 |
|
1179 CUISettingsSrvSession::~CUISettingsSrvSession() |
|
1180 { |
|
1181 RDEBUG( "CUISettingsSrvSession::~CUISettingsSrvSession" ); |
|
1182 |
|
1183 if( iServer != NULL ) |
|
1184 { |
|
1185 TInt err = KErrNone; |
|
1186 TRAP( err, iServer->RemoveListChangeNotifierL( &iListChanged ) ); |
|
1187 iServer->RemoveSession(); |
|
1188 } |
|
1189 } |
|
1190 |
|
1191 CUISettingsSrvSession* CUISettingsSrvSession::NewL(CUISettingsSrvServer* aServer) |
|
1192 { |
|
1193 RDEBUG( "CUISettingsSrvSession::NewL" ); |
|
1194 |
|
1195 CUISettingsSrvSession* self = new (ELeave) CUISettingsSrvSession( aServer ); |
|
1196 CleanupStack::PushL( self ); |
|
1197 self->ConstructL( ); |
|
1198 CleanupStack::Pop(); |
|
1199 |
|
1200 return self; |
|
1201 } |
|
1202 |
|
1203 |
|
1204 void CUISettingsSrvSession::ServiceL(const RMessage2& aMessage) |
|
1205 { |
|
1206 RDEBUG( "CUISettingsSrvSession::ServiceL" ); |
|
1207 |
|
1208 TBool complete = ETrue; |
|
1209 TRAPD(err,complete = DispatchMessageL(aMessage)); |
|
1210 if( complete ) |
|
1211 { |
|
1212 aMessage.Complete(err); |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 |
|
1217 |
|
1218 // service a client request; test the opcode and then do appropriate servicing |
|
1219 TBool CUISettingsSrvSession::DispatchMessageL(const RMessage2& aMessage) |
|
1220 { |
|
1221 RDEBUG( "CUISettingsSrvSession::DispatchMessageL" ); |
|
1222 |
|
1223 switch (aMessage.Function()) |
|
1224 { |
|
1225 case EUISettingsSrvSetStartupImage: |
|
1226 SetStartupImageL( aMessage ); |
|
1227 return ETrue; |
|
1228 case EUISettingsSrvGetStartupImagePath: |
|
1229 GetStartupImagePathL( aMessage ); |
|
1230 return ETrue; |
|
1231 case EUISettingsSrvSetStartupText: |
|
1232 SetStartupTextL( aMessage ); |
|
1233 return ETrue; |
|
1234 case EUISettingsSrvGetStartupText: |
|
1235 GetStartupTextL( aMessage ); |
|
1236 return ETrue; |
|
1237 case EUISettingsSrvGetStartupTextSize: |
|
1238 GetStartupTextSizeL( aMessage ); |
|
1239 return ETrue; |
|
1240 case EUISettingsSrvSetStartupNoteType: |
|
1241 SetStartupNoteTypeL( aMessage ); |
|
1242 return ETrue; |
|
1243 case EUISettingsSrvGetStartupNoteType: |
|
1244 GetStartupNoteTypeL( aMessage ); |
|
1245 return ETrue; |
|
1246 case EUISettingsSrvUpdateShortcutList: |
|
1247 GetShortcutTargetListL( ); |
|
1248 return ETrue; |
|
1249 case EUISettingsSrvGetShortcutCount: |
|
1250 GetShortcutTargetCountL( aMessage ); |
|
1251 return ETrue; |
|
1252 case EUISettingsSrvGetShortcutType: |
|
1253 GetShortcutTargetTypeL( aMessage ); |
|
1254 return ETrue; |
|
1255 case EUISettingsSrvGetShortcutTargetCaption: |
|
1256 GetShortcutTargetCaptionL( aMessage ); |
|
1257 return ETrue; |
|
1258 case EUISettingsSrvSetShortcutTargetCaption: |
|
1259 SetShortcutTargetCaptionL( aMessage ); |
|
1260 return ETrue; |
|
1261 case EUISettingsSrvGetShortcutAppUid: |
|
1262 GetShortcutTargetAppUidL( aMessage ); |
|
1263 return ETrue; |
|
1264 case EUISettingsSrvGetShortcutIndexFromAT: |
|
1265 GetShortcutTargetIndexFromATL( aMessage ); |
|
1266 return ETrue; |
|
1267 case EUISettingsSrvGetShortcutIndex: |
|
1268 GetShortcutTargetIndexL( aMessage ); |
|
1269 return ETrue; |
|
1270 case EUISettingsSrvSetShortcutTargetAppIndex: |
|
1271 SetShortcutTargetAppIndexL( aMessage ); |
|
1272 return ETrue; |
|
1273 case EUISettingsSrvGetShortcutRtType: |
|
1274 GetShortcutRtTypeL( aMessage ); |
|
1275 return ETrue; |
|
1276 case EUISettingsSrvSetShortcutTargetBitmap: |
|
1277 SetShortcutTargetBitmapL( aMessage ); |
|
1278 return ETrue; |
|
1279 case EUISettingsSrvSetShortcutTargetMask: |
|
1280 SetShortcutTargetBitmapL( aMessage, ETrue ); |
|
1281 return ETrue; |
|
1282 case EUISettingsSrvGetShortcutTargetBitmap: |
|
1283 GetShortcutTargetBitmapL( aMessage ); |
|
1284 return ETrue; |
|
1285 case EUISettingsSrvGetShortcutTargetMask: |
|
1286 GetShortcutTargetBitmapL( aMessage, ETrue ); |
|
1287 return ETrue; |
|
1288 case EUISettingsSrvGetSoftkeyBitmap: |
|
1289 GetSoftkeyBitmapL( aMessage ); |
|
1290 return ETrue; |
|
1291 case EUISettingsSrvGetSoftkeyMask: |
|
1292 GetSoftkeyBitmapL( aMessage, ETrue ); |
|
1293 return ETrue; |
|
1294 case EUISettingsSrvSetSoftkeyBitmap: |
|
1295 SetSoftkeyBitmapL( aMessage ); |
|
1296 return ETrue; |
|
1297 case EUISettingsSrvSetSoftkeyMask: |
|
1298 SetSoftkeyBitmapL( aMessage, ETrue ); |
|
1299 return ETrue; |
|
1300 |
|
1301 // requests we don't understand at all are a different thing, |
|
1302 // so panic the client here, this function also completes the message |
|
1303 default: |
|
1304 PanicClient(aMessage, EBadRequest); |
|
1305 return ETrue; |
|
1306 } |
|
1307 } |
|
1308 |
|
1309 void CUISettingsSrvSession::SetStartupImageL(const RMessage2 &aMessage) |
|
1310 { |
|
1311 RDEBUG( "CUISettingsSrvSession::SetStartupImageL" ); |
|
1312 ((CUISettingsSrvServer*)Server())->SetStartupImageL( aMessage ); |
|
1313 } |
|
1314 |
|
1315 void CUISettingsSrvSession::GetStartupImagePathL(const RMessage2 &aMessage) |
|
1316 { |
|
1317 RDEBUG( "CUISettingsSrvSession::GetStartupImagePathL" ); |
|
1318 ((CUISettingsSrvServer*)Server())->GetStartupImagePathL( aMessage ); |
|
1319 } |
|
1320 |
|
1321 void CUISettingsSrvSession::SetStartupTextL(const RMessage2 &aMessage) |
|
1322 { |
|
1323 RDEBUG( "CUISettingsSrvSession::SetStartupTextL" ); |
|
1324 ((CUISettingsSrvServer*)Server())->SetStartupTextL( aMessage ); |
|
1325 } |
|
1326 |
|
1327 void CUISettingsSrvSession::GetStartupTextL(const RMessage2 &aMessage) |
|
1328 { |
|
1329 RDEBUG( "CUISettingsSrvSession::GetStartupTextL" ); |
|
1330 ((CUISettingsSrvServer*)Server())->GetStartupTextL( aMessage ); |
|
1331 } |
|
1332 |
|
1333 void CUISettingsSrvSession::GetStartupTextSizeL(const RMessage2 &aMessage) |
|
1334 { |
|
1335 RDEBUG( "CUISettingsSrvSession::GetStartupTextSizeL" ); |
|
1336 ((CUISettingsSrvServer*)Server())->GetStartupTextSizeL( aMessage ); |
|
1337 } |
|
1338 |
|
1339 void CUISettingsSrvSession::SetStartupNoteTypeL(const RMessage2 &aMessage) |
|
1340 { |
|
1341 RDEBUG( "CUISettingsSrvSession::SetStartupNoteTypeL" ); |
|
1342 ((CUISettingsSrvServer*)Server())->SetStartupNoteTypeL( aMessage ); |
|
1343 } |
|
1344 |
|
1345 void CUISettingsSrvSession::GetStartupNoteTypeL(const RMessage2 &aMessage) |
|
1346 { |
|
1347 RDEBUG( "CUISettingsSrvSession::GetStartupNoteTypeL" ); |
|
1348 ((CUISettingsSrvServer*)Server())->GetStartupNoteTypeL( aMessage ); |
|
1349 } |
|
1350 |
|
1351 void CUISettingsSrvSession::GetShortcutTargetListL( ) |
|
1352 { |
|
1353 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetListL" ); |
|
1354 ((CUISettingsSrvServer*)Server())->GetShortcutTargetListL( ); |
|
1355 |
|
1356 // If short list had changed, server has notified it by settings flag |
|
1357 // Clear flag of this session, other currently connected clients will still get notified |
|
1358 // NOTE: There is no way to notify future clients about changes, there will be errors ... |
|
1359 // |
|
1360 iListChanged = 0; |
|
1361 } |
|
1362 |
|
1363 void CUISettingsSrvSession::GetShortcutTargetCountL( const RMessage2 &aMessage ) |
|
1364 { |
|
1365 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetCountL" ); |
|
1366 |
|
1367 AppListCheckL(); |
|
1368 ((CUISettingsSrvServer*)Server())->GetShortcutTargetCountL( aMessage ); |
|
1369 } |
|
1370 |
|
1371 void CUISettingsSrvSession::GetShortcutTargetTypeL( const RMessage2 &aMessage ) |
|
1372 { |
|
1373 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetTypeL" ); |
|
1374 |
|
1375 AppListCheckL(); |
|
1376 ((CUISettingsSrvServer*)Server())->GetShortcutTargetTypeL( aMessage ); |
|
1377 } |
|
1378 |
|
1379 void CUISettingsSrvSession::GetShortcutTargetCaptionL( const RMessage2 &aMessage ) |
|
1380 { |
|
1381 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetCaptionL" ); |
|
1382 |
|
1383 AppListCheckL(); |
|
1384 ((CUISettingsSrvServer*)Server())->GetShortcutTargetCaptionL( aMessage ); |
|
1385 } |
|
1386 |
|
1387 void CUISettingsSrvSession::GetShortcutTargetAppUidL( const RMessage2 &aMessage ) |
|
1388 { |
|
1389 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetAppUidL" ); |
|
1390 |
|
1391 AppListCheckL(); |
|
1392 ((CUISettingsSrvServer*)Server())->GetShortcutTargetAppUidL( aMessage ); |
|
1393 } |
|
1394 |
|
1395 void CUISettingsSrvSession::GetShortcutTargetIndexL( const RMessage2 &aMessage ) |
|
1396 { |
|
1397 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetIndexL" ); |
|
1398 |
|
1399 AppListCheckL(); |
|
1400 ((CUISettingsSrvServer*)Server())->GetShortcutTargetIndexL( aMessage ); |
|
1401 } |
|
1402 |
|
1403 void CUISettingsSrvSession::GetShortcutTargetIndexFromATL( const RMessage2 &aMessage ) |
|
1404 { |
|
1405 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetIndexFromATL" ); |
|
1406 |
|
1407 AppListCheckL(); |
|
1408 ((CUISettingsSrvServer*)Server())->GetShortcutTargetIndexFromATL( aMessage ); |
|
1409 } |
|
1410 |
|
1411 void CUISettingsSrvSession::SetShortcutTargetAppIndexL(const RMessage2 &aMessage) |
|
1412 { |
|
1413 RDEBUG( "CUISettingsSrvSession::SetShortcutTargetAppIndexL" ); |
|
1414 |
|
1415 AppListCheckL(); |
|
1416 ((CUISettingsSrvServer*)Server())->SetShortcutTargetAppIndexL( aMessage ); |
|
1417 } |
|
1418 |
|
1419 void CUISettingsSrvSession::GetShortcutRtTypeL(const RMessage2 &aMessage) |
|
1420 { |
|
1421 RDEBUG( "CUISettingsSrvSession::GetShortcutRtTypeL" ); |
|
1422 |
|
1423 AppListCheckL(); |
|
1424 ((CUISettingsSrvServer*)Server())->GetShortcutRtTypeL( aMessage ); |
|
1425 } |
|
1426 |
|
1427 void CUISettingsSrvSession::SetShortcutTargetCaptionL(const RMessage2 &aMessage) |
|
1428 { |
|
1429 RDEBUG( "CUISettingsSrvSession::SetShortcutTargetCaptionL" ); |
|
1430 |
|
1431 AppListCheckL(); |
|
1432 ((CUISettingsSrvServer*)Server())->SetShortcutTargetCaptionL( aMessage ); |
|
1433 } |
|
1434 |
|
1435 void CUISettingsSrvSession::SetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
1436 { |
|
1437 RDEBUG( "CUISettingsSrvSession::SetShortcutTargetBitmapL" ); |
|
1438 |
|
1439 AppListCheckL(); |
|
1440 ((CUISettingsSrvServer*)Server())->SetShortcutTargetBitmapL( aMessage, aIsMask ); |
|
1441 } |
|
1442 |
|
1443 void CUISettingsSrvSession::GetShortcutTargetBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
1444 { |
|
1445 RDEBUG( "CUISettingsSrvSession::GetShortcutTargetBitmapL" ); |
|
1446 |
|
1447 AppListCheckL(); |
|
1448 ((CUISettingsSrvServer*)Server())->GetShortcutTargetBitmapL( aMessage, aIsMask ); |
|
1449 } |
|
1450 |
|
1451 void CUISettingsSrvSession::SetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
1452 { |
|
1453 RDEBUG( "CUISettingsSrvSession::SetSoftkeyBitmapL" ); |
|
1454 |
|
1455 AppListCheckL(); |
|
1456 ((CUISettingsSrvServer*)Server())->SetSoftkeyBitmapL( aMessage, aIsMask ); |
|
1457 } |
|
1458 |
|
1459 void CUISettingsSrvSession::GetSoftkeyBitmapL(const RMessage2 &aMessage, TBool aIsMask/*=EFalse*/) |
|
1460 { |
|
1461 RDEBUG( "CUISettingsSrvSession::GetSoftkeyBitmapL" ); |
|
1462 |
|
1463 AppListCheckL(); |
|
1464 ((CUISettingsSrvServer*)Server())->GetSoftkeyBitmapL( aMessage, aIsMask ); |
|
1465 } |
|
1466 |
|
1467 void CUISettingsSrvSession::AppListCheckL() |
|
1468 { |
|
1469 RDEBUG( "CUISettingsSrvSession::AppListCheckL" ); |
|
1470 |
|
1471 if( iListChanged == 1 ) |
|
1472 { |
|
1473 // Shortcut list has changed during the session |
|
1474 // This session is therefore invalid and all following commands will fail |
|
1475 RDEBUG( "CUISettingsSrvSession::AppListCheckL Invalidate session!" ); |
|
1476 User::Leave( KErrCorrupt ); |
|
1477 } |
|
1478 } |
|
1479 |
|
1480 HBufC8* CUISettingsSrvSession::CopyParameter8L( const RMessage2 &aMsg, TInt aIndex ) |
|
1481 { |
|
1482 RDEBUG( "CUISettingsSrvSession::CopyParameter8L" ); |
|
1483 |
|
1484 TInt length = aMsg.GetDesLengthL( aIndex ); |
|
1485 |
|
1486 HBufC8* buffer = HBufC8::NewL( length ); |
|
1487 RDEBUG_2( "CUISettingsSrvSession::CopyParameter8L HBufC8::NewL ALLOC %x", buffer ); |
|
1488 |
|
1489 TPtr8 ptr( buffer->Des() ); |
|
1490 aMsg.ReadL( aIndex, ptr ); |
|
1491 |
|
1492 return buffer; |
|
1493 } |
|
1494 |
|
1495 HBufC16* CUISettingsSrvSession::CopyParameter16L( const RMessage2 &aMsg, TInt aIndex ) |
|
1496 { |
|
1497 RDEBUG( "CUISettingsSrvSession::CopyParameter16L" ); |
|
1498 |
|
1499 TInt length = aMsg.GetDesLengthL( aIndex ); |
|
1500 |
|
1501 HBufC16* buffer = HBufC16::NewL( length ); |
|
1502 RDEBUG_2("CUISettingsSrvSession::CopyParameter16L HBufC16::NewL ALLOC %x", buffer ); |
|
1503 |
|
1504 TPtr16 ptr( buffer->Des() ); |
|
1505 aMsg.ReadL( aIndex, ptr ); |
|
1506 |
|
1507 return buffer; |
|
1508 } |
|
1509 |
|
1510 // RMessagePtr2::Panic() also completes the message. This is: |
|
1511 // (a) important for efficient cleanup within the kernel |
|
1512 // (b) a problem if the message is completed a second time |
|
1513 void CUISettingsSrvSession::PanicClient(const RMessagePtr2& aMessage,TInt aPanic) |
|
1514 { |
|
1515 _LIT(KTxtServer,"CountServ server"); |
|
1516 aMessage.Panic(KTxtServer,aPanic); |
|
1517 } |
|
1518 |
|
1519 |
|
1520 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1521 |
|
1522 // ---------------------------------------------------------------------------------------- |
|
1523 // Global functions |
|
1524 // ---------------------------------------------------------------------------------------- |
|
1525 |
|
1526 |
|
1527 |
|
1528 // Panic the server |
|
1529 GLDEF_C void PanicServer(TUISettingsSrvPanic aPanic) |
|
1530 { |
|
1531 _LIT(KTxtServerPanic,"UISettingsSrv server panic"); |
|
1532 User::Panic(KTxtServerPanic,aPanic); |
|
1533 } |
|
1534 |
|
1535 |
|
1536 // End of File |